public class treeControl
extends javax.swing.JPanel
implements java.awt.event.AdjustmentListener, java.awt.event.ActionListener, java.awt.event.FocusListener, java.awt.event.MouseWheelListener
treeCallback,
treeNode,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
private class |
treeControl.myKeyListener |
private class |
treeControl.treeControlAction |
javax.swing.JPanel.AccessibleJPaneljavax.swing.JComponent.AccessibleJComponent| Modifier and Type | Field and Description |
|---|---|
(package private) static int |
borderSpace |
(package private) java.awt.Rectangle |
bounding_rect |
(package private) treeCallback |
callback |
(package private) treeCanvas |
canvas |
(package private) treeDragDropCallback |
dCallback |
(package private) static boolean |
debug |
static int |
DRAG_ICON |
static int |
DRAG_LINE |
static int |
DRAG_NONE |
(package private) treeNode |
dragAboveNode |
(package private) treeNode |
dragBelowNode |
(package private) int |
dragMode |
(package private) treeNode |
dragNode |
(package private) treeNode |
dragOverNode |
(package private) javax.swing.JScrollBar |
hbar |
(package private) boolean |
hbar_visible |
(package private) int |
maxWidth |
(package private) treeMenu |
menu |
(package private) treeNode |
menuedNode |
(package private) int |
minWidth |
(package private) treeNode |
oldNode |
(package private) treeNode |
root |
(package private) int |
row_height |
(package private) java.util.Vector |
rows |
(package private) treeNode |
selectedNode |
(package private) javax.swing.JScrollBar |
vbar |
(package private) boolean |
vbar_visible |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
treeControl(java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color bgColor,
treeCallback callback,
java.awt.Image[] images)
Constructor
|
treeControl(java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color bgColor,
treeCallback callback,
java.awt.Image[] images,
treeMenu menu)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Handle notification from popupmenus and from key board navigation
actions
|
void |
adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
Handles scrollbar events.
|
private void |
adjustScrollbars()
Check to see whether we need scrollbars in our current component size,
set the min/max/visible parameters
This method is intended to be called from reShape(). |
(package private) void |
breakdownTree(treeNode node)
Helper function to break down links in a tree to speed GC.
|
private void |
clearStacks(treeNode node)
Helper method to force recalculation of childStacks.
|
void |
clearTree()
Clear out the tree.
|
void |
contractNode(treeNode node,
boolean repaint)
close the given node
|
void |
contractNode(treeNode node,
boolean repaint,
boolean doCallback)
close the given node
|
void |
deleteNode(treeNode node,
boolean repaint)
Removes a node from the tree, along with all its children.
|
void |
destroyTree()
Call this on the GUI thread to break apart and destroy this
tree.
|
void |
dispose()
Method to be called after this treeControl is removed from use
and visibility.
|
(package private) void |
doubleClickNode(treeNode node)
Used to trigger the default action in the callback.
|
void |
dumpRows()
Internal diagnostic method, prints the structure of this tree to
System.err.
|
void |
expandNode(treeNode node,
boolean repaint)
open the given node
|
void |
expandNode(treeNode node,
boolean repaint,
boolean doCallback)
open the given node
|
void |
focusGained(java.awt.event.FocusEvent e) |
void |
focusLost(java.awt.event.FocusEvent e) |
treeNode |
getRoot()
Get access to the root of the treeCanvas's tree of nodes.
|
private void |
getVisibleDescendantRange(treeNode node,
Range range)
Calculates the rows that are visible at and below node,
so that contractNode() can remove all nodes in that
range from visibility
|
private void |
initializeKeyboardActions() |
void |
insertNode(treeNode newNode,
boolean repaint)
Inserts a new node into the tree.
|
private int |
makeDescendantsVisible(treeNode node,
int row)
recursive routine to make descendant nodes visible.
|
void |
mouseWheelMoved(java.awt.event.MouseWheelEvent e) |
treeNode |
moveNode(treeNode node,
treeNode parent,
treeNode insertAfter,
boolean repaint)
Moves a node (possibly the root of an extensive subtree) from one
location in the tree to another.
|
(package private) void |
moveSelection(treeNode node)
This method deselects the currently selected node (if any) and
selects the paramater node.
|
void |
refresh()
Recalculate and redraw the tree.
|
(package private) void |
refreshTree()
Redraw the canvas.
|
void |
removeChildren(treeNode node,
boolean repaint)
Removes all children of the specified node from the tree.
|
private void |
reShape()
This method recalculates the general parameters of our tree's
display.
|
void |
resize(int x,
int y,
int width,
int height)
This method is called when our size is changed.
|
private void |
scrollToSelectedRow()
This method scrolls the treeCanvas so that the selected row is
visible.
|
void |
selectNode(treeNode node)
Mark a node as selected, issuing a callback to the client
reporting the selection.
|
void |
setBounds(int x,
int y,
int width,
int height)
Called when we are being resized by our container.
|
void |
setDrag(treeDragDropCallback dCallback,
int mode)
This method is used to set the drag behavior of the tree.
|
void |
setMinimumWidth(int minWidth)
Sets the minimum width the treeControl will demand in a sliding
pane.
|
void |
setRoot(treeNode root)
Clear the tree and establish a new root node.
|
(package private) void |
transientSelectNode(treeNode node)
Select a node without issuing a callback to the client.
|
(package private) void |
transientUnselectNode(treeNode node)
Deselect a node without issuing a callback to the client.
|
private void |
tryMatchString(java.lang.String matchOn)
This method is used by the myKeyListener on this tree to advance
the selection mark in response to data entry keyboard input from
the user.
|
void |
unselectAllNodes(boolean anySelected)
Deselect all nodes, issuing a callback to the client
reporting the deselection.
|
(package private) void |
unselectNode(treeNode node,
boolean anySelected)
Deselect a node, issuing a callback to the client
reporting the deselection.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, 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, 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, updateadd, 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, validateTreeaction, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclestatic final boolean debug
static final int borderSpace
public static final int DRAG_NONE
public static final int DRAG_ICON
public static final int DRAG_LINE
treeNode root
treeCallback callback
treeCanvas canvas
treeNode selectedNode
treeDragDropCallback dCallback
int dragMode
treeNode oldNode
treeNode dragNode
treeNode dragOverNode
treeNode dragBelowNode
treeNode dragAboveNode
treeMenu menu
javax.swing.JScrollBar hbar
javax.swing.JScrollBar vbar
java.awt.Rectangle bounding_rect
boolean hbar_visible
boolean vbar_visible
int minWidth
int maxWidth
int row_height
java.util.Vector rows
treeNode menuedNode
public treeControl(java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color bgColor,
treeCallback callback,
java.awt.Image[] images,
treeMenu menu)
font - Font for text in the Tree CanvasfgColor - Foreground color for text in the treeCanvasbgColor - Background color for text in the treeCanvascallback - Object to receive notification of eventsimages - Array of images to be used in the canvas; nodes refer to images by indexmenu - Popup menu to attach to the treeControlpublic treeControl(java.awt.Font font,
java.awt.Color fgColor,
java.awt.Color bgColor,
treeCallback callback,
java.awt.Image[] images)
font - Font for text in the Tree CanvasfgColor - Foreground color for text in the treeCanvasbgColor - Background color for text in the treeCanvascallback - Object to receive notification of eventsimages - Array of images to be used in the canvas; nodes refer to images by indexpublic void setDrag(treeDragDropCallback dCallback, int mode)
dCallback - DragDrop manager objectmode - A binary or'ing of of treeControl.DRAG_NONE, treeControl.DRAG_ICON,
and treeControl.DRAG_LINE.treeDragDropCallbackpublic void destroyTree()
Call this on the GUI thread to break apart and destroy this tree.
public void clearTree()
public void setRoot(treeNode root)
public void setMinimumWidth(int minWidth)
public void insertNode(treeNode newNode, boolean repaint)
newNode - The node to be inserted. Properties of the node determine where the node is inserted.repaint - If true, immediately re-render and refresh the treeCanvas.public void deleteNode(treeNode node, boolean repaint)
Removes a node from the tree, along with all its children. Any child nodes attached to the node to be deleted will be unlinked from one another. If you want to be able to re-insert the deleted node elsewhere in the tree, you probably should use moveNode() instead.
node - The node to be removed.repaint - If true, immediately re-render and refresh the treeCanvas.public treeNode moveNode(treeNode node, treeNode parent, treeNode insertAfter, boolean repaint)
node - The node to be moved.parent - Parent node to insert this node under, null if this is a top-level nodeinsertAfter - sibling to insert this node afterrepaint - If true, immediately re-render and refresh the treeCanvas after moving the node.public void removeChildren(treeNode node, boolean repaint)
node - The node whose children should be removedrepaint - If true, immediately re-render and refresh the treeCanvas.void breakdownTree(treeNode node)
private void clearStacks(treeNode node)
public treeNode getRoot()
public void refresh()
public void dumpRows()
public void expandNode(treeNode node, boolean repaint)
public void expandNode(treeNode node, boolean repaint, boolean doCallback)
private int makeDescendantsVisible(treeNode node, int row)
row - the row to match the node to.public void contractNode(treeNode node, boolean repaint)
public void contractNode(treeNode node, boolean repaint, boolean doCallback)
private void getVisibleDescendantRange(treeNode node, Range range)
node - The node of the subtree we need to examinerange - We encode the range below node in the Range objectvoid transientSelectNode(treeNode node)
void doubleClickNode(treeNode node)
public void selectNode(treeNode node)
node - The node to selectvoid moveSelection(treeNode node)
node - The node to selectvoid transientUnselectNode(treeNode node)
node - The node to deselectvoid unselectNode(treeNode node, boolean anySelected)
anySelected - If true, the client will be told
that some node will remain selected after this operation
is completednode - The node to deselectpublic void unselectAllNodes(boolean anySelected)
anySelected - If true, the client will be told
that some node will remain selected after this operation
is completed.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - The event we're receiving as an ActionListenerprivate void scrollToSelectedRow()
public void adjustmentValueChanged(java.awt.event.AdjustmentEvent e)
adjustmentValueChanged in interface java.awt.event.AdjustmentListenerpublic void resize(int x,
int y,
int width,
int height)
public void setBounds(int x,
int y,
int width,
int height)
setBounds in class java.awt.Componentprivate void reShape()
private void adjustScrollbars()
void refreshTree()
public void dispose()
public void focusGained(java.awt.event.FocusEvent e)
focusGained in interface java.awt.event.FocusListenerpublic void focusLost(java.awt.event.FocusEvent e)
focusLost in interface java.awt.event.FocusListenerpublic void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
mouseWheelMoved in interface java.awt.event.MouseWheelListenerprivate void initializeKeyboardActions()
private void tryMatchString(java.lang.String matchOn)