public class AS400TreeModel
extends java.lang.Object
implements javax.swing.tree.TreeModel, java.io.Serializable
Use this class if you want to customize the graphical user interface that presents a tree. If you do not need to customize the interface, then use AS400TreePane instead.
Most errors are reported as ErrorEvents rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.
AS400TreeModel objects generate the following events:
The following example creates a tree model filled with the list of printers on a system. It then presents the tree in a JTree object.
//Set up the tree model and JTree. AS400 system = new AS400 ("MySystem", "Userid", "Password"); VPrinters printers = new VPrinters (system); AS400TreeModel treeModel = new AS400TreeModel (printers); treeModel.load (); JTree tree = new JTree (treeModel);
// Add the JTree to a frame. JFrame frame = new JFrame ("My Window"); frame.getContentPane().add(new JScrollPane(tree));
AS400TreePane
,
Serialized FormConstructor and Description |
---|
AS400TreeModel()
Deprecated.
Constructs an AS400TreeModel object.
|
AS400TreeModel(VNode root)
Deprecated.
Constructs an AS400TreeModel object.
|
Modifier and Type | Method and Description |
---|---|
void |
addErrorListener(ErrorListener listener)
Deprecated.
Adds a listener to be notified when an error occurs.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.
Adds a listener to be notified when the value of any
bound property changes.
|
void |
addTreeModelListener(javax.swing.event.TreeModelListener listener)
Deprecated.
Adds a listener to be notified when the contents of
the tree change.
|
void |
addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.
Adds a listener to be notified when the value of any
constrained property changes.
|
void |
addWorkingListener(WorkingListener listener)
Deprecated.
Adds a listener to be notified when work starts and stops
on potentially long-running operations.
|
java.lang.Object |
getChild(java.lang.Object parent,
int index)
Deprecated.
Returns a child of the parent.
|
int |
getChildCount(java.lang.Object parent)
Deprecated.
Returns the number of children of the parent.
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
Deprecated.
Returns the index of a child in the parent.
|
javax.swing.tree.TreePath |
getPath(java.lang.Object object)
Deprecated.
Returns the path from the root to get to this object in the tree
hierarchy.
|
java.lang.Object |
getRoot()
Deprecated.
Returns the root, or the system resource, from which all information for the model is gathered.
|
boolean |
isLeaf(java.lang.Object object)
Deprecated.
Indicates if the object is a leaf in the tree.
|
void |
load()
Deprecated.
Loads the information from the system.
|
void |
removeErrorListener(ErrorListener listener)
Deprecated.
Removes an error listener.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Deprecated.
Removes a property change listener.
|
void |
removeTreeModelListener(javax.swing.event.TreeModelListener listener)
Deprecated.
Removes a tree model listener.
|
void |
removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Deprecated.
Removes a vetoable change listener.
|
void |
removeWorkingListener(WorkingListener listener)
Deprecated.
Removes a working listener.
|
void |
setRoot(java.lang.Object root)
Deprecated.
Sets the root, or the system resource, from which all information
for the model is gathered.
|
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object value)
Deprecated.
Notifies the object that the value for the item identified by path
has changed.
|
public AS400TreeModel()
public AS400TreeModel(VNode root)
root
- The root, or the system resource, from which all information for the model is gathered.public void addErrorListener(ErrorListener listener)
listener
- The listener.public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void addTreeModelListener(javax.swing.event.TreeModelListener listener)
addTreeModelListener
in interface javax.swing.tree.TreeModel
listener
- The listener.public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener.public void addWorkingListener(WorkingListener listener)
listener
- The listener.public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
parent
- The parent.index
- The index of the child.public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
parent
- The parent.public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
parent
- The parent.child
- The child.public javax.swing.tree.TreePath getPath(java.lang.Object object)
object
- The object.public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
public boolean isLeaf(java.lang.Object object)
isLeaf
in interface javax.swing.tree.TreeModel
object
- The object.public void load()
public void removeErrorListener(ErrorListener listener)
listener
- The listener.public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The listener.public void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
listener
- The listener.public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
listener
- The listener.public void removeWorkingListener(WorkingListener listener)
listener
- The listener.public void setRoot(java.lang.Object root) throws java.beans.PropertyVetoException
root
- The root, or the system resource, from which all
information for the model is gathered. This must
be a VNode.java.beans.PropertyVetoException
- If the change is vetoed.public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object value)
valueForPathChanged
in interface javax.swing.tree.TreeModel
path
- The path of the item containing the new value.value
- The new value.