|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JTree
|
+--com.zfqjava.swing.XTree
XTree provides a JTree expends component, provides
inheritance selection mode.
Note:
Since XTree is compitable with JTree
at API level, use it just replace JTree
with XTree.
| Inner Class Summary | |
protected class |
XTree.AccessibleXTree
This class implements accessibility support for the XTree class. |
| Inner 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 |
| Inner classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
| Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
| Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
| Field Summary | |
static int |
CONTIGUOUS_TREE_SELECTION
Selection can only be contiguous. |
static int |
DISCONTIGUOUS_TREE_SELECTION
Selection can contain any number of items that are not necessarily contiguous. |
static int |
INHERITANCE_TREE_SELECTION
Selection can inherited from parent node. |
static int |
SINGLE_TREE_SELECTION
Selection can only contain one path at a time. |
| 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 java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
XTree()
Returns a XTree with a sample model. |
|
XTree(java.util.Hashtable value)
Returns a XTree created from a Hashtable
which does not display with root. |
|
XTree(java.lang.Object[] value)
Returns a XTree with each element of the
specified array as the
child of a new root node which is not displayed. |
|
XTree(javax.swing.tree.TreeModel newModel)
Returns an instance of XTree which displays the root node
-- the tree is created using the specified data model. |
|
XTree(javax.swing.tree.TreeNode root)
Returns a XTree with the specified
TreeNode as its root,
which displays the root node. |
|
XTree(javax.swing.tree.TreeNode root,
boolean asksAllowsChildren)
Returns a XTree 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. |
|
XTree(java.util.Vector value)
Returns a XTree with each element of the specified
Vector as the
child of a new root node which is not displayed. |
|
| Method Summary | |
void |
addChangeListener(javax.swing.event.ChangeListener l)
Adds a ChangeListener to this cardpane. |
void |
clearSelection()
Clears the selection. |
protected void |
fireStateChanged()
Sends a ChangeEvent, whose source is this cardpane,
to each listener. |
protected void |
fireValueChanged(javax.swing.event.TreeSelectionEvent e)
Notifies all listeners that have registered interest for notification on this event type. |
javax.accessibility.AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this XTree. |
javax.swing.event.ChangeListener[] |
getChangeListeners()
Returns an array of all the ChangeListeners added
to this JCardpane with addChangeListener. |
javax.swing.tree.TreePath[] |
getSelection()
Returns the paths of all selected values. |
int |
getSelectionMode()
Returns the tree selection mode. |
boolean |
isSelectionEmpty()
Returns true if the selection is currently empty. |
protected java.lang.String |
paramString()
Returns a string representation of this XTree. |
void |
removeChangeListener(javax.swing.event.ChangeListener l)
Removes a ChangeListener from this cardpane. |
void |
setRealCellEditor(javax.swing.tree.TreeCellEditor cellEditor)
Sets the cell editor. |
void |
setRealCellRenderer(javax.swing.tree.TreeCellRenderer x)
Sets the TreeCellRenderer that will be used to
draw each cell. |
void |
setSelection(javax.swing.tree.TreePath[] paths)
Selects the nodes identified by the specified array of paths. |
void |
setSelectionMode(int mode)
Sets the tree selection mode. |
void |
updateUI()
|
| Methods inherited from class javax.swing.JTree |
addSelectionInterval, addSelectionPath, addSelectionPaths, addSelectionRow, addSelectionRows, addTreeExpansionListener, addTreeSelectionListener, addTreeWillExpandListener, cancelEditing, clearToggledPaths, collapsePath, collapseRow, convertValueToText, createTreeModel, createTreeModelListener, expandPath, expandRow, fireTreeCollapsed, fireTreeExpanded, fireTreeWillCollapse, fireTreeWillExpand, getAnchorSelectionPath, getCellEditor, getCellRenderer, getClosestPathForLocation, getClosestRowForLocation, getDefaultTreeModel, getDescendantToggledPaths, getEditingPath, getExpandedDescendants, getExpandsSelectedPaths, getInvokesStopCellEditing, getLastSelectedPathComponent, getLeadSelectionPath, getLeadSelectionRow, getMaxSelectionRow, getMinSelectionRow, getModel, getPathBetweenRows, getPathBounds, getPathForLocation, getPathForRow, getPreferredScrollableViewportSize, getRowBounds, getRowCount, getRowForLocation, getRowForPath, getRowHeight, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getScrollsOnExpand, getSelectionCount, getSelectionModel, getSelectionPath, getSelectionPaths, getSelectionRows, getShowsRootHandles, getToggleClickCount, getToolTipText, getUI, getUIClassID, getVisibleRowCount, hasBeenExpanded, isCollapsed, isCollapsed, isEditable, isEditing, isExpanded, isExpanded, isFixedRowHeight, isLargeModel, isPathEditable, isPathSelected, isRootVisible, isRowSelected, isVisible, makeVisible, removeDescendantSelectedPaths, removeDescendantToggledPaths, removeSelectionInterval, removeSelectionPath, removeSelectionPaths, removeSelectionRow, removeSelectionRows, removeTreeExpansionListener, removeTreeSelectionListener, removeTreeWillExpandListener, scrollPathToVisible, scrollRowToVisible, setAnchorSelectionPath, setCellEditor, setCellRenderer, setEditable, setExpandedState, setExpandsSelectedPaths, setInvokesStopCellEditing, setLargeModel, setLeadSelectionPath, setModel, setRootVisible, setRowHeight, setScrollsOnExpand, setSelectionInterval, setSelectionModel, setSelectionPath, setSelectionPaths, setSelectionRow, setSelectionRows, setShowsRootHandles, setToggleClickCount, setUI, setVisibleRowCount, startEditingAtPath, stopEditing, treeDidChange |
| 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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int SINGLE_TREE_SELECTION
public static final int CONTIGUOUS_TREE_SELECTION
public static final int DISCONTIGUOUS_TREE_SELECTION
public static final int INHERITANCE_TREE_SELECTION
JTree.getSelectionPaths()
gets current selection.| Constructor Detail |
public XTree()
XTree with a sample model.
The default model used by the tree defines a leaf node as any node
without children.DefaultTreeModel.asksAllowsChildrenpublic XTree(java.lang.Object[] value)
XTree 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 ObjectsDefaultTreeModel.asksAllowsChildrenpublic XTree(java.util.Vector value)
XTree 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 VectorDefaultTreeModel.asksAllowsChildrenpublic XTree(java.util.Hashtable value)
XTree 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 HashtableDefaultTreeModel.asksAllowsChildrenpublic XTree(javax.swing.tree.TreeNode root)
XTree 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 XTree(javax.swing.tree.TreeNode root,
boolean asksAllowsChildren)
XTree 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.asksAllowsChildrenpublic XTree(javax.swing.tree.TreeModel newModel)
XTree which displays the root node
-- the tree is created using the specified data model.newModel - the TreeModel to use as the data model| Method Detail |
public void setSelectionMode(int mode)
mode - the tree selection mdoe, one of 4 legal values:
public int getSelectionMode()
public void clearSelection()
clearSelection in class javax.swing.JTreepublic boolean isSelectionEmpty()
isSelectionEmpty in class javax.swing.JTreepublic javax.swing.tree.TreePath[] getSelection()
TreePath objects indicating the selected
nodes, or null if nothing is currently selectedpublic void setSelection(javax.swing.tree.TreePath[] paths)
getExpandsSelectedPaths is true
it is exposed (made viewable).paths - an array of TreePath objects that specifies
the nodes to selectpublic void updateUI()
updateUI in class javax.swing.JTreepublic void setRealCellRenderer(javax.swing.tree.TreeCellRenderer x)
TreeCellRenderer that will be used to
draw each cell.x - the TreeCellRenderer that is to render each cellpublic void setRealCellEditor(javax.swing.tree.TreeCellEditor cellEditor)
null value implies that the
tree cannot be edited. If this represents a change in the
cellEditor, the propertyChange
method is invoked on all listeners.cellEditor - the TreeCellEditor to useprotected void fireValueChanged(javax.swing.event.TreeSelectionEvent e)
fireValueChanged in class javax.swing.JTreee - the TreeSelectionEvent to be fired;
generated by the
TreeSelectionModel
when a node is selected or deselectedEventListenerListpublic void addChangeListener(javax.swing.event.ChangeListener l)
ChangeListener to this cardpane.l - the ChangeListener to addfireStateChanged(),
removeChangeListener(javax.swing.event.ChangeListener)public void removeChangeListener(javax.swing.event.ChangeListener l)
ChangeListener from this cardpane.l - the ChangeListener to removefireStateChanged(),
addChangeListener(javax.swing.event.ChangeListener)public javax.swing.event.ChangeListener[] getChangeListeners()
ChangeListeners added
to this JCardpane with addChangeListener.ChangeListeners added or an empty
array if no listeners have been addedprotected void fireStateChanged()
ChangeEvent, whose source is this cardpane,
to each listener. This method method is called each time
a ChangeEvent is received from the model.addChangeListener(javax.swing.event.ChangeListener),
EventListenerListprotected java.lang.String paramString()
null.paramString in class javax.swing.JTreepublic javax.accessibility.AccessibleContext getAccessibleContext()
getAccessibleContext in interface javax.accessibility.AccessiblegetAccessibleContext in class javax.swing.JTree
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||