jsynoptic.plugins.async
Class TimePlot

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by simtools.shapes.PlotShape
          extended by jsynoptic.builtin.Plot
              extended by jsynoptic.builtin.TimePlot
                  extended by jsynoptic.plugins.async.TimePlot
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, ContextualActionProvider, DataSourceConsumer, Linkable, SelectionContextualActionProvider, EndNotificationListener, DiagramComponent.ContextualDrawingProvider, Resizable, CurveShapeListener, ShapeListener, NamedProperties

public class TimePlot
extends TimePlot
implements DataSourceConsumer

A plot dedicated to time stamped data source The X axis (primary and secondary) display the time source values of TimeStampedDataSource. Assuming the time values are based on the same time zone, the data sources do not need to belong to the same collection (they are all asynchronous).

Author:
Claude Cazenave
See Also:
TimeStampedDataSource, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class jsynoptic.builtin.Plot
Plot.AxeRange, Plot.PlotCompoundEdit, Plot.PlotPropertiesNames
 
Nested classes/interfaces inherited from class simtools.shapes.PlotShape
PlotShape.Curve, PlotShape.Limit
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
static MenuResourceBundle addedResources
           
protected  boolean displaySecondaryAxis
          boolean to enabled the diplay of the secondary axis
protected  double time2Offset
          diferences between time and time2
 
Fields inherited from class jsynoptic.builtin.TimePlot
_dateTime, _dateTimeFont, _sdateTime, datePart1, datePart2
 
Fields inherited from class jsynoptic.builtin.Plot
autopx, autopy, autosx, autosy, AXE_NUMBER, axesLimitsArray, AXIS_ID, DEFAULT_DISPLAY_DATA_SOURCE_ID, defaultPalette, isNotifying, isPrimaryBounded, isSecondaryBounded, link, nbXGraduation, nbYGraduation, paletteIndex, preferredXGraduation, preferredYGraduation, primaryCurves, primaryEndIndex, primaryStartIndex, primaryX, PX, pxlabel, pxmax, pxmin, pxstep, pxvaluesOK, PY, pylabel, pymax, pymin, pystep, pyvaluesOK, resources, secondaryCurves, secondaryEndIndex, secondaryStartIndex, secondaryX, SX, sxlabel, sxmax, sxmin, sxstep, sxvaluesOK, SY, sylabel, symax, symin, systep, syvaluesOK, translateDrawing, zoomDrawing
 
Fields inherited from class simtools.shapes.PlotShape
_asx1, _asx2, _asy1, _asy2, _color, _curves, _font, _limits, _magnetizedCurve, curveInformationFont, curveInformationLabel, dirty, displayCurveInformation, hasLegend, image, imageGraphics, legendBounds, logpx, logpy, logsx, logsy, optimize, optimizeMode, pyformat, syformat, title, titleFont
 
Fields inherited from class simtools.shapes.AbstractShape
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD
 
Fields inherited from interface jsynoptic.base.ContextualActionProvider
EDITOR_CONTEXT, MOUSE_OUT_CONTEXT, MOUSE_OVER_CONTEXT, MOUSE_PRESSED_CONTEXT, SHAPELIST_CONTEXT, SOURCELIST_CONTEXT
 
Constructor Summary
TimePlot(int ox, int oy, int width, int height)
           
 
Method Summary
protected  boolean add(TimeStampedDataSource ds, boolean primary, boolean background)
           
 boolean addDataSource(DataSource d)
           
 boolean canAddDataSource(DataSource d)
           
 boolean canDoAction(double x, double y, java.lang.Object o, java.lang.String action, int context)
          Returns true if, and only if, it is possible to do the action right now
 JPropertiesPanel createPanel()
           
 boolean doAction(double x, double y, java.lang.Object o, java.lang.String action, javax.swing.undo.CompoundEdit undoableEdit)
          Do one of the actions previously declared by getAction.
protected  CurveShape doAddYAction(java.lang.Object[] obar)
           
 java.lang.String[] getActions(double x, double y, java.lang.Object o, int context)
          Return list of possible actions the contect information may be used, or not.
 java.util.LinkedHashMap getCollectiveActions(DiagramSelection sel, double x, double y, java.lang.Object o, int context)
          Return list of possible collective actions
 java.lang.String[] getPropertyNames()
          Get the list of property names
 java.lang.Object getPropertyValue(java.lang.String name)
          Get the value of the property named name
