ucar.unidata.idv.control.chart
Class TimeSeriesChartWrapper

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.collab.PropertiedThing
          extended by ucar.unidata.idv.control.multi.DisplayComponent
              extended by ucar.unidata.idv.control.chart.ChartWrapper
                  extended by ucar.unidata.idv.control.chart.PlotWrapper
                      extended by ucar.unidata.idv.control.chart.TimeSeriesChartWrapper
All Implemented Interfaces:
KeyListener, PropertyChangeListener, EventListener, Sharable

public class TimeSeriesChartWrapper
extends PlotWrapper

Provides a time series chart

Version:
$Revision: 1.51 $
Author:
IDV Development Team

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.chart.PlotWrapper
PlotWrapper.MyChartPanel
 
Nested classes/interfaces inherited from class ucar.unidata.idv.control.chart.ChartWrapper
ChartWrapper.FieldProperties
 
Field Summary
static String PROP_TIMERANGE
          Property change id
 
Fields inherited from class ucar.unidata.idv.control.chart.PlotWrapper
chart, chartPanel, EVENT_DONTPASSON, EVENT_PASSON
 
Fields inherited from class ucar.unidata.idv.control.chart.ChartWrapper
animationWidget, dataChoiceWrappers, PROP_SELECTEDTIME, timeFilterSource, timeSelectSource
 
Fields inherited from class ucar.unidata.idv.control.multi.DisplayComponent
CMD_SAVEIMAGE, CMD_SAVEMOVIE, displayControl, displayLabel, hasBeenInitialized, isRemoved, PROP_REMOVED
 
Fields inherited from class ucar.unidata.collab.PropertiedThing
propertiesDialog
 
Constructor Summary
TimeSeriesChartWrapper()
          Default ctor
TimeSeriesChartWrapper(String name, List dataChoices)
          Ctor
 
Method Summary
 void addSegment(WayPoint[] wps)
          Add a segment between the 2 waypoints
 void annotationChanged(ChartAnnotation chartAnnotation)
          The annotaiton has changed.
protected  boolean applyProperties()
          Apply properties
protected  boolean canDoColors()
          Can we do the data area colors in the properties dialog
protected  boolean canDoDriveTime()
          We can set the time in the main display
protected  boolean canDoJython()
          The timeseries can have jython applied to it
protected  boolean canDoTimeFilters()
          Can we add time subsetting to this chart
protected  boolean canDoTimeSelect()
          Can this chart use time selects This is used to determine whether the checkbox should be shown in the menus
 boolean canDoWrapperColor()
          Show colors in fields properties
 boolean canDoWrapperSide()
          SHow side menu in fields properties
 void centerOn(RangeFilter rangeFilter)
          Center the range axis
 void centerOn(WayPoint wayPoint)
          Center the domain axis about
 String chartPanelGetToolTipText(MouseEvent event)
          Get the tool tip text
 boolean chartPanelMouseClicked(MouseEvent event)
          Callback method for receiving notification of a mouse click on a chart.
 boolean chartPanelMouseDragged(MouseEvent event)
          Handle event in chart
 boolean chartPanelMousePressed(MouseEvent event)
          Callback method for receiving notification of a mouse click on a chart.
 boolean chartPanelMouseReleased(MouseEvent event)
          Handle event in chart
protected  JComponent doMakeContents()
          Create the chart if needed
 void doRemove()
          remove me
 void editAnnotation(ChartAnnotation annotation)
          Show the properties
 ChartAnnotation findClosestAnnotation(List list, int x, int y, boolean andSetSelected, boolean addToSelected)
          Find the closest annotation
 List getDisplayables()
          Get the list of displayables we use
 double getDomainValue(int x)
          Get the domain value of the x position
 org.jfree.chart.plot.XYPlot getPlot()
          Get the plot we use
protected  List getPopupMenuItems(List items)
          Get the popup menu items
protected  void getPropertiesComponents(List comps, int tabIdx)
          Add to the properties components
 List getRangeFilters()
          Get the RangeFilters property.
 double getRangeValue(int y)
          Get the range value of y
 List getRangeValues(int dataset)
          Get the List of range values for the given dataset
 List getSegments()
          Get the Segments property.
 List getSelected(List annotations)
          Get list of selected annotations
 boolean getShowDots()
          Get the ShowDots property.
 List getTimeRanges()
          Create a list of time ranges from the segments
 WayPoint getTimeWayPoint()
          Get the TimeWayPoint property.
 String getTypeName()
          Return the human readable name of this chart
 List getWayPoints()
          Get the WayPoints property.
 void initDone()
          Do final initialization
