|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JTree | +--com.glaivestone.javax.swing.JTreeX
A JTree
that allows each of its nodes to have its own tool tip
and provides various convenience services for working with
tree nodes.
Tool tips for nodes in the tree can be supported by building the tree
with nodes which implement the ToolTipTextAccessor
interface.
Clients who do not use custom tree nodes can arrange for node-specific
tool tips by configuring the JTreeX
component with a
ToolTipTextEventAccessor
. The client's ToolTipTextEventAccessor
is responsible for mapping a mouse event in the tree to a suitable tool tip,
overriding or supplementing the ToolTipTextAccessor
on
individual tree nodes as appropriate.
JTree
,
Serialized FormNested Class Summary |
Nested classes inherited from class javax.swing.JTree |
javax.swing.JTree.DynamicUtilTreeNode |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary |
Fields inherited from class javax.swing.JTree |
ANCHOR_SELECTION_PATH_PROPERTY, CELL_EDITOR_PROPERTY, CELL_RENDERER_PROPERTY, EDITABLE_PROPERTY, EXPANDS_SELECTED_PATHS_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, LARGE_MODEL_PROPERTY, LEAD_SELECTION_PATH_PROPERTY, ROOT_VISIBLE_PROPERTY, ROW_HEIGHT_PROPERTY, SCROLLS_ON_EXPAND_PROPERTY, SELECTION_MODEL_PROPERTY, SHOWS_ROOT_HANDLES_PROPERTY, TOGGLE_CLICK_COUNT_PROPERTY, TREE_MODEL_PROPERTY, VISIBLE_ROW_COUNT_PROPERTY |
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, 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 | |
JTreeX()
Returns a JTreeX with a sample model. |
|
JTreeX(java.util.Hashtable value)
Returns a JTreeX created from a Hashtable
which does not display with root. |
|
JTreeX(java.lang.Object[] value)
Returns a JTreeX with each element of the
specified array as the
child of a new root node which is not displayed. |
|
JTreeX(javax.swing.tree.TreeModel newModel)
Returns an instance of JTreeX which displays the root node
-- the tree is created using the specified data model. |
|
JTreeX(javax.swing.tree.TreeNode root)
Returns a JTreeX with the specified TreeNode as its root,
which displays the root node. |
|
JTreeX(javax.swing.tree.TreeNode root,
boolean asksAllowsChildren)
Returns a JTreeX with the specified TreeNode
as its root, which
displays the root node and which decides whether a node is a
leaf node in the specified manner. |
|
JTreeX(java.util.Vector value)
Returns a JTreeX with each element of the specified
Vector as the
child of a new root node which is not displayed. |
Method Summary | |
void |
collapseAll()
Collapse all nodes in the tree. |
void |
collapseAllBelowDepth(int depth)
Collapse all nodes in the tree below a given depth. |
void |
expandAll()
Expand all nodes in the tree. |
void |
expandAll(java.lang.Class typeToExpand)
Expand all nodes in the tree of the specified type. |
void |
expandAllExcept(java.lang.Class typeToExclude)
Expand all nodes in the tree except for those of the specified type. |
java.lang.String |
getToolTipFromNode(java.awt.event.MouseEvent mouseEvent)
Get the tool tip from the node for the given mouse event. |
java.lang.String |
getToolTipText(java.awt.event.MouseEvent mouseEvent)
Get the tool tip text for the given mouse event. |
ToolTipTextAccessor |
getToolTipTextAccessor(java.awt.event.MouseEvent mouseEvent)
Get the ToolTipTextAccessor for the given mouse event. |
ToolTipTextEventAccessor |
getToolTipTextEventAccessor()
Return the ToolTipTextEventAccessor for the tree. |
static javax.swing.tree.TreeNode |
getTreeNode(javax.swing.JTree tree,
java.awt.event.MouseEvent mouseEvent)
Return the TreeNode for the given mouseEvent or null. |
static javax.swing.tree.TreePath |
getTreePath(javax.swing.JTree tree,
java.awt.event.MouseEvent mouseEvent)
Return the TreePath for the given mouseEvent or null. |
static java.lang.Object |
getUserObject(javax.swing.JTree tree,
java.awt.event.MouseEvent mouseEvent)
Return the user Object for the given mouseEvent or null. |
java.lang.Object |
getUserObject(java.awt.event.MouseEvent mouseEvent)
Get the user object held by the tree node under the given mouse event. |
boolean |
hasSelection()
Returns whether there is a selection in the tree. |
boolean |
isEmpty()
Returns whether the tree is empty (not displaying any rows). |
static javax.swing.tree.MutableTreeNode |
newMutableTreeNode(java.lang.Object userObject)
Create a new instance of a MutableTreeNode
which holds the given value. |
static javax.swing.tree.MutableTreeNode |
newMutableTreeNode(java.lang.Object userObject,
java.lang.String toolTip)
Create a new instance of a MutableTreeNode
which holds the given value and has the specified tool tip. |
static javax.swing.tree.TreeModel |
newTreeModel(javax.swing.tree.TreeNode treeNode)
Create a new instance of a TreeModel . |
void |
registerWithToolTipManager()
Register this tree with the ToolTipManager. |
void |
setToolTipTextEventAccessor(ToolTipTextEventAccessor toolTipTextEventAccessor)
Set the ToolTipTextEventAccessor for this tree.. |
Methods inherited from class javax.swing.JTree |
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearSelection, collapsePath, collapseRow, convertValueToText, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, getAccessibleContext, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDragEnabled, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getNextMatch, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getTreeExpansionListeners, getTreeSelectionListeners, getTreeWillExpandListeners, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isSelectionEmpty, isVisible, makeVisible, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setDragEnabled, setEditable, 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, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, 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, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, 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, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, 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, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, 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, 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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public JTreeX()
JTreeX
with a sample model.
The default model used by the tree defines a leaf node as any node
without children.
DefaultTreeModel.asksAllowsChildren()
public JTreeX(java.lang.Object[] value)
JTreeX
with each element of the
specified array as the
child of a new root node which is not displayed.
By default, the tree defines a leaf node as any node without
children.
value
- an array of Object
sDefaultTreeModel.asksAllowsChildren()
public JTreeX(java.util.Vector value)
JTreeX
with each element of the specified
Vector
as the
child of a new root node which is not displayed. By default, the
tree defines a leaf node as any node without children.
value
- a Vector
DefaultTreeModel.asksAllowsChildren()
public JTreeX(java.util.Hashtable value)
JTreeX
created from a Hashtable
which does not display with root.
Each value-half of the key/value pairs in the HashTable
becomes a child of the new root node. By default, the tree defines
a leaf node as any node without children.
value
- a Hashtable
DefaultTreeModel.asksAllowsChildren()
public JTreeX(javax.swing.tree.TreeNode root)
JTreeX
with the specified TreeNode as its root,
which displays the root node.
By default, the tree defines a leaf node as any node without children.
root
- a TreeNode
objectDefaultTreeModel.asksAllowsChildren()
public JTreeX(javax.swing.tree.TreeNode root, boolean asksAllowsChildren)
JTreeX
with the specified TreeNode
as its root, which
displays the root node and which decides whether a node is a
leaf node in the specified manner.
root
- a TreeNode
objectasksAllowsChildren
- if false, any node without children is a
leaf node; if true, only nodes that do not allow
children are leaf nodesDefaultTreeModel.asksAllowsChildren()
public JTreeX(javax.swing.tree.TreeModel newModel)
JTreeX
which displays the root node
-- the tree is created using the specified data model.
newModel
- the TreeModel
to use as the data modelMethod Detail |
public static javax.swing.tree.TreeNode getTreeNode(javax.swing.JTree tree, java.awt.event.MouseEvent mouseEvent)
public static javax.swing.tree.TreePath getTreePath(javax.swing.JTree tree, java.awt.event.MouseEvent mouseEvent)
public static java.lang.Object getUserObject(javax.swing.JTree tree, java.awt.event.MouseEvent mouseEvent)
public static javax.swing.tree.MutableTreeNode newMutableTreeNode(java.lang.Object userObject)
MutableTreeNode
which holds the given value.
public static javax.swing.tree.MutableTreeNode newMutableTreeNode(java.lang.Object userObject, java.lang.String toolTip)
MutableTreeNode
which holds the given value and has the specified tool tip.
public static javax.swing.tree.TreeModel newTreeModel(javax.swing.tree.TreeNode treeNode)
TreeModel
.
public void collapseAll()
public void collapseAllBelowDepth(int depth)
public void expandAll()
public void expandAll(java.lang.Class typeToExpand)
public void expandAllExcept(java.lang.Class typeToExclude)
public java.lang.String getToolTipFromNode(java.awt.event.MouseEvent mouseEvent)
ToolTipTextAccessor
.
public java.lang.String getToolTipText(java.awt.event.MouseEvent mouseEvent)
ToolTipTextEventAccessor
is configured, then call it.
Otherwise, return the tool tip provided by the node's
ToolTipTextAccessor
, if any.
Returns null if there is no tool tip defined for the tree node under the mouse event.
getToolTipText
in class javax.swing.JTree
public ToolTipTextAccessor getToolTipTextAccessor(java.awt.event.MouseEvent mouseEvent)
ToolTipTextAccessor
for the given mouse event.
Returns null if the tree node under the mouse event does not implement
ToolTipTextAccessor
.
public ToolTipTextEventAccessor getToolTipTextEventAccessor()
ToolTipTextEventAccessor
for the tree.
Returns null if no accessor has been configured by a client..
public java.lang.Object getUserObject(java.awt.event.MouseEvent mouseEvent)
public void registerWithToolTipManager()
This method is called from each constructor in this class.
public boolean hasSelection()
public boolean isEmpty()
public void setToolTipTextEventAccessor(ToolTipTextEventAccessor toolTipTextEventAccessor)
ToolTipTextEventAccessor
for this tree..
|
GFL 1.1 API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |