Class DataSelector

java.lang.Object
ucar.unidata.idv.ui.DataSourceHolder
ucar.unidata.idv.ui.DataSelector

public class DataSelector extends DataSourceHolder
This class provides facilities for managing a collection of DataSource, DataCategory and DataChoice in a selection GUI.

It holds a list of DataSources. For each DataSource there is a DataTree that shows the DataChoices of the DataSource. There is a list of ControlDescriptor-s that are shown in the DataControlDialog

Version:
$Revision: 1.87 $Date: 2007/08/10 13:38:11 $
Author:
IDV development team
  • Field Details

    • COLOR_BADSEARCH

      public static final Color COLOR_BADSEARCH
      Color for failed search
  • Constructor Details

    • DataSelector

      public DataSelector(IntegratedDataViewer idv, DataSource formulaDataSource)
      Create a DataSelector with the given idv and lsit of formulas
      Parameters:
      idv - The IDV
      formulaDataSource - Contains the end-user formulas
    • DataSelector

      public DataSelector(IntegratedDataViewer idv, boolean horizontalOrientation, DataSource formulaDataSource)
      Create a DataSelector with the given idv and lsit of formulas
      Parameters:
      idv - The IDV
      horizontalOrientation - Should this be configured with normal dimensions
      formulaDataSource - Contains the end-user formulas
    • DataSelector

      public DataSelector(IntegratedDataViewer idv, Dimension defaultSize, boolean singletonDataSource)
      Create a DataSelector with the given idv and list of formulas
      Parameters:
      idv - The IDV
      defaultSize - Size of the window
      singletonDataSource - Does this dialog just show one data source
  • Method Details

    • setDataSource

      public void setDataSource(DataSource dataSource)
      Set the data source shown by this selector
      Parameters:
      dataSource - The data source
    • getContents

      public JComponent getContents()
      Return the GUI contents
      Specified by:
      getContents in class DataSourceHolder
      Returns:
      The GUI contents
    • getButtons

      public JComponent getButtons()
      Return the JComponent that holds the Create and Close buttons.
      Overrides:
      getButtons in class DataSourceHolder
      Returns:
      Button panel
    • dispose

      public void dispose()
      Remove all references to anything we may have. We do this because (stupid) Swing seems to keep around lots of different references to thei component and/or it's frame. So when we do a window.dispose () this DataSelector does not get gc'ed.
      Overrides:
      dispose in class DataSourceHolder
    • removeDataSourceInner

      protected boolean removeDataSourceInner(DataSource dataSource)
      Remove the specified data source only if it is not the formulaDataSource.
      Overrides:
      removeDataSourceInner in class DataSourceHolder
      Parameters:
      dataSource - The data source to remove
      Returns:
      Did we remove the data source
    • displayTemplatesChanged

      public void displayTemplatesChanged()
      Be notified of a change to the display templates
      Overrides:
      displayTemplatesChanged in class DataSourceHolder
    • dataSourceTimeChanged

      public void dataSourceTimeChanged(DataSource dataSource)
      Change the gui when the given data source has changed. This gets called by the IntegratedDataViewer When one of the DataControlDialog-s changes the times on the data source.
      Overrides:
      dataSourceTimeChanged in class DataSourceHolder
      Parameters:
      dataSource - The data source that changed
    • dataSourceChanged

      public void dataSourceChanged(DataSource dataSource)
      The given data source has changed. This method just re-adds the datasource to force an update of the GUI
      Overrides:
      dataSourceChanged in class DataSourceHolder
      Parameters:
      dataSource - The data source that changed
    • addDataSource

      public void addDataSource(DataSource dataSource)
      Add the DataSource and its DataChoice-s into the gui
      Overrides:
      addDataSource in class DataSourceHolder
      Parameters:
      dataSource - The data source to add
    • getNameForDataSource

      public static String getNameForDataSource(DataSource ds)
      A helper method to find the label to use for the given DataSource. If the length of the toString of the data source is less than 30 just use that. Else be a bit smart about truncating it.
      Parameters:
      ds - The data soruce to get a label for
      Returns:
      The label
    • getNameForDataSource

      public static String getNameForDataSource(DataSource ds, int length, boolean alwaysDoIt)
      A helper method to find the label to use for the given DataSource. If the length of the toString of the data source is less than 30 just use that. Else be a bit smart about truncating it.
      Parameters:
      ds - The data soruce to get a label for
      length - String length to clip to
      alwaysDoIt - If false then we only lip if this is a file or url
      Returns:
      The label