Package ucar.unidata.data
Class DataChoice
java.lang.Object
ucar.unidata.data.DataChoice
- Direct Known Subclasses:
DataDataChoice
,DirectDataChoice
,ListDataChoice
,UnboundDataChoice
,UrlDataChoice
,UserDataChoice
An abstract base class that represents some selection of data. A DataChoice
is created with an identifying Object (e.g., a date/time, a field name, etc.)
a String name, a String description and a set of
DataCategory
s that
represent the flavor or flavors of data provided by this DataChoice.- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Long descriptive name (e.g, "isobaric temperature", "u component of wind", etc.)protected Object
The identifying object.protected String
Short descriptive name (e.g., T, U, etc.).static final DataSelection
Anull
DataSelection
static final Hashtable
Anull
properties intrinsicstatic final Hashtable
Thenull
request properties intrinsicprotected DataChoice
DataChoice-s can follow a composite pattern.static final String
The icon propertystatic final String
The requester propertyprotected Hashtable
A general properties table. -
Constructor Summary
ConstructorsConstructorDescriptionThe bean constructor.DataChoice
(Object id, String description) Create a new DataChoice.DataChoice
(Object id, String name, String description, List categories) Create a new DataChoice.Create a new DataChoice.DataChoice
(Object id, String description, List categories) Create a new DataChoice.DataChoice
(Object id, String description, DataCategory category) Create a new DataChoice.DataChoice
(DataChoice other) Create a new DataChoice, using the state of the given DataChoice to initialize the new object. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCategory
(DataCategory newCategory) Add the givenDataCategory
into the list of data categories.static void
addCurrentName
(Object name) This adds into a globallist the given param nameabstract void
addDataChangeListener
(DataChangeListener listener) Add theDataChangeListener
.protected void
Add the DataCategory "param:" and "param:" to the list of data categories. boolean
basicallyEquals
(DataChoice that) This just checks for basic equality.static List
cloneDataChoices
(List listOfChoices) Utility method to clone and return a list of DataChoice-s.abstract DataChoice
cloneMe()
Create a new instance of this DataChoice.final DataChoice
Create a new instance of this DataChoice.boolean
Check for equality of this object to anotherGet all the times associated with this choiceGet all the levels associated with this choicegetAllLevels
(DataSelection dataSelection) Get all the levels associated with this choiceGet the list ofDataCategory
s that this DataChoice represents.static List
Get the list of all data choice names there ever was during the runprotected abstract Data
getData
(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Return theData
object that this DataChoice represents.final Data
getData
(DataSelection incomingDataSelection) Return theData
object that this DataChoice represents.final Data
getData
(DataSelection incomingDataSelection, Hashtable requestProperties) Return theData
object that this DataChoice represents.Get the list of DataCategory-s.getDataCategories
(boolean excludeDisplayCategories) Get the list of DataCategory-s but exclude any that are used for display if excludeDisplayCategories is trueGet the data selection for this choicevoid
getDataSources
(List dataSources) Add to the given list all the data sourcesReturn the human readable description.Return theDataCategory
that is meant to be used for displaying this DataChoice within a UI.void
getFinalDataChoices
(List dataChoices) Add to the given list all final data choices (i.e., the leafs of the datachoice tree)Get the FixedRequestProperties property.boolean
A DataChoice can be not intended to be shown to the user within a UI.This method is used to get a lengthy description of this DataChoice.getId()
Return the identifying object.getIndexedName
(int index) Return the indexed name, the default is to simply return the name.getName()
Return the name of this DataChoice.Return the parent of this DataChoice (may be, and usually is, null).Getter method for the properties hashtable.getProperty
(String name) Return the property, if not found return the null.boolean
getProperty
(String name, boolean dflt) Return the boolean property, if not found return the dflt.getProperty
(String name, String dflt) Return the String property, if not found return the dflt.Get the List of selected times (sub selection of all times).Return the toString() value of the id.int
hashCode()
Override the hashCodes method.void
initAfterUnPersistence
(Hashtable properties) This gets called after the data choice has been unpersistedboolean
Top-level method to determine if this object is an end-user formula.static Hashtable
mergeRequestProperties
(Hashtable incoming, Hashtable fixedRequestProperties) Merge the given incoming request properties with the ones held by this data choice.abstract void
removeDataChangeListener
(DataChangeListener listener) Remove theDataChangeListener
.void
setCategories
(List categories) Set the list ofDataCategory
s that this DataChoice represents.void
setDataCategories
(List categories) Note: This does not do anything anymore.void
setDataSelection
(DataSelection dataSelection) Set the data time selection for this choicevoid
setDescription
(String desc) Set the human readable description.void
Set the FixedRequestProperties property.void
DataChoices typically have some identifying Object associated with them (e.g., a time, a field name, etc.)void
setLevelSelection
(Real level) Set the levelvoid
Set the name of this DataChoice.void
setObjectProperty
(String name, Object propertyValue) Set the String property.void
setParent
(DataChoice parent) Set the parent of this DataChoice.void
setProperties
(Hashtable newProperties) Setter method for the properties hashtable.void
setProperty
(String name, boolean propertyValue) Set the boolean property.void
setProperty
(String name, String propertyValue) Set the property.void
setTimeSelection
(List times) Set the time selection for this choicetoString()
Return the description.
-
Field Details
-
NULL_DATASELECTION
Anull
DataSelection
-
NULL_PROPERTIES
Anull
properties intrinsic -
PROP_REQUESTER
The requester property- See Also:
-
PROP_ICON
The icon property- See Also:
-
NULL_REQUESTPROPERTIES
Thenull
request properties intrinsic -
properties
A general properties table. -
parent
DataChoice-s can follow a composite pattern. The parent member is a (possibly null) reference to the parent DataChoice. -
id
The identifying object. -
name
Short descriptive name (e.g., T, U, etc.). -
description
Long descriptive name (e.g, "isobaric temperature", "u component of wind", etc.)
-
-
Constructor Details
-
DataChoice
public DataChoice()The bean constructor. We need this for xml decoding. -
DataChoice
Create a new DataChoice, using the state of the given DataChoice to initialize the new object.- Parameters:
other
- The other data choice.
-
DataChoice
Create a new DataChoice.- Parameters:
id
- The identifying object.name
- The short name of this choice.description
- The long description of this choice.categories
- List ofDataCategory
s.
-
DataChoice
public DataChoice(Object id, String name, String description, List categories, Hashtable properties) Create a new DataChoice.- Parameters:
id
- The identifying object.name
- The short name of this choice.description
- The long description of this choice.categories
- List ofDataCategory
s.properties
- The properties for this data choice (may be null).
-
DataChoice
Create a new DataChoice. Use a null list of categories.- Parameters:
id
- The identifying object.description
- The long description of this choice.
-
DataChoice
Create a new DataChoice. Use the description as the name of the DataChoice.- Parameters:
id
- The identifying object.description
- The long description of this choice.categories
- List ofDataCategory
s.
-
DataChoice
Create a new DataChoice.- Parameters:
id
- The identifying object.description
- The long description of this choice.category
- The DataCategory.
-
-
Method Details
-
addCurrentName
This adds into a globallist the given param name- Parameters:
name
- param name to add
-
getCurrentNames
Get the list of all data choice names there ever was during the run- Returns:
- data choice names
-
initAfterUnPersistence
This gets called after the data choice has been unpersisted- Parameters:
properties
- Properties
-
getFinalDataChoices
Add to the given list all final data choices (i.e., the leafs of the datachoice tree)- Parameters:
dataChoices
- List to put data choices into
-
getDataSources
Add to the given list all the data sources- Parameters:
dataSources
- List to put data sources into
-
addParamNameToCategories
protected void addParamNameToCategories()Add the DataCategory "param:" and "param:" to the list of data categories. -
setDataSelection
Set the data time selection for this choice- Parameters:
dataSelection
- The data Selection
-
getDataSelection
Get the data selection for this choice- Returns:
- the dataselection
-
setTimeSelection
Set the time selection for this choice- Parameters:
times
- List of times
-
setLevelSelection
Set the level- Parameters:
level
- The level
-
getAllLevels
Get all the levels associated with this choice- Returns:
- List of levels
-
getAllLevels
Get all the levels associated with this choice- Parameters:
dataSelection
- data selection- Returns:
- List of levels
-
getAllDateTimes
Get all the times associated with this choice- Returns:
- List of times
-
getSelectedDateTimes
Get the List of selected times (sub selection of all times).- Returns:
- selected times
-
cloneDataChoices
Utility method to clone and return a list of DataChoice-s.- Parameters:
listOfChoices
- The source list of choices.- Returns:
- The list of cloned choices.
-
createClone
Create a new instance of this DataChoice.- Returns:
- The new instance.
-
cloneMe
Create a new instance of this DataChoice.- Returns:
- The new instance.
-
getParent
Return the parent of this DataChoice (may be, and usually is, null). This is used for the DerivedDataChoice-s somewhat composite pattern.- Returns:
- The parent of this data choice.
-
setParent
Set the parent of this DataChoice. This is used by the CompositeDataChoice- Parameters:
parent
- The new parent of this data choice.
-
getForUser
public boolean getForUser()A DataChoice can be not intended to be shown to the user within a UI. For example, it may be a DerivedDataChoice that is used to calculate an intermediate value but where it doesn't make sense to show it to the user.- Returns:
- Is this DataChoice intended for the user to see.
-
getDisplayCategory
Return theDataCategory
that is meant to be used for displaying this DataChoice within a UI. For now just return the first category this is "forDisplay".- Returns:
- The DataCategory used for display.
-
addCategory
Add the givenDataCategory
into the list of data categories.- Parameters:
newCategory
- The newDataCategory
-
getCategories
Get the list ofDataCategory
s that this DataChoice represents.- Returns:
- The list of data categories.
-
getDataCategories
Get the list of DataCategory-s. Note: this is now deprecated. The problem is that we had the getDataCategories and getCategories methods. These would get used in wrting to a bundle and we'd end up clobbering any display categorie. deprecated- Returns:
- data categories
-
getDataCategories
Get the list of DataCategory-s but exclude any that are used for display if excludeDisplayCategories is true- Parameters:
excludeDisplayCategories
- if true then only return the data categories that are not display categories- Returns:
- data categories
-
setDataCategories
Note: This does not do anything anymore. It still needs to be around for old bundles but the list of categories excluded any display categories and would clobber the main categories list deprecated Does nothing now.- Parameters:
categories
- The list of data categories.
-
setCategories
Set the list ofDataCategory
s that this DataChoice represents.- Parameters:
categories
- The list of data categories.
-
getData
public final Data getData(DataSelection incomingDataSelection) throws VisADException, RemoteException, DataCancelException Return theData
object that this DataChoice represents. Merge this object'sDataSelection
with the argument DataSelection (which has higher priority).- Parameters:
incomingDataSelection
- Allows one to subset the request.- Returns:
- The data.
- Throws:
DataCancelException
- if the request to get data is canceledRemoteException
- problem accessing remote dataVisADException
- problem creating the Data object
-
getData
public final Data getData(DataSelection incomingDataSelection, Hashtable requestProperties) throws VisADException, RemoteException, DataCancelException Return theData
object that this DataChoice represents. Merge this object'sDataSelection
with the argument DataSelection (which has higher priority).- Parameters:
incomingDataSelection
- Allows one to subset the request.requestProperties
- The object requesting this data.- Returns:
- The data.
- Throws:
DataCancelException
- if the request to get data is canceledRemoteException
- problem accessing remote dataVisADException
- problem creating the Data object
-
getData
protected abstract Data getData(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException, DataCancelException Return theData
object that this DataChoice represents.- Parameters:
category
- TheDataCategory
used to subset this call (usually not used but placed in here just in case it is needed.)dataSelection
- Allows one to subset the data request (e.g., asking for a smaller set of times, etc.)requestProperties
- Extra selection properties- Returns:
- The data.
- Throws:
DataCancelException
- if the request to get data is canceledRemoteException
- problem accessing remote dataVisADException
- problem creating the Data object
-
mergeRequestProperties
public static Hashtable mergeRequestProperties(Hashtable incoming, Hashtable fixedRequestProperties) Merge the given incoming request properties with the ones held by this data choice.- Parameters:
incoming
- Incoming choicesfixedRequestProperties
- The lower priority hashtable- Returns:
- Merged set of choices with the incomng having priority.
-
hashCode
public int hashCode()Override the hashCodes method. -
equals
Check for equality of this object to another -
basicallyEquals
This just checks for basic equality. Things like id, datasource, etc.- Parameters:
that
- The object ot check for equality- Returns:
- Is basically equals
-
getStringId
Return the toString() value of the id.- Returns:
- the toString() value of the id.
-
getIndexedName
Return the indexed name, the default is to simply return the name. This method provides a hook for derived classes to return different names. For example, theDerivedDataChoice
uses this to return the name of the index'th operand.- Parameters:
index
- The (0 based) index.- Returns:
- By default, the name of this DataChoice.
-
getName
Return the name of this DataChoice.- Returns:
- The name of the DataChoice.
-
setName
Set the name of this DataChoice. This is mostly for the xml encoding.- Parameters:
newName
- The new name.
-
getDescription
Return the human readable description. This is typically longer than the name.- Returns:
- The description of this DataChoice.
-
setDescription
Set the human readable description. Usually used for xml decoding.- Parameters:
desc
- The new description.
-
getFullDescription
This method is used to get a lengthy description of this DataChoice. This is used by the DataTree to show a tooltip. By default it just returns the name concatenated with the description but can be overwritten.- Returns:
- The name concatenated with the description.
-
setId
DataChoices typically have some identifying Object associated with them (e.g., a time, a field name, etc.)- Parameters:
theId
- The identifying Object.
-
getId
Return the identifying object.- Returns:
- The identifying object.
-
toString
Return the description. -
setProperty
Set the boolean property.- Parameters:
name
- Property name.propertyValue
- boolean property value
-
setObjectProperty
Set the String property.- Parameters:
name
- Property name.propertyValue
- String property value
-
setProperty
Set the property.- Parameters:
name
- Property name.propertyValue
- String property value
-
getProperty
Return the boolean property, if not found return the dflt.- Parameters:
name
- Property name.dflt
- The default value.- Returns:
- The boolean property value or the dflt argument if not found.
-
getProperty
Return the String property, if not found return the dflt.- Parameters:
name
- Property name.dflt
- The default value.- Returns:
- The String property value or the dflt argument if not found.
-
getProperty
Return the property, if not found return the null.- Parameters:
name
- Property name.- Returns:
- The property value
-
getProperties
Getter method for the properties hashtable. We have this here for the XmlEncoder.- Returns:
- The properties table.
-
setProperties
Setter method for the properties hashtable. We have this here for the XmlEncoder.- Parameters:
newProperties
- The new Properties table.
-
addDataChangeListener
Add theDataChangeListener
. This is the object that is notify when the data that this DataChoice represents has changed. This is an abstract method, the derived classes override it. e.g., theDerivedDataChoice
tells simply passes the listener on to its set of children DataChoices.- Parameters:
listener
- TheDataChangeListener
to add.
-
removeDataChangeListener
Remove theDataChangeListener
.- Parameters:
listener
- TheDataChangeListener
to remove.
-
isEndUserFormula
public boolean isEndUserFormula()Top-level method to determine if this object is an end-user formula. Default is false.- Returns:
- Is this object an end user formula (i.e., really means is this
object a
DerivedDataChoice
created through the formulas framework.
-
setFixedRequestProperties
Set the FixedRequestProperties property.- Parameters:
value
- The new value for FixedRequestProperties
-
getFixedRequestProperties
Get the FixedRequestProperties property.- Returns:
- The FixedRequestProperties
-