Package ucar.unidata.idv.control.chart
Class ChartWrapper
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.collab.PropertiedThing
ucar.unidata.idv.control.multi.DisplayComponent
ucar.unidata.idv.control.chart.ChartWrapper
- All Implemented Interfaces:
KeyListener
,PropertyChangeListener
,EventListener
,Sharable
- Direct Known Subclasses:
PlotWrapper
,ReadoutTable
,StatisticsChartWrapper
,TableChartWrapper
Abstract class for chart implementations
- Version:
- $Revision: 1.46 $
- Author:
- IDV Development Team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static class
Class FieldProperties holds state for the data choice wrappers in the properties dialog -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AnimationWidget
The widgetprotected List
List of data choicesstatic final String
Property change idstatic final String
Property change idprotected TimeSeriesChartWrapper
This is the time series that we get the time segments from for subsettingprotected ChartWrapper
This is the source for time selectsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataChoice
(DataChoice dataChoice) Add the dta choicevoid
addDataChoices
(List newDataChoices) Add the data choicesvoid
addField()
Add a field to thei chartvoid
animationTimeChanged
(Real time) Use the animation time to set the domain crosshairsvoid
Get the jython text from the text field and apply itprotected void
applyJython
(String jython) Evaluate the jython.protected boolean
Apply propertiesprotected boolean
Can this component be a source for time selection eventsboolean
ok to show the data choice listprotected boolean
Can this chart drive the times in the main display.protected boolean
Should the jython field be shown in the propertiesprotected boolean
Can this chart subset the entire data set on timeboolean
Can we add fieldsboolean
Can we remove fieldsprotected boolean
Should show resolution widgetprotected boolean
Can this chart use time subset filters.protected boolean
Can this chart use time selects This is used to determine whether the checkbox should be shown in the menusboolean
Can the color swatch be shown in the properties for the data choice wrappers.boolean
Can the Side menu be shown in the properties for the data choice wrappers.protected DataChoiceWrapper
createDataChoiceWrapper
(DataChoice dataChoice) A utility to create a data choice wrapperprotected boolean
Apply the propertiesprotected JComponent
doMakeWrapperDisplayComponent
(int idx, ChartWrapper.FieldProperties fieldProperty) Make the widget for the fieldboolean
When selecting data does the data tree support multiple selectionsvoid
doRemove()
Cleanup the chartprotected double[][]
filterData
(double[] samples, double[] timeValues) Utility to pull subset the given samples based on the time filter rangesformatValue
(double v) utility to format the valueGet the AnimationShareGroup property.Get the data categories for selecting data choicesCreate and return a list of the data choices held by the data choice wrappers.Get the DataChoiceWrappers property.boolean
Get the DriveTime property.Returns the list of labels used for selecting data choices.protected FlatField
getFlatField
(FieldImpl data) Utility to extract a FlatField from the dataprotected org.python.util.PythonInterpreter
Create, if needed, and return the interpreterGet the Jython property.double
Get the MaxDate property.double
Get the MinDate property.protected List
getPopupMenuItems
(List items) Add the default menu itemsprotected void
getPropertiesComponents
(List comps, int tabIdx) Create the properties contentsdouble
Get the Resolution property.boolean
Get the ShowTime property.protected List
Get get list of Ranges for time subsetting.Get the FilterSource property.Get the time ranges to useGet the SelectSource property.double[]
getTimeValues
(double[][] samples, FlatField data) Convert the time from the data (in samples[1]) into an array of millisecondsabstract String
Overwritten by derived classes to return the name of the type of this chart.void
init
(MultiDisplayHolder displayControl, List dataChoices) Initializevoid
initDone()
Called after this chart has been created.protected void
initializeJython
(org.python.util.PythonInterpreter interpreter) Add the state of this chart to the interpretervoid
Noopvoid
Noopvoid
Noopvoid
loadData()
create shapes for an individual time step.void
Handle the eventvoid
Remove the current time filter sourcevoid
Remove the current time select sourcevoid
setAnimationShareGroup
(String value) Set the AnimationShareGroup property.void
setDataChoiceWrappers
(List value) Set the DataChoiceWrappers property.void
setDriveTime
(boolean value) Set the DriveTime property.void
Set the Jython property.void
setMaxDate
(double value) Set the MaxDate property.void
setMinDate
(double value) Set the MinDate property.void
setResolution
(double value) Set the Resolution property.void
setShowTime
(boolean value) Set the ShowTime property.void
Set the FilterSource property.void
setTimeFromAnimation
(Real time) Animation in main display changed.void
setTimeSelectSource
(ChartWrapper value) Set the SelectSource property.protected List
wrapDataChoices
(List choices) A utility that takes a list of DataChoice-s and wraps each one in the DataChoiceWrapper.Methods inherited from class ucar.unidata.idv.control.multi.DisplayComponent
addGroupMenuItems, doMakeContents, doMakeDisplayLabel, doSaveImage, doSaveMovie, getBackgroundColor, getContents, getDisplayables, getDisplayControl, getDisplayGroup, getDisplayLabel, getIsRemoved, getLabelShown, getName, initAfterUnPersistence, removeDisplayComponent, setBackgroundColor, setDisplayControl, setDisplayGroup, setIsRemoved, setLabelShown, setName, showPopup, showProperties, toString
Methods inherited from class ucar.unidata.collab.PropertiedThing
addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, removePropertyChangeListener, showProperties
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
-
Field Details
-
PROP_TIMERANGE
Property change id- See Also:
-
PROP_SELECTEDTIME
Property change id- See Also:
-
animationWidget
The widget -
dataChoiceWrappers
List of data choices -
timeFilterSource
This is the time series that we get the time segments from for subsetting -
timeSelectSource
This is the source for time selects
-
-
Constructor Details
-
ChartWrapper
public ChartWrapper()Default ctor -
ChartWrapper
Ctor- Parameters:
name
- The namedataChoices
- List of data choices
-
-
Method Details
-
getCategories
Get the data categories for selecting data choices- Returns:
- List of data categories
-
init
Initialize- Parameters:
displayControl
- The display control we're in.dataChoices
- List of data choices
-
initDone
public void initDone()Called after this chart has been created.- Overrides:
initDone
in classDisplayComponent
-
getFlatField
Utility to extract a FlatField from the data- Parameters:
data
- The data- Returns:
- The flat field
- Throws:
RemoteException
- On badnessVisADException
- On badness
-
getTypeName
Overwritten by derived classes to return the name of the type of this chart. ex: Histogram, Time Series, etc.- Overrides:
getTypeName
in classDisplayComponent
- Returns:
- The type name
-
keyPressed
Noop- Specified by:
keyPressed
in interfaceKeyListener
- Parameters:
e
- The event
-
keyReleased
Noop- Specified by:
keyReleased
in interfaceKeyListener
- Parameters:
e
- The event
-
keyTyped
Noop- Specified by:
keyTyped
in interfaceKeyListener
- Parameters:
e
- The event
-
wrapDataChoices
A utility that takes a list of DataChoice-s and wraps each one in the DataChoiceWrapper. We use the DataChoiceWrapper so that sub classes can have their own extra info for each data choice. ex: colors, etc.- Parameters:
choices
- List of data choices- Returns:
- List of data choice wrappers
-
createDataChoiceWrapper
A utility to create a data choice wrapper- Parameters:
dataChoice
- The data choice- Returns:
- The data choice wrapper
-
getTimeFilterRanges
Get get list of Ranges for time subsetting. If there are none then return null.- Returns:
- List of time ranges or null
-
getTimeRanges
Get the time ranges to use- Returns:
- null
-
getPopupMenuItems
Add the default menu items- Overrides:
getPopupMenuItems
in classDisplayComponent
- Parameters:
items
- List of menu items- Returns:
- The items list
-
getInterpreter
protected org.python.util.PythonInterpreter getInterpreter()Create, if needed, and return the interpreter- Returns:
- The interpreter
-
applyJython
public void applyJython()Get the jython text from the text field and apply it -
applyJython
Evaluate the jython. This is used so end users can write some jython to extract and muck with the data in a chart.- Parameters:
jython
- The jython
-
initializeJython
protected void initializeJython(org.python.util.PythonInterpreter interpreter) Add the state of this chart to the interpreter- Parameters:
interpreter
- The interpreter to initialize
-
canDoJython
protected boolean canDoJython()Should the jython field be shown in the properties- Returns:
- Can this chart have jython applied to it
-
canBeASourceForTimeSelectionEvents
protected boolean canBeASourceForTimeSelectionEvents()Can this component be a source for time selection events- Returns:
- false
-
canDoTimeFilters
protected boolean canDoTimeFilters()Can this chart use time subset filters. This is used to determine whether the checkbox should be shown in the menus- Returns:
- Can this chart use time subset filters.
-
canDoTimeSelect
protected boolean canDoTimeSelect()Can this chart use time selects This is used to determine whether the checkbox should be shown in the menus- Returns:
- Can this chart use time select
-
canDoDriveTime
protected boolean canDoDriveTime()Can this chart drive the times in the main display. This is used to determine whether the checkbox should be shown in the menus- Returns:
- Can this chart drive the times in the main display
-
canDoMinMaxDate
protected boolean canDoMinMaxDate()Can this chart subset the entire data set on time- Returns:
- Can do min max data subsetting
-
canDoResolution
protected boolean canDoResolution()Should show resolution widget- Returns:
- Should show resolution widget
-
canDoParameters
public boolean canDoParameters()Can we add fields- Returns:
- ok to add fields
-
canDoRemoveParameters
public boolean canDoRemoveParameters()Can we remove fields- Returns:
- ok to add fields
-
canDoDataChoiceList
public boolean canDoDataChoiceList()ok to show the data choice list- Returns:
- ok to show the data choice list
-
canDoWrapperColor
public boolean canDoWrapperColor()Can the color swatch be shown in the properties for the data choice wrappers.- Returns:
- Can do wrapper colors
-
canDoWrapperSide
public boolean canDoWrapperSide()Can the Side menu be shown in the properties for the data choice wrappers.- Returns:
- Can do sides in properties
-
propertyChange
Handle the event- Specified by:
propertyChange
in interfacePropertyChangeListener
- Overrides:
propertyChange
in classPropertiedThing
- Parameters:
event
- The event
-
doRemove
public void doRemove()Cleanup the chart- Overrides:
doRemove
in classDisplayComponent
-
getPropertiesComponents
Create the properties contents- Overrides:
getPropertiesComponents
in classDisplayComponent
- Parameters:
comps
- List of componentstabIdx
- Which tab
-
doMakeWrapperDisplayComponent
protected JComponent doMakeWrapperDisplayComponent(int idx, ChartWrapper.FieldProperties fieldProperty) Make the widget for the field- Parameters:
idx
- which onefieldProperty
- The wrapper wrapper- Returns:
- The gui
-
applyProperties
protected boolean applyProperties()Apply properties- Overrides:
applyProperties
in classDisplayComponent
- Returns:
- Was successful
-
doApplyProperties
protected boolean doApplyProperties()Apply the properties- Overrides:
doApplyProperties
in classDisplayComponent
- Returns:
- success
-
addField
public void addField()Add a field to thei chart -
getFieldSelectionLabels
Returns the list of labels used for selecting data choices. If a derived class needs more than one data choice they can override this.- Returns:
- List of field labels
-
doMultipleAddFields
public boolean doMultipleAddFields()When selecting data does the data tree support multiple selections- Returns:
- Do multiples
-
formatValue
utility to format the value- Parameters:
v
- the value- Returns:
- the value formatted
-
addDataChoice
Add the dta choice- Parameters:
dataChoice
- the choice- Throws:
RemoteException
- On badnessVisADException
- On badness
-
addDataChoices
Add the data choices- Parameters:
newDataChoices
- the choices- Throws:
RemoteException
- On badnessVisADException
- On badness
-
loadData
create shapes for an individual time step.- Overrides:
loadData
in classDisplayComponent
- Throws:
RemoteException
- On badnessVisADException
- On badness
-
setTimeFromAnimation
Animation in main display changed. Some charts show this- Parameters:
time
- the animation time
-
animationTimeChanged
Use the animation time to set the domain crosshairs- Overrides:
animationTimeChanged
in classDisplayComponent
- Parameters:
time
- The time
-
setDataChoiceWrappers
Set the DataChoiceWrappers property.- Parameters:
value
- The new value for DataChoiceWrappers
-
getDataChoiceWrappers
Get the DataChoiceWrappers property.- Returns:
- The DataChoiceWrappers
-
setResolution
public void setResolution(double value) Set the Resolution property.- Parameters:
value
- The new value for Resolution
-
getResolution
public double getResolution()Get the Resolution property.- Returns:
- The Resolution
-
getDataChoices
Create and return a list of the data choices held by the data choice wrappers.- Returns:
- List of data choices
-
removeTimeFilterSource
public void removeTimeFilterSource()Remove the current time filter source -
setTimeFilterSource
Set the FilterSource property.- Parameters:
value
- The new value for FilterSource
-
getTimeFilterSource
Get the FilterSource property.- Returns:
- The FilterSource
-
removeTimeSelectSource
public void removeTimeSelectSource()Remove the current time select source -
setTimeSelectSource
Set the SelectSource property.- Parameters:
value
- The new value for SelectSource
-
getTimeSelectSource
Get the SelectSource property.- Returns:
- The SelectSource
-
filterData
protected double[][] filterData(double[] samples, double[] timeValues) throws VisADException, RemoteException Utility to pull subset the given samples based on the time filter ranges- Parameters:
samples
- The datatimeValues
- The times- Returns:
- The sampled data/time
- Throws:
RemoteException
- On badness_VisADException
- On badness_
-
getTimeValues
public double[] getTimeValues(double[][] samples, FlatField data) throws VisADException, RemoteException Convert the time from the data (in samples[1]) into an array of milliseconds- Parameters:
samples
- The datadata
- Where the data came from- Returns:
- The times
- Throws:
RemoteException
- On badnessVisADException
- On badness
-
setShowTime
public void setShowTime(boolean value) Set the ShowTime property.- Parameters:
value
- The new value for ShowTime
-
getShowTime
public boolean getShowTime()Get the ShowTime property.- Returns:
- The ShowTime
-
setDriveTime
public void setDriveTime(boolean value) Set the DriveTime property.- Parameters:
value
- The new value for DriveTime
-
getDriveTime
public boolean getDriveTime()Get the DriveTime property.- Returns:
- The DriveTime
-
setMinDate
public void setMinDate(double value) Set the MinDate property.- Parameters:
value
- The new value for MinDate
-
getMinDate
public double getMinDate()Get the MinDate property.- Returns:
- The MinDate
-
setMaxDate
public void setMaxDate(double value) Set the MaxDate property.- Parameters:
value
- The new value for MaxDate
-
getMaxDate
public double getMaxDate()Get the MaxDate property.- Returns:
- The MaxDate
-
setJython
Set the Jython property.- Parameters:
value
- The new value for Jython
-
getJython
Get the Jython property.- Returns:
- The Jython
-