|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.idv.ui.DataSourceHolder
ucar.unidata.idv.ui.DataTree
public class DataTree
This class provides a JTree interface for a set
of DataChoice-s and
DataSource-s.
It is used two ways:
DataSelector
| Field Summary |
|---|
| Fields inherited from class ucar.unidata.idv.ui.DataSourceHolder |
|---|
defaultDimension, formulaDataSource, frame, idv, treatFormulaDataSourceSpecial |
| Constructor Summary | |
|---|---|
DataTree(IntegratedDataViewer idv,
boolean showDataSourceNode,
boolean treatFormulaDataSourceSpecial)
Create a DataTree with the given idv reference. |
|
DataTree(IntegratedDataViewer idv,
DataSource formulaDataSource)
Create a DataTree with the given idv reference and formula data source. |
|
DataTree(IntegratedDataViewer idv,
DataSource formulaDataSource,
Dimension defaultSize)
Create a DataTree with the given idv reference, formula data source and window size. |
|
DataTree(IntegratedDataViewer idv,
List sources,
List categories)
Create a DataTree with the given idv reference, list of DataSource-s and
(potentially null) list of
DataCategory-s
If the categories list is non-null then this DataTree
will only show data choices that are applicable to the categories. |
|
DataTree(IntegratedDataViewer idv,
List sources,
List categories,
Dimension defaultSize)
Create a DataTree with the given idv reference, list of DataSource-s,
(potentially null) list of
DataCategory-s and default window size. |
|
DataTree(IntegratedDataViewer idv,
List sources,
List categories,
String initialSelectedFieldName,
Dimension defaultSize)
Create a DataTree with the given idv reference, list of DataSource-s,
(potentially null) list of
DataCategory-s and default window size. |
|
| Method Summary | |
|---|---|
void |
addDataSource(DataSource dataSource)
Add the given DataSource and
its DataChoice-s into the jtree. |
void |
addDisplayControl(DisplayControl control,
DataChoice choice)
We have this here so we can display the DisplayControl-s in the DataTree. |
void |
clearSearchState()
CLear the search state |
protected void |
createSubtree(CompositeDataChoice choice,
DataTreeNode treeNode)
Recurse down the CompositeDataChoice
hierarhcy of DataChoice-s, creating the JTree tree. |
DataTreeNode |
createTreeNode(DataTreeNode parent,
String label,
Object data)
Create a DataTreeNode with the given label
that holds the given data object. |
DataTreeNode |
createTreeNode(String label,
Object data)
Create a DataTreeNode with the given label
that holds the given data object |
void |
dataSourceChanged(DataSource source)
Something changed about the given data source. |
void |
dispose()
Remove all references to anything we may have. |
boolean |
doSearch(String searchString,
JComponent near)
Search the tree |
JComponent |
getContents()
Get the main GUI contents |
Hashtable |
getExpandedPaths()
Get all expanded tree paths |
protected String |
getName()
Overwrite the base class getName method. |
Object |
getObjectAt(int x,
int y)
Find the data object that is contained by the tree node nearest to the given x/y position. |
TreePath |
getPath(DefaultMutableTreeNode treeNode)
Get the TreePath to the given treeNode |
JScrollPane |
getScroller()
Create (if needed) and return the JScrollPane around the JTree |
DataChoice |
getSelectedDataChoice()
Find and return the first DataChoice that is selected. |
DataChoice |
getSelectedDataChoice(ControlDescriptor descriptor)
Find the first selected data choice that the given ControlDescriptor is applicable
to. |
List |
getSelectedDataChoices()
Get the list of selected data choices |
JTree |
getTree()
Get the JTree we use |
DataTreeNode |
getTreeNode(Object data)
Return the tree node that represents the given data object (e.g., data source, data choice) |
boolean |
isValidData(Object data)
Is the given object (either a data source or a data choice) represented in the JTree |
void |
openUp()
If the tree has a single path to a DataChoice then open up the tree to that data choice and select it. |
void |
removeAllDataSources()
Remove all data sources from this tree |
void |
removeDataSource(DataSource dataSource)
Remove the specified data source only if it is not the formulaDataSource. |
protected boolean |
removeDataSourceInner(DataSource dataSource)
Remove the specified data source only if it is not the formulaDataSource. |
void |
removeDisplayControl(DisplayControl control)
Remove the tree node that represents the given display control |
void |
removeObject(Object dataObject)
Find the DataTree node that represents the
given data object and remove it from the tree |
void |
removeTreeNode(DataTreeNode node)
Remove the given DataTreeNode from the
tree. |
void |
selectChoices(List choices)
Have the JTree select the paths that lead to the DataChoice-s in the given list. |
void |
selectChoices(List choices,
boolean shouldSet)
Have the JTree select the paths that lead to the DataChoice-s in the given list. |
void |
setDataSource(DataSource dataSource)
This does a removeAllDataSource/addDataSource resulting in a datatree that holds just the given datasource |
void |
setMultipleSelect(boolean v)
Set the selection mode of the JTree |
void |
sort()
Turn on sorting |
| Methods inherited from class ucar.unidata.idv.ui.DataSourceHolder |
|---|
addDisplayControl, dataSourceTimeChanged, displayTemplatesChanged, doClose, doMakeFrame, getButtons, getDataSources, getDerivedIcon, getFrame, getIdv, getLocationOnScreen, setDefaultSize, setFrame, show |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DataTree(IntegratedDataViewer idv, boolean showDataSourceNode, boolean treatFormulaDataSourceSpecial)
idv - The idvshowDataSourceNode - Should this DataTree display the DataSource-s in the treetreatFormulaDataSourceSpecial - If true we put the Formula data source
(which represents the end-user formulas) at the top.public DataTree(IntegratedDataViewer idv, DataSource formulaDataSource)
idv - The IDVformulaDataSource - The formula data source that holds the
end-user formulaspublic DataTree(IntegratedDataViewer idv, DataSource formulaDataSource, Dimension defaultSize)
idv - The IDVformulaDataSource - The formula data source that holds thedefaultSize - Default size of the window (if non-null)public DataTree(IntegratedDataViewer idv, List sources, List categories)
DataSource-s and
(potentially null) list of
DataCategory-s
If the categories list is non-null then this DataTree
will only show data choices that are applicable to the categories.
idv - The IDVsources - List of data sourcescategories - List of data categoriespublic DataTree(IntegratedDataViewer idv, List sources, List categories, Dimension defaultSize)
DataSource-s,
(potentially null) list of
DataCategory-s and default window size.
If the categories list is non-null then this DataTree
will only show data choices that are applicable to the categories.
idv - The IDVsources - List of data sourcescategories - List of data categoriesdefaultSize - Windwo size (if non-null)public DataTree(IntegratedDataViewer idv, List sources, List categories, String initialSelectedFieldName, Dimension defaultSize)
DataSource-s,
(potentially null) list of
DataCategory-s and default window size.
If the categories list is non-null then this DataTree
will only show data choices that are applicable to the categories.
idv - The IDVsources - List of data sourcescategories - List of data categoriesinitialSelectedFieldName - The name of the data choice we should selectdefaultSize - Window size (if non-null)| Method Detail |
|---|
public void sort()
protected String getName()
getName in class DataSourceHolderpublic void setDataSource(DataSource dataSource)
dataSource - The data source to usepublic JComponent getContents()
getContents in class DataSourceHolderpublic JTree getTree()
public void clearSearchState()
public boolean doSearch(String searchString, JComponent near)
searchString - search fornear - component to show dialog near
public void selectChoices(List choices)
DataChoice-s in the given list.
choices - List of data choicespublic void selectChoices(List choices, boolean shouldSet)
DataChoice-s in the given list.
choices - List of data choicesshouldSet - Should we set the selection or add to the selectionpublic void setMultipleSelect(boolean v)
v - JTree is multiple or single selectpublic JScrollPane getScroller()
public void addDisplayControl(DisplayControl control, DataChoice choice)
DisplayControl-s in the DataTree.
We display them under the tree node
that represents the given
DataChoice
addDisplayControl in class DataSourceHoldercontrol - The display control to representchoice - The data choice to show the display control underpublic void removeDisplayControl(DisplayControl control)
removeDisplayControl in class DataSourceHoldercontrol - The control to remove from the treepublic boolean isValidData(Object data)
data - The object to look for a tree node for
public DataTreeNode getTreeNode(Object data)
data - The object to look for a tree node
public DataTreeNode createTreeNode(String label, Object data)
DataTreeNode with the given label
that holds the given data object
label - The labeldata - The data
public DataTreeNode createTreeNode(DataTreeNode parent, String label, Object data)
DataTreeNode with the given label
that holds the given data object. Add it as a child if the
given parent node.
parent - The parent nodelabel - The labeldata - The data
public void removeTreeNode(DataTreeNode node)
DataTreeNode from the
tree. Remove it from the dataToNode mapping.
Jump through some hoops to fire the tree
structure changed event and maintain the current
expanded tree paths.
node - The node to removepublic void removeObject(Object dataObject)
DataTree node that represents the
given data object and remove it from the tree
dataObject - The object whose tree node is to be removedpublic TreePath getPath(DefaultMutableTreeNode treeNode)
treeNode - The node to find the path to
public Hashtable getExpandedPaths()
public void dispose()
dispose in class DataSourceHolderpublic void removeAllDataSources()
removeAllDataSources in class DataSourceHolderpublic void removeDataSource(DataSource dataSource)
removeDataSource in class DataSourceHolderdataSource - The data source to removeprotected boolean removeDataSourceInner(DataSource dataSource)
removeDataSourceInner in class DataSourceHolderdataSource - The data source to remove
public void dataSourceChanged(DataSource source)
dataSourceChanged in class DataSourceHoldersource - The data source that changed.public void addDataSource(DataSource dataSource)
DataSource and
its DataChoice-s into the jtree.
addDataSource in class DataSourceHolderdataSource - The data source to addprotected void createSubtree(CompositeDataChoice choice, DataTreeNode treeNode)
CompositeDataChoice
hierarhcy of DataChoice-s, creating the JTree tree.
choice - The data choice to recurse down ontreeNode - The tree node which represents the given
composite data choicepublic void openUp()
public DataChoice getSelectedDataChoice()
public DataChoice getSelectedDataChoice(ControlDescriptor descriptor)
ControlDescriptor is applicable
to.
descriptor - The descriptor to check for data choice applicability
public List getSelectedDataChoices()
public Object getObjectAt(int x, int y)
x - x positiony - y position
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||