Package ucar.unidata.idv.ui
Class DataSourceHolder
java.lang.Object
ucar.unidata.idv.ui.DataSourceHolder
- Direct Known Subclasses:
DataSelector,DataTree
A base class for those components that show a set of
DataSources. For now these are the
DataTree and
DataSelector. This class provides
basic facilities to manage the list of data sources, create the
window, etc.- Author:
- IDV development team
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DimensionThe size of the windowprotected DataSourceThe formula data source, i.e., the one that holds the end-user formulasprotected IdvWindowThe window this gui is inprotected IntegratedDataViewerThe IDVprotected booleanIf true then we don't remove the formula data source -
Constructor Summary
ConstructorsConstructorDescriptionDataSourceHolder(IntegratedDataViewer idv, DataSource formulaDataSource, Dimension defaultDimension) Create this object -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDataSource(DataSource dataSource) Add the givenDataSourcevoidaddDisplayControl(DisplayControl control) Adds the givenDisplayControlvoidaddDisplayControl(DisplayControl control, DataChoice choice) A no-op that can be overrode by a derived classvoiddataSourceChanged(DataSource source) Be notified that the givenDataSourcehas changed.voiddataSourceTimeChanged(DataSource source) Be notified that the tim selection on the givenDataSourcehas changed.voidA hook to notify that the list of favorites has changedvoiddispose()Remove all references to anything we may have.voiddoClose()Remove this holder from the IDV and dispose of the windowMake the IdvWindow.Hook for derived classes to provide their own dialog buttonsabstract JComponentNeeds to be overrode by derived classes to return the GUIReturn the list ofDataSourcesstatic ImageIconUtility method to create, if needed, and return the ImageIcon to be used to showDerivedDataChoicesgetFrame()Get our window.getIdv()Return the IDV member.Utility to determine the location on the screen.protected StringgetName()Get the name of this data source holder.voidRemove all data sourcesvoidremoveDataSource(DataSource dataSource) Remove the givenDataSourceonly if it is not the formulaDataSource.protected booleanremoveDataSourceInner(DataSource dataSource) Remove the specified data source only if it is not the formulaDataSource.voidremoveDisplayControl(DisplayControl control) Remove the givenDisplayControlvoidSet the default window size to be used by this componentvoidSet our windowvoidshow()Show the window if it is non-null
-
Field Details
-
idv
The IDV -
frame
The window this gui is in -
formulaDataSource
The formula data source, i.e., the one that holds the end-user formulas -
treatFormulaDataSourceSpecial
protected boolean treatFormulaDataSourceSpecialIf true then we don't remove the formula data source -
defaultDimension
The size of the window
-
-
Constructor Details
-
DataSourceHolder
public DataSourceHolder(IntegratedDataViewer idv, DataSource formulaDataSource, Dimension defaultDimension) Create this object- Parameters:
idv- The IDVformulaDataSource- The singleton formula data source. We treat this special.defaultDimension- How big is the window.
-
-
Method Details
-
doMakeFrame
Make the IdvWindow. Add event handlers for adding new data sources and closing the window.- Returns:
- The window to put the gui in
-
getIdv
Return the IDV member.- Returns:
- The IDV
-
getName
Get the name of this data source holder. Can be overrode by derived classes to provide their own name.- Returns:
- The name
-
doClose
public void doClose()Remove this holder from the IDV and dispose of the window -
show
public void show()Show the window if it is non-null -
setFrame
Set our window- Parameters:
f- The window
-
getFrame
Get our window.- Returns:
- The window
-
getContents
Needs to be overrode by derived classes to return the GUI- Returns:
- The GUI
-
getLocationOnScreen
Utility to determine the location on the screen.- Returns:
- Screen location
-
getButtons
Hook for derived classes to provide their own dialog buttons- Returns:
- This returns null but is meant to return dialog buttons
-
getDataSources
Return the list ofDataSources- Returns:
- List of data sources
-
getDerivedIcon
Utility method to create, if needed, and return the ImageIcon to be used to showDerivedDataChoices- Returns:
- The icon for derived data choices
-
setDefaultSize
Set the default window size to be used by this component- Parameters:
d- The default size
-
addDisplayControl
A no-op that can be overrode by a derived class- Parameters:
control- The new display controlchoice- The data choice
-
removeDisplayControl
Remove the givenDisplayControl- Parameters:
control- The removed display control
-
addDisplayControl
Adds the givenDisplayControl- Parameters:
control- The new display control
-
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 DataSourceHolder does not get gc'ed. -
removeAllDataSources
public void removeAllDataSources()Remove all data sources -
addDataSource
Add the givenDataSource- Parameters:
dataSource- The new data source
-
removeDataSource
Remove the givenDataSourceonly if it is not the formulaDataSource.- Parameters:
dataSource- The data source to be removed
-
removeDataSourceInner
Remove the specified data source only if it is not the formulaDataSource.- Parameters:
dataSource- The data source to be removed- Returns:
- Was this actually removed
-
dataSourceChanged
Be notified that the givenDataSourcehas changed.- Parameters:
source- The data source that changed
-
dataSourceTimeChanged
Be notified that the tim selection on the givenDataSourcehas changed.- Parameters:
source- The data source whose time has changed
-
displayTemplatesChanged
public void displayTemplatesChanged()A hook to notify that the list of favorites has changed
-