pamScrollSystem
Class AbstractScrollManager

java.lang.Object
  extended by pamScrollSystem.AbstractScrollManager
Direct Known Subclasses:
RealTimeScrollManager, ViewerScrollerManager

public abstract class AbstractScrollManager
extends java.lang.Object


Field Summary
protected  java.util.Vector<AbstractPamScroller> pamScrollers
           
private  java.util.Vector<ScrollerCoupling> scrollerCouplings
           
private static AbstractScrollManager singleInstance
           
 
Constructor Summary
protected AbstractScrollManager()
           
 
Method Summary
 void addPamScroller(AbstractPamScroller pamScroller)
          Add a new scroller to the managed list.
abstract  void centreDataAt(PamDataBlock dataBlock, long menuMouseTime)
          Centre all data in all data blocks at the given time
abstract  long checkGapPos(AbstractPamScroller abstractPamScroller, long oldMin, long oldMax, long newMin, long newMax, int direction)
          Check to see whether or not we are scrolling into a data gap.
abstract  long checkMaximumTime(long requestedTime)
          Check the maximum time requested by a scroll bar doesn't go beyond the end of the data
abstract  long checkMinimumTime(long requestedTime)
          Check the minimum time requested by a scroll bar doesn't go below the start of the data
 ScrollerCoupling coupleScroller(AbstractPamScroller abstractPamScroller, java.lang.String couplingName)
          Couple a scroller to another scroller so that both have exactly the same behaviour, load the same data period, move their scrolls together, etc.
private  ScrollerCoupling findCoupling(java.lang.String name, boolean autoCreate)
          Find a scroller coupling with a given name
static AbstractScrollManager getScrollManager()
           
 javax.swing.JPopupMenu getStandardOptionsMenu(AbstractPamScroller pamSCroller)
           
 int isInGap(PamDataBlock dataBlock, long timeMillis)
          Work out whether or not a particular time falls in the gap between points in a datamap .
abstract  void moveInnerScroller(AbstractPamScroller scroller, long newValue)
          Move the scroll bar component of a scroller.
abstract  void moveOuterScroller(AbstractPamScroller scroller, long newMin, long newMax)
          Move the data load component of a scroller.
abstract  void notifyModelChanged(int changeType)
           
abstract  void reLoad()
          Command telling manager to reload it's data.
 void removePamScroller(AbstractPamScroller pamScroller)
          Remove a pam scroller from the managed list.
abstract  void startDataAt(PamDataBlock dataBlock, long menuMouseTime)
          Start all data in all data blocks at the given time
 void uncoupleScroller(AbstractPamScroller abstractPamScroller)
          Uncouple a scroller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pamScrollers

protected java.util.Vector<AbstractPamScroller> pamScrollers

scrollerCouplings

private java.util.Vector<ScrollerCoupling> scrollerCouplings

singleInstance

private static AbstractScrollManager singleInstance
Constructor Detail

AbstractScrollManager

protected AbstractScrollManager()
Method Detail

getScrollManager

public static AbstractScrollManager getScrollManager()

addPamScroller

public void addPamScroller(AbstractPamScroller pamScroller)
Add a new scroller to the managed list.

Parameters:
pamScroller - scroller to add

removePamScroller

public void removePamScroller(AbstractPamScroller pamScroller)
Remove a pam scroller from the managed list.

Parameters:
pamScroller - scroller to remove

moveInnerScroller

public abstract void moveInnerScroller(AbstractPamScroller scroller,
                                       long newValue)
Move the scroll bar component of a scroller. This should not cause the reloading of any data, but other scroll bars should be notified of any changes.

Parameters:
scroller - scroller that moved
newValue - new value (time in milliseconds).

moveOuterScroller

public abstract void moveOuterScroller(AbstractPamScroller scroller,
                                       long newMin,
                                       long newMax)
Move the data load component of a scroller. This should cause data to be reloaded and will need to notify all other scrollers incase they also need to shuffle along a bit.

Parameters:
scroller - scroller that changed
newMin - new data min value in millis
newMax - new data max value in millis

checkMaximumTime

public abstract long checkMaximumTime(long requestedTime)
Check the maximum time requested by a scroll bar doesn't go beyond the end of the data

Parameters:
requestedTime - requested time in millis.
Returns:
the minimum of the requested time and the actual end time of the data

checkMinimumTime

public abstract long checkMinimumTime(long requestedTime)
Check the minimum time requested by a scroll bar doesn't go below the start of the data

Parameters:
requestedTimerequested - time in millis.
Returns:
the maximum of the requested time and the actual start time of the data

notifyModelChanged

public abstract void notifyModelChanged(int changeType)

centreDataAt

public abstract void centreDataAt(PamDataBlock dataBlock,
                                  long menuMouseTime)
Centre all data in all data blocks at the given time

Parameters:
menuMouseTime - time in milliseconds

startDataAt

public abstract void startDataAt(PamDataBlock dataBlock,
                                 long menuMouseTime)
Start all data in all data blocks at the given time

Parameters:
menuMouseTime - time in milliseconds

coupleScroller

public ScrollerCoupling coupleScroller(AbstractPamScroller abstractPamScroller,
                                       java.lang.String couplingName)
Couple a 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:
abstractPamScroller - scroller to couple
couplingName - coupling name
Returns:
reference to the coupler

uncoupleScroller

public void uncoupleScroller(AbstractPamScroller abstractPamScroller)
Uncouple a scroller.

Parameters:
abstractPamScroller - scroller to uncouple

findCoupling

private ScrollerCoupling findCoupling(java.lang.String name,
                                      boolean autoCreate)
Find a scroller coupling with a given name

Parameters:
name - name of coupling
autoCreate - flag to automatically create a coupling if one isn't found.
Returns:
the scroller coupling or null if none was found and the autoCreate flag was false.

reLoad

public abstract void reLoad()
Command telling manager to reload it's data.


getStandardOptionsMenu

public javax.swing.JPopupMenu getStandardOptionsMenu(AbstractPamScroller pamSCroller)

isInGap

public int isInGap(PamDataBlock dataBlock,
                   long timeMillis)
Work out whether or not a particular time falls in the gap between points in a datamap .

Parameters:
dataBlock - Pamguard data block
timeMillis - time in milliseconds
Returns:
true if the data are in a gap.

checkGapPos

public abstract long checkGapPos(AbstractPamScroller abstractPamScroller,
                                 long oldMin,
                                 long oldMax,
                                 long newMin,
                                 long newMax,
                                 int direction)
Check to see whether or not we are scrolling into a data gap. Rules exist for stopping / starting / jumping over gaps depending on the current state and the new position of the scroller.

Parameters:
abstractPamScroller - PamScroller that moved
oldMin - old minimum time
oldMax - old maximum time
newMin - new minimum time
newMax - new maximum time
direction - direction of scroll +1 = forward, -1 = backward, 0 = plonked down by mouse on datamap.
Returns:
new minimum position. Calling function must then work out the new maximum position.