com.ibm.as400.vaccess
Class VPrinters

java.lang.Object
  |
  +--com.ibm.as400.vaccess.VPrinters
All Implemented Interfaces:
java.io.Serializable, javax.swing.tree.TreeNode, VNode, VObject

public class VPrinters
extends java.lang.Object
implements VNode, java.io.Serializable

The VPrinters class represents a list of AS/400 printers for use in various models and panes in this package.

Both the children and details children of a VPrinters object are the printers (VPrinter objects) in this list.

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

VPrinters objects generate the following events:

See Also:
Serialized Form

Fields inherited from interface com.ibm.as400.vaccess.VObject
DESCRIPTION_PROPERTY, NAME_PROPERTY
 
Constructor Summary
VPrinters()
          Constructs a VPrinters object.
VPrinters(AS400 system)
          Constructs a VPrinters object.
VPrinters(VNode parent, AS400 system)
          Constructs a VPrinters 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 addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Adds a listener to be notified when the value of any constrained property changes.
 void addVObjectListener(VObjectListener listener)
          Adds a listener to be notified when a VObject is changed, created, or deleted.
 void addWorkingListener(WorkingListener listener)
          Adds a listener to be notified when work starts and stops on potentially long-running operations.
 java.util.Enumeration children()
          Returns the children of the node.
 VAction[] getActions()
          Returns the list of actions that can be performed.
 boolean getAllowsChildren()
          Indiciates if the node allows children.
 javax.swing.tree.TreeNode getChildAt(int index)
          Returns the child node at the specified index.
 int getChildCount()
          Returns the number of children.
 VAction getDefaultAction()
          Returns the default action.
 VObject getDetailsChildAt(int index)
          Returns the child for the details at the specified index.
 int getDetailsChildCount()
          Returns the number of children for the details.
 javax.swing.table.TableColumnModel getDetailsColumnModel()
          Returns the table column model to use in the details when representing the children.
 int getDetailsIndex(VObject detailsChild)
          Returns the index of the specified child for the details.
 javax.swing.Icon getIcon(int size, boolean open)
          Returns the icon.
 int getIndex(javax.swing.tree.TreeNode child)
          Returns the index of the specified child.
 javax.swing.tree.TreeNode getParent()
          Returns the parent node.
 java.lang.String getPrinterFilter()
          Returns the printer list filter.
 VPropertiesPane getPropertiesPane()
          Returns the properties pane.
 java.lang.Object getPropertyValue(java.lang.Object propertyIdentifier)
          Returns a property value.
 AS400 getSystem()
          Returns the AS/400 from which the list will be retrieved.
 java.lang.String getText()
          Returns the text.
 boolean isLeaf()
          Indicates if the node is a leaf.
 boolean isSortable()
          Indicates if the details children are sortable.
 void load()
          Loads information about the object from the AS/400.
 void removeErrorListener(ErrorListener listener)
          Removes an error listener.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a property change listener.
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          Removes a vetoable change listener.
 void removeVObjectListener(VObjectListener listener)
          Removes a VObjectListener.
 void removeWorkingListener(WorkingListener listener)
          Removes a working listener.
 void setPrinterFilter(java.lang.String printerFilter)
          Sets printer list filter.
 void setSystem(AS400 system)
          Sets the AS/400 from which the list will be retrieved.
 void sortDetailsChildren(java.lang.Object[] propertyIdentifiers, boolean[] orders)
          Sorts the children for the details.
 java.lang.String toString()
          Returns the string representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VPrinters

public VPrinters()
Constructs a VPrinters object.

VPrinters

public VPrinters(AS400 system)
Constructs a VPrinters object.
Parameters:
system - The AS/400 from which the list will be retrieved.

VPrinters

public VPrinters(VNode parent,
                 AS400 system)
Constructs a VPrinters object.
Parameters:
parent - The parent.
system - The AS/400 from which the list will be retrieved.
Method Detail

addErrorListener

public void addErrorListener(ErrorListener listener)
Adds a listener to be notified when an error occurs.
Specified by:
addErrorListener in interface VObject
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.
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.
Parameters:
listener - The listener.

addVObjectListener

public void addVObjectListener(VObjectListener listener)
Adds a listener to be notified when a VObject is changed, created, or deleted.
Specified by:
addVObjectListener in interface VObject
Parameters:
listener - The listener.

addWorkingListener

public void addWorkingListener(WorkingListener listener)
Adds a listener to be notified when work starts and stops on potentially long-running operations.
Specified by:
addWorkingListener in interface VObject
Parameters:
listener - The listener.

children

public java.util.Enumeration children()
Returns the children of the node. The children are the printers.
Specified by:
children in interface javax.swing.tree.TreeNode
Returns:
The children.

getActions

public VAction[] getActions()
Returns the list of actions that can be performed.
Specified by:
getActions in interface VObject
Returns:
Always null. There are no actions.

getAllowsChildren

public boolean getAllowsChildren()
Indiciates if the node allows children.
Specified by:
getAllowsChildren in interface javax.swing.tree.TreeNode
Returns:
Always true.

getChildAt

public javax.swing.tree.TreeNode getChildAt(int index)
Returns the child node at the specified index.
Specified by:
getChildAt in interface javax.swing.tree.TreeNode
Parameters:
index - The index.
Returns:
The child node, or null if the index is not valid.

getChildCount

