Package PamView

Class PamGui

All Implemented Interfaces:
WindowListener, EventListener, PamSettings, SettingsNameProvider, PamViewInterface

public class PamGui extends PamView implements WindowListener, PamSettings
Author:
Doug Gillespie

Simple PamGui implementing a tab control.

  • Constructor Details

    • PamGui

      public PamGui(PamController pamControllerInterface, PamModel pamModelInterface, int frameNumber)
  • Method Details

    • isSomethingShowing

      public static boolean isSomethingShowing()
      Static flag to say that at least one GUI has opened.
      Returns:
      true when one or more GUI frames are visible.
    • addControlledUnit

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

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

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

      public void renameControlledUnit(PamControlledUnit unit)
      Specified by:
      renameControlledUnit in class PamView
    • findControlledUnit

      public PamControlledUnit findControlledUnit(int tabNo)
    • ShowTabSpecificSettings

      public void ShowTabSpecificSettings()
      Set up specific settings for the tab - get's called quite a lot, including whenever modules are added or removed in order to make sure that menus contain the correct options for existing modules.
    • makeGuiMenu

      public JMenuBar makeGuiMenu()
    • openURL

      public static void openURL(String urlString)
    • pamEnded

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

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

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

      public int setTabsSize(Dimension dimension)
      Set all tab sizes to a new dimension
      Parameters:
      dimension - - the new tab size to set.
      font - - the tab font to set.
    • setTabFont

      public void setTabFont(Font font)
      Set font for the main tab panel.
      Parameters:
      font - - the font to set.
    • windowActivated

      public void windowActivated(WindowEvent e)
      Implementation of WindowListener
      Specified by:
      windowActivated in interface WindowListener
    • windowClosing

      public void windowClosing(WindowEvent e)
      Specified by:
      windowClosing in interface WindowListener
    • windowOpened

      public void windowOpened(WindowEvent e)
      Specified by:
      windowOpened in interface WindowListener
    • windowIconified

      public void windowIconified(WindowEvent e)
      Specified by:
      windowIconified in interface WindowListener
    • windowDeiconified

      public void windowDeiconified(WindowEvent e)
      Specified by:
      windowDeiconified in interface WindowListener
    • windowDeactivated

      public void windowDeactivated(WindowEvent e)
      Specified by:
      windowDeactivated in interface WindowListener
    • windowClosed

      public void windowClosed(WindowEvent e)
      Specified by:
      windowClosed in interface WindowListener
    • showDialog

      public void showDialog(String s1, String s2, int dialogType)
    • showControlledUnit

      public void showControlledUnit(PamControlledUnit pamControlledUnit)
      Description copied from class: PamView
      tells the view to show the main display panel of a pamControlledUnit
      Specified by:
      showControlledUnit in interface PamViewInterface
      Specified by:
      showControlledUnit in class PamView
      Parameters:
      pamControlledUnit - -the controlled unit to show.
    • getViewName

      public String getViewName()
      Specified by:
      getViewName in class PamView
    • 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
    • getUnitName

      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

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Returns:
      A Name specific to the type, e.g. Click 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
    • getMainTab

      public PamTabbedPane getMainTab()
    • 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/
    • packFrame

      public static void packFrame(JComponent component)
      find the frame owning the given component and pack it.
      Parameters:
      component -
    • toggleFullScreen

      public void toggleFullScreen()
      Toggle between full screen and not full screen.
    • setToolBarVisible

      public void setToolBarVisible(boolean useToolBar)
      Set whether the top toolbar (with the record/viewer play buttons) is visible or not
      Parameters:
      useToolBar - - true to have it visible (default)
    • getMainPanel

      public JPanel getMainPanel()
      Get the main panel, this contains all components within the frame.
      Returns:
      the main panel.
    • getSidePanel

      public HidingSidePanel getSidePanel()
      Get the side panel. This holds all the side pane.s
      Returns:
      the side panel.
    • getTabbedPane

      public PamTabbedPane getTabbedPane()
      Get the main tab pane.
      Returns:
      the tab pane.
    • findComponentWindow

      public static Window findComponentWindow(JComponent component)
      find a parent window for a JComponent. This can be useful in finding windows to open child dialogs when the object holding the component may not have a direct reference back to it's dialog.
      Parameters:
      component - any Swing component
      Returns:
      parent Window (or frame) if it can be found