Package ucar.unidata.idv.ui
Class DataSelector
java.lang.Object
ucar.unidata.idv.ui.DataSourceHolder
ucar.unidata.idv.ui.DataSelector
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class DataSourceWrapper Holds the selector gui for a data source -
Field Summary
FieldsFields inherited from class ucar.unidata.idv.ui.DataSourceHolder
formulaDataSource, frame, idv, treatFormulaDataSourceSpecial
-
Constructor Summary
ConstructorsConstructorDescriptionDataSelector
(IntegratedDataViewer idv, boolean horizontalOrientation, DataSource formulaDataSource) Create a DataSelector with the given idv and lsit of formulasDataSelector
(IntegratedDataViewer idv, Dimension defaultSize, boolean singletonDataSource) Create a DataSelector with the given idv and list of formulasDataSelector
(IntegratedDataViewer idv, DataSource formulaDataSource) Create a DataSelector with the given idv and lsit of formulas -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataSource
(DataSource dataSource) Add theDataSource
and itsDataChoice
-s into the guivoid
dataSourceChanged
(DataSource dataSource) The given data source has changed.void
dataSourceTimeChanged
(DataSource dataSource) Change the gui when the given data source has changed.void
Be notified of a change to the display templatesvoid
dispose()
Remove all references to anything we may have.Return the JComponent that holds the Create and Close buttons.Return the GUI contentsstatic String
A helper method to find the label to use for the givenDataSource
.static String
getNameForDataSource
(DataSource ds, int length, boolean alwaysDoIt) A helper method to find the label to use for the givenDataSource
.protected boolean
removeDataSourceInner
(DataSource dataSource) Remove the specified data source only if it is not the formulaDataSource.void
setDataSource
(DataSource dataSource) Set the data source shown by this selectorMethods inherited from class ucar.unidata.idv.ui.DataSourceHolder
addDisplayControl, addDisplayControl, doClose, doMakeFrame, getDataSources, getDerivedIcon, getFrame, getIdv, getLocationOnScreen, getName, removeAllDataSources, removeDataSource, removeDisplayControl, setDefaultSize, setFrame, show
-
Field Details
-
COLOR_BADSEARCH
Color for failed search
-
-
Constructor Details
-
DataSelector
Create a DataSelector with the given idv and lsit of formulas- Parameters:
idv
- The IDVformulaDataSource
- 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 IDVhorizontalOrientation
- Should this be configured with normal dimensionsformulaDataSource
- Contains the end-user formulas
-
DataSelector
Create a DataSelector with the given idv and list of formulas- Parameters:
idv
- The IDVdefaultSize
- Size of the windowsingletonDataSource
- Does this dialog just show one data source
-
-
Method Details
-
setDataSource
Set the data source shown by this selector- Parameters:
dataSource
- The data source
-
getContents
Return the GUI contents- Specified by:
getContents
in classDataSourceHolder
- Returns:
- The GUI contents
-
getButtons
Return the JComponent that holds the Create and Close buttons.- Overrides:
getButtons
in classDataSourceHolder
- 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 classDataSourceHolder
-
removeDataSourceInner
Remove the specified data source only if it is not the formulaDataSource.- Overrides:
removeDataSourceInner
in classDataSourceHolder
- 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 classDataSourceHolder
-
dataSourceTimeChanged
Change the gui when the given data source has changed. This gets called by theIntegratedDataViewer
When one of theDataControlDialog
-s changes the times on the data source.- Overrides:
dataSourceTimeChanged
in classDataSourceHolder
- Parameters:
dataSource
- The data source that changed
-
dataSourceChanged
The given data source has changed. This method just re-adds the datasource to force an update of the GUI- Overrides:
dataSourceChanged
in classDataSourceHolder
- Parameters:
dataSource
- The data source that changed
-
addDataSource
Add theDataSource
and itsDataChoice
-s into the gui- Overrides:
addDataSource
in classDataSourceHolder
- Parameters:
dataSource
- The data source to add
-
getNameForDataSource
A helper method to find the label to use for the givenDataSource
. 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
A helper method to find the label to use for the givenDataSource
. 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 forlength
- String length to clip toalwaysDoIt
- If false then we only lip if this is a file or url- Returns:
- The label
-