protected  double getStartEndTime(java.util.Vector curves, boolean start, boolean secondaryXaxis)
          Get start or end time related to a list of curves
 void notificationEnd(java.lang.Object referer)
          This callback is called after all notifications were processed.
 void repaintDiagram(java.awt.Rectangle oldBounds)
           
protected  void secondaryAxisBoundComputation(java.awt.Rectangle ret)
          Take into account additional elements in bounds computation for the secondary x axis
 void setPropertyValue(java.lang.String name, java.lang.Object value)
          Assigns value to the property named name
 
Methods inherited from class jsynoptic.builtin.TimePlot
computeFormat, displayCursorLocation, drawLegendAndGetBounds, set, setDateTime, setDateTimeFont, setTimeFormat
 
Methods inherited from class jsynoptic.builtin.Plot
addPrimaryY, addPrimaryYForSecondaryX, addSecondaryY, addSecondaryYForSecondaryX, addY, cloneShape, computeHorizontalAxeRange, computeStep, computeTranslationAxeRange, computeVerticalAxeRange, computeVerticalBoundAndStep, computeZoomWheelHorizontalAxeRange, computeZoomWheelVerticalAxeRange, doAddLimitAction, doCollectiveAction, getAxesProperties, getAxeValue, getContextualDrawing, getCurveParameters, getCurvesProperties, getLimitParameters, getLink, getPrimaryX, getSecondaryX, notifyChange, refresh, removeCurve, setCurveParameters, setLimitParamters, setLink, setPrimaryX, setSecondaryX, setX, setX, shapeDataChanged, translate, zoom, zoomWheel
 
Methods inherited from class simtools.shapes.PlotShape
computeBounds, computeLegendBounds, draw, drawCurves, drawLegend, drawLimits, drawMagnetizedCurve, getCurve, getCurve, getCurveNumber, getCurvesInformation, getLimit, getLimit, getLimitNumber, getPrimaryXAxis, getSecondaryXAxis, getTitle, insertCurve, insertCurve, insertCurve, insertCurve, insertLimit, insertLimit, insertLimit, isCurveInformationVisible, isLegendVisible, isOptimize, isSecondaryAxis, removeLimit, resize, setAnchor, setAnchor, setColor, setCurveColor, setCurveInformationVisible, setCurveLabel, setFont, setFormat, setLabel, setLegendVisible, setLimitColor, setLimitLabel, setOptimize, setSecondaryAxis, setSecondaryX, setSecondaryY, setTitle, setTitleFont, setX, setXLabel, setXLabel, setY, setYLabel, setYLabel, shapeChanged, shapeChanged, translate, updateBounds, updateCurveInformation
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, intersects, intersects, notifyChange, removeListener, setProperties, wipeOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addedResources

public static MenuResourceBundle addedResources

time2Offset

protected double time2Offset
diferences between time and time2


displaySecondaryAxis

protected boolean displaySecondaryAxis
boolean to enabled the diplay of the secondary axis

Constructor Detail

TimePlot

public TimePlot(int ox,
                int oy,
                int width,
                int height)
Parameters:
ox -
oy -
width -
height -
Method Detail

doAddYAction

protected CurveShape doAddYAction(java.lang.Object[] obar)
Overrides:
doAddYAction in class Plot

add

protected boolean add(TimeStampedDataSource ds,
                      boolean primary,
                      boolean background)

repaintDiagram

public void repaintDiagram(java.awt.Rectangle oldBounds)
Overrides:
repaintDiagram in class Plot

notificationEnd

public void notificationEnd(java.lang.Object referer)
Description copied from interface: EndNotificationListener
This callback is called after all notifications were processed. The referer object is the one to decide what the end means. For example, it may be a single data source notifying both a range change and a value change. Or it could be a collection notifying all its sources.

Specified by:
notificationEnd in interface EndNotificationListener
Overrides:
notificationEnd in class Plot

getCollectiveActions

public java.util.LinkedHashMap getCollectiveActions(DiagramSelection sel,
                                                    double x,
                                                    double y,
                                                    java.lang.Object o,
                                                    int context)
Description copied from interface: SelectionContextualActionProvider
Return list of possible collective actions

