com.ibm.as400.vaccess

Class AS400TreeModel

  • java.lang.Object
    • com.ibm.as400.vaccess.AS400TreeModel
  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.tree.TreeModel

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

    public class AS400TreeModel
    extends java.lang.Object
    implements javax.swing.tree.TreeModel, java.io.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:

    • ErrorEvent
    • PropertyChangeEvent
    • TreeModelEvent
    • WorkingEvent

    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

      Constructors 
      Constructor and Description
      AS400TreeModel()
      Deprecated. 
      Constructs an AS400TreeModel object.
      AS400TreeModel(VNode root)
      Deprecated. 
      Constructs an AS400TreeModel object.
    • Method Summary

      Methods 
      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.
      • 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(java.beans.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(javax.swing.event.TreeModelListener listener)
        Deprecated. 
        Adds a listener to be notified when the contents of the tree change.
        Specified by:
        addTreeModelListener in interface javax.swing.tree.TreeModel
        Parameters:
        listener - The listener.
      • addVetoableChangeListener

        public void addVetoableChangeListener(java.beans.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 java.lang.Object getChild(java.lang.Object parent,
                                int index)
        Deprecated. 
        Returns a child of the parent.
        Specified by:
        getChild in interface javax.swing.tree.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(java.lang.Object parent)
        Deprecated. 
        Returns the number of children of the parent.
        Specified by:
        getChildCount in interface javax.swing.tree.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(java.lang.Object parent,
                          java.lang.Object child)
        Deprecated. 
        Returns the index of a child in the parent.
        Specified by:
        getIndexOfChild in interface javax.swing.tree.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 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. 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 java.lang.Object getRoot()
        Deprecated. 
        Returns the root, or the system resource, from which all information for the model is gathered.
        Specified by:
        getRoot in interface javax.swing.tree.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(java.lang.Object object)
        Deprecated. 
        Indicates if the object is a leaf in the tree.
        Specified by:
        isLeaf in interface javax.swing.tree.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(java.beans.PropertyChangeListener listener)
        Deprecated. 
        Removes a property change listener.
        Parameters:
        listener - The listener.
      • removeTreeModelListener

        public void removeTreeModelListener(javax.swing.event.TreeModelListener listener)
        Deprecated. 
        Removes a tree model listener.
        Specified by:
        removeTreeModelListener in interface javax.swing.tree.TreeModel
        Parameters:
        listener - The listener.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(java.beans.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(java.lang.Object root)
                     throws java.beans.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:
        java.beans.PropertyVetoException - If the change is vetoed.
      • valueForPathChanged

        public 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.
        Specified by:
        valueForPathChanged in interface javax.swing.tree.TreeModel
        Parameters:
        path - The path of the item containing the new value.
        value - The new value.