Class HidingPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, PamSettings, SettingsNameProvider, ColorManaged
Direct Known Subclasses:
TabbedHidingPane.TabHidingPanel

public class HidingPanel extends PamPanel implements PamSettings
Class for a hiding, possibly sliding panel to hold things like the side bar, top control panel of the clip display, etc.
Author:
Doug Gillespie
See Also:
  • Field Details

  • Constructor Details

    • HidingPanel

      public HidingPanel(Component componentFrame, Component mainComponent, int direction, boolean canScroll)
      Create a panel which can hide.
      Parameters:
      componentFrame - the component where the hiding panel will sit.
      mainComponent - - the component which will be shown inside the hiding panel i.e. the component which can be hidden.
      direction - - direction: either HORIZONTAL or VERTICAL.
      canScroll - - true if mainComponent is shown within a scroll pane.
    • HidingPanel

      public HidingPanel(Component componentFrame, Component mainComponent, int direction, boolean canScroll, String displayName, String settingsName)
      Create a panel which can hide.
      Parameters:
      componentFrame - the component where the hiding panel will sit.
      mainComponent - - the component which will be shown inside the hiding panel i.e. the component which can be hidden.
      direction - - direction: either HORIZONTAL or VERTICAL.
      canScroll - - true if mainComponent is shown within a scroll pane.
      displayName - String to show in hide / show tips.
      settingsName - String unique name to store to hold position for next time.
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
    • extraPainting

      public void extraPainting(Graphics g)
      Extra painting to highlight panel if mouse is inside.
      Parameters:
      g - - graphics handle.
    • reverseShowButton

      public void reverseShowButton()
      Swaps the hide and show buttons around. Generally use this when a panel is on left hand side or bottom of screen.
    • setTitle

      public void setTitle(String title)
    • showPanel

      public void showPanel(boolean state)
      Show or hide the panel
      Parameters:
      state - true = show, false = hide.
    • isExpanded

      public boolean isExpanded()
      Return true if the panel is in it's expanded state.
      Returns:
      whether the panel is showing or not.
    • setOpaque

      public void setOpaque(boolean isOpaque)
      Overrides:
      setOpaque in class JComponent
    • removeMainComponent

      public void removeMainComponent()
      Remove the mainComponentPanel.
    • addMainComponent

      public void addMainComponent(Component mainComponent)
      Add the mainComponent to the hiding panel
      Parameters:
      mainComponent -
    • getHideButton

      public JButton getHideButton()
      Get the button which controls hide behaviour. Can be used to add additional listeners.
      Returns:
      HidePanel button.
    • getMainComponent

      public Component getMainComponent()
    • getEdgePanel

      public PamPanel getEdgePanel()
      Get the panel which contains the show and hide buttons
      Returns:
      panel which contaisn the show and hide buttons
    • setEdgePanel

      public void setEdgePanel(PamPanel edgePanel)
    • isHighlight

      public boolean isHighlight()
      Check whether the hiding panel is highlighted when the mouse enters. Only highlights the panle, not top level components.
      Returns:
      true of panel is set to highlight.
    • setHighlight

      public void setHighlight(boolean highlight)
      Set whether the hiding panel is highlighted when the mouse enters. Only highlights the panle, not top level components.
    • 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
    • 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 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