protected  void initializeJython(org.python.util.PythonInterpreter interpreter)
          Add the state of this chart to the interpreter
 void loadData()
          Create the charts
 void loadDatax()
          Create the charts
 boolean okToDraw(ChartAnnotation annotation)
          Is it ok to draw the annotation
 void propertyChange(PropertyChangeEvent event)
          Handle the event
 void rangeFiltersChanged()
          Range filters changed
 boolean rangeValueOk(int dataset, double value)
          Does the value apss the range filters
 void removeAnnotation(ChartAnnotation annotation)
          Remove the annotation
 void removeAnnotations(List annotations)
          Remove all of the annotations in the list.
 void removeSelectedAnnotations(List annotations)
          Remove the selected annotations in the list.
 void setRangeFilters(List value)
          Set the RangeFilters property.
 void setSegments(List value)
          Set the Segments property.
 void setSelectedAnnotation(ChartAnnotation annotation, List list, boolean dontClear)
          Set the given annotation as selected.
 void setShowDots(boolean value)
          Set the ShowDots property.
protected  void setTime(double value, boolean andDriveAnimation)
          Set the time we're at
 void setTimeFromAnimation(Real time)
          Animation in main display changed.
 void setTimeWayPoint(WayPoint value)
          Set the TimeWayPoint property.
 void setWayPoints(List value)
          Set the WayPoints property.
 String toString()
          to string
 boolean valuesOk(int dataset, double domainValue, double rangeValue)
          Are the values ok to render
 void zoomTo(RangeFilter rangeFilter)
          Zoom the range axis
 void zoomTo(TrackSegment segment)
          Zoom the domain axis
 
Methods inherited from class ucar.unidata.idv.control.chart.PlotWrapper
doMakeChartPanel, getAutoRange, getBackgroundColor, getChartPanel, getDataAreaColor, getDomainLineState, getPreferredChartSize, getPropertyTabs, getRangeLineState, initXYPlot, keyPressed, keyReleased, keyTyped, panPlot, panPlot, setAutoRange, setBackgroundColor, setDataAreaColor, setDomainLineState, setName, setRangeLineState, signalChartChanged
 
Methods inherited from class ucar.unidata.idv.control.chart.ChartWrapper
addDataChoice, addDataChoices, addField, animationTimeChanged, applyJython, applyJython, canBeASourceForTimeSelectionEvents, canDoDataChoiceList, canDoMinMaxDate, canDoParameters, canDoRemoveParameters, canDoResolution, createDataChoiceWrapper, doApplyProperties, doMakeWrapperDisplayComponent, doMultipleAddFields, filterData, formatValue, getAnimationShareGroup, getCategories, getDataChoices, getDataChoiceWrappers, getDriveTime, getFieldSelectionLabels, getFlatField, getInterpreter, getJython, getMaxDate, getMinDate, getResolution, getShowTime, getTimeFilterRanges, getTimeFilterSource, getTimeSelectSource, getTimeValues, init, removeTimeFilterSource, removeTimeSelectSource, setAnimationShareGroup, setDataChoiceWrappers, setDriveTime, setJython, setMaxDate, setMinDate, setResolution, setShowTime, setTimeFilterSource, setTimeSelectSource, wrapDataChoices
 
Methods inherited from class ucar.unidata.idv.control.multi.DisplayComponent
addGroupMenuItems, doMakeDisplayLabel, doSaveImage, doSaveMovie, getContents, getDisplayControl, getDisplayGroup, getDisplayLabel, getIsRemoved, getLabelShown, getName, initAfterUnPersistence, removeDisplayComponent, setDisplayControl, setDisplayGroup, setIsRemoved, setLabelShown, showPopup, showProperties
 
Methods inherited from class ucar.unidata.collab.PropertiedThing
addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyListeners, isShowing, removePropertyChangeListener, showProperties
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_TIMERANGE

public static final String PROP_TIMERANGE
Property change id

See Also:
Constant Field Values
Constructor Detail

TimeSeriesChartWrapper

public TimeSeriesChartWrapper()
Default ctor


TimeSeriesChartWrapper

public TimeSeriesChartWrapper(String name,
                              List dataChoices)
Ctor

Parameters:
name - The name
dataChoices - List of data choices
Method Detail

getPlot

public org.jfree.chart.plot.XYPlot getPlot()
Get the plot we use

Returns:
The plot

getTypeName

public String getTypeName()
Return the human readable name of this chart

Specified by:
getTypeName in class ChartWrapper
Returns:
Chart type name

doMakeContents

protected JComponent doMakeContents()
Create the chart if needed

Specified by:
doMakeContents in class DisplayComponent
Returns:
The gui contents

getDisplayables

public List getDisplayables()
Get the list of displayables we use

Overrides:
getDisplayables in class DisplayComponent
Returns:
List of displayables

loadData

public void loadData()
              throws VisADException,
                     RemoteException
