Class IdvChooser

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, IdvConstants
Direct Known Subclasses:
BundleChooser, FileChooser, McidasImageChooser, MesoWestChooser, RaobChooser, SkeletonChooser, SoundingSelector, TimesChooser, UrlChooser, XmlChooser

public abstract class IdvChooser extends ChooserPanel implements IdvConstants
This is the base class of all Chooser classes.
Version:
$Revision: 1.91 $Date: 2007/07/27 20:59:03 $
Author:
IDV development team
See Also:
  • Field Details

    • PROP_CHOOSER_MAPS

      public static final String PROP_CHOOSER_MAPS
      Where we get the maps
      See Also:
    • PROP_STATUS_FOREGROUND

      public static final String PROP_STATUS_FOREGROUND
      status foreground color
      See Also:
    • PROP_STATUS_BACKGROUND

      public static final String PROP_STATUS_BACKGROUND
      status background color
      See Also:
    • PROP_STATUS_TEMPLATE

      public static final String PROP_STATUS_TEMPLATE
      status template
      See Also:
    • PROP_CHOOSER_PROJECTION_BOUNDS

      public static final String PROP_CHOOSER_PROJECTION_BOUNDS
      Where we get the projection bounds
      See Also:
    • PROP_CHOOSERCLASSNAME

      public static final String PROP_CHOOSERCLASSNAME
      _more_
      See Also:
    • NULL_PROPERTIES

      public static final Hashtable NULL_PROPERTIES
      Can pass in null properties. So instead of a null or casting null as a Hashtable we just define one here
    • NULL_STRING

      public static final String NULL_STRING
      Like above, a handy way to pass in a null string
    • PREF_DEFAULTDIR

      public static final String PREF_DEFAULTDIR
      Used by derived classes to save the last directory the user was in
      See Also:
    • PREF_POLLINGINFO

      public static final String PREF_POLLINGINFO
      Saves off the pollinginfo_
      See Also:
    • PREF_CATALOGLIST

      public static final String PREF_CATALOGLIST
      Used by derived classes to save the list of catalogs
      See Also:
    • PREF_ADDESERVERS

      public static final String PREF_ADDESERVERS
      Used by derived classes to save the list of adde servers
      See Also:
    • PREF_IMAGEDESCLIST

      public static final String PREF_IMAGEDESCLIST
      Used by derived classes to save the list of image descriptors
      See Also:
    • PREF_RADARDESCLIST

      public static final String PREF_RADARDESCLIST
      Used by derived classes to save the list of radar descriptors
      See Also:
    • PREF_TDSRADARSERVER

      public static final String PREF_TDSRADARSERVER
      Used by derived classes to save the list of tds radar servers
      See Also:
    • PREF_TDSPOINTOBSERVER

      public static final String PREF_TDSPOINTOBSERVER
      Used by derived classes to save the list of tds point ob servers
      See Also:
    • ATTR_ID

      public static final String ATTR_ID
      Name of the id attribute in the choosers.xml
      See Also:
    • ATTR_SHOWDETAILS

      public static final String ATTR_SHOWDETAILS
      Name of the details attribute in the choosers.xml
      See Also:
    • ignoreDirHistory

      protected boolean ignoreDirHistory
      For the dir history
    • dirHistoryCbx

      protected JComboBox dirHistoryCbx
      For the dir history
    • stationMap

      protected StationLocationMap stationMap
      station location map
  • Constructor Details

    • IdvChooser

      public IdvChooser(IntegratedDataViewer idv, Element chooserNode)
      Create the chooser
      Parameters:
      idv - The IDV
      chooserNode - The Xml
    • IdvChooser

      public IdvChooser(IdvChooserManager chooserManager, Element chooserNode)
      Create the chooser
      Parameters:
      chooserManager - The manager of all of the choosers
      chooserNode - The Xml
    • IdvChooser

      public IdvChooser(IntegratedDataViewer idv, IdvChooserManager chooserManager, Element chooserNode)
      Create the chooser
      Parameters:
      idv - The IDV
      chooserManager - The manager of all of the choosers
      chooserNode - The Xml
  • Method Details

    • getStatusLabel

      protected JLabel getStatusLabel()
      Create (if needed) and return the JLabel that shows the status messages.
      Overrides:
      getStatusLabel in class ChooserPanel
      Returns:
      The status label
    • decorateButtons

      public JComponent decorateButtons(JComponent buttons)
      Add extra components to "decorate" the button panel
      Parameters:
      buttons - button panel
      Returns:
      decorated buttons
    • getDefaultButtons

      public JComponent getDefaultButtons(ActionListener listener)
      Get the default buttons
      Overrides:
      getDefaultButtons in class ChooserPanel
      Parameters:
      listener - the listener
      Returns:
      the button component
    • getDefaultDisplayType

      protected String getDefaultDisplayType()
      Get the default display type
      Returns:
      the name of the default display
    • getDataSourceProperties

      protected void getDataSourceProperties(Hashtable ht)
      Get the properties from the datasource
      Parameters:
      ht - a Hashtable of properties
    • getDefaultMap

      protected String getDefaultMap()
      Get the default map to be used. For now needs to be a mcidas map.
      Returns:
      Default map.
    • getDefaultMaps

      protected List getDefaultMaps()
      Get the default map to be used. For now needs to be a mcidas map.
      Returns:
      Default map.
    • initStationMap

      protected void initStationMap(StationLocationMap stationMap)
      Initialize the stations
      Parameters:
      stationMap - The station map
    • createStationMap

      protected StationLocationMap createStationMap()
      Create the station map
      Returns:
      The new station map.
    • usingStations

      protected boolean usingStations()
      Is this chooser using the station map
      Returns:
      Using stations.
    • haveStationSelected

      protected boolean haveStationSelected()
      If there is a station map created then return whether there are any stations selected.
      Returns:
      Any stations selected.
    • newSelectedStations

      protected void newSelectedStations(List stations)
      Notify of new selected stations.
      Parameters:
      stations - Selected stations.
    • getStationMap

      protected StationLocationMap getStationMap()
      Create (if needed) and return the station map
      Returns:
      The station map
    • getSelectedStations

      public List getSelectedStations()
      Get list of selected stations, objects of ucar/unidata/metdata/NamedStationImpl class
      Returns:
      list of selected stations
    • getSelectedStation

      protected String getSelectedStation()
      Get the first seleted station or null if none selected.
      Returns:
      Get a selected station.
    • clearSelectedStations

      protected void clearSelectedStations()
      Clear any selected stations.
    • clearStations

      protected void clearStations()
      Clear all stations in the station map.
    • getHaveStations

      protected boolean getHaveStations()
      Do we have stations
      Returns:
      true if there is a station map and there are stations set
    • getDefaultProjection

      protected ucar.unidata.geoloc.ProjectionImpl getDefaultProjection()
      Create and return the default projection used for the station map.
      Returns:
      _Default map projection
    • getDefaultProjectionRect

      protected ucar.unidata.geoloc.ProjectionRect getDefaultProjectionRect()
      Create and return the default projection rect used for the station map.
      Returns:
      Default map projection rectangle
    • makeTimeMenus

      public List makeTimeMenus(ActionListener listener)
      Make time menus
      Parameters:
      listener - the listener for this
      Returns:
      a list of options for times from each display
    • getXmlNode

      public Element getXmlNode()
      Get the xml node that defined this chooser
      Returns:
      The chooser node
    • getAttribute

      protected String getAttribute(String name, String dflt)
      Utility to get the attribute from the chooser xml node. If there is one we'll also apply the global macros
      Parameters:
      name - attr name
      dflt - default value
      Returns:
      attribute
    • getProperty

      public String getProperty(String name, String dflt)
      Utility to get a String property
      Parameters:
      name - property name
      dflt - default value
      Returns:
      property or default
    • getProperty

      public boolean getProperty(String name, boolean dflt)
      Utility to get a boolean property
      Parameters:
      name - property name
      dflt - default value
      Returns:
      property or default
    • getShowInMenu

      public boolean getShowInMenu()
      Should this chooser entry be shown in the file menu
      Returns:
      Show this chooser in the file menu?
    • getMenuTitle

      public String getMenuTitle()
      Get the title to use for menu entries.
      Returns:
      Menu title
    • getTitle

      public String getTitle()
      Get the title
      Returns:
      The title
    • initChooserPanel

      protected void initChooserPanel(ChooserPanel chooserPanel)
      Initialize the given panel. Set the help path on it.
      Parameters:
      chooserPanel - The panel to initialize.
    • getDataSourcesComponent

      protected JComboBox getDataSourcesComponent()
      Return the component that holds the dataSources combo box
      Returns:
      The GUI for the data sources selector
    • getDataSourcesComponent

      protected JComboBox getDataSourcesComponent(boolean justFileSources)
      Return the component that holds the dataSources combo box
      Parameters:
      justFileSources - If true then just use data sources that access files
      Returns:
      The GUI for the data sources selector
    • getDataSourcesComponent

      public static JComboBox getDataSourcesComponent(boolean justFileSources, DataManager dataManager)
      Return the component that holds the dataSources combo box
      Parameters:
      justFileSources - If true then just use data sources that access files
      dataManager - The data manager
      Returns:
      The GUI for the data sources selector
    • getDataSourcesComponent

      public static JComboBox getDataSourcesComponent(boolean justFileSources, DataManager dataManager, boolean addLucky)
      Get the component for listing data source types
      Parameters:
      justFileSources - true for just files
      dataManager - the data manager
      addLucky - true to add the "I'm Feeiling Lucky" option
      Returns:
      the component
    • getDataSourceId

      protected String getDataSourceId()
      If the dataSources combo box is non-null then return the data source id the user selected. Else, return null
      Returns:
      Data source id
    • getDataSourceId

      protected String getDataSourceId(JComboBox dataSourcesCbx)
      Get the data source ID for the particular item selected in the box
      Parameters:
      dataSourcesCbx - the list of source descriptions
      Returns:
      the id of the selected data source type
    • resetDataSourceId

      protected void resetDataSourceId()
      Clear the dataSources combo box
    • makeDataSource

      protected boolean makeDataSource(Object definingObject, Hashtable properties)
      Create the data source defined by the given definingObject (e.g., a string filename, a list of images, etc.
      Parameters:
      definingObject - What defines the data source
      properties - extra properties
      Returns:
      Was this creation successful
    • setDataSourceListener

      public void setDataSourceListener(ActionListener listener)
      Set the data source listener
      Parameters:
      listener - the listener
    • isReloadable

      public boolean isReloadable()
      _more_
      Returns:
      _more_
    • makeDataSource

      protected boolean makeDataSource(Object definingObject, String dataType, Hashtable properties)
      Create the data source defined by the given definingObject (ex: a string filename, a list of images). If dataType is non-null then it defines a data source id (defined in idv/resources/datasources.xml)

      Else the creation is done by looking at the string value of the defining object and seeing if it matches any of the patterns that are defined in datasources.xml

      One more way to define what data source to create is to add the id into the properties Hashable using DataManager.DATATYPE_ID

      Parameters:
      definingObject - What defines the data source
      dataType - Define the data type to create
      properties - extra properties
      Returns:
      Was this creation successful
    • startTask

      protected Object startTask()
      Start the task
      Returns:
      the task id
    • stopTask

      protected void stopTask(Object taskId)
      Stop the task
      Parameters:
      taskId - the task id
    • stopTaskAndIsOk

      protected boolean stopTaskAndIsOk(Object taskId)
      See if we can stop the task and it's okay
      Parameters:
      taskId - the task id
      Returns:
      true if ok
    • taskOk

      protected boolean taskOk(Object taskId)
      Is the task ok?
      Parameters:
      taskId - the task id
      Returns:
      true if ok
    • showWaitCursor

      public void showWaitCursor()
      show wait cursor
      Overrides:
      showWaitCursor in class ChooserPanel
    • showNormalCursor

      public void showNormalCursor()
      show regular cursor
      Overrides:
      showNormalCursor in class ChooserPanel
    • doClose

      public void doClose()
      Close the chooser window
      Overrides:
      doClose in class ChooserPanel
    • doCancel

      public void doCancel()
      Handle a cancel
      Overrides:
      doCancel in class ChooserPanel
    • closeChooser

      protected void closeChooser()
      Close the chooser window
    • init

      protected void init()
      Initialize after creation
    • shouldDoUpdateOnFirstDisplay

      protected boolean shouldDoUpdateOnFirstDisplay()
      As the name implies should this chooser do call doUpdate the first time it is painted. This is a hook for derived classes to specify this behavior.
      Returns:
      Should update
    • getContents

      public final JComponent getContents()
      Create and return the GUI contents.
      Overrides:
      getContents in class ChooserPanel
      Returns:
      The GUI
    • updateStatus

      protected void updateStatus()
      Update the status
      Overrides:
      updateStatus in class ChooserPanel
    • getDataManager

      public DataManager getDataManager()
      Return the DataManager
      Returns:
      The data manager
    • getId

      public String getId()
      Return the id
      Returns:
      The id
    • getIdv

      public IntegratedDataViewer getIdv()
      Getter method to return the IDV
      Returns:
      The idv
    • logException

      public void logException(String msg, Exception exc)
      Helper method that calls LogUtil.printException
      Overrides:
      logException in class ChooserPanel
      Parameters:
      msg - The message
      exc - The exception
    • errorMessage

      public static void errorMessage(String msg)
      Helper method to show a user error message
      Parameters:
      msg - The message
    • userMessage

      public static void userMessage(String msg)
      Helper method to show a user message
      Parameters:
      msg - The message
    • getPreferenceList

      public PreferenceList getPreferenceList(String listProp)
      Find the PreferenceList associated with the given property.
      Parameters:
      listProp - The property name
      Returns:
      The PreferenceList
    • getPreferenceList

      public PreferenceList getPreferenceList(String listProp, boolean mergeTheIdvProperty)
      Find the PreferenceList associated with the given property.
      Parameters:
      listProp - The property name
      mergeTheIdvProperty - If true, then we also lookup the String property from the IDV and merge it into the list.
      Returns:
      The PreferenceList
    • getPreferenceList

      public PreferenceList getPreferenceList(String listProp, boolean mergeTheIdvProperty, String butNotThisOne)
      Find the PreferenceList associated with the given listProp.
      Parameters:
      listProp - The property key
      mergeTheIdvProperty - If true, then we also lookup the String property from the IDV and merge it into the list.
      butNotThisOne - If non-null then we don't include this property. This is used to remove old catalogs from the XmlChooser's list
      Returns:
      The PreferenceList
    • getPreferenceList

      public PreferenceList getPreferenceList(String listProp, boolean mergeTheIdvProperty, List butNotThese)
      Find the PreferenceList associated with the given listProp.
      Parameters:
      listProp - The property key
      mergeTheIdvProperty - If true, then we also lookup the String property from the IDV and merge it into the list.
      butNotThese - If non-null or empty then we don't include these properties. This is used to remove old values from the list
      Returns:
      The PreferenceList
    • getPropList

      public List getPropList(String property, boolean mergeTheIdvProperty)
      Find the list (of Strings) defined by the property name
      Parameters:
      property - The property name
      mergeTheIdvProperty - If true, then we also lookup the String property from the IDV and merge it into the list.
      Returns:
      Property list
    • getStatusLabelBackground

      public Color getStatusLabelBackground()
      get the status label background color
      Overrides:
      getStatusLabelBackground in class ChooserPanel
      Returns:
      the status label background color
    • getStatusLabelForeground

      public Color getStatusLabelForeground()
      Get the status label foreground color
      Overrides:
      getStatusLabelForeground in class ChooserPanel
      Returns:
      the status label foreground color
    • setDataSource

      public void setDataSource(DataSource value)
      Set the DataSource property.
      Parameters:
      value - The new value for DataSource
    • getDataSource

      public DataSource getDataSource()
      Get the DataSource property.
      Returns:
      The DataSource