Package pamScrollSystem
Class AbstractPamScroller
java.lang.Object
pamScrollSystem.AbstractPamScroller
- All Implemented Interfaces:
DataTimeLimits
- Direct Known Subclasses:
AbstractPamScrollerAWT
,AbstractPamScrollerFX
-
Constructor Summary
ConstructorDescriptionAbstractPamScroller
(String name, int orientation, int stepSizeMillis, long defaultLoadTime, boolean hasMenu) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataBlock
(PamDataBlock dataBlock) Add a datablock to the list for this scroller.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.void
addObserver
(PamScrollObserver pamScrollObserver) Ad an observer that will receive notifications when the the scroller moves.abstract void
anotherScrollerMovedInner
(long newValue) Another managed scroller moved it's positionvoid
anotherScrollerMovedOuter
(long newMin, long newMax) Another managed scroller moved its outer position - will cause new data to be loaded.void
coupledScrollerChanged
(ScrollerCoupling scrollerCoupling, AbstractPamScroller scroller) Called when a scroller which is coupled to this scroller changes in any way.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.void
long
long
long
int
int
Get menu parts to add to the menu from the scroller right clicklong
Get scroller data.long[]
getSpecialLoadTimes
(PamDataBlock pamDataBlock, long minimumMillis, long maximumMillis) Get the load times for a special data block based on current load times.int
stepSizeMillis is the resolution of the scroller in milliseconds.getUsedDataBlock
(int iBlock) Get a specific data block observed by this scroller.abstract long
The start time of the scroller in milliseconds.abstract long
This will be none for sliders, such as on the map.long
The end of the current visible screen which is getValueMillis() + getVisibleAmount();final boolean
isDataBlockUsed
(PamDataBlock dataBlock) See if this scroller is using a particular data blockboolean
isInSpecialList
(PamDataBlock pamDataBlock) Check if a data block is within the special data block list.boolean
void
Send a notification to all observers of this scroller to say that the range of data loaded has changed.void
pageBack()
void
void
void
abstract void
rangesChanged
(long setValue) Called when ranges have been changed and tells scroller to go to a particular absolute value.void
reLoad()
Command passed through the the scroll manager telling it reload data.void
Remove all datablocks from the viewed list.void
removeDataBlock
(PamDataBlock dataBlock) Remove a datablock from the viewed list.void
removeObserver
(PamScrollObserver pamScrollObserver) Remove an observer which no longer requires notifications when the scroller moves.void
setBlockIncrement
(long blockIncrement) void
setPageStep
(int pageStep) void
setRangeMillis
(long minimumMillis, long maximumMillis, boolean notify) Set the range of the currently loaded data and optionally notify other scrollers.void
setScrollerCoupling
(ScrollerCoupling scrollerCoupling) void
setStepSizeMillis
(int stepSizeMillis) void
setUnitIncrement
(long unitIncrement) final void
setValueMillis
(long valueMillis) void
setVisibleMillis
(long visibleAmount) void
void
toString()
void
Remove the scroller from it's coupling.abstract void
valueSetMillis
(long valueMillis) Called when a new position has been set
-
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
Ad an observer that will receive notifications when the the scroller moves.- Parameters:
pamScrollObserver
-
-
removeObserver
Remove an observer which no longer requires notifications when the scroller moves.- Parameters:
pamScrollObserver
-
-
addDataBlock
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
Remove a datablock from the viewed list.- Parameters:
dataBlock
- a PamDataBlock
-
removeAllDataBlocks
public void removeAllDataBlocks()Remove all datablocks from the viewed list. -
isDataBlockUsed
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 interfaceDataTimeLimits
- Returns:
- the minimumMillis - the minimum of loaded data
-
getMaximumMillis
public long getMaximumMillis()- Specified by:
getMaximumMillis
in interfaceDataTimeLimits
- 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 millisecondsmaximumMillis
- maximum time in millisecondsnotify
- 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
- 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
- Returns:
- the scrollManager
-
coupleScroller
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
-
setScrollerCoupling
-
coupledScrollerChanged
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
Get a specific data block observed by this scroller.- Parameters:
iBlock
- block index- Returns:
- reference to an observed datablock
-
isInSpecialList
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
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
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
Get menu parts to add to the menu from the scroller right click- Returns:
- the pamMenuParts
-
isShowing
public boolean isShowing() -
toString
-