Create the charts

Overrides:
loadData in class ChartWrapper
Throws:
RemoteException - On badness
VisADException - On badness

loadDatax

public void loadDatax()
               throws VisADException,
                      RemoteException
Create the charts

Throws:
RemoteException - On badness
VisADException - On badness

toString

public String toString()
to string

Overrides:
toString in class DisplayComponent
Returns:
string

setSelectedAnnotation

public void setSelectedAnnotation(ChartAnnotation annotation,
                                  List list,
                                  boolean dontClear)
Set the given annotation as selected. The list is one of rangeFilters, wayPoints or segments.

Parameters:
annotation - The annotation
list - List its in
dontClear - Dont clear the others in the list

removeAnnotations

public void removeAnnotations(List annotations)
Remove all of the annotations in the list. The list is one of rangeFilters, wayPoints or segments.

Parameters:
annotations - The list of annotations

removeAnnotation

public void removeAnnotation(ChartAnnotation annotation)
Remove the annotation

Parameters:
annotation - The annotation

editAnnotation

public void editAnnotation(ChartAnnotation annotation)
Show the properties

Parameters:
annotation - The annotation

removeSelectedAnnotations

public void removeSelectedAnnotations(List annotations)
Remove the selected annotations in the list.

Parameters:
annotations - The list of annotations

chartPanelMousePressed

public boolean chartPanelMousePressed(MouseEvent event)
Callback method for receiving notification of a mouse click on a chart.

Overrides:
chartPanelMousePressed in class PlotWrapper
Parameters:
event - information about the event.
Returns:
Did we handle this event

chartPanelMouseClicked

public boolean chartPanelMouseClicked(MouseEvent event)
Callback method for receiving notification of a mouse click on a chart.

Overrides:
chartPanelMouseClicked in class PlotWrapper
Parameters:
event - information about the event.
Returns:
Did we handle this event

getDomainValue

public double getDomainValue(int x)
Get the domain value of the x position

Parameters:
x - The x position
Returns:
Domain value

getRangeValue

public double getRangeValue(int y)
Get the range value of y

Parameters:
y - The y position
Returns:
Range value

getTimeRanges

public List getTimeRanges()
Create a list of time ranges from the segments

Overrides:
getTimeRanges in class ChartWrapper
Returns:
List of ranges

setTimeFromAnimation

public void setTimeFromAnimation(Real time)
Animation in main display changed. Some charts show this

Overrides:
setTimeFromAnimation in class ChartWrapper
Parameters:
time - the animation time

setTime

protected void setTime(double value,
                       boolean andDriveAnimation)
Set the time we're at

Parameters:
value - time
andDriveAnimation - Set the time in the animation widget

propertyChange

public void propertyChange(PropertyChangeEvent event)
Handle the event

Specified by:
propertyChange in interface PropertyChangeListener
Overrides:
propertyChange in class ChartWrapper
Parameters:
event - the event

zoomTo

public void zoomTo(TrackSegment segment)
Zoom the domain axis

Parameters:
segment - The track segment

zoomTo

public void zoomTo(RangeFilter rangeFilter)
Zoom the range axis

Parameters:
rangeFilter - The range filter

centerOn

public void centerOn(WayPoint wayPoint)
Center the domain axis about

Parameters:
wayPoint - The way point

centerOn

public void centerOn(RangeFilter rangeFilter)
Center the range axis

Parameters:
rangeFilter - The range filter

chartPanelMouseReleased

public boolean chartPanelMouseReleased(MouseEvent event)
Handle event in chart

Overrides:
chartPanelMouseReleased in class PlotWrapper
Parameters:
event - The event
Returns:
Did we handle this event

getPropertiesComponents

protected void getPropertiesComponents(List comps,
                                       int tabIdx)
Add to the properties components

Overrides:
getPropertiesComponents in class PlotWrapper
Parameters:
comps - List of components
tabIdx - Which tab in the properties dialog

applyProperties

protected boolean applyProperties()
Apply properties

Overrides:
applyProperties in class PlotWrapper
Returns:
Was successful

annotationChanged

public void annotationChanged(ChartAnnotation chartAnnotation)
The annotaiton has changed. If its a WayPoint then fire the timerange property change.

Overrides:
annotationChanged in class PlotWrapper
Parameters:
chartAnnotation - The annotation that changed

addSegment

public void addSegment(WayPoint[] wps)
Add a segment between the 2 waypoints

Parameters:
wps - 2 waypoints

okToDraw

public boolean okToDraw(ChartAnnotation annotation)
Is it ok to draw the annotation

Overrides:
okToDraw in class PlotWrapper
Parameters:
annotation - The annotation
Returns:
ok to draw

getSelected

public List getSelected(List annotations)
Get list of selected annotations

Parameters:
annotations - The list of annotations
Returns:
selected annotations in list

getPopupMenuItems

protected List getPopupMenuItems(List items)
Get the popup menu items

Overrides:
getPopupMenuItems in class PlotWrapper
Parameters:
items - list to add to
Returns:
the list with items from this

findClosestAnnotation

public ChartAnnotation findClosestAnnotation(List list,
                                             int x,
                                             int y,
                                             boolean andSetSelected,
                                             boolean addToSelected)
Find the closest annotation

Parameters:
list - List of annotations
x - The x position
y - The y position
andSetSelected - If true set the closest as selected
addToSelected - If true add to selected. Else remove selection set (if andSetSelected is true.
Returns:
Closest annotation or null

canDoDriveTime

protected boolean canDoDriveTime()
We can set the time in the main display

Overrides:
canDoDriveTime in class ChartWrapper
Returns:
can set the time in the main display

canDoTimeSelect

protected boolean canDoTimeSelect()
Can this chart use time selects This is used to determine whether the checkbox should be shown in the menus

Overrides:
canDoTimeSelect in class ChartWrapper
Returns:
Can this chart use time select

canDoJython

protected boolean canDoJython()
The timeseries can have jython applied to it

Overrides:
canDoJython in class ChartWrapper
Returns:
Can this chart have jython applied to it

initializeJython

protected void initializeJython(org.python.util.PythonInterpreter interpreter)
Add the state of this chart to the interpreter

Overrides:
initializeJython in class ChartWrapper
Parameters:
interpreter - The interpreter to initialize

canDoColors

protected boolean canDoColors()
Can we do the data area colors in the properties dialog

Overrides:
canDoColors in class PlotWrapper
Returns:
can do colors

canDoTimeFilters

protected boolean canDoTimeFilters()
Can we add time subsetting to this chart

Overrides:
canDoTimeFilters in class ChartWrapper
Returns:
false

canDoWrapperColor

public boolean canDoWrapperColor()
Show colors in fields properties

Overrides:
canDoWrapperColor in class ChartWrapper
Returns:
can do colors

canDoWrapperSide

public boolean canDoWrapperSide()
SHow side menu in fields properties

Overrides:
canDoWrapperSide in class ChartWrapper
Returns:
can do sides

valuesOk

public boolean valuesOk(int dataset,
                        double domainValue,
                        double rangeValue)
Are the values ok to render

Parameters:
dataset - Which data set
domainValue - The domain value
rangeValue - The range value
Returns:
show values

getRangeValues

public List getRangeValues(int dataset)
Get the List of range values for the given dataset

Parameters:
dataset - The data set
Returns:
List of range values

rangeValueOk

public boolean rangeValueOk(int dataset,
                            double value)
Does the value apss the range filters

Parameters:
dataset - Which dataset
value - The range value
Returns:
show values

chartPanelMouseDragged

public boolean chartPanelMouseDragged(MouseEvent event)
Handle event in chart

Overrides:
chartPanelMouseDragged in class PlotWrapper
Parameters:
event - The event
Returns:
Did we handle this event

chartPanelGetToolTipText

public String chartPanelGetToolTipText(MouseEvent event)
Get the tool tip text

Overrides:
chartPanelGetToolTipText in class PlotWrapper
Parameters:
event - The event
Returns:
tool tip

rangeFiltersChanged

public void rangeFiltersChanged()
Range filters changed


doRemove

public void doRemove()
remove me

Overrides:
doRemove in class ChartWrapper

initDone

public void initDone()
Do final initialization

Overrides:
initDone in class ChartWrapper

setWayPoints

public void setWayPoints(List value)
Set the WayPoints property.

Parameters:
value - The new value for WayPoints

getWayPoints

public List getWayPoints()
Get the WayPoints property.

Returns:
The WayPoints

setSegments

public void setSegments(List value)
Set the Segments property.

Parameters:
value - The new value for Segments

getSegments

public List getSegments()
Get the Segments property.

Returns:
The Segments

setRangeFilters

public void setRangeFilters(List value)
Set the RangeFilters property.

Parameters:
value - The new value for RangeFilters

getRangeFilters

public List getRangeFilters()
Get the RangeFilters property.

Returns:
The RangeFilters

setTimeWayPoint

public void setTimeWayPoint(WayPoint value)
Set the TimeWayPoint property.

Parameters:
value - The new value for TimeWayPoint

getTimeWayPoint

public WayPoint getTimeWayPoint()
Get the TimeWayPoint property.

Returns:
The TimeWayPoint

setShowDots

public void setShowDots(boolean value)
Set the ShowDots property.

Parameters:
value - The new value for ShowDots

getShowDots

public boolean getShowDots()
Get the ShowDots property.

Returns:
The ShowDots