Package pamViewFX

Class PamGuiManagerFX

java.lang.Object
pamViewFX.PamGuiManagerFX
All Implemented Interfaces:
PAMControllerGUI, PamSettings, SettingsNameProvider, PamViewInterface

public class PamGuiManagerFX extends Object implements PAMControllerGUI, PamSettings
Handles the FX based GUI. The GUI is made up of multiple PAMGuiFX stages. The PAMGuiManagerFX handles the number of these stages and starting/closing the GUI.
Author:
Jamie Macaulay
  • Field Details

    • iconSize

      public static int iconSize
      The default size for icons in PAMGaurd- helps keep everything looking coherent.
    • iconColor

      public static javafx.scene.paint.Color iconColor
  • Constructor Details

  • Method Details

    • getPrimaryView

      public PamGuiFX getPrimaryView()
      Returns:
      the primaryView
    • setPrimaryView

      public void setPrimaryView(PamGuiFX primaryView)
      Parameters:
      primaryView - the primaryView to set
    • getInstance

      public static PamGuiManagerFX getInstance()
      Get the instance of the PAMGuiManager
      Returns:
      the instance;
    • titleFont1style

      public static void titleFont1style(javafx.scene.control.Labeled label)
      Set the label style for titles
      Parameters:
      label -
    • titleFont2style

      public static void titleFont2style(javafx.scene.control.Labeled label)
      Set the label style for sub titles
      Parameters:
      label - - the label style.
    • getPamGuiFXList

      public ArrayList<PamGuiFX> getPamGuiFXList()
      Get a list of the current PamGUIFX frames available.
      Returns:
      a list of the current showing PamGUIFX frames.
    • addControlledUnit

      public void addControlledUnit(PamControlledUnit controlledUnit)
      Add a controlled unit to the scene. The controlled unit may have a graphical component or no graphical component at all.
      Specified by:
      addControlledUnit in interface PamViewInterface
      Parameters:
      controlledUnit - -
    • removeControlledUnit

      public void removeControlledUnit(PamControlledUnit controlledUnit)
      Remove a controlled unit from the scene. The controlled unit may have a graphical component or no graphical component at all.
      Specified by:
      removeControlledUnit in interface PamViewInterface
      Parameters:
      controlledUnit - - the controlled unit to remove (here we're removing all it's displays)
    • getPamSettingsCSS

      public ArrayList<String> getPamSettingsCSS()
      Get CSS for PAMGUARD setting 'look and feel' for sliding dialogs
      Returns:
      the CSS for settings feels.
    • getPamCSS

      public ArrayList<String> getPamCSS()
      Get CSS for PAMGUARD GUI standard 'look and feel'
      Returns:
      the standard CSS fro PAMGUARD.
    • getPamDialogCSS

      public ArrayList<String> getPamDialogCSS()
      Get CSS for PAMGUARD GUI standard 'look and feel' for regular dialogs
      Returns:
      the standard CSS fro PAMGUARD.
    • setPamRunning

      public void setPamRunning(boolean running)
      Set the GUI to show PAMGUARD has started or stopped.
    • pamStop

      public void pamStop(javafx.stage.WindowEvent e)
    • notifyModelChanged

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

      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
    • showControlledUnit

      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.
    • destroyModel

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

      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/
    • getMainScene

      public javafx.stage.Stage getMainScene()
    • sortFrameTitles

      public void sortFrameTitles()
    • getAllFrameParameters

      public void getAllFrameParameters()
    • getNumFrames

      public int getNumFrames()
      Get the number of stages
      Returns:
      the number of stages (windows) currently open.
    • getFrame

      public PamGuiFX getFrame(int i)
      Get a stage.
      Parameters:
      i - - frame number
      Returns:
      the stage
    • getModuleName

      public String getModuleName(PamModuleInfo moduleInfo)
      Create a dialog to name a new module.
      Parameters:
      moduleInfo -
      Returns:
      the new name of the module.
    • switchToTab

      public void switchToTab(UserDisplayNodeFX userDisplayNodeFX)
      Switch to the tab which contains a certain display within it's content area.
      Parameters:
      userDisplayNodeFX - - the display to show.
    • getDataModelFX

      public DataModelPaneFX getDataModelFX()
      Get the data model pane.
      Returns:
      the data model pane.
    • showLoadMode

      public void showLoadMode(boolean loadMode)
      Show GUI in load mode. SHows load bars etc.
      Parameters:
      loadMode - - shoe the GUI in loadMode;
    • notifyLoadProgress

      public void notifyLoadProgress(PamTaskUpdate pamTaskUpdate)
      Notify the GUI that progress has been made in an external task.
      Specified by:
      notifyLoadProgress in interface PAMControllerGUI
      Parameters:
      pamTaskUpdate - - class which holds information on the Task and progress.
    • getInitialSettings

      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

      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

      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

      public PamViewInterface initPrimaryView(PamController pamController, PamModel pamModel)
      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
    • setPrimaryStage

      public javafx.stage.Stage setPrimaryStage(javafx.stage.Stage primaryStage2)
    • getModuleName

      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.
    • showAlertDialog

      public static javafx.scene.control.ButtonType showAlertDialog(String strheader, String confirm)
      Show the alert dialog.
      Parameters:
      strheader -
      confirm -
      Returns:
    • prepareToClose

      public boolean prepareToClose(boolean weShouldSave)
      This get's called whenever the main window closes - ideally, I'd like to stop this happening when the system is running, but since that's not possible, just make sure everything has stopped.
      Parameters:
      weShouldSave - true if the settings should get saved to the psf file, false if otherwise
      Returns:
      true if ok to close, false otherwise.
    • getShowLoadMode

      public boolean getShowLoadMode()
    • pamStarted

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

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

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

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

      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

      public JFrame getGuiFrame()
      Specified by:
      getGuiFrame in interface PamViewInterface
    • getUnitName

      public String getUnitName()
      Settings Manager
      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

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

      public 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
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings settings)
      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
    • getPrimaryStage

      public javafx.stage.Window getPrimaryStage()