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 classClass FieldProperties holds state for the data choice wrappers in the properties dialog -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AnimationWidgetThe widgetprotected ListList of data choicesstatic final StringProperty change idstatic final StringProperty change idprotected TimeSeriesChartWrapperThis is the time series that we get the time segments from for subsettingprotected ChartWrapperThis is the source for time selectsFields inherited from class ucar.unidata.idv.control.multi.DisplayComponent
CMD_SAVEIMAGE, CMD_SAVEMOVIE, displayControl, displayLabel, hasBeenInitialized, isRemoved, PROP_REMOVEDFields inherited from class ucar.unidata.collab.PropertiedThing
propertiesDialog -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataChoice(DataChoice dataChoice) Add the dta choicevoidaddDataChoices(List newDataChoices) Add the data choicesvoidaddField()Add a field to thei chartvoidanimationTimeChanged(Real time) Use the animation time to set the domain crosshairsvoidGet the jython text from the text field and apply itprotected voidapplyJython(String jython) Evaluate the jython.protected booleanApply propertiesprotected booleanCan this component be a source for time selection eventsbooleanok to show the data choice listprotected booleanCan this chart drive the times in the main display.protected booleanShould the jython field be shown in the propertiesprotected booleanCan this chart subset the entire data set on timebooleanCan we add fieldsbooleanCan we remove fieldsprotected booleanShould show resolution widgetprotected booleanCan this chart use time subset filters.protected booleanCan this chart use time selects This is used to determine whether the checkbox should be shown in the menusbooleanCan the color swatch be shown in the properties for the data choice wrappers.booleanCan the Side menu be shown in the properties for the data choice wrappers.protected DataChoiceWrappercreateDataChoiceWrapper(DataChoice dataChoice) A utility to create a data choice wrapperprotected booleanApply the propertiesprotected JComponentdoMakeWrapperDisplayComponent(int idx, ChartWrapper.FieldProperties fieldProperty) Make the widget for the fieldbooleanWhen selecting data does the data tree support multiple selectionsvoiddoRemove()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.booleanGet the DriveTime property.Returns the list of labels used for selecting data choices.protected FlatFieldgetFlatField(FieldImpl data) Utility to extract a FlatField from the dataprotected org.python.util.PythonInterpreterCreate, if needed, and return the interpreterGet the Jython property.doubleGet the MaxDate property.doubleGet the MinDate property.protected ListgetPopupMenuItems(List items) Add the default menu itemsprotected voidgetPropertiesComponents(List comps, int tabIdx) Create the properties contentsdoubleGet the Resolution property.booleanGet the ShowTime property.protected ListGet 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 StringOverwritten by derived classes to return the name of the type of this chart.voidinit(MultiDisplayHolder displayControl, List dataChoices) InitializevoidinitDone()Called after this chart has been created.protected voidinitializeJython(org.python.util.PythonInterpreter interpreter) Add the state of this chart to the interpretervoidNoopvoidNoopvoidNoopvoidloadData()create shapes for an individual time step.voidHandle the eventvoidRemove the current time filter sourcevoidRemove the current time select sourcevoidsetAnimationShareGroup(String value) Set the AnimationShareGroup property.voidsetDataChoiceWrappers(List value) Set the DataChoiceWrappers property.voidsetDriveTime(boolean value) Set the DriveTime property.voidSet the Jython property.voidsetMaxDate(double value) Set the MaxDate property.voidsetMinDate(double value) Set the MinDate property.voidsetResolution(double value) Set the Resolution property.voidsetShowTime(boolean value) Set the ShowTime property.voidSet the FilterSource property.voidsetTimeFromAnimation(Real time) Animation in main display changed.voidsetTimeSelectSource(ChartWrapper value) Set the SelectSource property.protected ListwrapDataChoices(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, toStringMethods inherited from class ucar.unidata.collab.PropertiedThing
addPropertyChangeListener, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, removePropertyChangeListener, showPropertiesMethods 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:
initDonein 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:
getTypeNamein classDisplayComponent- Returns:
- The type name
-
keyPressed
Noop- Specified by:
keyPressedin interfaceKeyListener- Parameters:
e- The event
-
keyReleased
Noop- Specified by:
keyReleasedin interfaceKeyListener- Parameters:
e- The event
-
keyTyped
Noop- Specified by:
keyTypedin 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:
getPopupMenuItemsin 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:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classPropertiedThing- Parameters:
event- The event
-
doRemove
public void doRemove()Cleanup the chart- Overrides:
doRemovein classDisplayComponent
-
getPropertiesComponents
Create the properties contents- Overrides:
getPropertiesComponentsin 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:
applyPropertiesin classDisplayComponent- Returns:
- Was successful
-
doApplyProperties
protected boolean doApplyProperties()Apply the properties- Overrides:
doApplyPropertiesin 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:
loadDatain 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:
animationTimeChangedin 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
-