ucar.unidata.data
Class DirectDataChoice

java.lang.Object
  extended by ucar.unidata.data.DataChoice
      extended by ucar.unidata.data.DirectDataChoice
Direct Known Subclasses:
CompositeDataChoice

public class DirectDataChoice
extends DataChoice

A subclass of DataChoice for supporting a leaf choice. This choice maps directly to data.

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

Field Summary
protected  DataSource dataSource
          The data source
static String PROP_WRITEDATASOURCE
          This is the XmlEncoder encoding property we use to determine if the datasource should be written out
 
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
DirectDataChoice()
          Default bean constructor; does nothing.
DirectDataChoice(DataSource dataSource, Object id, String name, String description, List categories)
          Create a new DirectDataChoice.
DirectDataChoice(DataSource dataSource, Object id, String name, String description, List categories, DataSelection dataSelection)
          Create a new DirectDataChoice.
DirectDataChoice(DataSource dataSource, Object id, String name, String description, List categories, DataSelection dataSelection, Hashtable properties)
          Create a new DirectDataChoice.
DirectDataChoice(DataSource dataSource, Object id, String name, String description, List categories, Hashtable properties)
          Create a new DirectDataChoice.
DirectDataChoice(DirectDataChoice other)
          Copy constructor.
 
Method Summary
 void addDataChangeListener(DataChangeListener listener)
          Add the data change listener
 boolean basicallyEquals(DataChoice that)
          This just checks for basic equality.
 DataChoice cloneMe()
          Method for cloning.
 boolean equals(Object o)
          Check for equality.
 List getAllDateTimes()
          Get all the times associated with this choice.
 List getAllLevels(DataSelection dataSelection)
          Get all the levels associated with this choice
protected  Data getData(DataCategory category, DataSelection dataSelection, Hashtable requestProperties)
          Get the data that this choice represents.
 DataSource getDataSource()
          Get the associated DataSource.
 void getDataSources(List dataSources)
          Add to the given list all the data sources
 void getFinalDataChoices(List finalDataChoices)
          Add to the given list all final data choices (i.e., the leafs of the datachoice tree)
 String getFullDescription()
          Get the full description for this DataChoice.
 List getSelectedDateTimes()
          Get all the selected times associated with this choice.
 int hashCode()
          Return the hashcode for this DirectDataChoice
 void initAfterUnPersistence(Hashtable properties)
          This gets called after the data choice has been unpersisted
 void removeDataChangeListener(DataChangeListener listener)
          Remove the data change listener
 void setDataSource(DataSource s)
          Set the associated DataSource.
 
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, getIndexedName, getName, getParent, getProperties, getProperty, getProperty, getProperty, getStringId, isEndUserFormula, mergeRequestProperties, setCategories, setDataCategories, setDataSelection, setDescription, setFixedRequestProperties, setId, setLevelSelection, setName, setObjectProperty, setParent, setProperties, setProperty, setProperty, setTimeSelection, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

PROP_WRITEDATASOURCE

public static final String PROP_WRITEDATASOURCE
This is the XmlEncoder encoding property we use to determine if the datasource should be written out

See Also:
Constant Field Values

dataSource

protected DataSource dataSource
The data source

Constructor Detail

DirectDataChoice

public DirectDataChoice()
Default bean constructor; does nothing.


DirectDataChoice

public DirectDataChoice(DataSource dataSource,
                        Object id,
                        String name,
                        String description,
                        List categories,
                        Hashtable properties)
Create a new DirectDataChoice.

Parameters:
dataSource - The source of the data
id - The identifying object.
name - The short name of this choice.
description - The long description of this choice.
categories - List of DataCategorys.
properties - The properties for this data choice (may be null).

DirectDataChoice

public DirectDataChoice(DataSource dataSource,
                        Object id,
                        String name,
                        String description,
                        List categories)
Create a new DirectDataChoice.

Parameters:
dataSource - The source of the data
id - The identifying object.
name - The short name of this choice.
description - The long description of this choice.
categories - List of DataCategorys.

DirectDataChoice

public DirectDataChoice(DataSource dataSource,
                        Object id,
                        String name,
                        String description,
                        List categories,
                        DataSelection dataSelection)
