Package edu.wisc.ssec.mcidasv.util
Class TreePanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
edu.wisc.ssec.mcidasv.util.TreePanel
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,EventListener,Accessible,TreeSelectionListener
This class shows a tree on the left and a card panel on the right.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classTreeNode extensions that allows us to associate an icon with this node.Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescription_more_static final Stringprivate final Map<String, DefaultMutableTreeNode> Maps categories to tree node.private final Map<Component, DefaultMutableTreeNode> Maps components to tree node.private final JPanel_more_private booleanWhether or not it is okay to save.private booleanOkay to respond to selection changes.private GuiUtils.CardLayoutPanelThe panel.private final DefaultMutableTreeNodeThe root.private final JTreeThe tree.private final DefaultTreeModelThe model.private final JScrollPaneThe scroller.Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCategoryComponent(String cat, JComponent comp) _more_voidaddComponent(JComponent component, String category, String label, ImageIcon icon) Add the component to the panel.voidcloseAll()Close all tree paths.static TreePathfindByName(JTree tree, List<String> names) static DefaultMutableTreeNodefindNodeByPath(JTree tree, String path) static Stringprivate static TreePathgetPathToFirstLeaf(TreePath searchPath) private StringvoidopenAll()Open all tree paths.voidremoveComponent(JComponent component) _more_private voidprivate static TreePathsearchTree(TreePath parent, List<String> nodes, int depth) voidAssociate an icon with a component.voidShow the givencomponent.voidShow the tree node that corresponds to the component.voidAttempts to select the path from a previous McIDAS-V session.tokenizePath(String path) private voidvoidHandle tree selection changed.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeMethods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
CATEGORY_DELIMITER
- See Also:
-
root
The root. -
treeModel
The model. -
tree
The tree. -
treeView
The scroller. -
panel
The panel. -
emptyPanel
_more_ -
catComponents
_more_ -
catToNode
Maps categories to tree node. -
compToNode
Maps components to tree node. -
okToUpdateTree
Okay to respond to selection changes. -
okToSave
Whether or not it is okay to save.
-
-
Constructor Details
-
TreePanel
public TreePanel()Default constructor. CallsTreePanel(boolean, int)withuseSplitPaneset totrueandtreeWidthset to-1. -
TreePanel
Constructor that actually does the work.- Parameters:
useSplitPane- Whether or not to use a split pane.treeWidth- Width of the component containing the tree.
-
-
Method Details
-
getVisibleComponent
-
valueChanged
Handle tree selection changed.- Specified by:
valueChangedin interfaceTreeSelectionListener- Parameters:
e- Event to handle. Cannot benull.
-
setIcon
Associate an icon with a component.- Parameters:
comp- Component to associate withicon.icon- Icon to associate withcomp. Should not benull.
-
addComponent
Add the component to the panel.- Parameters:
component- componentcategory- tree category. May be null.label- Tree node labelicon- Node icon. May be null.
-
treeChanged
-
addCategoryComponent
_more_- Parameters:
cat- _more_comp- _more_
-
removeComponent
_more_- Parameters:
component- _more_
-
show
Show the givencomponent.- Parameters:
component- Component to show. Should not benull.
-
showPath
Show the tree node that corresponds to the component.- Parameters:
component- Component whose corresponding tree node to show. Should not benull.
-
openAll
Open all tree paths. -
closeAll
Close all tree paths. -
showPersistedSelection
Attempts to select the path from a previous McIDAS-V session. If no path was persisted, the method attempts to use the "first" non-leaf node.This method also sets
okToSavetotrue, so that user selections can be captured after this method quits. -
saveCurrentPath
-
loadSavedPath
-
tokenizePath
-
getPath
-
findNodeByPath
-
findByName
-
searchTree
-
getPathToFirstLeaf
-