com.sas.io
Class Printer

com.sas.io.Printer
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, ComponentInterface, LinkPropertiesInterface, ModelInterface, NodeInterface, SimpleNodeInterface, com.sas.PublicClonable, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class Printer
implements NodeInterface, com.sas.PublicClonable

A class representing Printer attached to a local machine. Based on the Operating System on the local machine creates either a Windows Printer Class or Unix Printer Class(to be added later).

Creating a Printer Component

Printr p = new Printer("\\Novprint\chpljr57");

Usage

Currently, the only functionality this class has is to list the value of the printer's properties. User can query the properties by using getProperties() method.

See Also:
Serialized Form

Field Summary
protected  com.sas.io.WindowsPrinterPeer peer
           
static java.lang.String RB_KEY
           
 
Constructor Summary
Printer()
          Default Constructor
Printer(java.lang.String name)
          Creates a Printer object for a given printer and sets its attributes based on the operting system being used on local machine.
 
Method Summary
 java.lang.Object clone()
          Create a copy of the current model
protected  void commonInit(java.lang.String name)
          Create the printer peer object based on the OS.
 int countNodeChildren(int maximumChildCount)
          Counts the children of the current node. countNodeChildren differs from getNodeChildCount when the number of children is not readily known.
 java.lang.String getComment()
          Gets a brief description of the printer.
 com.sas.visuals.IconInterface getDefaultIcon()
          Returns the default icon for the current node.
 com.sas.visuals.IconInterface getExpandedIcon()
          Returns the expanded icon for the current node.
 com.sas.visuals.IconInterface getExpandedSelectedIcon()
          Sets the expandedSelected icon for the current node.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 SimpleNodeInterface getNodeChild(int index)
          Returns the child node at the specified index.
 int getNodeChildCount()
          Returns the number of children available.
 SimpleNodeInterface[] getNodeChildren(int startIndex, int count)
          Returns the children of the current node in the specified range.
 java.lang.String getNodeExpandedText()
          Returns a the expanded (usually more descriptive) text for the current node.
 java.lang.String getNodeText()
          Gets the name of this node.
 java.lang.String getNodeType()
          Gets the type of this node.
 java.lang.String getPrinterName()
          Gets the name of the printer.
 java.util.Hashtable getProperties()
          Gets the name value pair of Properties of this printer object based on type of operating system.
 java.lang.Object getProperty(java.lang.String name)
          Gets the property value based on the name of the property specified.
 java.util.Hashtable getPropertyDescription()
          Gets the Properties and description of this printer object based on type of operating system.
 com.sas.visuals.IconInterface getSelectedIcon()
          Returns the selected icon for the current node.
 boolean isLeafNode()
          Returns true if this node is a leaf and hence will not have any children, otherwise false. this is always true
 java.lang.String toString()
           
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getLinkInfo, getModelInterface, getRequiredInterfaces, getResources, getStringResource, getViewInterfaceSupportInfo, initialize, initializeComponent, isDesignTime, isLinked, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setComponentDescription, setComponentSupportInfo, setDefaultValues, setLinkInfo, setModelInterface, setRequiredInterfaces, setViewInterfaceSupportInfo, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, validateObject
 

Field Detail

peer

protected transient com.sas.io.WindowsPrinterPeer peer

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

Printer

public Printer()
Default Constructor


Printer

public Printer(java.lang.String name)
Creates a Printer object for a given printer and sets its attributes based on the operting system being used on local machine.

Parameters:
name - name of the printer.
Throws:
Security - exception if cannot access the operating system name on the local machine.
Method Detail

getExtendedBeanInfo

public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Create a copy of the current model

Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class Component
Returns:
a clone of the object.
Throws:
java.lang.CloneNotSupportedException - if the model attached to the component being cloned will not allow the clone to attach.

commonInit

protected void commonInit(java.lang.String name)
Create the printer peer object based on the OS. This is code common to both constructors.

Parameters:
name - The name of the printer. If null, the default peer constructor is used.

getPrinterName

public java.lang.String getPrinterName()
Gets the name of the printer.


getComment

public java.lang.String getComment()
Gets a brief description of the printer.

Returns:
String-Description of the printer eg.HPLaserjet...

getNodeType

