Class ListDataChoice

java.lang.Object
ucar.unidata.data.DataChoice
ucar.unidata.data.ListDataChoice
Direct Known Subclasses:
DerivedDataChoice

public class ListDataChoice extends DataChoice
A subclass of DataChoice for derived quantities.
Version:
$Revision: 1.118 $
Author:
IDV Development Team
  • Constructor Details

    • ListDataChoice

      public ListDataChoice()
      Dummy param-less constructor so we can be recreated thru reflection.
    • ListDataChoice

      public ListDataChoice(ListDataChoice other)
      The cloning ctor.
      Parameters:
      other - The object to instantiate from.
    • ListDataChoice

      public ListDataChoice(Object id, String name, String description, List categories)
      The regular constructor from a DerivedDataDescriptor 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 id
      name - name
      description - description
      categories - categories
    • ListDataChoice

      public ListDataChoice(String name, List children)
      ctor
      Parameters:
      name - name
      children - The children data choices
  • Method Details

    • setChildrenDataChoices

      public void setChildrenDataChoices(List dataChoices)
      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 class DataChoice
      Parameters:
      category - category
      dataSelection - selection
      requestProperties - properties
      Returns:
      This just returns null.
      Throws:
      DataCancelException - On badness
      RemoteException - On badness
      VisADException - 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 - category
      dataSelection - selection
      requestProperties - properties
      Returns:
      data from children
      Throws:
      DataCancelException - On badness
      RemoteException - On badness
      VisADException - On badness
    • cloneMe

      public DataChoice cloneMe()
      Create a new instance of this object.
      Specified by:
      cloneMe in class DataChoice
      Returns:
      The new instance.
    • getIndexedName

      public String getIndexedName(int index)
      Return the name of the index'th child DataChoice.
      Overrides:
      getIndexedName in class DataChoice
      Parameters:
      index - The (0 based) index.
      Returns:
      The name of the child DataChoice.
    • checkCategories

      protected void checkCategories()
      This method runs through the list of DataCategory-s. If any of them are "inherited" categories then we replace the inherited category with the data categories of the children DataChoice-s.
    • initAfterUnPersistence

      public void initAfterUnPersistence(Hashtable properties)
      This gets called after the data choice has been unpersisted
      Overrides:
      initAfterUnPersistence in class DataChoice
      Parameters:
      properties - Properties
    • 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
    • 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
    • inherit

      protected void inherit(DataCategory src)
      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 - The DataCategory to look at.
    • convertLabel

      protected String convertLabel(String label, List dataChoices)
      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 child DataChoices.
      Returns:
      The instantiated label.
    • getFullDescription

      public String getFullDescription()
      Get the full Description for this DataChoice.
      Overrides:
      getFullDescription in class DataChoice
      Returns:
      full description
    • getAllLevels

      public List getAllLevels(DataSelection dataSelection)
      Get the union of all of the children DataChoice-s levels.
      Overrides:
      getAllLevels in class DataChoice
      Parameters:
      dataSelection - data selection
      Returns:
      The union of all of the children DataChoice-s levels.
    • getAllDateTimes

      public List getAllDateTimes()
      Get the union of all of the children DataChoice-s times.
      Overrides:
      getAllDateTimes in class DataChoice
      Returns:
      The union of all of the children DataChoice-s times.
    • getSelectedDateTimes

      public List getSelectedDateTimes()
      Get the union of all of the children DataChoice-s selected times
      Overrides:
      getSelectedDateTimes in class DataChoice
      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

      public void setChoices(List l)
      Set the child DataChoices. Mostly used for xml encoding.
      Parameters:
      l - The list of choices
    • getChoices

      public List 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

      protected void addDataChangeListeners(DataChoice dataChoice)
      Add the data change listeners to the data choice
      Parameters:
      dataChoice - data choice
    • addDataChangeListener

      public void addDataChangeListener(DataChangeListener listener)
      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 class DataChoice
      Parameters:
      listener - The listener to add.
    • removeDataChangeListener

      public void removeDataChangeListener(DataChangeListener listener)
      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 class DataChoice
      Parameters:
      listener - The listener to remove.
    • hashCode

      public int hashCode()
      Override the hasCode method.
      Overrides:
      hashCode in class DataChoice
      Returns:
      The object's hashcode.
    • 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
    • equals

      public boolean equals(Object o)
      Override the equals method.
      Overrides:
      equals in class DataChoice
      Parameters:
      o - Obejct to compare to.
      Returns:
      Is equals?