Package PamView

Class GuiFrameManager

java.lang.Object
PamView.GuiFrameManager
All Implemented Interfaces:
PAMControllerGUI, PamSettings, SettingsNameProvider, PamViewInterface

public class GuiFrameManager extends Object implements PamSettings, PAMControllerGUI
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 Details Link icon

    • GuiFrameManager Link icon

      public GuiFrameManager(PamController pamController)
  • Method Details Link icon

    • getFrameList Link icon

      public List<Integer> getFrameList()
    • makeFrameList Link icon

      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 Link icon

      public int getNumFrames()
      Get the total number of frames
      Returns:
      number of frames.
    • getFrame Link icon

      public JFrame getFrame(int iFrame)
      Get a frame
      Parameters:
      iFrame - frame number
      Returns:
      frame.
    • closeExtraFrame Link icon

      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 Link icon

      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 Link icon

      public PamGui getFrameGui(int iFrame)
      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 Link icon

      public JPopupMenu getTabPopupMenu(PamGui pamGui, int tabIndex)
    • getMenuFrameName Link icon

      public String getMenuFrameName(int iFrame)
    • getFrameName Link icon

      public 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 Link icon

      public void sortFrameTitles()
    • addControlledUnit Link icon

      public void addControlledUnit(PamControlledUnit controlledUnit)
      Description copied from interface: PamViewInterface
      Called whenever a pamcontrolled unit is added ot the model.
      Specified by:
      addControlledUnit in interface PamViewInterface
      Parameters:
      controlledUnit - - the added controlled unit.
    • removeControlledUnit Link icon

      public void removeControlledUnit(PamControlledUnit controlledUnit)
      Description copied from interface: PamViewInterface
      Called whenever a controlled unit is removed.
      Specified by:
      removeControlledUnit in interface PamViewInterface
    • addView Link icon

      public void addView(PamViewInterface newView)
      Description copied from interface: PAMControllerGUI
      Add a PAMView Interface. This mirrors many of the functions in PAMControllerGUI
      Specified by:
      addView in interface PAMControllerGUI
    • removeView Link icon

      public void removeView(PamViewInterface oldView)
    • showControlledUnit Link icon

      public void showControlledUnit(PamControlledUnit unit)
      Description copied from interface: PamViewInterface
      Show the GUI for a specific controlled unit
      Specified by:
      showControlledUnit in interface PamViewInterface
      Parameters:
      unit - -the controlled unit to show.
    • pamStart Link icon

      public void pamStart()
    • pamStop Link icon

      public void pamStop()
    • notifyModelChanged Link icon

      public void notifyModelChanged(int changeType)
      Description copied from interface: PAMControllerGUI
      Notification flag that the model has changed
      Specified by:
      notifyModelChanged in interface PAMControllerGUI
    • destroyModel Link icon

      public void destroyModel()
      Description copied from interface: PAMControllerGUI
      Called to destroy model
      Specified by:
      destroyModel in interface PAMControllerGUI
    • getSettingsReference Link icon

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion Link icon

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

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType Link icon

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click detector
    • restoreSettings Link icon

      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 Link icon

      public void enableGUIControl(boolean enable)
      Description copied from interface: PamViewInterface
      Enable and disable the entire GUI.
      Specified by:
      enableGUIControl in interface PamViewInterface
      Parameters:
      enable - - true to enable the GUI/
    • getCollapseMenuItem Link icon

      public JMenuItem getCollapseMenuItem()
    • notifyLoadProgress Link icon

      public void notifyLoadProgress(PamTaskUpdate progress)
      Description copied from interface: PAMControllerGUI
      Notify the GUI that some loading is taking place
      Specified by:
      notifyLoadProgress in interface PAMControllerGUI
      Parameters:
      progress - - the progress.
    • getInitialSettings Link icon

      public PamSettings getInitialSettings()
      Description copied from interface: PAMControllerGUI
      Called on startup to grab pamsettings/database from somewhere.
      Specified by:
      getInitialSettings in interface PAMControllerGUI
      Returns:
      the pamsettings/database.
    • init Link icon

      public void init()
      Description copied from interface: PAMControllerGUI
      Called immediately after the creation of the GUI in the PAMController.
      Specified by:
      init in interface PAMControllerGUI
    • hasCallBack Link icon

      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 interface PAMControllerGUI
      Returns:
    • initPrimaryView Link icon

      public PamViewInterface initPrimaryView(PamController pamController, PamModel pamModelInterface)
      Description copied from interface: PAMControllerGUI
      Called when the controller is ready for the fire view.
      Specified by:
      initPrimaryView in interface PAMControllerGUI
      Returns:
      init and retuirn the first view
    • getModuleName Link icon

      public String getModuleName(Object parentFrame, PamModuleInfo moduleInfo)
      Description copied from interface: PAMControllerGUI
      Get the name for a controlled unit from user input.
      Specified by:
      getModuleName in interface PAMControllerGUI
      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 Link icon

      public void pamStarted()
      Specified by:
      pamStarted in interface PamViewInterface
    • pamEnded Link icon

      public void pamEnded()
      Specified by:
      pamEnded in interface PamViewInterface
    • modelChanged Link icon

      public void modelChanged(int changeType)
      Specified by:
      modelChanged in interface PamViewInterface
    • setTitle Link icon

      public void setTitle(String title)
      Specified by:
      setTitle in interface PamViewInterface
    • getFrameNumber Link icon

      public int getFrameNumber()
      Specified by:
      getFrameNumber in interface PamViewInterface
      Returns:
      Frame number used by the multiple GUI frames. All other objects, such as the model view should return invalid input: '<' 0.
    • getGuiFrame Link icon

      public JFrame getGuiFrame()
      Specified by:
      getGuiFrame in interface PamViewInterface
    • setDefaultFrameIcon Link icon

      public void setDefaultFrameIcon(Image frameIcon)
    • getDefaultFrameIcon Link icon

      public Image getDefaultFrameIcon()
    • findGUI Link icon

      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.