com.ibm.as400.vaccess
Class AS400TreePane

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.ibm.as400.vaccess.AS400TreePane
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class AS400TreePane
extends javax.swing.JComponent
implements java.io.Serializable

The AS400TreePane class represents a graphical user interface that presents a tree, where all information for the tree is gathered from the hierarchy of objects rooted at an AS/400 resource. You must explicitly call load() to load the information from the AS/400.

Most errors are reported as ErrorEvents rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.

AS400TreePane objects generate the following events:

The following example creates a tree pane filled with the contents of a directory in the integrated file system of an AS/400.

// Set up the tree pane.
AS400 system = new AS400 ("MySystem", "Userid", "Password");
VIFSDirectory directory = new VIFSDirectory (system, "/myDirectory");
AS400TreePane treePane = new AS400TreePane (directory);
treePane.load ();

// Add the tree pane to a frame. JFrame frame = new JFrame ("My Window"); frame.getContentPane().add (treePane);

See Also:
AS400TreeModel, Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
AS400TreePane()
          Constructs an AS400TreePane object.
AS400TreePane(VNode root)
          Constructs an AS400TreePane object.
 
Method Summary
 void addErrorListener(ErrorListener listener)
          Adds a listener to be notified when an error occurs.
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a listener to be notified when the value of any bound property changes.
 void addTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
          Adds a listener to be notified when a tree selection occurs.
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a listener to be notified when the value of any constrained property changes.
 void collapse(VNode object)
          Collapses the specified object.
 void expand(VNode object)
          Expands the specified object.
 VActionContext getActionContext()
          Returns the context in which actions will be performed.
 boolean getAllowActions()
          Indicates if actions can be invoked on objects.
 boolean getConfirm()
          Indicates if certain actions are confirmed with the user.
 javax.swing.tree.TreeModel getModel()
          Returns the model which contains the data for the tree.
 javax.swing.tree.TreePath getPath(VNode object)
          Returns the path from the root to get to this object in the tree hierarchy.
 VNode getRoot()
          Returns the root, or the AS/400 resource, from which all information for the model is gathered.
 VNode getSelectedObject()
          Returns the first selected object.
 VNode[] getSelectedObjects()
          Returns the selected objects.
 javax.swing.tree.TreeSelectionModel getSelectionModel()
          Returns the selection model that is used to maintain selection state.
 boolean isCollapsed(VNode object)
          Indicates if the object is currently collapsed.
 boolean isExpanded(VNode object)
          Indicates if the object is currently expanded.
 boolean isSelected(VNode object)
          Indicates if the object is selected.
 boolean isVisible(VNode object)
          Indicates if the object is currently visible.
 void load()
          Loads the information from the AS/400.
 void makeVisible(VNode object)
          Makes the object visible in the tree by expanding its parent objects as needed.
 void removeErrorListener(ErrorListener listener)
          Removes an error listener.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener.
 void removeTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
          Removes a tree selection listener.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes a vetoable change listener.
 void setAllowActions(boolean allowActions)
          Sets whether actions are allowed.
 void setConfirm(boolean confirm)
          Sets whether certain actions are confirmed with the user.
 void setRoot(VNode root)
          Sets the root, or the AS/400 resource, from which all information for the model is gathered.
 void setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
          Sets the selection model that is used to maintain selection state.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AS400TreePane

public AS400TreePane()
Constructs an AS400TreePane object.

AS400TreePane

public AS400TreePane(VNode root)
Constructs an AS400TreePane object.
Parameters:
root - The root, or the AS/400 resource, from which all information for the model is gathered.
Method Detail

addErrorListener

public void addErrorListener(ErrorListener listener)
Adds a listener to be notified when an error occurs.
Parameters:
listener - The listener.

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a listener to be notified when the value of any bound property changes.
Overrides:
addPropertyChangeListener in class javax.swing.JComponent
Parameters:
listener - The listener.

addTreeSelectionListener

