|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.as400.vaccess.AS400TreeModel
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));
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(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 |
---|
public AS400TreeModel()
public AS400TreeModel(VNode root)
root
- The root, or the system resource, from which all information for the model is gathered.Method Detail |
---|
public void addErrorListener(ErrorListener listener)
listener
- The listener.public void addPropertyChangeListener(PropertyChangeListener listener)
listener
- The listener.public void addTreeModelListener(TreeModelListener listener)
addTreeModelListener
in interface TreeModel
listener
- The listener.public void addVetoableChangeListener(VetoableChangeListener listener)
listener
- The listener.public void addWorkingListener(WorkingListener listener)
listener
- The listener.public Object getChild(Object parent, int index)
getChild
in interface TreeModel
parent
- The parent.index
- The index of the child.public int getChildCount(Object parent)
getChildCount
in interface TreeModel
parent
- The parent.public int getIndexOfChild(Object parent, Object child)
getIndexOfChild
in interface TreeModel
parent
- The parent.child
- The child.public TreePath getPath(Object object)
object
- The object.public Object getRoot()
getRoot
in interface TreeModel
public boolean isLeaf(Object object)
isLeaf
in interface TreeModel
object
- The object.public void load()
public void removeErrorListener(ErrorListener listener)
listener
- The listener.public void removePropertyChangeListener(PropertyChangeListener listener)
listener
- The listener.public void removeTreeModelListener(TreeModelListener listener)
removeTreeModelListener
in interface TreeModel
listener
- The listener.public void removeVetoableChangeListener(VetoableChangeListener listener)
listener
- The listener.public void removeWorkingListener(WorkingListener listener)
listener
- The listener.public void setRoot(Object root) throws PropertyVetoException
root
- The root, or the system resource, from which all
information for the model is gathered. This must
be a VNode.PropertyVetoException
- If the change is vetoed.public void valueForPathChanged(TreePath path, Object value)
valueForPathChanged
in interface TreeModel
path
- The path of the item containing the new value.value
- The new value.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |