com.ibm.as400.vaccess
Class AS400TreeModel

java.lang.Object
  extended by com.ibm.as400.vaccess.AS400TreeModel
All Implemented Interfaces:
Serializable, TreeModel

Deprecated. Use Java Swing instead, along with the classes in package com.ibm.as400.access

public class AS400TreeModel
extends Object
implements TreeModel, Serializable

The AS400TreeModel class implements an underlying model for a tree, where all information for the tree is gathered from the hierarchy of objects rooted at a system resource. You must explicitly call load() to load the information from the system.

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));

See Also:
AS400TreePane, Serialized Form

Constructor Summary
Constructor and Description
AS400TreeModel()
          Deprecated. Constructs an AS400TreeModel object.
AS400TreeModel(VNode root)
          Deprecated. Constructs an AS400TreeModel object.
 
Method Summary
Modifier and Type Method and Description
 void addErrorListener(ErrorListener listener)
          Deprecated. Adds a listener to be notified when an error occurs.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Deprecated. Adds a listener to be notified when the value of any bound property changes.
 void addTreeModelListener(TreeModelListener listener)
          Deprecated. Adds a listener to be notified when the contents of the tree change.
 void addVetoableChangeListener(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.
 Object getChild(Object parent, int index)
          Deprecated. Returns a child of the parent.
 int getChildCount(Object parent)
          Deprecated. Returns the number of children of the parent.
 int getIndexOfChild(Object parent, Object child)
          Deprecated. Returns the index of a child in the parent.
 TreePath getPath(Object object)
          Deprecated. Returns the path from the root to get to this object in the tree hierarchy.
 Object getRoot()
          Deprecated. Returns the root, or the system resource, from which all information for the model is gathered.
 boolean isLeaf(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(PropertyChangeListener listener)
          Deprecated. Removes a property change listener.
 void removeTreeModelListener(TreeModelListener listener)
          Deprecated. Removes a tree model listener.
 void removeVetoableChangeListener(VetoableChangeListener listener)
          Deprecated. Removes a vetoable change listener.
 void removeWorkingListener(WorkingListener listener)
          Deprecated. Removes a working listener.
 void setRoot(Object root)
          Deprecated. Sets the root, or the system resource, from which all information for the model is gathered.
 void valueForPathChanged(TreePath path, Object value)
          Deprecated. Notifies the object that the value for the item identified by path has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AS400TreeModel

public AS400TreeModel()
Deprecated. 
Constructs an AS400TreeModel object.


AS400TreeModel

public AS400TreeModel(VNode root)
Deprecated. 
Constructs an AS400TreeModel object.

Parameters:
root - The root, or the system resource, from which all information for the model is gathered.
Method Detail

addErrorListener

public void addErrorListener(ErrorListener listener)
Deprecated. 
Adds a listener to be notified when an error occurs.

Parameters:
listener - The listener.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Deprecated. 
Adds a listener to be notified when the value of any bound property changes.

Parameters:
listener - The listener.

addTreeModelListener

public void addTreeModelListener(TreeModelListener listener)
Deprecated. 
Adds a listener to be notified when the contents of the tree change.

Specified by:
addTreeModelListener in interface TreeModel
Parameters:
listener - The listener.

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener listener)
Deprecated. 
Adds a listener to be notified when the value of any constrained property changes.

Parameters:
listener - The listener.

addWorkingListener

public void addWorkingListener(WorkingListener listener)
Deprecated. 
Adds a listener to be notified when work starts and stops on potentially long-running operations.

Parameters:
listener - The listener.

getChild

public Object getChild(Object parent,
                       int index)
Deprecated. 
Returns a child of the parent.

Specified by:
getChild in interface TreeModel
Parameters:
parent - The parent.
index - The index of the child.
Returns:
The child. It will be null if the parent is not a valid object or if the index is not valid for the parent.

getChildCount

public int getChildCount(Object parent)
Deprecated. 
Returns the number of children of the parent.

Specified by:
getChildCount in interface TreeModel
Parameters:
parent - The parent.
Returns:
The number of children of the parent, or 0 if the parent is not a valid object.

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Deprecated. 
Returns the index of a child in the parent.

Specified by:
getIndexOfChild in interface TreeModel
Parameters:
parent - The parent.
child - The child.
Returns:
The index of the child in the parent. It will be -1 if the parent or child are not valid objects or if the child is not in the parent.

getPath

public TreePath getPath(Object object)
Deprecated. 
Returns the path from the root to get to this object in the tree hierarchy. The last element in the path will be this object.

Parameters:
object - The object.
Returns:
The path, or null if the object is not a valid object.

getRoot

public Object getRoot()
Deprecated. 
Returns the root, or the system resource, from which all information for the model is gathered.

Specified by:
getRoot in interface TreeModel
Returns:
The root, or the system resource, from which all information for the model is gathered. It will be null if none has been set.

isLeaf

public boolean isLeaf(Object object)
Deprecated. 
Indicates if the object is a leaf in the tree.

Specified by:
isLeaf in interface TreeModel
Parameters:
object - The object.
Returns:
true if the object is a leaf or the object is not a valid object; false if the object is not a leaf.

load

public void load()
Deprecated. 
Loads the information from the system.


removeErrorListener

public void removeErrorListener(ErrorListener listener)
Deprecated. 
Removes an error listener.

Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Deprecated. 
Removes a property change listener.

Parameters:
listener - The listener.

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener listener)
Deprecated. 
Removes a tree model listener.

Specified by:
removeTreeModelListener in interface TreeModel
Parameters:
listener - The listener.

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener listener)
Deprecated. 
Removes a vetoable change listener.

Parameters:
listener - The listener.

removeWorkingListener

public void removeWorkingListener(WorkingListener listener)
Deprecated. 
Removes a working listener.

Parameters:
listener - The listener.

setRoot

public void setRoot(Object root)
             throws PropertyVetoException
Deprecated. 
Sets the root, or the system resource, from which all information for the model is gathered. It will not take effect until load() is done.

Parameters:
root - The root, or the system resource, from which all information for the model is gathered. This must be a VNode.
Throws:
PropertyVetoException - If the change is vetoed.

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object value)
Deprecated. 
Notifies the object that the value for the item identified by path has changed.

Specified by:
valueForPathChanged in interface TreeModel
Parameters:
path - The path of the item containing the new value.
value - The new value.