convertValueToText
public String convertValueToText(Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
Converts the specified value to a String. This is used by the renderers
of this JTree and its nodes.
This implementation simply returns value.toString()
and
ignores all other parameters. Subclass this method to control the
conversion.
value
- the value that is converted to a Stringselected
- indicates if that value is selected or notexpanded
- indicates if that value is expanded or notleaf
- indicates if that value is a leaf node or notrow
- the row of the nodehasFocus
- indicates if that node has focus or not
fireTreeCollapsed
public void fireTreeCollapsed(TreePath path)
Notifies all listeners that the tree was collapsed.
path
- the path to the node that was collapsed
fireTreeExpanded
public void fireTreeExpanded(TreePath path)
Notifies all listeners that the tree was expanded.
path
- the path to the node that was expanded
getDefaultTreeModel
protected static TreeModel getDefaultTreeModel()
Returns a sample TreeModel that can be used in a JTree. This can be used
in Bean- or GUI-Builders to show something interesting.
- a sample TreeModel that can be used in a JTree
getDragEnabled
public boolean getDragEnabled()
Return the value of the dragEnabled
property.
- the value
- 1.4
getExpandedDescendants
public Enumeration getExpandedDescendants(TreePath path)
Returns all TreePath objects which are a descendants of the given path
and are exapanded at the moment of the execution of this method. If the
state of any node is beeing toggled while this method is executing this
change may be left unaccounted.
path
- The parent of this request
- An Enumeration containing TreePath objects
getModel
public TreeModel getModel()
Returns the model of this JTree
object.
- the associated
TreeModel
getNextMatch
public TreePath getNextMatch(String prefix,
int startingRow,
Position.Bias bias)
Returns the next table element (beginning from the row
startingRow
that starts with
prefix
.
Searching is done in the direction specified by
bias
.
Position.Bias.Backward
prefix
- the prefix to search for in the cell valuesstartingRow
- the index of the row where to start searching frombias
- the search direction, either Position.Bias.Forward
or
- the path to the found element or -1 if no such element has been
found
IllegalArgumentException
- if prefix is null
or
startingRow is not valid
- 1.4
getUI
public TreeUI getUI()
Return the UI associated with this JTree
object.
- the associated
TreeUI
object
getUIClassID
public String getUIClassID()
This method returns the String ID of the UI class of Separator.
- getUIClassID in interface JComponent
- The UI class' String ID.
isEditable
public boolean isEditable()
Checks if this JTree
object is editable.
true
if this tree object is editable,
false
otherwise
isRootVisible
public boolean isRootVisible()
Checks if the root element is visible.
true
if the root element is visible,
false
otherwise
paramString
public String paramString()
A String representation of this JTree. This is intended to be used for
debugging. The returned string may be empty but may not be
null
.
- paramString in interface JComponent
- a String representation of this JTree
removeDescendantSelectedPaths
protected boolean removeDescendantSelectedPaths(TreePath path,
boolean includeSelected)
Removes any paths in the current set of selected paths that are
descendants of path
. If includePath
is set
to true
and path
itself is selected, then
it will be removed too.
path
- the path from which selected descendants are to be removedincludeSelected
- if true
then path
itself
will also be remove if it's selected
true
if something has been removed,
false
otherwise
- 1.3
setDragEnabled
public void setDragEnabled(boolean enabled)
Set the dragEnabled
property.
enabled
- new value
- 1.4
setEditable
public void setEditable(boolean flag)
Sets the editable
property.
flag
- true
to make this tree object editable,
false
otherwise
setModel
public void setModel(TreeModel model)
Sets the model to use in JTree
.
model
- the TreeModel
to use
setUI
public void setUI(TreeUI ui)
Sets the UI associated with this JTree
object.
ui
- the TreeUI
to associate
updateUI
public void updateUI()
This method resets the UI used to the Look and Feel defaults..
- updateUI in interface JComponent
JTree.java
Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.