Create a new DirectDataChoice.

Parameters:
dataSource - The source of the data
id - The identifying object.
name - The short name of this choice.
description - The long description of this choice.
categories - List of DataCategorys.
dataSelection - The subsetting criteria

DirectDataChoice

public DirectDataChoice(DataSource dataSource,
                        Object id,
                        String name,
                        String description,
                        List categories,
                        DataSelection dataSelection,
                        Hashtable properties)
Create a new DirectDataChoice.

Parameters:
dataSource - The source of the data
id - The identifying object.
name - The short name of this choice.
description - The long description of this choice.
categories - List of DataCategorys.
dataSelection - The subsetting criteria
properties - The properties for this data choice (may be null).

DirectDataChoice

public DirectDataChoice(DirectDataChoice other)
Copy constructor.

Parameters:
other - other DirectDataChoice to get state from
Method Detail

cloneMe

public DataChoice cloneMe()
Method for cloning. Calls copy constructor.

Specified by:
cloneMe in class DataChoice
Returns:
copy of this

getFinalDataChoices

public void getFinalDataChoices(List finalDataChoices)
Add to the given list all final data choices (i.e., the leafs of the datachoice tree)

Overrides:
getFinalDataChoices in class DataChoice
Parameters:
finalDataChoices - The list to add to

getFullDescription

public String getFullDescription()
Get the full description for this DataChoice. Overrides the superclass method.

Overrides:
getFullDescription in class DataChoice
Returns:
full description

getDataSources

public void getDataSources(List dataSources)
Add to the given list all the data sources

Overrides:
getDataSources in class DataChoice
Parameters:
dataSources - List to put data sources into

getAllLevels

public List getAllLevels(DataSelection dataSelection)
Get all the levels associated with this choice

Overrides:
getAllLevels in class DataChoice
Parameters:
dataSelection - data selection
Returns:
List of levels

getAllDateTimes

public List getAllDateTimes()
Get all the times associated with this choice.

Overrides:
getAllDateTimes in class DataChoice
Returns:
all times from the superclass or all times from the datasource

getSelectedDateTimes

public List getSelectedDateTimes()
Get all the selected times associated with this choice.

Overrides:
getSelectedDateTimes in class DataChoice
Returns:
the selected times

initAfterUnPersistence

public void initAfterUnPersistence(Hashtable properties)
This gets called after the data choice has been unpersisted

Overrides:
initAfterUnPersistence in class DataChoice
Parameters:
properties - Properties

getDataSource

public DataSource getDataSource()
Get the associated DataSource. Mostly used by XML persistence.

Returns:
the DataSource.

setDataSource

public void setDataSource(DataSource s)
Set the associated DataSource. Mostly used by XML persistence.

Parameters:
s - the DataSource.

getData

protected Data getData(DataCategory category,
                       DataSelection dataSelection,
                       Hashtable requestProperties)
                throws VisADException,
                       RemoteException,
                       DataCancelException
Get the data that this choice represents.

Specified by:
getData in class DataChoice
Parameters:
category - The DataCategory 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 canceled
RemoteException - problem accessing remote data
VisADException - problem creating the Data object

hashCode

public int hashCode()
Return the hashcode for this DirectDataChoice

Overrides:
hashCode in class DataChoice
Returns:
the hashcode

equals

public boolean equals(Object o)
Check for equality.

Overrides:
equals in class DataChoice
Parameters:
o - Object to check.
Returns:
true if o is equivalent

basicallyEquals

public boolean basicallyEquals(DataChoice that)
This just checks for basic equality. Things like id, datasource, etc.

Overrides:
basicallyEquals in class DataChoice
Parameters:
that - The object ot check for equality
Returns:
Is basically equals

addDataChangeListener

public void addDataChangeListener(DataChangeListener listener)
Add the data change listener

Specified by:
addDataChangeListener in class DataChoice
Parameters:
listener - listener to add

removeDataChangeListener

public void removeDataChangeListener(DataChangeListener listener)
Remove the data change listener

Specified by:
removeDataChangeListener in class DataChoice
Parameters:
listener - listener to remove