|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JTree
com.zfqjava.swing.XTree
public class 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.
| Nested Class Summary | |
|---|---|
protected class |
XTree.AccessibleXTree
This class implements accessibility support for the XTree class. |
| Nested classes/interfaces inherited from class javax.swing.JTree |
|---|
JTree.AccessibleJTree, JTree.DropLocation, JTree.DynamicUtilTreeNode, JTree.EmptySelectionModel, JTree.TreeModelHandler, JTree.TreeSelectionRedirector |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| 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.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(Hashtable value)
Returns a XTree created from a Hashtable
which does not display with root. |
|
XTree(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(TreeModel newModel)
Returns an instance of XTree which displays the root node
-- the tree is created using the specified data model. |
|
XTree(TreeNode root)
Returns a XTree with the specified
TreeNode as its root,
which displays the root node. |
|
XTree(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(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(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. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this XTree. |
ChangeListener[] |
getChangeListeners()
Returns an array of all the ChangeListeners added
to this JCardpane with addChangeListener. |
TreeCellEditor |
getRealCellEditor()
Returns the real cell editor. |
TreeCellRenderer |
getRealCellRenderer()
Returns the real cell renderer. |
TreePath[] |
getSelection()
Returns the paths of all selected values. |
int |
getSelectionMode()
Returns the tree selection mode. |
Point |
getToolTipLocation(MouseEvent event)
|
String |
getToolTipText(MouseEvent event)
|
boolean |
isSelectionEmpty()
Returns true if the selection is currently empty. |
protected String |
paramString()
Returns a string representation of this XTree. |
void |
removeChangeListener(ChangeListener l)
Removes a ChangeListener from this cardpane. |
void |
setRealCellEditor(TreeCellEditor cellEditor)
Sets the cell editor. |
void |
setRealCellRenderer(TreeCellRenderer x)
Sets the TreeCellRenderer that will be used to
draw each cell. |
void |
setSelection(TreePath[] paths)
Selects the nodes identified by the specified array of paths. |
void |
setSelectionMode(int mode)
Sets the tree selection mode. |
| 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(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(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(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(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(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(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 String getToolTipText(MouseEvent event)
getToolTipText in class JTreepublic Point getToolTipLocation(MouseEvent event)
getToolTipLocation in class JComponentpublic void setSelectionMode(int mode)
mode - the tree selection mdoe, one of 4 legal values:
public int getSelectionMode()
public void clearSelection()
clearSelection in class JTreepublic boolean isSelectionEmpty()
isSelectionEmpty in class JTreepublic TreePath[] getSelection()
TreePath objects indicating the selected
nodes, or null if nothing is currently selectedpublic void setSelection(TreePath[] paths)
getExpandsSelectedPaths is true
it is exposed (made viewable).
paths - an array of TreePath objects that specifies
the nodes to selectpublic void setRealCellRenderer(TreeCellRenderer x)
TreeCellRenderer that will be used to
draw each cell.
x - the TreeCellRenderer that is to render each cellpublic TreeCellRenderer getRealCellRenderer()
setRealCellRenderer(javax.swing.tree.TreeCellRenderer)public void setRealCellEditor(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 usepublic TreeCellEditor getRealCellEditor()
setRealCellEditorpublic void addChangeListener(ChangeListener l)
ChangeListener to this cardpane.
l - the ChangeListener to addfireStateChanged(),
removeChangeListener(javax.swing.event.ChangeListener)public void removeChangeListener(ChangeListener l)
ChangeListener from this cardpane.
l - the ChangeListener to removefireStateChanged(),
addChangeListener(javax.swing.event.ChangeListener)public 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 String paramString()
null.
paramString in class JTreepublic AccessibleContext getAccessibleContext()
getAccessibleContext in interface AccessiblegetAccessibleContext in class JTree
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||