Class AbstractPamScroller

java.lang.Object
pamScrollSystem.AbstractPamScroller
All Implemented Interfaces:
DataTimeLimits
Direct Known Subclasses:
AbstractPamScrollerAWT, AbstractPamScrollerFX

public abstract class AbstractPamScroller extends Object implements DataTimeLimits
  • Constructor Details

    • AbstractPamScroller

      public AbstractPamScroller(String name, int orientation, int stepSizeMillis, long defaultLoadTime, boolean hasMenu)
  • Method Details

    • pageForward

      public void pageForward()
    • pageBack

      public void pageBack()
    • destroyScroller

      public void destroyScroller()
    • addObserver

      public void addObserver(PamScrollObserver pamScrollObserver)
      Ad an observer that will receive notifications when the the scroller moves.
      Parameters:
      pamScrollObserver -
    • removeObserver

      public void removeObserver(PamScrollObserver pamScrollObserver)
      Remove an observer which no longer requires notifications when the scroller moves.
      Parameters:
      pamScrollObserver -
    • addDataBlock

      public void addDataBlock(PamDataBlock dataBlock)
      Add a datablock to the list for this scroller.

      When the scroller is moved, data from data blocks in this list will re read from the database and binary stores. Other data will not be read.

      Parameters:
      dataBlock - a PamDataBlock
    • removeDataBlock

      public void removeDataBlock(PamDataBlock dataBlock)
      Remove a datablock from the viewed list.
      Parameters:
      dataBlock - a PamDataBlock
    • removeAllDataBlocks

      public void removeAllDataBlocks()
      Remove all datablocks from the viewed list.
    • isDataBlockUsed

      public final boolean isDataBlockUsed(PamDataBlock dataBlock)
      See if this scroller is using a particular data block
      Parameters:
      dataBlock - a Pamguard data block
      Returns:
      true if it's being used.
    • anotherScrollerMovedInner

      public abstract void anotherScrollerMovedInner(long newValue)
      Another managed scroller moved it's position
      Parameters:
      newValue - new value in millis
    • anotherScrollerMovedOuter

      public void anotherScrollerMovedOuter(long newMin, long newMax)
      Another managed scroller moved its outer position - will cause new data to be loaded.
      Parameters:
      newMin -
      newMax -
    • notifyRangeChange

      public void notifyRangeChange()
      Send a notification to all observers of this scroller to say that the range of data loaded has changed.
    • getMinimumMillis

      public long getMinimumMillis()
      Specified by:
      getMinimumMillis in interface DataTimeLimits
      Returns:
      the minimumMillis - the minimum of loaded data
    • getMaximumMillis

      public long getMaximumMillis()
      Specified by:
      getMaximumMillis in interface DataTimeLimits
      Returns:
      the maximumMillis - the maximum of loaded data
    • getRangeMillis

      public long getRangeMillis()
      Returns:
      the difference between getMaximumMills and getMinimumMillis
    • setRangeMillis

      public void setRangeMillis(long minimumMillis, long maximumMillis, boolean notify)
      Set the range of the currently loaded data and optionally notify other scrollers.
      Parameters:
      minimumMillis - minimum time in milliseconds
      maximumMillis - maximum time in milliseconds
      notify - notify the rangesChanged function.
    • setVisibleMillis

      public void setVisibleMillis(long visibleAmount)
      Parameters:
      visibleAmount - the visibleAmount to set in millis
    • rangesChanged

      public abstract void rangesChanged(long setValue)
      Called when ranges have been changed and tells scroller to go to a particular absolute value.
      Parameters:
      setValue -
    • reLoad

      public void reLoad()
      Command passed through the the scroll manager telling it reload data.
    • getValueMillis

      public abstract long getValueMillis()
      The start time of the scroller in milliseconds. This is the current position of the scroller NOT the start time of loaded data.
      Returns:
      the valueMillis
    • getVisibleAmount

      public abstract long getVisibleAmount()
      This will be none for sliders, such as on the map. For other scrollers it should be the same as the time displayed in to the navigaiton buttons of the scroller.
      Returns:
      the visible display time in milliseconds.
    • getVisibleEnd

      public long getVisibleEnd()
      The end of the current visible screen which is getValueMillis() + getVisibleAmount();
      Returns:
      end of visible time
    • setValueMillis

      public final void setValueMillis(long valueMillis)
      Parameters:
      valueMillis - the valueMillis to set
    • valueSetMillis

      public abstract void valueSetMillis(long valueMillis)
      Called when a new position has been set
      Parameters:
      valueMillis - new scroll value in milliseconds
    • getStepSizeMillis

      public int getStepSizeMillis()
      stepSizeMillis is the resolution of the scroller in milliseconds.

      For displays which will only ever display a short amount of data this can be one, however for longer displays this should be 1000 (a second) or more to avoid wrap around of the 32 bit integers used to control the actual scroll bar.

      Returns:
      the stepSizeMillis
    • setStepSizeMillis

      public void setStepSizeMillis(int stepSizeMillis)
      Parameters:
      stepSizeMillis - the stepSizeMillis to set
    • setBlockIncrement

      public void setBlockIncrement(long blockIncrement)
      Parameters:
      blockIncrement - the blockIncrement to set in millis
    • setUnitIncrement

      public void setUnitIncrement(long unitIncrement)
      Parameters:
      unitIncrement - the unitIncrement to set in millis
    • getObservers

      public Vector<PamScrollObserver> getObservers()
      Returns:
      the observers
    • getPageStep

      public int getPageStep()
      Returns:
      the pageStep - the size to move when loading forward or backward.
    • setPageStep

      public void setPageStep(int pageStep)
      Parameters:
      pageStep - the pageStep to set
    • getDefaultLoadtime

      public long getDefaultLoadtime()
    • getScrollManager

      public AbstractScrollManager getScrollManager()
      Returns:
      the scrollManager
    • coupleScroller

      public ScrollerCoupling coupleScroller(String couplingName)
      Couple this scroller to another scroller so that both have exactly the same behaviour, load the same data period, move their scrolls together, etc.

      Scollers are coupled by name so that they don't necessarily need to find references to each other in the code. These names can be anything by measures should be taken to ensure that they are going to be unique, for example by using module names as part of the coupling name.

      Parameters:
      couplingName - name of the coupling
      Returns:
      number of other scrollers in this coupling
    • uncoupleScroller

      public void uncoupleScroller()
      Remove the scroller from it's coupling.
    • getScrollerCoupling

      public ScrollerCoupling getScrollerCoupling()
    • setScrollerCoupling

      public void setScrollerCoupling(ScrollerCoupling scrollerCoupling)
    • coupledScrollerChanged

      public void coupledScrollerChanged(ScrollerCoupling scrollerCoupling, AbstractPamScroller scroller)
      Called when a scroller which is coupled to this scroller changes in any way.
      Parameters:
      scrollerCoupling -
      scroller - coupled scroller which changes.
    • getNumUsedDataBlocks

      public int getNumUsedDataBlocks()
      Returns:
      the number of data blocks observed by this scroller
    • getUsedDataBlock

      public PamDataBlock getUsedDataBlock(int iBlock)
      Get a specific data block observed by this scroller.
      Parameters:
      iBlock - block index
      Returns:
      reference to an observed datablock
    • isInSpecialList

      public boolean isInSpecialList(PamDataBlock pamDataBlock)
      Check if a data block is within the special data block list. The special data block list is a list of data blocks that load data regardless of a subscription to a scroller.
      Parameters:
      pamDataBlock - - the data block to test
      Returns:
      true if in the special list.
    • getSpecialLoadTimes

      public long[] getSpecialLoadTimes(PamDataBlock pamDataBlock, long minimumMillis, long maximumMillis)
      Get the load times for a special data block based on current load times. Unless specifically set when added to special data block list the default is Long.MIN_VALUE and Long.MAX_VALUE.
      Parameters:
      pamDataBlock - - the data block to grab.
      minimumMillis - - the minimum time of the current scroller.
      maximumMillis - - the maximum time of the current scroller
      Returns:
      the load time of the special data block.
    • getScrollerData

      public PamScrollerData getScrollerData()
      Get scroller data.
      Returns:
      the current scroller data.
    • startPlayback

      public void startPlayback()
    • stopPlayback

      public void stopPlayback()
    • playbackStopped

      public void playbackStopped()
    • playbackStarted

      public void playbackStarted()
    • addMenuParts

      public void addMenuParts(PamMenuParts menuParts)
      Add menuparts, items that will be added to the menus little popup menu that appears from the middle of the scroller controls.
      Parameters:
      menuParts -
    • getPamMenuParts

      public Vector<PamMenuParts> getPamMenuParts()
      Get menu parts to add to the menu from the scroller right click
      Returns:
      the pamMenuParts
    • isShowing

      public boolean isShowing()
    • toString

      public String toString()
      Overrides:
      toString in class Object