public void addTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
Adds a listener to be notified when a tree selection occurs.
Parameters:
listener - The listener.

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
Adds a listener to be notified when the value of any constrained property changes.
Overrides:
addVetoableChangeListener in class javax.swing.JComponent
Parameters:
listener - The listener.

collapse

public void collapse(VNode object)
Collapses the specified object.
Parameters:
object - The object.

expand

public void expand(VNode object)
Expands the specified object.
Parameters:
object - The object.

getActionContext

public VActionContext getActionContext()
Returns the context in which actions will be performed.
Returns:
The action context.

getAllowActions

public boolean getAllowActions()
Indicates if actions can be invoked on objects.
Returns:
true if actions can be invoked; false otherwise.

getConfirm

public boolean getConfirm()
Indicates if certain actions are confirmed with the user.
Returns:
true if certain actions are confirmed with the user; false otherwise.

getModel

public javax.swing.tree.TreeModel getModel()
Returns the model which contains the data for the tree.
Returns:
The tree model.

getPath

public javax.swing.tree.TreePath getPath(VNode object)
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 VNode getRoot()
Returns the root, or the AS/400 resource, from which all information for the model is gathered.
Returns:
The root, or the AS/400 resource, from which all information for the model is gathered. It will be null if none has been set.

getSelectedObject

public VNode getSelectedObject()
Returns the first selected object.
Returns:
The first selected object, or null if none are selected.

getSelectedObjects

public VNode[] getSelectedObjects()
Returns the selected objects.
Returns:
The selected objects.

getSelectionModel

public javax.swing.tree.TreeSelectionModel getSelectionModel()
Returns the selection model that is used to maintain selection state. This provides the ability to programmatically select and deselect objects.
Returns:
The selection model, or null if selections are not allowed.

isCollapsed

public boolean isCollapsed(VNode object)
Indicates if the object is currently collapsed.
Parameters:
object - The object.
Returns:
true if the object is collapsed; false otherwise.

isExpanded

public boolean isExpanded(VNode object)
Indicates if the object is currently expanded.
Parameters:
object - The object.
Returns:
true if the object is expanded; false otherwise.

isSelected

public boolean isSelected(VNode object)
Indicates if the object is selected.
Parameters:
object - The object.
Returns:
true if the object is selected; false otherwise.

isVisible

public boolean isVisible(VNode object)
Indicates if the object is currently visible.
Parameters:
object - The object.
Returns:
true if the object is visible; false otherwise.

load

public void load()
Loads the information from the AS/400.

makeVisible

public void makeVisible(VNode object)
Makes the object visible in the tree by expanding its parent objects as needed.
Parameters:
object - The object.

removeErrorListener

public void removeErrorListener(ErrorListener listener)
Removes an error listener.
Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener.
Overrides:
removePropertyChangeListener in class javax.swing.JComponent
Parameters:
listener - The listener.

removeTreeSelectionListener

public void removeTreeSelectionListener(javax.swing.event.TreeSelectionListener listener)
Removes a tree selection listener.
Parameters:
listener - The listener.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a vetoable change listener.
Overrides:
removeVetoableChangeListener in class javax.swing.JComponent
Parameters:
listener - The listener.

setAllowActions

public void setAllowActions(boolean allowActions)
Sets whether actions are allowed. The following are enabled only when actions are allowed:

The default is true.

Parameters:
allowActions - true if actions are allowed; false otherwise.

setConfirm

public void setConfirm(boolean confirm)
Sets whether certain actions are confirmed with the user. The default is true.
Parameters:
confirm - true if certain actions are confirmed with the user; false otherwise.

setRoot

public void setRoot(VNode root)
             throws java.beans.PropertyVetoException
Sets the root, or the AS/400 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 AS/400 resource, from which all information for the model is gathered.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setSelectionModel

public void setSelectionModel(javax.swing.tree.TreeSelectionModel selectionModel)
Sets the selection model that is used to maintain selection state. This provides the ability to programmatically select and deselect objects.
Parameters:
selectionModel - The selection model, or null if selections are not allowed.