|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.lwuit.Component
com.sun.lwuit.Container
com.sun.lwuit.tree.Tree
public class Tree
The tree component allows constructing simple tree component hierechies that can be expaneded seamingly with no limit. The tree is bound to a model that can provide data with free form depth such as file system or similarly structured data. To customize the look of the tree the component can be derived and component creation can be replaced.
Field Summary |
---|
Fields inherited from class com.sun.lwuit.Component |
---|
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP |
Constructor Summary | |
---|---|
Tree()
Constructor for usage by GUI builder and automated tools, normally one should use the version that accepts the model |
|
Tree(TreeModel model)
Construct a tree with the given tree model |
Method Summary | |
---|---|
void |
addLeafListener(ActionListener l)
A listener that fires when a leaf is clicked |
protected Dimension |
calcPreferredSize()
Calculates the preferred size based on component content. |
protected java.lang.String |
childToDisplayLabel(java.lang.Object child)
Converts a tree child to a label, this method can be overriden for simple rendering effects |
protected Button |
createNodeComponent(java.lang.Object node,
int depth)
Creates a node within the tree, this method is protected allowing tree to be subclassed to replace the rendering logic of individual tree buttons. |
TreeModel |
getModel()
Returns the tree model instance |
java.lang.String[] |
getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code |
java.lang.Class[] |
getPropertyTypes()
Matches the property names method (see that method for further details). |
java.lang.Object |
getPropertyValue(java.lang.String name)
Returns the current value of the property name, this method is used by the GUI builder |
java.lang.Object |
getSelectedItem()
Returns the currently selected item in the tree |
void |
removeLeafListener(ActionListener l)
Removes the listener that fires when a leaf is clicked |
static void |
setFolderIcon(Image folderIcon)
Sets the icon for a tree folder |
static void |
setFolderOpenIcon(Image folderIcon)
Sets the icon for a tree folder in its expanded state |
void |
setModel(TreeModel model)
Sets the tree model to a new value |
static void |
setNodeIcon(Image nodeIcon)
Sets the icon for a tree node |
java.lang.String |
setPropertyValue(java.lang.String name,
java.lang.Object value)
Sets a new value to the given property, returns an error message if failed and null if successful. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Tree()
public Tree(TreeModel model)
model
- represents the contents of the treeMethod Detail |
---|
public java.lang.String[] getPropertyNames()
Component
getPropertyNames
in class Component
public java.lang.Class[] getPropertyTypes()
Component
getPropertyTypes
in class Component
public java.lang.Object getPropertyValue(java.lang.String name)
Component
getPropertyValue
in class Component
name
- the name of the property
public java.lang.String setPropertyValue(java.lang.String name, java.lang.Object value)
Component
setPropertyValue
in class Component
name
- the name of the propertyvalue
- new value for the property
public TreeModel getModel()
public void setModel(TreeModel model)
model
- the model of the treepublic static void setFolderIcon(Image folderIcon)
folderIcon
- the icon for a folder within the treepublic static void setFolderOpenIcon(Image folderIcon)
folderIcon
- the icon for a folder within the treepublic static void setNodeIcon(Image nodeIcon)
nodeIcon
- the icon for a node within the treepublic java.lang.Object getSelectedItem()
protected Button createNodeComponent(java.lang.Object node, int depth)
node
- the node object from the model to display on the buttondepth
- the depth within the tree (normally represented by indenting the entry)
protected java.lang.String childToDisplayLabel(java.lang.Object child)
public void addLeafListener(ActionListener l)
l
- listener to fire when the leaf is clickedpublic void removeLeafListener(ActionListener l)
l
- listener to removeprotected Dimension calcPreferredSize()
Component
calcPreferredSize
in class Container
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |