pamScrollSystem
Class ViewerScrollerManager

java.lang.Object
  extended by pamScrollSystem.AbstractScrollManager
      extended by pamScrollSystem.ViewerScrollerManager
All Implemented Interfaces:
PamSettings

public class ViewerScrollerManager
extends AbstractScrollManager
implements PamSettings


Nested Class Summary
(package private)  class ViewerScrollerManager.CoupleScrollersMenuItem
           
(package private)  class ViewerScrollerManager.DataLoader
           
 
Field Summary
private  ViewerScrollerManager.DataLoader dataLoader
           
private  boolean initialisationComplete
           
private  boolean intialiseLoadDone
           
private  boolean loaderRunning
           
private  StoredScrollerData oldScrollerData
           
 
Fields inherited from class pamScrollSystem.AbstractScrollManager
pamScrollers
 
Constructor Summary
ViewerScrollerManager()
           
 
Method Summary
 void addPamScroller(AbstractPamScroller pamScroller)
          Add a new scroller to the managed list.
 void centreDataAt(PamDataBlock dataBlock, long menuMouseTime)
          Centre all data in all data blocks at the given time
 long checkGapPos(AbstractPamScroller scroller, long oldMin, long oldMax, long newMin, long newMax, int direction)
          Check to see whether or not we are scrolling into a data gap.
private  long checkGapPos(PamDataBlock dataBlock, long newMin, long newMax)
          Very similar to the function checking gap pos for a whole scroller, but only does it for one datablock.
private  void checkLoadLimits(java.util.ArrayList<DataLoadQueData> dataLoadQueue, PamDataBlock pamDataBlock)
          check the required load limits for a data block which may be being used my multiple scrollers.
 long checkMaximumTime(long requestedTime)
          Check the maximum time requested by a scroll bar doesn't go beyond the end of the data
 long checkMinimumTime(long requestedTime)
          Check the minimum time requested by a scroll bar doesn't go below the start of the data
private  DataMapControl findDataMapControl()
           
private  void followCoupledScroller(AbstractPamScroller pamScroller)
           
 long getNextDataStart(AbstractPamScroller scroller, long timeMillis)
           
 long getPrevDataEnd(AbstractPamScroller scroller, long timeMillis)
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 javax.swing.JPopupMenu getStandardOptionsMenu(AbstractPamScroller pamScroller)
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
private  void initialiseScrollers()
          Called once at the start, and possibly after any changes to the database or binary store.
 void loadData()
          loads data after a scroller has changed.
private  void loadDataQueue(java.util.ArrayList<DataLoadQueData> dataLoadQueue)
           
private  void loadDone()
           
 void moveInnerScroller(AbstractPamScroller scroller, long newValue)
          Move the scroll bar component of a scroller.
 void moveOuterScroller(AbstractPamScroller scroller, long newMin, long newMax)
          Move the data load component of a scroller.
 void notifyModelChanged(int changeType)
           
 void reLoad()
          Command telling manager to reload it's data.
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
private  void setCoupleAllScrollers(AbstractPamScroller pamScroller, boolean newState)
           
 void startDataAt(PamDataBlock dataBlock, long menuMouseTime)
          Start all data in all data blocks at the given time
 
Methods inherited from class pamScrollSystem.AbstractScrollManager
coupleScroller, getScrollManager, isInGap, removePamScroller, uncoupleScroller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

initialisationComplete

private boolean initialisationComplete

intialiseLoadDone

private boolean intialiseLoadDone

oldScrollerData

private StoredScrollerData oldScrollerData

loaderRunning

private boolean loaderRunning

dataLoader

private ViewerScrollerManager.DataLoader dataLoader
Constructor Detail

ViewerScrollerManager

public ViewerScrollerManager()
Method Detail

addPamScroller

public void addPamScroller(AbstractPamScroller pamScroller)
Description copied from class: AbstractScrollManager
Add a new scroller to the managed list.

Overrides:
addPamScroller in class AbstractScrollManager
Parameters:
pamScroller - scroller to add

moveInnerScroller

public void moveInnerScroller(AbstractPamScroller scroller,
                              long newValue)
Description copied from class: AbstractScrollManager
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.

Specified by:
moveInnerScroller in class AbstractScrollManager
Parameters:
scroller - scroller that moved
newValue - new value (time in milliseconds).

moveOuterScroller

public void moveOuterScroller(AbstractPamScroller scroller,
                              long newMin,
                              long newMax)
Description copied from class: AbstractScrollManager
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.

Specified by:
moveOuterScroller in class AbstractScrollManager
Parameters:
scroller - scroller that changed
newMin - new data min value in millis
newMax - new data max value in millis

reLoad

public void reLoad()
Description copied from class: AbstractScrollManager
Command telling manager to reload it's data.

Specified by:
reLoad in class AbstractScrollManager

loadData

public void loadData()
loads data after a scroller has changed.


loadDataQueue

private void loadDataQueue(java.util.ArrayList<DataLoadQueData> dataLoadQueue)

loadDone

private void loadDone()

checkLoadLimits

private void checkLoadLimits(java.util.ArrayList<DataLoadQueData> dataLoadQueue,
                             PamDataBlock pamDataBlock)
check the required load limits for a data block which may be being used my multiple scrollers.

Parameters:
pamDataBlock - datablock to check

findDataMapControl

private DataMapControl findDataMapControl()

checkMaximumTime

public long checkMaximumTime(long requestedTime)
Description copied from class: AbstractScrollManager
Check the maximum time requested by a scroll bar doesn't go beyond the end of the data

Specified by:
checkMaximumTime in class AbstractScrollManager
Parameters:
requestedTime - requested time in millis.
Returns:
the minimum of the requested time and the actual end time of the data

checkMinimumTime

public long checkMinimumTime(long requestedTime)
Description copied from class: AbstractScrollManager
Check the minimum time requested by a scroll bar doesn't go below the start of the data

Specified by:
checkMinimumTime in class AbstractScrollManager
Returns:
the maximum of the requested time and the actual start time of the data

notifyModelChanged

public void notifyModelChanged(int changeType)
Specified by:
notifyModelChanged in class AbstractScrollManager

initialiseScrollers

private void initialiseScrollers()
Called once at the start, and possibly after any changes to the database or binary store. Initialises scroll bars and calls for a data load.


getSettingsReference

public java.io.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 java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

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

centreDataAt

public void centreDataAt(PamDataBlock dataBlock,
                         long menuMouseTime)
Description copied from class: AbstractScrollManager
Centre all data in all data blocks at the given time

Specified by:
centreDataAt in class AbstractScrollManager
menuMouseTime - time in milliseconds

startDataAt

public void startDataAt(PamDataBlock dataBlock,
                        long menuMouseTime)
Description copied from class: AbstractScrollManager
Start all data in all data blocks at the given time

Specified by:
startDataAt in class AbstractScrollManager
menuMouseTime - time in milliseconds

getStandardOptionsMenu

public javax.swing.JPopupMenu getStandardOptionsMenu(AbstractPamScroller pamScroller)
Overrides:
getStandardOptionsMenu in class AbstractScrollManager

setCoupleAllScrollers

private void setCoupleAllScrollers(AbstractPamScroller pamScroller,
                                   boolean newState)

followCoupledScroller

private void followCoupledScroller(AbstractPamScroller pamScroller)

checkGapPos

public long checkGapPos(AbstractPamScroller scroller,
                        long oldMin,
                        long oldMax,
                        long newMin,
                        long newMax,
                        int direction)
Description copied from class: AbstractScrollManager
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.

Specified by:
checkGapPos in class AbstractScrollManager
Parameters:
scroller - 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.

checkGapPos

private long checkGapPos(PamDataBlock dataBlock,
                         long newMin,
                         long newMax)
Very similar to the function checking gap pos for a whole scroller, but only does it for one datablock.

Parameters:
dataBlock - data block
newMin - new min time
newMax - new max time
Returns:
adjusted new min time

getNextDataStart

public long getNextDataStart(AbstractPamScroller scroller,
                             long timeMillis)

getPrevDataEnd

public long getPrevDataEnd(AbstractPamScroller scroller,
                           long timeMillis)