|
||||||||||
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
org.jdesktop.swingx.JXTree
public class JXTree
JXTree. PENDING: support filtering/sorting.
Nested Class Summary | |
---|---|
class |
JXTree.CellEditorRemover
This class tracks changes in the keyboard focus state. |
class |
JXTree.DelegatingRenderer
|
protected static class |
JXTree.TreeAdapter
|
class |
JXTree.TreeRolloverController<T extends JTree>
listens to rollover properties. |
class |
JXTree.TreeSearchable
A searchable targetting the visible rows of a JXTree. |
Nested classes/interfaces inherited from class javax.swing.JTree |
---|
JTree.AccessibleJTree, 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.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected CompoundHighlighter |
compoundHighlighter
|
protected ComponentAdapter |
dataAdapter
|
protected FilterPipeline |
filters
|
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 | |
---|---|
JXTree()
Constructs a JXTree with a sample model. |
|
JXTree(Hashtable value)
Constructs a JXTree created from a Hashtable which does not
display with root. |
|
JXTree(Object[] value)
Constructs a JXTree with each element of the specified array
as the child of a new root node which is not displayed. |
|
JXTree(TreeModel newModel)
Constructs an instance of JXTree which displays the root
node -- the tree is created using the specified data model. |
|
JXTree(TreeNode root)
Constructs a JXTree with the specified TreeNode as its root,
which displays the root node. |
|
JXTree(TreeNode root,
boolean asksAllowsChildren)
Constructs a JXTree 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. |
|
JXTree(Vector value)
Constructs a JXTree with each element of the specified
Vector as the child of a new root node which is not displayed. |
Method Summary | |
---|---|
void |
addHighlighter(Highlighter highlighter)
Adds a Highlighter. |
void |
collapseAll()
Collapses all nodes in the tree table. |
String |
convertValueToText(Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Called by the renderers to convert the specified value to text. |
protected JXTree.TreeRolloverController |
createLinkController()
|
protected RolloverProducer |
createRolloverProducer()
creates and returns the RolloverProducer to use with this tree. |
protected void |
doFind()
|
void |
expandAll()
Expands all nodes in the tree table. |
TreeCellRenderer |
getCellRenderer()
Returns the current TreeCellRenderer
that is rendering each cell. |
protected ComponentAdapter |
getComponentAdapter()
|
protected ComponentAdapter |
getComponentAdapter(int index)
Convenience to access a configured ComponentAdapter. |
Highlighter[] |
getHighlighters()
Returns the Highlighter s used by this tree. |
protected JXTree.TreeRolloverController |
getLinkController()
|
Searchable |
getSearchable()
|
TreePath[] |
getSelectionPaths()
overridden to always return a not-null array (following SwingX convention). |
int[] |
getSelectionRows()
overridden to always return a not-null array (following SwingX convention). |
protected Method |
getValueConversionMethod(TreeModel model)
Tries to find and return a method for Object --> to String conversion on the model by reflection. |
boolean |
isOverwriteRendererIcons()
|
boolean |
isRolloverEnabled()
returns the rolloverEnabled property. |
void |
removeHighlighter(Highlighter highlighter)
Removes the given Highlighter. |
void |
removeNotify()
Overridden to release the CellEditorRemover, if any. |
void |
setCellRenderer(TreeCellRenderer renderer)
Sets the TreeCellRenderer that will be used to
draw each cell. |
void |
setClosedIcon(Icon closedIcon)
set the icon for a closed non-leaf node. |
void |
setCollapsedIcon(Icon collapsed)
sets the icon for the handel of a collapsed node. |
void |
setExpandedIcon(Icon expanded)
sets the icon for the handle of an expanded node. |
void |
setHighlighters(Highlighter... highlighters)
Sets the Highlighter s to the table, replacing any old settings. |
void |
setLeafIcon(Icon leafIcon)
set the icon for a leaf node. |
void |
setModel(TreeModel newModel)
Sets the TreeModel that will provide the data. |
void |
setOpenIcon(Icon openIcon)
set the icon for a open non-leaf node. |
void |
setOverwriteRendererIcons(boolean overwrite)
Property to control whether per-tree icons should be copied to the renderer on setCellRenderer. |
void |
setRolloverEnabled(boolean rolloverEnabled)
Property to enable/disable rollover support. |
void |
setSearchable(Searchable searchable)
sets the Searchable for this editor. |
void |
startEditingAtPath(TreePath path)
Overridden to terminate edits on focusLost. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected FilterPipeline filters
protected CompoundHighlighter compoundHighlighter
protected ComponentAdapter dataAdapter
Constructor Detail |
---|
public JXTree()
JXTree
with a sample model. The default model
used by this tree defines a leaf node as any node without children.
public JXTree(Object[] value)
JXTree
with each element of the specified array
as the child of a new root node which is not displayed. By default, this
tree defines a leaf node as any node without children.
This version of the constructor simply invokes the super class version
with the same arguments.
value
- an array of objects that are children of the root.public JXTree(Vector value)
JXTree
with each element of the specified
Vector as the child of a new root node which is not displayed.
By default, this tree defines a leaf node as any node without children.
This version of the constructor simply invokes the super class version
with the same arguments.
value
- an Vector of objects that are children of the root.public JXTree(Hashtable value)
JXTree
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.
This version of the constructor simply invokes the super class version
with the same arguments.
value
- a Hashtable containing objects that are children of the root.public JXTree(TreeNode root)
JXTree
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.
This version of the constructor simply invokes the super class version
with the same arguments.
root
- root node of this treepublic JXTree(TreeNode root, boolean asksAllowsChildren)
JXTree
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.
This version of the constructor simply invokes the super class version
with the same arguments.
root
- root node of this treeasksAllowsChildren
- if true, only nodes that do not allow children
are leaf nodes; otherwise, any node without children is a leaf node;DefaultTreeModel.asksAllowsChildren
public JXTree(TreeModel newModel)
JXTree
which displays the root
node -- the tree is created using the specified data model.
This version of the constructor simply invokes the super class version
with the same arguments.
newModel
- the TreeModel
to use as the data modelMethod Detail |
---|
public void setModel(TreeModel newModel)
javax.swing.JTree
TreeModel
that will provide the data.
setModel
in class JTree
newModel
- the TreeModel
that is to provide the dataprotected Method getValueConversionMethod(TreeModel model)
String convertValueToText(Object);
PENDING JW: check - does this work with restricted permissions?
JW: widened access for testing - do test!
model
- the model to detect the method
Method
or null if the model has no method with
the expected signaturepublic String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus)
javax.swing.JTree
value.toString
, ignoring
all other arguments. To control the conversion, subclass this
method and use any of the arguments you need.
convertValueToText
in class JTree
value
- the Object
to convert to textselected
- true if the node is selectedexpanded
- true if the node is expandedleaf
- true if the node is a leaf noderow
- an integer specifying the node's display row, where 0 is
the first row in the displayhasFocus
- true if the node has the focus
String
representation of the node's valueprotected void doFind()
public Searchable getSearchable()
public void setSearchable(Searchable searchable)
searchable
- public void collapseAll()
public void expandAll()
public int[] getSelectionRows()
getSelectionRows
in class JTree
public TreePath[] getSelectionPaths()
getSelectionPaths
in class JTree
TreePath
objects indicating the selected
nodes, or null
if nothing is currently selectedpublic void setHighlighters(Highlighter... highlighters)
Highlighter
s to the table, replacing any old settings.
None of the given Highlighters must be null.Note: the implementation is lenient with a single null highighter to ease the api change from previous versions. PENDING: property change?
highlighters
- zero or more not null highlighters to use for renderer decoration.getHighlighters()
,
addHighlighter(Highlighter)
,
removeHighlighter(Highlighter)
public Highlighter[] getHighlighters()
Highlighter
s used by this tree.
Maybe empty, but guarantees to be never null.
setHighlighters(Highlighter[])
public void addHighlighter(Highlighter highlighter)
highlighter
- the Highlighter
to add.
NullPointerException
- if Highlighter
is null.removeHighlighter(Highlighter)
,
setHighlighters(Highlighter[])
public void removeHighlighter(Highlighter highlighter)
Does nothing if the Highlighter is not contained.
highlighter
- the Highlighter to remove.addHighlighter(Highlighter)
,
#setHighlighters(Highlighter..)
public void setRolloverEnabled(boolean rolloverEnabled)
rolloverEnabled
- protected JXTree.TreeRolloverController getLinkController()
protected JXTree.TreeRolloverController createLinkController()
protected RolloverProducer createRolloverProducer()
RolloverProducer
to use with this treepublic boolean isRolloverEnabled()
public TreeCellRenderer getCellRenderer()
javax.swing.JTree
TreeCellRenderer
that is rendering each cell.
getCellRenderer
in class JTree
TreeCellRenderer
that is rendering each cellpublic void setCellRenderer(TreeCellRenderer renderer)
javax.swing.JTree
TreeCellRenderer
that will be used to
draw each cell.
setCellRenderer
in class JTree
renderer
- the TreeCellRenderer
that is to render each cellpublic void setExpandedIcon(Icon expanded)
expanded
- public void setCollapsedIcon(Icon collapsed)
collapsed
- public void setLeafIcon(Icon leafIcon)
leafIcon
- public void setOpenIcon(Icon openIcon)
openIcon
- public void setClosedIcon(Icon closedIcon)
closedIcon
- public void setOverwriteRendererIcons(boolean overwrite)
overwrite
- public boolean isOverwriteRendererIcons()
public void startEditingAtPath(TreePath path)
startEditingAtPath
in class JTree
path
- the TreePath
identifying a nodeupdateEditorRemover()
public void removeNotify()
removeNotify
in class JComponent
JComponent.registerKeyboardAction(java.awt.event.ActionListener, java.lang.String, javax.swing.KeyStroke, int)
protected ComponentAdapter getComponentAdapter()
protected ComponentAdapter getComponentAdapter(int index)
index
- the row index in view coordinates, must be valid.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |