Package PamView
Class GuiFrameManager
java.lang.Object
PamView.GuiFrameManager
- All Implemented Interfaces:
PAMControllerGUI
,PamSettings
,SettingsNameProvider
,PamViewInterface
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:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addControlledUnit
(PamControlledUnit controlledUnit) Called whenever a pamcontrolled unit is added ot the model.void
addView
(PamViewInterface newView) Add a PAMView Interface.void
closeExtraFrame
(PamGui pamGui) Closes a PamGui FRame (not the main one) All tabs are first moved to the main frame (No.void
Called to destroy modelvoid
enableGUIControl
(boolean enable) Enable and disable the entire GUI.void
findGUI()
Function that can move GUI frames back onto the main window.void
Goes through all open frames before they start closing and gets their parameters into the structure which will be written to the psf file.getFrame
(int iFrame) Get a framegetFrameGui
(int iFrame) Get a frame GUI.getFrameName
(int iFrame) Get a name for a frame which can be used in their titles and in menus, etc.int
Called on startup to grab pamsettings/database from somewhere.getMenuFrameName
(int iFrame) getModuleName
(Object parentFrame, PamModuleInfo moduleInfo) Get the name for a controlled unit from user input.int
Get the total number of frameslong
getTabPopupMenu
(PamGui pamGui, int tabIndex) boolean
The GUI may have a callback into the PamController once it has all been set up.void
init()
Called immediately after the creation of the GUI in the PAMController.initPrimaryView
(PamController pamController, PamModel pamModelInterface) Called when the controller is ready for the fire view.void
Make a list of Gui frames - that is all PamView's with a frame number > 0 which indicates they are a GUI frame.void
modelChanged
(int changeType) void
notifyLoadProgress
(PamTaskUpdate progress) Notify the GUI that some loading is taking placevoid
notifyModelChanged
(int changeType) Notification flag that the model has changedvoid
pamEnded()
void
pamStart()
void
void
pamStop()
void
removeControlledUnit
(PamControlledUnit controlledUnit) Called whenever a controlled unit is removed.void
removeView
(PamViewInterface oldView) boolean
restoreSettings
(PamControlledUnitSettings pamControlledUnitSettings) void
setDefaultFrameIcon
(Image frameIcon) void
void
Show the GUI for a specific controlled unitvoid
-
Constructor Details
-
GuiFrameManager
-
-
Method Details
-
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 invalid input: '<' 0. -
getNumFrames
public int getNumFrames()Get the total number of frames- Returns:
- number of frames.
-
getFrame
Get a frame- Parameters:
iFrame
- frame number- Returns:
- frame.
-
closeExtraFrame
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. -
getFrameGui
Get a frame GUI. This is a single frame whihc holds a GUI with tabs etc.- Parameters:
iFram
- e- the frame index to get.- Returns:
- the frame GUI to get.
-
getTabPopupMenu
-
getMenuFrameName
-
getFrameName
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() -
addControlledUnit
Description copied from interface:PamViewInterface
Called whenever a pamcontrolled unit is added ot the model.- Specified by:
addControlledUnit
in interfacePamViewInterface
- Parameters:
controlledUnit
- - the added controlled unit.
-
removeControlledUnit
Description copied from interface:PamViewInterface
Called whenever a controlled unit is removed.- Specified by:
removeControlledUnit
in interfacePamViewInterface
-
addView
Description copied from interface:PAMControllerGUI
Add a PAMView Interface. This mirrors many of the functions in PAMControllerGUI- Specified by:
addView
in interfacePAMControllerGUI
-
removeView
-
showControlledUnit
Description copied from interface:PamViewInterface
Show the GUI for a specific controlled unit- Specified by:
showControlledUnit
in interfacePamViewInterface
- Parameters:
unit
- -the controlled unit to show.
-
pamStart
public void pamStart() -
pamStop
public void pamStop() -
notifyModelChanged
public void notifyModelChanged(int changeType) Description copied from interface:PAMControllerGUI
Notification flag that the model has changed- Specified by:
notifyModelChanged
in interfacePAMControllerGUI
-
destroyModel
public void destroyModel()Description copied from interface:PAMControllerGUI
Called to destroy model- Specified by:
destroyModel
in interfacePAMControllerGUI
-
getSettingsReference
- Specified by:
getSettingsReference
in interfacePamSettings
- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersion
in interfacePamSettings
- Returns:
- An integer version number for the settings
-
getUnitName
- Specified by:
getUnitName
in interfaceSettingsNameProvider
- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitType
in interfacePamSettings
- Returns:
- A Name specific to the type, e.g. Click detector
-
restoreSettings
- Specified by:
restoreSettings
in interfacePamSettings
- 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) Description copied from interface:PamViewInterface
Enable and disable the entire GUI.- Specified by:
enableGUIControl
in interfacePamViewInterface
- Parameters:
enable
- - true to enable the GUI/
-
getCollapseMenuItem
-
notifyLoadProgress
Description copied from interface:PAMControllerGUI
Notify the GUI that some loading is taking place- Specified by:
notifyLoadProgress
in interfacePAMControllerGUI
- Parameters:
progress
- - the progress.
-
getInitialSettings
Description copied from interface:PAMControllerGUI
Called on startup to grab pamsettings/database from somewhere.- Specified by:
getInitialSettings
in interfacePAMControllerGUI
- Returns:
- the pamsettings/database.
-
init
public void init()Description copied from interface:PAMControllerGUI
Called immediately after the creation of the GUI in the PAMController.- Specified by:
init
in interfacePAMControllerGUI
-
hasCallBack
public boolean hasCallBack()Description copied from interface:PAMControllerGUI
The GUI may have a callback into the PamController once it has all been set up. If this is the case then on init() PAMController stops and relies on the GUI code to call the relevant setupPAMGuard folder once the GUI thread is happy everything is being set up properly.- Specified by:
hasCallBack
in interfacePAMControllerGUI
- Returns:
-
initPrimaryView
Description copied from interface:PAMControllerGUI
Called when the controller is ready for the fire view.- Specified by:
initPrimaryView
in interfacePAMControllerGUI
- Returns:
- init and retuirn the first view
-
getModuleName
Description copied from interface:PAMControllerGUI
Get the name for a controlled unit from user input.- Specified by:
getModuleName
in interfacePAMControllerGUI
- Parameters:
parentFrame
- - an object which can be the parent frame for the dialog.moduleInfo
- - the type of controlled unit.- Returns:
- the name of the module.
-
pamStarted
public void pamStarted()- Specified by:
pamStarted
in interfacePamViewInterface
-
pamEnded
public void pamEnded()- Specified by:
pamEnded
in interfacePamViewInterface
-
modelChanged
public void modelChanged(int changeType) - Specified by:
modelChanged
in interfacePamViewInterface
-
setTitle
- Specified by:
setTitle
in interfacePamViewInterface
-
getFrameNumber
public int getFrameNumber()- Specified by:
getFrameNumber
in interfacePamViewInterface
- Returns:
- Frame number used by the multiple GUI frames. All other objects, such as the model view should return invalid input: '<' 0.
-
getGuiFrame
- Specified by:
getGuiFrame
in interfacePamViewInterface
-
setDefaultFrameIcon
-
getDefaultFrameIcon
-
findGUI
public void findGUI()Function that can move GUI frames back onto the main window. Can be used to recover a GUI if it's on a monitor that is not present.
-