Specified by:
getCollectiveActions in interface SelectionContextualActionProvider
Overrides:
getCollectiveActions in class Plot
Parameters:
sel - the current selection
x - Coordinate, mouse position in the same unit as contains(x,y)
y - Coordinate, mouse position in the same unit as contains(x,y)
o - Object the collective actions should work on. Possibly null => default or all actions
context - one of the context defined in the ContextualActionProvider class
Returns:
The list of possible actions, possibly empty.The map values contains when applicable parent sub menus and icons

getActions

public java.lang.String[] getActions(double x,
                                     double y,
                                     java.lang.Object o,
                                     int context)
Description copied from interface: ContextualActionProvider
Return list of possible actions the contect information may be used, or not.

Specified by:
getActions in interface ContextualActionProvider
Overrides:
getActions in class Plot
Parameters:
x - Coordinate, mouse position in the same unit as contains(x,y)
y - Coordinate, mouse position in the same unit as contains(x,y)
o - Object the actions should work on. Possibly null => default or all actions
context - one of the context defined in the ContextualActionProvider class
Returns:
The list of possible actions, possibly null or an empty array

canDoAction

public boolean canDoAction(double x,
                           double y,
                           java.lang.Object o,
                           java.lang.String action,
                           int context)
Description copied from interface: ContextualActionProvider
Returns true if, and only if, it is possible to do the action right now

Specified by:
canDoAction in interface ContextualActionProvider
Overrides:
canDoAction in class Plot
Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - Object the action should work on.
action - An action returned by a previous getActions call with the same x, y, o parameters It may be null, in which case the default action is requested for this x,y,o.
context - one of the context defined in the ContextualActionProvider class
Returns:
true if the action can be performed

doAction

public boolean doAction(double x,
                        double y,
                        java.lang.Object o,
                        java.lang.String action,
                        javax.swing.undo.CompoundEdit undoableEdit)
Description copied from interface: ContextualActionProvider
Do one of the actions previously declared by getAction.

Specified by:
doAction in interface ContextualActionProvider
Overrides:
doAction in class TimePlot
Parameters:
x - Coordinate, for example mouse position
y - Coordinate, for example mouse position
o - Object the action should work on.
action - An action returned by a previous getActions call with the same x, y, o parameters It may be null, in which case the default action is requested for this x,y,o.
undoableEdit - current edit for undo/redo operation If not null, this action is undoable.
Returns:
true if the action could be performed

secondaryAxisBoundComputation

protected void secondaryAxisBoundComputation(java.awt.Rectangle ret)
Description copied from class: TimePlot
Take into account additional elements in bounds computation for the secondary x axis

Overrides:
secondaryAxisBoundComputation in class TimePlot
Parameters:
ret - the rectangle with bounds to update

createPanel

public JPropertiesPanel createPanel()
Overrides:
createPanel in class TimePlot

canAddDataSource

public boolean canAddDataSource(DataSource d)
Specified by:
canAddDataSource in interface DataSourceConsumer
Overrides:
canAddDataSource in class Plot
Parameters:
d - the data source to be added
Returns:
true if operation can be be performed

addDataSource

public boolean addDataSource(DataSource d)
Specified by:
addDataSource in interface DataSourceConsumer
Overrides:
addDataSource in class Plot
Parameters:
d - the data source to be added
Returns:
true if operation succeeds

getStartEndTime

protected double getStartEndTime(java.util.Vector curves,
                                 boolean start,
                                 boolean secondaryXaxis)
Get start or end time related to a list of curves

Parameters:
curves -
start - - if true get start time, otherwise get end time
secondaryXaxis - - if true look on all curves whose X is defined on X secondaryXaxis otherwise look on all curves whose X is defined on X primary
Returns:

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from interface: NamedProperties
Get the list of property names

Specified by:
getPropertyNames in interface NamedProperties
Overrides:
getPropertyNames in class Plot

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Description copied from class: AbstractShape
Get the value of the property named name

Specified by:
getPropertyValue in interface NamedProperties
Overrides:
getPropertyValue in class Plot
Parameters:
name - the name of the property to get
Returns:
the property value
See Also:
AbstractShape.getPropertyValue(String)

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
Description copied from class: AbstractShape
Assigns value to the property named name

Specified by:
setPropertyValue in interface NamedProperties
Overrides:
setPropertyValue in class Plot
Parameters:
name - the name of the property to get
value - its new value
See Also:
AbstractShape.setPropertyValue(String, Object)