public int getChildCount()
Returns the number of children. This is the number of printers.
Specified by:
getChildCount in interface javax.swing.tree.TreeNode
Returns:
The number of children.

getDefaultAction

public VAction getDefaultAction()
Returns the default action.
Specified by:
getDefaultAction in interface VObject
Returns:
Always null. There is no default action.

getDetailsChildAt

public VObject getDetailsChildAt(int index)
Returns the child for the details at the specified index.
Specified by:
getDetailsChildAt in interface VNode
Parameters:
index - The index.
Returns:
The child, or null if the index is not valid.

getDetailsChildCount

public int getDetailsChildCount()
Returns the number of children for the details.
Specified by:
getDetailsChildCount in interface VNode
Returns:
The number of children for the details.

getDetailsColumnModel

public javax.swing.table.TableColumnModel getDetailsColumnModel()
Returns the table column model to use in the details when representing the children. This column model describes the details values for the children.
Specified by:
getDetailsColumnModel in interface VNode
Returns:
The details column model.

getDetailsIndex

public int getDetailsIndex(VObject detailsChild)
Returns the index of the specified child for the details.
Specified by:
getDetailsIndex in interface VNode
Parameters:
detailsChild - The details child.
Returns:
The index, or -1 if the child is not found in the details.

getIcon

public javax.swing.Icon getIcon(int size,
                                boolean open)
Returns the icon.
Specified by:
getIcon in interface VObject
Parameters:
size - The icon size, either 16 or 32. If any other value is given, then return the default of 16.
open - This parameter has no effect.
Returns:
The icon.

getIndex

public int getIndex(javax.swing.tree.TreeNode child)
Returns the index of the specified child.
Specified by:
getIndex in interface javax.swing.tree.TreeNode
Parameters:
child - The child.
Returns:
The index, or -1 if the child is not found.

getParent

public javax.swing.tree.TreeNode getParent()
Returns the parent node.
Specified by:
getParent in interface javax.swing.tree.TreeNode
Returns:
The parent node, or null if there is no parent.

getPrinterFilter

public java.lang.String getPrinterFilter()
Returns the printer list filter.
Returns:
The printer filter.

getPropertiesPane

public VPropertiesPane getPropertiesPane()
Returns the properties pane.
Specified by:
getPropertiesPane in interface VObject
Returns:
The properties pane.

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object propertyIdentifier)
Returns a property value.
Specified by:
getPropertyValue in interface VObject
Parameters:
propertyIdentifier - The property identifier. The choices are
  • NAME_PROPERTY
  • DESCRIPTION_PROPERTY
Returns:
The property value, or null if the property identifier is not recognized.

getSystem

public AS400 getSystem()
Returns the AS/400 from which the list will be retrieved.
Returns:
The AS/400 from which the list will be retrieved.

getText

public java.lang.String getText()
Returns the text. This is a constant string which identifies this object as a list of printers.
Specified by:
getText in interface VObject
Returns:
The text.

isLeaf

public boolean isLeaf()
Indicates if the node is a leaf.
Specified by:
isLeaf in interface javax.swing.tree.TreeNode
Returns:
true if the node if a leaf; false otherwise.

isSortable

public boolean isSortable()
Indicates if the details children are sortable.
Specified by:
isSortable in interface VNode
Returns:
Always false.

load

public void load()
Loads information about the object from the AS/400.
Specified by:
load in interface VObject

removeErrorListener

public void removeErrorListener(ErrorListener listener)
Removes an error listener.
Specified by:
removeErrorListener in interface VObject
Parameters:
listener - The listener.

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a property change listener.
Parameters:
listener - The listener.

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
Removes a vetoable change listener.
Parameters:
listener - The listener.

removeVObjectListener

public void removeVObjectListener(VObjectListener listener)
Removes a VObjectListener.
Specified by:
removeVObjectListener in interface VObject
Parameters:
listener - The listener.

removeWorkingListener

public void removeWorkingListener(WorkingListener listener)
Removes a working listener.
Specified by:
removeWorkingListener in interface VObject
Parameters:
listener - The listener.

setPrinterFilter

public void setPrinterFilter(java.lang.String printerFilter)
                      throws java.beans.PropertyVetoException
Sets printer list filter. A call to load() must be done after calling this funtion inorder to update the details and tree children.
Parameters:
printerFilter - The name of the printers to list. It cannot be greater than 10 characters in length. It can be a specific name, a generic name, or the special value *ALL. The default for the printerFilter is *ALL.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

setSystem

public void setSystem(AS400 system)
               throws java.beans.PropertyVetoException
Sets the AS/400 from which the list will be retrieved. A call to load() must be done after calling this funtion inorder to update the details and tree children.
Parameters:
system - The AS/400 from which the list will be retrieved.
Throws:
java.beans.PropertyVetoException - If the change is vetoed.

sortDetailsChildren

public void sortDetailsChildren(java.lang.Object[] propertyIdentifiers,
                                boolean[] orders)
Sorts the children for the details. Since sorting is not supported, this method does nothing.
Specified by:
sortDetailsChildren in interface VNode
Parameters:
propertyIdentifiers - The property identifiers.
orders - The sort orders for each property identifier; true for ascending order, false for descending order.

toString

public java.lang.String toString()
Returns the string representation. This is a constant string which identifies this object as a list of printers.
Overrides:
toString in class java.lang.Object
Returns:
The string representation.