|
Generated by JDiff |
||||||||
PREV PACKAGE NEXT PACKAGE FRAMES NO FRAMES |
This file contains all the changes in documentation in the packagejavax.swing.tree
as colored differences. Deletions are shownlike this, and additions are shown like this.
If no deletions or additions are shown in an entry, the HTML tags will be what has changed. The new HTML tags are shown in the differences. If no documentation existed, and then some was added in a later version, this change is noted in the appropriate class pages of differences, but the change is not shown on this page. Only changes in existing text are shown here. Similarly, documentation which was inherited from another class or interface is not shown here.
Note that an HTML error in the new documentation may cause the display of other documentation changes to be presented incorrectly. For instance, failure to close a <code> tag will cause all subsequent paragraphs to be displayed differently.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.10 0213 12/0203/0001 @author Scott Violet
Used byClass AbstractLayoutCache.NodeDimensions, Rectangle getNodeDimensions(Object, int, int, boolean, Rectangle)AbstractLayoutCache
todetermingdetermine the size and x origin of a particular node.
Returns by reference in bounds the size and x origin to place value at. Thereceivercalling method is responsible fordetermingdetermining the Y location. If bounds isnull
a newly createdRectangle
should be returned otherwise the value should be placed in bounds and returned. @param value thevalue
to be represented @param row row being queried @param depth the depth of the row @param expanded true if row is expanded false otherwise @param bounds aRectangle
containing the size needed to representvalue
@return aRectangle
containing the node dimensions ornull
if node has no dimension
Returns a rectangle giving the bounds needed to draw path. @param path aClass AbstractLayoutCache, boolean getExpandedState(TreePath)TreePath
specifying a node @param placeIn aRectangle
object giving the available space @return aRectangle
object specifying the space to be used
Returns true if the path is expanded and visible. @param path the path being queried @return true if the path is expanded and visible false otherwiseClass AbstractLayoutCache, TreeModel getModel()
Returns theClass AbstractLayoutCache, NodeDimensions getNodeDimensions()TreeModel
that is providing the data. @return theTreeModel
that is providing the data
Returns the object that renders nodes in the tree and which is responsible for calculating the dimensions of individual nodes. @return the NodeDimensions
object
Class AbstractLayoutCache, Rectangle getNodeDimensions(Object, int, int, boolean, Rectangle)Returns by reference inClass AbstractLayoutCache, TreePath getPathClosestTo(int, int)sizeplaceIn
the size needed toreprensentrepresentvalue
. IfsizeinPlace
isnull
a newly createdDimensionRectangle
should be returned otherwise the value should be placed insizeinPlace
and returned. This will returnnull
if there is no renderer. @param value thevalue
to be represented @param row row being queried @param depth the depth of the row @param expanded true if row is expanded false otherwise @param placeIn aRectangle
containing the size needed to representvalue
@return aRectangle
containing the node dimensions ornull
if node has no dimension
Returns the path to the node that is closest to x y. If there is nothing currently visible this will returnClass AbstractLayoutCache, TreePath getPathForRow(int)null
otherwise it'll always return a valid path. If you need to test if the returned object is exactly at x y you should get the bounds for the returned path and test x y against that. @param x the horizontal component of the desired location @param y the vertical component of the desired location @return theTreePath
closest to the specified point
Returns the path for passed in row. If row is not visibleClass AbstractLayoutCache, int getPreferredHeight()null
is returned. @param row the row being queried @return theTreePath
for the given row
Returns the preferred height. @return the preferred heightClass AbstractLayoutCache, int getPreferredWidth(Rectangle)
Returns the preferred width for the passed in region. The region is defined by the path closest toClass AbstractLayoutCache, int getRowCount()(bounds.x bounds.y)
and ends atbounds.height + bounds.y
. Ifbounds
isnull
the preferred width for all the nodes will be returned (and this may be a VERY expensive computation). @param bounds the region being queried @return the preferred width for the passed in region
Number of rows being displayed. @return the number of rows being displayedClass AbstractLayoutCache, int getRowForPath(TreePath)
Returns the row that the last item identified in path is visible at. Will return -1 if any of the elements in path are not currently visible. @param path the TreePath
being queried @return the row where the last item in path is visible or -1 if any elements in path aren't currently visible
Class AbstractLayoutCache, int[] getRowsForPaths(TreePath[])Returns the rows that theClass AbstractLayoutCache, TreeSelectionModel getSelectionModel()TreePath
instances inpath
are being displayed at.The receiverThis method should return an array of the same length as that passed in and if one of theTreePaths
inpath
is not valid its entry in the array should be set to -1. @param paths the array ofTreePath
s being queried @return an array of the same length that is passed in containing the rows that each corresponding where eachTreePath
is displayed; ifpaths
isnull
null
is returned
Returns the model used to maintain the selection. @return the treeSelectionModel
Class AbstractLayoutCache, int getVisibleChildCount(TreePath)Returns the number of visible children for row. @param path the path being queried @return the number of visible children for the specified pathClass AbstractLayoutCache, Enumeration getVisiblePathsFrom(TreePath)
Returns anClass AbstractLayoutCache, void invalidatePathBounds(TreePath)Enumerator
that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed. The first element of the returned enumeration will be path unless it isn't visible in which casenull
will be returned. @param path the starting location for the enumeration @return theEnumerator
starting at the desired location
Instructs theClass AbstractLayoutCache, void invalidateSizes()LayoutCache
that the bounds forpath
are invalid and need to be updated. @param path the path being updated
Informs the TreeState
that it needs to recalculate all the sizes it is referencing.
Class AbstractLayoutCache, void setExpandedState(TreePath, boolean)Marks the pathClass AbstractLayoutCache, void setModel(TreeModel)path
expanded state toisExpanded
. @param path the path being expanded or collapsed @param isExpanded true if the path should be expanded false otherwise
Sets theClass AbstractLayoutCache, void setNodeDimensions(NodeDimensions)TreeModel
that will provide the data. @param newModel theTreeModel
that is to provide the data
Sets the renderer that is responsible for drawing nodes in the tree and which is threfore responsibleClass AbstractLayoutCache, void setRootVisible(boolean)focfor calculating the dimensions of individual nodes. @param nd aNodeDimensions
object
Determines whether or not the root node from the TreeModel
is visible. @param rootVisible true if the root node of the tree is to be displayed @see #rootVisible @beaninfo bound: true description: Whether or not the root node from the TreeModel is visible.
Class AbstractLayoutCache, void setSelectionModel(TreeSelectionModel)Sets theClass AbstractLayoutCache, void treeNodesChanged(TreeModelEvent)TreeSelectionModel
used to manage the selection to new LSM. @param newLSM the newTreeSelectionModel
Class AbstractLayoutCache, void treeNodesInserted(TreeModelEvent)Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays but other attributes have changed and may affect presentation. Example: the name of a file has changed but it is in the same location in the file system.
e.path() returns the path the parent of the changed node(s).
e.childIndices() returns the index(es) of the changed node(s).
@param e theTreeModelEvent
Class AbstractLayoutCache, void treeNodesRemoved(TreeModelEvent)Invoked after nodes have been inserted into the tree.
e.path() returns the parent of the new nodes
e.childIndices() returns the indices of the new nodes in ascending order.
@param e theTreeModelEvent
Class AbstractLayoutCache, void treeStructureChanged(TreeModelEvent)Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree this method may only be invoked once for the root of the removed subtree not once for each individual set of siblings removed.
e.path() returns the former parent of the deleted nodes.
e.childIndices() returns the indices the nodes had before they were deleted in ascending order.
@param e theTreeModelEvent
Invoked after the tree has drastically changed structure from a given node down. If the path returned by
e.getPath()
is of length one and the first element does not identify the current root node the first element should become the new root of the tree.e.path() holds the path to the node.
e.childIndices() returns null.
@param e theTreeModelEvent
AClass DefaultMutableTreeNode, DefaultMutableTreeNode getPreviousNode()DefaultMutableTreeNode
is a general-purpose node in a tree data structure. For examples of using default mutable tree nodes see How to Use Trees in The Java Tutorial.A tree node may have at most one parent and 0 or more children.
DefaultMutableTreeNode
provides operations for examining and modifying a node's parent and children and also operations for examining the tree that the node is a part of. A node's tree is the set of all nodes that can be reached by starting at the node and following all the possible links to parents and children. A node with no parent is the root of its tree; a node with no children is a leaf. A tree may consist of many subtrees each node acting as the root for its own subtree.This class provides enumerations for efficiently traversing a tree or subtree in various orders or for following the path between two nodes. A
DefaultMutableTreeNode
may also hold a reference to a user object the use of which is left to the user. Asking aDefaultMutableTreeNode
for its string representation withtoString()
returns the string representation of its user object.This is not a thread safe class.If you intend to use a DefaultMutableTreeNode (or a tree of TreeNodes) in more than one thread you need to do your own synchronizing. A good convention to adopt is synchronizing on the root node of a tree.
While DefaultMutableTreeNode implements the MutableTreeNode interface and will allow you to add in any implementation of MutableTreeNode not all of the methods in DefaultMutableTreeNode will be applicable to all MutableTreeNodes implementations. Especially with some of the enumerations that are provided using some of these methods assumes the DefaultMutableTreeNode contains only DefaultMutableNode instances. All of the TreeNode/MutableTreeNode methods will behave as defined no matter what implementations are added.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
A futureAsreleaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @see MutableTreeNode @version 1.15 0218 12/0203/0001 @author Rob Davis
Returns the node that precedes this node in a preorder traversal of this node's tree. Returnsnull
if this node is the first node of thetraveraltraversal -- the root of the tree. This is an inefficient way to traverse the entire tree; use an enumeration instead. @see #preorderEnumeration @return the node that precedes this node in a preorder traversal or null if this node is the first
ATreeCellEditor
. You need to supply an instance ofDefaultTreeCellRenderer
so that the icons can be obtained. You canoptionalyoptionally supply aTreeCellEditor
that will be layed out according to the icon in theDefaultTreeCellRenderer
. If you do not supply aTreeCellEditor
aTextField
will be used. Editing is started on a triple mouse click or after a click pause click and a delay of 1200 miliseconds.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
A future releaseAs ofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @see javax.swing.JTree @version 1.17 0225 12/0203/0001 @author Scott Violet
Class DefaultTreeCellEditor.DefaultTextField, constructor DefaultTreeCellEditor.DefaultTextField(Border)TextField
used when no editor is supplied. This textfield locks into the border it is constructed with. It also prefers its parents font over its font. And if the renderer is notnull
and no font has been specified the preferred height is that of the renderer.
Constructs aClass DefaultTreeCellEditor.DefaultTextField, Dimension getPreferredSize()DefaultTreeCellEditor
object. @param border a$.DefaultTextFieldBorder
object
OverridesClass DefaultTreeCellEditor.DefaultTextField, void setBorder(Border)JTextField.getPreferredSize
to return the preferred size based on current font if set or else use renderer's font. @return aDimension
object containing the preferred size
Sets the border of this component.The Border object is responsible for defining the insets for the component (overriding any insets set directly on the component) and for optionally rendering any border decorations within the bounds of those insets. Borders should be used (rather than insets) for creating both decorative and non-decorative (such as margins and padding) regions for a swing component. Compound borders can be used to nest multiple borders within a single component.This is a bound property. @param border the border to be rendered for this component @see Border @see CompoundBorder @beaninfo bound: true preferred: true attribute: visualUpdate true description: The component's border.
Container responsible for placing the editingComponent
.
Class DefaultTreeCellEditor.EditorContainer, constructor DefaultTreeCellEditor.EditorContainer()Constructs an EditorContainer
object.
Class DefaultTreeCellEditor.EditorContainer, void doLayout()Lays out thisClass DefaultTreeCellEditor.EditorContainer, Dimension getPreferredSize()Container
. If editing the editor will be placed atoffset
in the x direction and 0 for y.
Returns the preferred size for theContainer
. This will betheat least preferred size of the editoroffset byplusoffset
. @return aDimension
containing the preferred size for theContainer
; ifeditingComponent
isnull
theDimension
returned is 0 0
Constructs aClass DefaultTreeCellEditor, constructor DefaultTreeCellEditor(JTree, DefaultTreeCellRenderer, TreeCellEditor)DefaultTreeCellEditor
object for a JTree using the specified renderer and a default editor. (Use this constructor for normal editing.) @param tree aJTree
object @param renderer aDefaultTreeCellRenderer
object
Constructs aClass DefaultTreeCellEditor, void addCellEditorListener(CellEditorListener)DefaultTreeCellEditor
object for aJTree
using the specified renderer and the specified editor. (Use this constructor for specialized editing.) @param tree aJTree
object @param renderer aDefaultTreeCellRenderer
object @param editor aTreeCellEditor
object
Adds the CellEditorListener
. @param l the listener to be added
Class DefaultTreeCellEditor, boolean canEditImmediately(EventObject)Returns true ifClass DefaultTreeCellEditor, void cancelCellEditing()event
isnull
or it is aMouseEvent
with a click count > 2 andinHitRegion
returns true. @param event the event being studied
MessagesClass DefaultTreeCellEditor, Container createContainer()cancelCellEditing
to therealEditor
and removes it from this instance.
Creates the container to manage placement of editingComponent
.
Class DefaultTreeCellEditor, TreeCellEditor createTreeCellEditor()This is invoked if aClass DefaultTreeCellEditor, Color getBorderSelectionColor()TreeCellEditor
is not supplied in the constructor. It returns aTextField
editor. @return a newTextField
editor
Returns the color the border is drawn. @returns the border selection colorClass DefaultTreeCellEditor, Object getCellEditorValue()
Returns the value currently being edited. @return the value currently being editedClass DefaultTreeCellEditor, Font getFont()
Gets the font used for editing. @return the editing Font
@see #setFont
Class DefaultTreeCellEditor, Component getTreeCellEditorComponent(JTree, Object, boolean, boolean, boolean, int)Configures the editor. Passed onto the realEditor
.
Class DefaultTreeCellEditor, boolean inHitRegion(int, int)Class DefaultTreeCellEditor, boolean isCellEditable(EventObject)ShouldReturnsreturntrue if the passed in location is a valid mouse location to start editing from. This is implemented to return false ifx
is < the width of the icon and icon gap displayed by the renderer. In other words this returns true if the user clicks over the text part displayed by the renderer and false otherwise. @param x the x-coordinate of the point @param y the y-coordinate of the point @return true if the passed in location is a valid mouse location
If theClass DefaultTreeCellEditor, void removeCellEditorListener(CellEditorListener)realEditor
returns true to this messageprepareForEditing
is messaged and true is returned.
Removes the previously added CellEditorListener l
. @param the listener to be removed
Class DefaultTreeCellEditor, void setBorderSelectionColor(Color)Sets the color to use for the border. @param newColor the new border colorClass DefaultTreeCellEditor, void setFont(Font)
Sets the font to edit with.Class DefaultTreeCellEditor, void setTree(JTree)null
indicates the renderers font should be used. This will NOT override any font you have set in the editor the receiver was instantied with. Ifnull
for an editor was passed in a default editor will be created that will pick up this font. @param font the editingFont
@see #getFont
Sets the tree currently editing for. This is needed to add a selection listener. @param newTree the new tree to be editedClass DefaultTreeCellEditor, boolean shouldSelectCell(EventObject)
Messages the realEditor
for the return value.
Class DefaultTreeCellEditor, boolean shouldStartEditingTimer(EventObject)Returns true ifClass DefaultTreeCellEditor, boolean stopCellEditing()event
is aMouseEvent
and the click count is 1. @param event the event being studied
If theClass DefaultTreeCellEditor, void valueChanged(TreeSelectionEvent)realEditor
will allow editing to stop therealEditor
is removed and true is returned otherwise false is returned.
Resets lastPath
.
Class DefaultTreeCellEditor, boolean canEditClass DefaultTreeCellEditor, Component editingComponentShould isCellEditable return true ThisAs of Java 2 platformisv1.4set inthis fieldconfigure..should no longer be used.based on the path being edited and the selected selectedIf you wish to provide similar behavior you should directlypathoverrideisCellEditable
.
Component used in editing obtained from the editingContainer
.
Class DefaultTreeCellEditor, Container editingContainerEditing container will contain the editorComponent
.
Class DefaultTreeCellEditor, Font fontFont to paint with null
indicates font of renderer is to be used.
Class DefaultTreeCellEditor, TreePath lastPathClass DefaultTreeCellEditor, int lastRowlastLast path that was selected.
Row that was last passed into getTreeCellEditorComponent
.
Class DefaultTreeCellEditor, int offsetUsed in editing. Indicates x position to place editingComponent
.
Class DefaultTreeCellEditor, JTree treeJTree
instance listening too.
Displays an entry in a tree. See How to Use Trees in The Java Tutorial for examples of customizing node display using this class.Class DefaultTreeCellRenderer, Font getFont()Implementation Note: This class overrides
validate
revalidate
repaint
andfirePropertyChange
solely to improve performance. If not overridden these frequently called methods would execute code paths that are unnecessary for the default tree cell renderer. If you write your own renderer take care to weigh the benefits and drawbacks of overriding these methods.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.40 0246 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet
Gets the font of this component. @returnClass DefaultTreeCellRenderer, Color borderSelectionColorThisthis component's font.;Ifif a font has not been set for this component the font of its parent is returned. @see #setFont @since JDK1.0
Color to use for thebackgroundfocus indicator when the nodeisn'thasselectedfocus.
A simple tree data model that uses TreeNodes. For further information and examples that use DefaultTreeModel see How to Use Trees in The Java Tutorial.Class DefaultTreeModel, int getIndexOfChild(Object, Object)Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
A future releaseAs ofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.41 0251 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet
Returns the index of child in parent. If either the parent or child isClass DefaultTreeModel, EventListener[] getListeners(Class)null
returns -1. @param parent a note in the tree obtained from this data source @param child the node we are interested in @return the index of the child in the parent or -1 if either the parent or the child isnull
Class DefaultTreeModel, void setRoot(TreeNode)ReturnReturns an array of all the objects currently registered asFooListener
s upon this model.FooListener
s are registered using theaddFooListener
method.You can specify the
listenerslistenerType
argument with a class literal such asFooListener.class
. For example you can query aDefaultTreeModel
m
for its tree modelofwith thegivenfollowingtypecode:thatTreeModelListener[] tmls = (TreeModelListener[])(m.getListeners(TreeModelListener.class));
wereIfaddedno such listenerstoexist thismodelmethod returns an empty array. @returnsparamalllistenerType the type ofthelisteners requested; this parameter should specify an interface that descends fromjava.util.EventListener
@return an array of all objectsrecievingregistered ass
listenerTypeFoonotificationsListenerfromon thismodelcomponent or an empty array if no such listeners have been added @exception ClassCastException iflistenerType
doesn't specify a class or interface that implementsjava.util.EventListener
@see #getTreeModelListeners @since 1.3
Sets the root toroot
.This willA nullthrowroot
an IllegalArgumentException ifimplies the treerootis to display nothing and isnulllegal.
Default implementation of TreeSelectionModel. Listeners are notified whenever the paths in the selection change not the rows. In order to be able to track row changes you may wish to become a listener for expansion events on the tree and test for changes from there.Class DefaultTreeSelectionModel, EventListener[] getListeners(Class)resetRowSelection is called from any of the methods that update the selected paths. If you subclass any of these methods to filter what is allowed to be selected be sure and message
resetRowSelection
if you do not message super.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @see javax.swing.JTree @version 1.37 0243 12/0203/0001 @author Scott Violet
Returns an array of all the objects currently registered asClass DefaultTreeSelectionModel, boolean isRowSelected(int)FooListener
s upon this model.FooListener
s are registered using theaddFooListener
method.You can specify the
listenerslistenerType
argument with a class literal such asFooListener.class
. For example you can query aDefaultTreeSelectionModel
m
for its tree selectionofwith thegivenfollowingtypecode:thatTreeSelectionListener[] tsls = (TreeSelectionListener[])(m.getListeners(TreeSelectionListener.class));
wereIfaddedno such listenerstoexist thismodelmethod returns an empty array. @param listenerType the type of listeners requested; this parameter should specify an interface that descends fromjava.util
.EventListener @returnallan array oftheall objectsreceivingregistered aslistenerTypeFooListenersnotificationsonfromthismodelcomponent or an empty array if no such listeners have been added @exception ClassCastException iflistenerType
doesn't specify a class or interface that implementsjava.util.EventListener
@see #getTreeSelectionListeners @see #getPropertyChangeListeners @since 1.3
Returns true if the rowidentitifedidentified byrow
is selected.
Exception used to stop and expand/collapse from happening. See How to Write a Tree-Will-Expand Listener in The Java Tutorial for further information and examples. @version 1.7 028 12/0203/0001 @author Scott Violet
NOTE: This will become more open in a future release.Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.13 0219 12/0203/0001 @author Scott Violet
Defines the requirements for a tree node object that can change -- by adding or removing child nodes or by changing the contents of a user object stored in the node. @see DefaultMutableTreeNode @see javax.swing.JTree @version 1.8 029 12/0203/0001 @author Rob Davis @author Scott Violet
Defines the requirements for an object that translates paths in the tree into display rows. @version 1.10 0211 12/0203/0001 @author Scott Violet
Adds to CellEditor the extensions necessary to configure an editor in a tree. @see javax.swing.JTree @version 1.Class TreeCellEditor, Component getTreeCellEditorComponent(JTree, Object, boolean, boolean, boolean, int)10 0212 12/0203/0001 @author Scott Violet
Sets an initial value for the editor. This will cause the editor to stopEditing and lose any partially edited value if the editor is editing when this method is called.Returns the component that should be added to the client's Component hierarchy. Once installed in the client's hierarchy this component will then be able to draw and receive user input. @param
tabletree the JTree that is asking the editor to edit;Thisthis parameter can be null.@param value the value of the cell to be edited.@param isSelected true is the cell is to be renderer with selection highlighting @param expanded true if the node is expanded @param leaf true if the node is a leaf node @param row the row index of the node being edited @return the component for editing
Defines the requirements for an object that displays a tree node. See How to Use Trees in The Java Tutorial for an example of implementing a tree cell renderer that displays custom icons. @version 1.Class TreeCellRenderer, Component getTreeCellRendererComponent(JTree, Object, boolean, boolean, boolean, int, boolean)16 0218 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet
Sets the value of the current tree cell tovalue
. Ifselected
is true the cell will be drawn as if selected. Ifexpanded
is true the node is currently expanded and ifleaf
is true the node represets a leafanfand ifhasFocus
is true the node currently has focus.tree
is theJTree
the receiver is being configured for. Returns theComponent
that the renderer uses to draw the value. @return theComponent that the renderer uses to draw the value
.
The interface that defines a suitable data model for aClass TreeModel, void addTreeModelListener(TreeModelListener)JTree
. For further information on tree models including an example of a custom implementation see How to Use Trees in The Java Tutorial. @version 1.16 0219 12/0203/0001 @author Rob Davis @author Ray Ryan
Adds a listener for theClass TreeModel, Object getChild(Object, int)TreeModelEvent
posted after the tree changes. @see #removeTreeModelListener @param l the listener to add @see #removeTreeModelListener
Returns the child ofClass TreeModel, int getChildCount(Object)parent
at indexindex
in the parent's child array.parent
must be a node previously obtained from this data source. This should not returnnull
ifindex
is a valid index forparent
(that isindex >= 0 && index
)). @param parent a node in the tree obtained from this data source @return the child of parent
at indexindex
Returns the number of children ofClass TreeModel, int getIndexOfChild(Object, Object)parent
. Returns 0 if the node is a leaf or if it has no children.parent
must be a node previously obtained from this data source. @param parent a node in the tree obtained from this data source @return the number of children of the nodeparent
Returns the index of child in parent. IfClass TreeModel, Object getRoot()parent
isnull
orchild
isnull
returns -1. @param parent a note in the tree obtained from this data source @param child the node we are interested in @return the index of the child in the parent or -1 if eitherchild
orparent
arenull
Returns the root of the tree. Returns null
only if the tree has no nodes. @return the root of the tree
Class TreeModel, boolean isLeaf(Object)ReturnsClass TreeModel, void removeTreeModelListener(TreeModelListener)true
ifnode
is a leaf. It is possible for this method to returnfalse
even ifnode
has no children. A directory in a filesystem for example may contain no files; the node representing the directory is not a leaf but it also has no children. @param node a node in the tree obtained from this data source @return true ifnode
is a leaf
Removes a listener previously added with addTreeModelListener()
. @see #addTreeModelListener @param l the listener to remove
Class TreeModel, void valueForPathChanged(TreePath, Object)Messaged when the user has altered the value for the item identified bypath
tonewValue
. IfnewValue
signifies a truly new value the model should post atreeNodesChanged
event. @param path path to the node that the user has altered.@param newValue the new value from the TreeCellEditor.
Defines the requirements for an object that can be used as a tree node in a JTree.Class TreeNode, Enumeration children()For further information and examples of using tree nodes see How to Use Tree Nodes in The Java Tutorial. @version 1.
17 0219 12/0203/0001 @author Rob Davis @author Scott Violet
Returns the children of therecieverreceiver as anEnumeration
.
Represents a path to a node. A TreePath is an array of Objects that are vended from a TreeModel. The elements of the array are ordered such that the root is always the first element (index 0) of the array. TreePath is Serializable but if any components of the path are not serializable it will not be written out.For further information and examples of using tree paths see How to Use Trees in The Java Tutorial.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
A future releaseAs ofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.25 0227 12/0203/0001 @author Scott Violet @author Philip Milne
This interface represents the current state of the selection for the tree component. For information and examples of using tree selection models see How to Use Trees in The Java Tutorial.Class TreeSelectionModel, boolean isRowSelected(int)The state of the tree selection is characterized by a set of TreePaths and optionally a set of integers. The mapping from TreePath to integer is done by way of an instance of RowMapper. It is not necessary for a TreeSelectionModel to have a RowMapper to correctly operate but without a RowMapper
getSelectionRows
will return null.A TreeSelectionModel can be configured to allow only one path (
SINGLE_TREE_SELECTION
) a number of continguous paths (CONTIGUOUS_TREE_SELECTION
) or a number of discontiguous paths (DISCONTIGUOUS_TREE_SELECTION
). ARowMapper
is used to determine if TreePaths are contiguous. In the absence of a RowMapperCONTIGUOUS_TREE_SELECTION
andDISCONTIGUOUS_TREE_SELECTION
behave the same that is they allow any number of paths to be contained in the TreeSelectionModel.For a selection model of
CONTIGUOUS_TREE_SELECTION
any time the paths are changed (setSelectionPath
addSelectionPath
...) the TreePaths are again checked to make they are contiguous. A check of the TreePaths can also be forced by invokingresetRowSelection
. How a set of discontiguous TreePaths is mapped to a contiguous set is left to implementors of this interface to enforce a particular policy.Implementations should combine duplicate TreePaths that are added to the selection. For example the following code
TreePath[] paths = new TreePath[] { treePath treePath }; treeSelectionModel.setSelectionPaths(paths);should result in only one path being selected:treePath
and not two copies oftreePath
.The lead TreePath is the last path that was added (or set). The lead row is then the row that corresponds to the TreePath as determined from the RowMapper. @version 1.
19 0221 12/0203/0001 @author Scott Violet
Returns true if the rowidentitifedidentified byrow
is selected.
NOTE: This will become more open in a future release.Class VariableHeightLayoutCache, Rectangle getBounds(TreePath, Rectangle)Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing.
AAsfuture releaseofSwing will provide1.4 support for long termpersistencestorage of all JavaBeansTM has been added to thejava.beans
package. Please see java.beans.XMLEncoder @version 1.13 0218 12/0203/0001 @author Rob Davis @author Ray Ryan @author Scott Violet
Returns theClass VariableHeightLayoutCache, boolean getExpandedState(TreePath)Rectangle
enclosing the label portionthatinto which the item identified byrowpath
will be drawninto. @param path the path to be drawn @param placeIn the bounds of the enclosing rectangle @return the bounds of the enclosing rectangle ornull
if the node could not be ascertained
Returns true if the path is expanded and visible. @return true if the path is expanded and visible otherwise falseClass VariableHeightLayoutCache, TreePath getPathClosestTo(int, int)
Returns the path to the node that is closest to x y. If there is nothing currently visible this will returnClass VariableHeightLayoutCache, TreePath getPathForRow(int)null
otherwise it'llwill always return a valid path. If you need to test if the returned object is exactly at x y you should get the bounds for the returned path and test x y against that. @param x the x-coordinate @param y the y-coordinate @return the path to the node that is closest to x y
Returns the path forClass VariableHeightLayoutCache, int getPreferredHeight()passed inrow
. Ifrow
is not visiblenull
is returned. @param row the location of interest @return the path forrow
ornull
ifrow
is not visible
Returns the preferred height. @return the preferred heightClass VariableHeightLayoutCache, int getPreferredWidth(Rectangle)
Returns the preferred width and height for the region in visibleRegion
. @param bounds the region being queried
Class VariableHeightLayoutCache, int getRowCount()Returns the number of visible rows. @return the number of visible rowsClass VariableHeightLayoutCache, int getRowForPath(TreePath)
Returns the rowClass VariableHeightLayoutCache, int getVisibleChildCount(TreePath)thatwhere the last item identified in path is visibleat. Will return -1 if any of the elements in path are not currently visible. @param path theTreePath
of interest @return the row where the last item in path is visible
Returns the number of visible children forClass VariableHeightLayoutCache, Enumeration getVisiblePathsFrom(TreePath)rowpath
. @return the number of visible children forpath
Returns anClass VariableHeightLayoutCache, void invalidatePathBounds(TreePath)Enumerator
that increments over the visible paths starting at the passed in location. The ordering of the enumeration is based on how the paths are displayed. @param path the location in theTreePath
to start @return anEnumerator
that increments over the visible paths
Instructs theClass VariableHeightLayoutCache, void invalidateSizes()LayoutCache
that the bounds forpath
are invalid and need to be updated. @param path theTreePath
which is now invalid
Informs the TreeState
that it needs to recalculate all the sizes it is referencing.
Class VariableHeightLayoutCache, boolean isExpanded(TreePath)Returns true if the value identified byClass VariableHeightLayoutCache, void setExpandedState(TreePath, boolean)rowpath
is currently expanded. @return true if the value identified bypath
is currently expanded
Marks the pathClass VariableHeightLayoutCache, void setModel(TreeModel)path
expanded state toisExpanded
. @param path theTreePath
of interest @param isExpanded true if the path should be expanded otherwise false
Sets theClass VariableHeightLayoutCache, void setNodeDimensions(NodeDimensions)TreeModel
that will provide the data. @param newModel theTreeModel
that is to provide the data @beaninfo bound: true description: The TreeModel that will provide the data.
Sets the renderer that is responsible for drawing nodes in the tree. @param nd the rendererClass VariableHeightLayoutCache, void setRootVisible(boolean)
Determines whether or not the root node from the TreeModel
is visible. @param rootVisible true if the root node of the tree is to be displayed @see #rootVisible @beaninfo bound: true description: Whether or not the root node from the TreeModel is visible.
Class VariableHeightLayoutCache, void treeNodesChanged(TreeModelEvent)Invoked after a node (or a set of siblings) has changed in some way. The node(s) have not changed locations in the tree or altered their children arrays but other attributes have changed and may affect presentation. Example: the name of a file has changed but it is in the same location in the file system.Class VariableHeightLayoutCache, void treeNodesInserted(TreeModelEvent)
e.path
returns the path the parent of the changed node(s).()
e.childIndices
returns the index(es) of the changed node(s). @param e the()TreeModelEvent
of interest
Invoked after nodes have been inserted into the tree.Class VariableHeightLayoutCache, void treeNodesRemoved(TreeModelEvent)
e.path
returns the parent of the new nodes.()
e.childIndices
returns the indices of the new nodes in ascending order. @param e the()TreeModelEvent
of interest
Invoked after nodes have been removed from the tree. Note that if a subtree is removed from the tree this method may only be invoked once for the root of the removed subtree not once for each individual set of siblings removed.Class VariableHeightLayoutCache, void treeStructureChanged(TreeModelEvent)
e.path
returns the former parent of the deleted nodes.()
e.childIndices
returns the indices the nodes had before they were deleted in ascending order. @param e the()TreeModelEvent
of interest
Invoked after the tree has drastically changed structure from a given node down. If the path returned bye.getPath
is of length one and the first element does not identify the current root node the first element should become the new root of the tree.()
e.path
holds the path to the node.()
e.childIndices
returns()null
. @param e theTreeModelEvent
of interest