PamView
Class GuiFrameManager

java.lang.Object
  extended by PamView.GuiFrameManager
All Implemented Interfaces:
PamSettings

public class GuiFrameManager
extends java.lang.Object
implements PamSettings

The GuiFrameManager manages multiple PamGui frames, each of which may contain multiple tabs of module information and a side panel.

The user can move tabs between the various frames and create new frames by right clicking on the tabs themselves.

Author:
Doug Gillespie
See Also:
PamGui

Nested Class Summary
(package private)  class GuiFrameManager.TabMover
           
 
Field Summary
private  java.util.List<java.lang.Integer> frameList
           
private  int maxFrameNumber
           
private  PamController pamController
           
private  java.util.ArrayList<PamViewInterface> pamViewList
           
 
Constructor Summary
GuiFrameManager(PamController pamController)
           
 
Method Summary
 void addControlledUnit(PamControlledUnit controlledUnit)
           
 void addView(PamViewInterface newView)
           
 void closeExtraFrame(PamGui pamGui)
          Closes a PamGui FRame (not the main one) All tabs are first moved to the main frame (No.
private  PamViewInterface createFrame(int frameNumber)
          See if a frame exists in the current list.
 void destroyModel()
           
 void enableGUIControl(boolean enable)
           
private  PamViewInterface findFrame(int iFrame)
           
private  int firstFreeFrameNumber()
          Find the first free frame number that's not in the frame list
private  boolean frameExists(int iFrame)
          See if a real frame exists.
 void getAllFrameParameters()
          Goes through all open frames before they start closing and gets their parameters into the structure which will be written to the psf file.
 javax.swing.JFrame getFrame(int iFrame)
          Get a frame
 java.util.List<java.lang.Integer> getFrameList()
           
 java.lang.String getFrameName(int iFrame)
          Get a name for a frame which can be used in their titles and in menus, etc.
private  java.lang.String getFrameTitle(int frameNo, int nFrames)
           
 java.lang.String getMenuFrameName(int iFrame)
           
 int getNumFrames()
          Get the total number of frames
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 javax.swing.JPopupMenu getTabPopupMenu(PamGui pamGui, int tabIndex)
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
private  boolean haveFrameInList(int iFrame)
           
 void makeFrameList()
          Make a list of Gui frames - that is all PamView's with a frame number > 0 which indicates they are a GUI frame.
private  void moveUnit(PamControlledUnit pcu, int currentFrame, int destinationFrame)
           
 void notifyModelChanged(int changeType)
           
 void pamStart()
           
 void pamStop()
           
 void removeControlledUnt(PamControlledUnit controlledUnit)
           
 void removeView(PamViewInterface oldView)
           
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 void showControlledUnit(PamControlledUnit unit)
           
 void sortFrameTitles()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pamController

private PamController pamController

frameList

private java.util.List<java.lang.Integer> frameList

pamViewList

private java.util.ArrayList<PamViewInterface> pamViewList

maxFrameNumber

private int maxFrameNumber
Constructor Detail

GuiFrameManager

public GuiFrameManager(PamController pamController)
Method Detail

getFrameList

public java.util.List<java.lang.Integer> getFrameList()

makeFrameList

public void makeFrameList()
Make a list of Gui frames - that is all PamView's with a frame number > 0 which indicates they are a GUI frame. Other frames, such as the model view, have a frame number < 0.


getNumFrames

public int getNumFrames()
Get the total number of frames

Returns:
number of frames.

getFrame

public javax.swing.JFrame getFrame(int iFrame)
Get a frame

Parameters:
iFrame - frame number
Returns:
frame.

createFrame

private PamViewInterface createFrame(int frameNumber)
See if a frame exists in the current list. If it doens't, then create it.

Parameters:
frameNumber - Frame Number

closeExtraFrame

public void closeExtraFrame(PamGui pamGui)
Closes a PamGui FRame (not the main one) All tabs are first moved to the main frame (No. 0) then the frame is removed from the list of frames then the frame is closed.

Parameters:
pamGui - reference to frame to close.

getAllFrameParameters

public void getAllFrameParameters()
Goes through all open frames before they start closing and gets their parameters into the structure which will be written to the psf file.


frameExists

private boolean frameExists(int iFrame)
See if a real frame exists.

Parameters:
iFrame -
Returns:
true if a frame already exists.

firstFreeFrameNumber

private int firstFreeFrameNumber()
Find the first free frame number that's not in the frame list

Returns:
an integer.

findFrame

private PamViewInterface findFrame(int iFrame)

haveFrameInList

private boolean haveFrameInList(int iFrame)

moveUnit

private void moveUnit(PamControlledUnit pcu,
                      int currentFrame,
                      int destinationFrame)

getTabPopupMenu

public javax.swing.JPopupMenu getTabPopupMenu(PamGui pamGui,
                                              int tabIndex)

getMenuFrameName

public java.lang.String getMenuFrameName(int iFrame)

getFrameName

public java.lang.String getFrameName(int iFrame)
Get a name for a frame which can be used in their titles and in menus, etc.

Parameters:
iFrame - frame Number
Returns:
names String

sortFrameTitles

public void sortFrameTitles()

getFrameTitle

private java.lang.String getFrameTitle(int frameNo,
                                       int nFrames)

addControlledUnit

public void addControlledUnit(PamControlledUnit controlledUnit)

removeControlledUnt

public void removeControlledUnt(PamControlledUnit controlledUnit)

addView

public void addView(PamViewInterface newView)

removeView

public void removeView(PamViewInterface oldView)

showControlledUnit

public void showControlledUnit(PamControlledUnit unit)

pamStart

public void pamStart()

pamStop

public void pamStop()

notifyModelChanged

public void notifyModelChanged(int changeType)

destroyModel

public void destroyModel()

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Returns:
An integer version number for the settings

getUnitName

public java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

public java.lang.String getUnitType()
Specified by:
getUnitType in interface PamSettings
Returns:
A Name specific to the type, e.g. Glick detector

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required

enableGUIControl

public void enableGUIControl(boolean enable)