|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.wisc.ssec.mcidasv.util.TreePanel
public class TreePanel
This class shows a tree on the left and a card panel on the right. Ripped right out of the IDV, for the time being.
| Nested Class Summary | |
|---|---|
private static class |
TreePanel.MyTreeNode
TreeNode extensions that allows us to associate an icon with this node. |
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
private Map<String,Component> |
catComponents
_more_ |
static String |
CATEGORY_DELIMITER
|
private Map<String,DefaultMutableTreeNode> |
catToNode
Maps categories to tree node |
private Map<Component,DefaultMutableTreeNode> |
compToNode
Maps components to tree node |
private JPanel |
emptyPanel
_more_ |
private boolean |
okToSave
|
private boolean |
okToUpdateTree
ok to respond to selection changes |
private GuiUtils.CardLayoutPanel |
panel
The panel |
private DefaultMutableTreeNode |
root
The root |
private JTree |
tree
the tree |
private DefaultTreeModel |
treeModel
the model |
private JScrollPane |
treeView
The scroller |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Component |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface java.awt.image.ImageObserver |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
|---|---|
TreePanel()
ctor |
|
TreePanel(boolean useSplitPane,
int treeWidth)
_more_ |
|
| Method Summary | |
|---|---|
void |
addCategoryComponent(String cat,
JComponent comp)
_more_ |
void |
addComponent(JComponent component,
String category,
String label,
ImageIcon icon)
Add the component to the panel |
void |
closeAll()
Close all paths |
static TreePath |
findByName(JTree tree,
List<String> names)
|
static DefaultMutableTreeNode |
findNodeByPath(JTree tree,
String path)
|
static String |
getPath(DefaultMutableTreeNode node)
|
private static TreePath |
getPathToFirstLeaf(TreePath searchPath)
|
Component |
getVisibleComponent()
|
private String |
loadSavedPath()
|
void |
openAll()
Open all paths |
void |
removeComponent(JComponent component)
_more_ |
private void |
saveCurrentPath(DefaultMutableTreeNode node)
|
private static TreePath |
searchTree(TreePath parent,
List<String> nodes,
int depth)
|
void |
setIcon(Component comp,
ImageIcon icon)
|
void |
show(Component component)
|
void |
showPath(Component component)
Show the tree node that corresponds to the component |
void |
showPersistedSelection()
Attempts to select the path from a previous McIDAS-V session. |
static List<String> |
tokenizePath(String path)
|
private void |
treeChanged()
|
void |
valueChanged(TreeSelectionEvent e)
Handle tree selection changed |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String CATEGORY_DELIMITER
private final DefaultMutableTreeNode root
private final DefaultTreeModel treeModel
private final JTree tree
private final JScrollPane treeView
private GuiUtils.CardLayoutPanel panel
private final JPanel emptyPanel
private final Map<String,Component> catComponents
private final Map<String,DefaultMutableTreeNode> catToNode
private final Map<Component,DefaultMutableTreeNode> compToNode
private boolean okToUpdateTree
private boolean okToSave
| Constructor Detail |
|---|
public TreePanel()
public TreePanel(boolean useSplitPane,
int treeWidth)
useSplitPane - _more_treeWidth - _more_| Method Detail |
|---|
public Component getVisibleComponent()
public void valueChanged(TreeSelectionEvent e)
valueChanged in interface TreeSelectionListenere - event
public void setIcon(Component comp,
ImageIcon icon)
public void addComponent(JComponent component,
String category,
String label,
ImageIcon icon)
component - componentcategory - tree category. May be null.label - Tree node labelicon - Node icon. May be null.private void treeChanged()
public void addCategoryComponent(String cat,
JComponent comp)
cat - _more_comp - _more_public void removeComponent(JComponent component)
component - _more_public void show(Component component)
public void showPath(Component component)
component - comppublic void openAll()
public void closeAll()
public void showPersistedSelection()
This method also sets okToSave to true, so that
user selections can be captured after this method quits.
private void saveCurrentPath(DefaultMutableTreeNode node)
private String loadSavedPath()
public static List<String> tokenizePath(String path)
public static String getPath(DefaultMutableTreeNode node)
public static DefaultMutableTreeNode findNodeByPath(JTree tree,
String path)
public static TreePath findByName(JTree tree,
List<String> names)
private static TreePath searchTree(TreePath parent,
List<String> nodes,
int depth)
private static TreePath getPathToFirstLeaf(TreePath searchPath)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||