|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPamguardMVC.PamObservable
public class PamObservable
Similar functionality to the Observable Class, but works with the PamObserver interface which has a bitmore functionality.
e.g. The PamDataBlock, which is the most common class of PamObservable asks the observers what the first required sample is for each observing process or view.
| Field Summary | |
|---|---|
private double[] |
cpuPercent
|
private long[] |
cpuUsage
|
private static long |
LARGEST_SAMPLE
|
private long |
lastCPUCheckTime
|
private PamObserver |
longestObserver
|
protected long |
masterClockSample
Sample numbers are now passed around to all observers. |
protected boolean |
objectChanged
|
protected PanelOverlayDraw |
overlayDraw
Reference to a class that knows how to draw these things on any of the standard displays in the view, e.g. |
protected java.util.ArrayList<PamObserver> |
pamObservers
List of PamObservers |
protected PamProfiler |
pamProfiler
|
(package private) javax.swing.Timer |
t
|
(package private) long |
totalCalls
|
| Constructor Summary | |
|---|---|
PamObservable()
|
|
| Method Summary | |
|---|---|
void |
addObserver(PamObserver o)
Adds a PamObserver, which will then receive notifications when data is added. |
void |
addObserver(PamObserver o,
boolean reThread)
|
boolean |
canDraw(GeneralProjector projectorInfo)
|
void |
clearchanged()
Set flag to say the data have changed |
int |
countObservers()
|
PamKeyItem |
createKeyItem(GeneralProjector generalProjector,
int keyType)
provide a graphics component (probably a JPanel) that can be incorporated into a key panel for maps, and anything else that uses overlay graphics. |
void |
deleteObserver(PamObserver o)
Removes an observer from the list |
void |
deleteObservers()
Removes all observers from the list |
java.awt.Rectangle |
drawDataUnit(java.awt.Graphics g,
PamDataUnit pamDataUnit,
GeneralProjector projectorInfo)
|
ThreadedObserver |
findThreadedObserver(PamObserver o)
Go through the observer list and check inside any that are wrapped in threaded observers, |
double |
getCPUPercent(int objectIndex)
|
double |
getCPUPercent(PamObserver pamObserver)
|
java.lang.String |
getHoverText(GeneralProjector generalProjector,
PamDataUnit dataUnit,
int iSide)
Provides text for popup hover windows on displays. |
PamObserver |
getLongestObserver()
|
java.util.ArrayList<PamObserver> |
getPamObservers()
|
long |
getRequiredHistory()
Goes through all observers and works out which requires data the longest. |
void |
notifyObservers()
Instruction to notify observers that data have changed, but not to send them any information about the new data. |
void |
notifyObservers(PamDataUnit o)
Notify observers that data have changed and send them a reference to the new Data |
void |
setChanged()
Set flag to say the data have changed |
void |
setOverlayDraw(PanelOverlayDraw overlayDraw)
|
boolean |
waitForThreadedObservers(long timeOutms)
Go through all the threaded observers and wait for them to finish processing any data remaining in their lists. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long LARGEST_SAMPLE
protected java.util.ArrayList<PamObserver> pamObservers
private long[] cpuUsage
private long lastCPUCheckTime
private double[] cpuPercent
protected boolean objectChanged
long totalCalls
private PamObserver longestObserver
protected PanelOverlayDraw overlayDraw
protected PamProfiler pamProfiler
protected long masterClockSample
javax.swing.Timer t
| Constructor Detail |
|---|
PamObservable()
| Method Detail |
|---|
public void addObserver(PamObserver o)
o - Reference to the observer
public void addObserver(PamObserver o,
boolean reThread)
public ThreadedObserver findThreadedObserver(PamObserver o)
o -
public boolean waitForThreadedObservers(long timeOutms)
timeOutms - timeout in milliseconds
public void deleteObserver(PamObserver o)
o - Observer to removepublic void deleteObservers()
public int countObservers()
public java.util.ArrayList<PamObserver> getPamObservers()
public void notifyObservers()
public void setChanged()
public void clearchanged()
public void notifyObservers(PamDataUnit o)
o - Reference to the new PamDataUnitpublic double getCPUPercent(int objectIndex)
public double getCPUPercent(PamObserver pamObserver)
public long getRequiredHistory()
public PamObserver getLongestObserver()
public void setOverlayDraw(PanelOverlayDraw overlayDraw)
overlayDraw - Instance of a concrete class implementing the PanelIverlayDraw
interface.
Called to set the class which can draw overlays of the PamDataUnits held in this data block.
public java.awt.Rectangle drawDataUnit(java.awt.Graphics g,
PamDataUnit pamDataUnit,
GeneralProjector projectorInfo)
drawDataUnit in interface PanelOverlayDrawg - An awt Graphics object
projectorInfo - Class implementing GeneralProjector which can convert data to
screen coordinates.
pamDataUnit - PamDataUnit to draw
Any PamObserver which has been notified by a PamObservable that a new PamDatUnit has been created can call this function to draw some arbitrary shape on the image, e.g. a whistle contour, a picture of a whale, etc.
This should be overridden in the concrete class if it is to do anything.
public boolean canDraw(GeneralProjector projectorInfo)
canDraw in interface PanelOverlayDraw
public java.lang.String getHoverText(GeneralProjector generalProjector,
PamDataUnit dataUnit,
int iSide)
PanelOverlayDraw
getHoverText in interface PanelOverlayDrawgeneralProjector - Projector associated with the display requiring the textdataUnit - Data unit the mouse hovered over
public PamKeyItem createKeyItem(GeneralProjector generalProjector,
int keyType)
PanelOverlayDrawSince multiple keys may be created in various displays, new ones should normally be created each time this is called.
The GeneralProjector reference is passed as a parameter since the type of symbol or shape drawn on a particular plot may depend on the type of coordinate system. For example, whistles are drawn as a contour on the spectrogram display, but as a point (PamSymbol) on the map.
It is possible that some PanelOverlayDraw implementations will be rather complicated and the keys consequently quite large. The extendedKey parameter may therefore be used to draw a full or a cut down version of the key. It is expected that most implementations will ignore this parameter !
createKeyItem in interface PanelOverlayDrawgeneralProjector - Reference to a GeneralProjector responsible
for drawing with the PAnelOverlayDraw implementationkeyType - Draw a more complicated key, giving more detail
WhistleGraphics,
PamSymbol
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||