Package ucar.unidata.data
Class ListDataChoice
java.lang.Object
ucar.unidata.data.DataChoice
ucar.unidata.data.ListDataChoice
- Direct Known Subclasses:
DerivedDataChoice
A subclass of DataChoice for derived quantities.
- Version:
- $Revision: 1.118 $
- Author:
- IDV Development Team
-
Field Summary
Fields inherited from class ucar.unidata.data.DataChoice
description, id, name, NULL_DATASELECTION, NULL_PROPERTIES, NULL_REQUESTPROPERTIES, parent, PROP_ICON, PROP_REQUESTER, properties
-
Constructor Summary
ConstructorsConstructorDescriptionDummy param-less constructor so we can be recreated thru reflection.ListDataChoice
(Object id, String name, String description, List categories) The regular constructor from aDerivedDataDescriptor
TODO: Right now the children of a ListDataChoice do not refererence their parent.ListDataChoice
(String name, List children) ctorListDataChoice
(ListDataChoice other) The cloning ctor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataChangeListener
(DataChangeListener listener) Add the data change listener.protected void
addDataChangeListeners
(DataChoice dataChoice) Add the data change listeners to the data choiceboolean
basicallyEquals
(DataChoice that) This just checks for basic equality.protected void
This method runs through the list ofDataCategory
-s.cloneMe()
Create a new instance of this object.protected String
convertLabel
(String label, List dataChoices) Iterate through the children DataChoice-s.boolean
Override the equals method.protected void
For now set this object's data categories to be the union of the data categories of its sub-data choices.protected void
Remove any objects created by this choice from the cache.Get the union of all of the childrenDataChoice
-s times.getAllLevels
(DataSelection dataSelection) Get the union of all of the childrenDataChoice
-s levels.Get the children choices.protected Data
getData
(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Get the dataprotected Object[]
getDataList
(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Get the array of data from the children data choicesvoid
getDataSources
(List dataSources) Add to the given list all the data sourcesvoid
getFinalDataChoices
(List finalDataChoices) Add to the given list all final data choices (i.e., the leafs of the datachoice tree)Get the full Description for this DataChoice.getIndexedName
(int index) Return the name of the index'th child DataChoice.Get the union of all of the childrenDataChoice
-s selected timesint
hashCode()
Override the hasCode method.protected void
inherit
(DataCategory src) This method determines the type of inheritance defined by the given DataCategory.void
initAfterUnPersistence
(Hashtable properties) This gets called after the data choice has been unpersistedvoid
removeDataChangeListener
(DataChangeListener listener) Remove the data change listener.void
setChildrenDataChoices
(List dataChoices) set the childrenvoid
setChoices
(List l) Set the child DataChoices.Methods inherited from class ucar.unidata.data.DataChoice
addCategory, addCurrentName, addParamNameToCategories, cloneDataChoices, createClone, getAllLevels, getCategories, getCurrentNames, getData, getData, getDataCategories, getDataCategories, getDataSelection, getDescription, getDisplayCategory, getFixedRequestProperties, getForUser, getId, getName, getParent, getProperties, getProperty, getProperty, getProperty, getStringId, isEndUserFormula, mergeRequestProperties, setCategories, setDataCategories, setDataSelection, setDescription, setFixedRequestProperties, setId, setLevelSelection, setName, setObjectProperty, setParent, setProperties, setProperty, setProperty, setTimeSelection, toString
-
Constructor Details
-
ListDataChoice
public ListDataChoice()Dummy param-less constructor so we can be recreated thru reflection. -
ListDataChoice
The cloning ctor.- Parameters:
other
- The object to instantiate from.
-
ListDataChoice
The regular constructor from aDerivedDataDescriptor
TODO: Right now the children of a ListDataChoice do not refererence their parent. If they do we will need to clone the children here so a DataChoice only has one parent.- Parameters:
id
- The idname
- namedescription
- descriptioncategories
- categories
-
ListDataChoice
ctor- Parameters:
name
- namechildren
- The children data choices
-
-
Method Details
-
setChildrenDataChoices
set the children- Parameters:
dataChoices
- the children
-
getData
protected Data getData(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException, DataCancelException Get the data- Specified by:
getData
in classDataChoice
- Parameters:
category
- categorydataSelection
- selectionrequestProperties
- properties- Returns:
- This just returns null.
- Throws:
DataCancelException
- On badnessRemoteException
- On badnessVisADException
- On badness
-
getDataList
protected Object[] getDataList(DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException, DataCancelException Get the array of data from the children data choices- Parameters:
category
- categorydataSelection
- selectionrequestProperties
- properties- Returns:
- data from children
- Throws:
DataCancelException
- On badnessRemoteException
- On badnessVisADException
- On badness
-
cloneMe
Create a new instance of this object.- Specified by:
cloneMe
in classDataChoice
- Returns:
- The new instance.
-
getIndexedName
Return the name of the index'th child DataChoice.- Overrides:
getIndexedName
in classDataChoice
- Parameters:
index
- The (0 based) index.- Returns:
- The name of the child DataChoice.
-
checkCategories
protected void checkCategories()This method runs through the list ofDataCategory
-s. If any of them are "inherited" categories then we replace the inherited category with the data categories of the children DataChoice-s. -
initAfterUnPersistence
This gets called after the data choice has been unpersisted- Overrides:
initAfterUnPersistence
in classDataChoice
- Parameters:
properties
- Properties
-
getFinalDataChoices
Add to the given list all final data choices (i.e., the leafs of the datachoice tree)- Overrides:
getFinalDataChoices
in classDataChoice
- Parameters:
finalDataChoices
- The list to add to
-
getDataSources
Add to the given list all the data sources- Overrides:
getDataSources
in classDataChoice
- Parameters:
dataSources
- List to put data sources into
-
inherit
This method determines the type of inheritance defined by the given DataCategory. It collects the set of categories from the children DataChoice-s and replaces the given src category with this new set. The different flavors of of inheritance are:- all - take the (set) union of all of the categories of all of the children
- child index - take all of the categories form a particular child DataChoice (e.g., the second child).
- category index - take the index'th data category form each child.
- child invalid input: '&' category index - take the index'th category form a particular child.
- Parameters:
src
- TheDataCategory
to look at.
-
convertLabel
Iterate through the children DataChoice-s. For each child n replace within the given label the macro "%Nn%" with the name of the child choice. Replace %Dn" with the child's description.- Parameters:
label
- The inital (possibly macro containing) label.dataChoices
- The list of childDataChoice
s.- Returns:
- The instantiated label.
-
getFullDescription
Get the full Description for this DataChoice.- Overrides:
getFullDescription
in classDataChoice
- Returns:
- full description
-
getAllLevels
Get the union of all of the childrenDataChoice
-s levels.- Overrides:
getAllLevels
in classDataChoice
- Parameters:
dataSelection
- data selection- Returns:
- The union of all of the children
DataChoice
-s levels.
-
getAllDateTimes
Get the union of all of the childrenDataChoice
-s times.- Overrides:
getAllDateTimes
in classDataChoice
- Returns:
- The union of all of the children
DataChoice
-s times.
-
getSelectedDateTimes
Get the union of all of the childrenDataChoice
-s selected times- Overrides:
getSelectedDateTimes
in classDataChoice
- Returns:
- The union of all of the children
DataChoice
-s selected times
-
findDataCategories
protected void findDataCategories()For now set this object's data categories to be the union of the data categories of its sub-data choices. -
setChoices
Set the child DataChoices. Mostly used for xml encoding.- Parameters:
l
- The list of choices
-
getChoices
Get the children choices. Mostly used for xml encoding.- Returns:
- the list of children
-
flushCache
protected void flushCache()Remove any objects created by this choice from the cache. -
addDataChangeListeners
Add the data change listeners to the data choice- Parameters:
dataChoice
- data choice
-
addDataChangeListener
Add the data change listener. This overwrites the base class method to tell each of the children to addDataChangeListener (i.e., the composite pattern).- Specified by:
addDataChangeListener
in classDataChoice
- Parameters:
listener
- The listener to add.
-
removeDataChangeListener
Remove the data change listener. This overwrites the base class method to tell each of the children to removeDataChangeListener. (i.e., the composite pattern).- Specified by:
removeDataChangeListener
in classDataChoice
- Parameters:
listener
- The listener to remove.
-
hashCode
public int hashCode()Override the hasCode method.- Overrides:
hashCode
in classDataChoice
- Returns:
- The object's hashcode.
-
basicallyEquals
This just checks for basic equality. Things like id, datasource, etc.- Overrides:
basicallyEquals
in classDataChoice
- Parameters:
that
- The object ot check for equality- Returns:
- Is basically equals
-
equals
Override the equals method.- Overrides:
equals
in classDataChoice
- Parameters:
o
- Obejct to compare to.- Returns:
- Is equals?
-