VdexReload 1.1.3 API

uk.ac.reload.dweezil.gui.tree
Class ReloadTree

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JTree
                  extended byuk.ac.reload.dweezil.gui.tree.ReloadTree
All Implemented Interfaces:
javax.accessibility.Accessible, DweezilConstants, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.Scrollable, java.io.Serializable
Direct Known Subclasses:
ReloadDragTree, SchemaTree, SchemaTree, VdexTree

public abstract class ReloadTree
extends javax.swing.JTree
implements DweezilConstants

A Tree based on JTree with convenience methods

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JTree
javax.swing.JTree.AccessibleJTree, javax.swing.JTree.DynamicUtilTreeNode, javax.swing.JTree.EmptySelectionModel, javax.swing.JTree.TreeModelHandler, javax.swing.JTree.TreeSelectionRedirector
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  boolean dirtyTree
          This flag is set when we expand or contract a tree node.
 
Fields inherited from class javax.swing.JTree
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, cellEditor, cellRenderer, editable, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, invokesStopCellEditing, LARGE_MODEL_PROPERTY, largeModel, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, rootVisible, ROW_HEIGHT_PROPERTY, rowHeight, SCROLLS_ON_EXPAND_PROPERTY, scrollsOnExpand, SELECTION_MODEL_PROPERTY, selectionModel, selectionRedirector, SHOWS_ROOT_HANDLES_PROPERTY, showsRootHandles, TOGGLE_CLICK_COUNT_PROPERTY, toggleClickCount, TREE_MODEL_PROPERTY, treeModel, treeModelListener, VISIBLE_ROW_COUNT_PROPERTY, visibleRowCount
 
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 uk.ac.reload.dweezil.DweezilConstants
CR, DEBUG
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ReloadTree()
          Default Constructor
 
Method Summary
 void expandedNodes(java.lang.String nodeSet)
          Expand node on a tree given an expansion String
 void expandNode(javax.swing.tree.DefaultMutableTreeNode node, boolean expand)
          Expand/Collapse a node on the tree.
 void expandNode(java.lang.Object anObject, boolean expand)
          Expand/Collapse a node on the tree.
 void expandTree(boolean expand)
          Expand/Contract the whole Tree.
 java.lang.String getExpandedNodes()
          Get all the expanded node on the Tree as a String of node numbers
 ReloadTreeNode getNode(java.lang.Object object)
          Gets a node on the tree given its contained object.
 ReloadTreeNode getSelectedNode()
          Returns the currently selected node
 boolean isDirtyTree()
          Whether or not the Tree State has changed
protected  boolean isRootPath(javax.swing.tree.TreePath path)
          Determine root path
 void loadState(java.io.File file)
          Load the expanded node tree state from File
protected  void scrollNodeToVisible(javax.swing.tree.DefaultMutableTreeNode node)
          Scroll to a node on the tree
 void selectNode(javax.swing.tree.DefaultMutableTreeNode node)
          Select a node on the tree and scroll to it
 ReloadTreeNode selectNodeByObject(java.lang.Object anObject)
          Select a node on the Tree given the contained object
 void treeCollapsed(javax.swing.event.TreeExpansionEvent e)
          Tree Collapsed Listener
 void treeExpanded(javax.swing.event.TreeExpansionEvent e)
          Tree Expansion Listener
 void updateNodes()
          Update all nodes on the tree
 void updateSelectedNode()
          Update (repaint) the node that is currently selected
 void writeState(java.io.File file)
          Write the expanded node tree state to File
 
Methods inherited from class javax.swing.JTree
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, fireValueChanged, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getDragEnabled, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, paramString, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dirtyTree

protected boolean dirtyTree
This flag is set when we expand or contract a tree node. Then we can save The tree state if needed

Constructor Detail

ReloadTree

public ReloadTree()
Default Constructor

Method Detail

isRootPath

protected boolean isRootPath(javax.swing.tree.TreePath path)
Determine root path

Parameters:
path - the tree path concerned
Returns:
true if the tree path is a root path, false otherwise

selectNodeByObject

public ReloadTreeNode selectNodeByObject(java.lang.Object anObject)
Select a node on the Tree given the contained object

Parameters:
anObject - an object concerned
Returns:
the ReloadTreeNode that contains this object

selectNode

public void selectNode(javax.swing.tree.DefaultMutableTreeNode node)
Select a node on the tree and scroll to it

Parameters:
node - the DefaultMutableTreeNode

getSelectedNode

public ReloadTreeNode getSelectedNode()
Returns the currently selected node

Returns:
the currently selected node

getNode

public ReloadTreeNode getNode(java.lang.Object object)
Gets a node on the tree given its contained object. This assumes that all nodes are unique.

Parameters:
object - a contained object
Returns:
a ReloadTreeNode that contains this object

expandNode

public void expandNode(java.lang.Object anObject,
                       boolean expand)
Expand/Collapse a node on the tree. It only expands the top nodes. expand = true or false

Parameters:
anObject - a contained object
expand - true to expand a node on the tree, false to collapse the node

expandNode

public void expandNode(javax.swing.tree.DefaultMutableTreeNode node,
                       boolean expand)
Expand/Collapse a node on the tree. It only expands the top nodes. expand = true or false

Parameters:
node - a DefaultMutableTreeNode concerned
expand - true to expand a node on the tree, false to collapse the node

scrollNodeToVisible

protected void scrollNodeToVisible(javax.swing.tree.DefaultMutableTreeNode node)
Scroll to a node on the tree

Parameters:
node - a DefaultMutableTreeNode

updateSelectedNode

public void updateSelectedNode()
Update (repaint) the node that is currently selected


updateNodes

public void updateNodes()
Update all nodes on the tree


getExpandedNodes

public java.lang.String getExpandedNodes()
Get all the expanded node on the Tree as a String of node numbers

Returns:
a string of node numbers representing all the expanded nodes on the tree

expandedNodes

public void expandedNodes(java.lang.String nodeSet)
Expand node on a tree given an expansion String

Parameters:
nodeSet - the given expansion string

treeExpanded

public void treeExpanded(javax.swing.event.TreeExpansionEvent e)
Tree Expansion Listener

Parameters:
e - the TreeExpansionEvent

treeCollapsed

public void treeCollapsed(javax.swing.event.TreeExpansionEvent e)
Tree Collapsed Listener

Parameters:
e - the TreeExpansionEvent

isDirtyTree

public boolean isDirtyTree()
Whether or not the Tree State has changed

Returns:
true if the tree state has changed, false otherwise

expandTree

public void expandTree(boolean expand)
Expand/Contract the whole Tree.

Parameters:
expand - if true will expand the tree, if false will contract the tree

writeState

public void writeState(java.io.File file)
Write the expanded node tree state to File

Parameters:
file - the output file

loadState

public void loadState(java.io.File file)
Load the expanded node tree state from File

Parameters:
file - the input file

VdexReload 1.1.3 API