public java.lang.String getNodeType()
Gets the type of this node.

Specified by:
getNodeType in interface NodeInterface
Returns:
String specifying the type of this node.

getNodeText

public java.lang.String getNodeText()
Gets the name of this node.

Specified by:
getNodeText in interface NodeInterface
Returns:
String specifying the name of this node.

getProperties

public java.util.Hashtable getProperties()
Gets the name value pair of Properties of this printer object based on type of operating system.

Returns:
a hashtable with property name and value pairs.

getPropertyDescription

public java.util.Hashtable getPropertyDescription()
Gets the Properties and description of this printer object based on type of operating system.

Returns:
a hashtable with property name and descriptionname value pairs pairs.

getProperty

public java.lang.Object getProperty(java.lang.String name)
Gets the property value based on the name of the property specified.

Parameters:
name - of the property

getNodeExpandedText

public java.lang.String getNodeExpandedText()
Returns a the expanded (usually more descriptive) text for the current node.

Specified by:
getNodeExpandedText in interface NodeInterface
Returns:
the nodeExpandedText property

countNodeChildren

public int countNodeChildren(int maximumChildCount)
Counts the children of the current node. countNodeChildren differs from getNodeChildCount when the number of children is not readily known. In such a case, getNodeChildCount will simply return -1 to indicate that the count is unknown, while countNodeChildren will actually compute the answer; thus countNodeChildren is a potentially expensive operation. To limit this potential overhead, a maximum child count may be passed to this method, such that the implementation will not read more than that many children. If exactly the number of children specified as the maximum count to read exists under the current node then a value equal in magnitude but opposite in sign (-maximumChildCount) is returned.

Specified by:
countNodeChildren in interface SimpleNodeInterface
Parameters:
maximumChildCount - the maximum number of children to read, or 0 to read indefinitely
Returns:
The number of children known to be available.

getNodeChildCount

public int getNodeChildCount()
Returns the number of children available. If the number of children is unknown, -1 should be returned.
NOTE: In order to ease transition from the prior version of NodeInterface the unknown option is not yet supported when using NodeInterface with a com.sas.visuals.TreeView. A valid value should be returned from this method when using it in this manner.

Specified by:
getNodeChildCount in interface SimpleNodeInterface
Returns:
the number of children or -1 if unknown

isLeafNode

public boolean isLeafNode()
Returns true if this node is a leaf and hence will not have any children, otherwise false. this is always true

Specified by:
isLeafNode in interface SimpleNodeInterface
Returns:
true if the current node is a leaf, otherwise false

getNodeChild

public SimpleNodeInterface getNodeChild(int index)
Returns the child node at the specified index.

Specified by:
getNodeChild in interface SimpleNodeInterface
Parameters:
index - the index of the child node to retrieve
Returns:
the child at index or null if the leafNode property value is true.

getNodeChildren

public SimpleNodeInterface[] getNodeChildren(int startIndex,
                                             int count)
Returns the children of the current node in the specified range. If there are less children than are queried for, an implementation can return an array whose size if representative of the actual number of children being returned or an array whose size is the same as the number of children asked for. If the resulting array's size is the same as the number asked for and there are fewer children returned than asked for the implementation should assign the unused values in the array to null.

Specified by:
getNodeChildren in interface SimpleNodeInterface
Parameters:
startIndex - index which identifies the start of the range
count - number of children to return
Returns:
an array containing the specified range of children or null if the leafNode property value is true.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDefaultIcon

public com.sas.visuals.IconInterface getDefaultIcon()
Returns the default icon for the current node.


getExpandedIcon

public com.sas.visuals.IconInterface getExpandedIcon()
Returns the expanded icon for the current node. If the expanded icon is null then the result of getDefaultIcon should be returned.


getSelectedIcon

public com.sas.visuals.IconInterface getSelectedIcon()
Returns the selected icon for the current node. If the selected icon is null then the result of getDefaultIcon should be returned.


getExpandedSelectedIcon

public com.sas.visuals.IconInterface getExpandedSelectedIcon()
Sets the expandedSelected icon for the current node. If the expandedSelected icon is null then the result of getExpandedIcon should be returned.




Copyright © 2009 SAS Institute Inc. All Rights Reserved.