Class ScrollerCoupling

java.lang.Object
pamScrollSystem.coupling.ScrollerCoupling
All Implemented Interfaces:
PamSettings, SettingsNameProvider

public class ScrollerCoupling extends Object implements PamSettings
A class for coupling two or more scrollers.

Coupled scrollers will move together - when one moves, the others move.

Author:
Doug Gillespie
  • Constructor Details

    • ScrollerCoupling

      public ScrollerCoupling(String name)
  • Method Details

    • getCouplingParams

      public CouplingParams getCouplingParams()
    • getName

      public String getName()
    • getSwingOptionsMenu

      public JMenuItem getSwingOptionsMenu(Window frame)
    • addScroller

      public void addScroller(AbstractPamScroller aScroller)
      Add a new scroller to the coupling
      Parameters:
      aScroller -
    • notifyOthers

      public void notifyOthers(AbstractPamScroller scroller)
      Notify other scrollers in the set that a scroller has changed then pass them a reference to the changed scroller so that they can copy information from it.

      This function holds a lock since as soon as another scroller is changed, it's likely to call back to this same function and set up an infinite loop. The lock will exit the function if set to avoid this situation.

      Parameters:
      scroller - scroller which changes.
    • removeScroller

      public boolean removeScroller(AbstractPamScroller aScroller)
      Remove a scroller form a coupling
      Parameters:
      aScroller -
      Returns:
      true if the scroller wwas present.
    • getScrollerCount

      public int getScrollerCount()
    • getPopupMenuItems

      public List<javafx.scene.control.MenuItem> getPopupMenuItems(AbstractPamScroller hostScroller, OverlayMark overlayMark, Long mouseTime)
      Get a list of menu commands that can be inserted into a popup menu when a display is clicked, which may or may not have an overlay mark on it. If overlayMark and mouseTime are both null, null will be returned
      Parameters:
      overlayMark - Overlay mark, may be null;
      mouseTime - Mouse time in milliseconds, can also be null
      Returns:
      popup menu item list.
    • centreTime

      public void centreTime(AbstractPamScroller hostScroller, long mouseTime)
      Centre other displays at this mouse time ...
      Parameters:
      hostScroller -
      mouseTime -
    • startTime

      public void startTime(AbstractPamScroller hostScroller, long mouseTime)
      Start other displays at this mouse time ...
      Parameters:
      hostScroller -
      mouseTime -
    • 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