com.sas.models
Class FontList

com.sas.models.FontList
All Implemented Interfaces:
com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, CollectionInterface, com.sas.collection.ContentsChangedSource, OrderedCollectionInterface, Sortable, StaticCollectionInterface, StaticOrderedCollectionInterface, ComponentInterface, com.sas.DeepClonable, LinkPropertiesInterface, ModelInterface, NodeInterface, SimpleNodeInterface, TreeInterface, com.sas.PublicClonable, com.sas.util.Countable, com.sas.util.Enumerable, com.sas.util.EventGateInterface, IndexedGetInterface, IndexedSetInterface, ViewInterface, MultipleValueEventSourceInterface, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
DefaultFontList

public class FontList
implements TreeInterface, NodeInterface, com.sas.PublicClonable

This class provides a list of font objects that are available on the system.

See Also:
Serialized Form

Field Summary
protected  java.lang.String NODENAME
           
 
Fields inherited from class com.sas.collection.OrderedCollection
RB_KEY
 
Fields inherited from class com.sas.collection.BaseCollection
allContentsChangedListeners, mappingObject
 
Constructor Summary
FontList()
          The default constructor that fills list with the default fontnames.
 
Method Summary
 void add(Font f)
          Add a com.sas.awt.Font object into this list only if the name is not in the list.
 void add(java.lang.Object f, int index)
          Overridden to call convertObject(Object) first on the item to add to the ColorList.
 void addItems(java.util.Enumeration items, int index)
          Overridden to call convertObject(Object) first on all items in the Enumeration.
 void append(int index, java.lang.Object item)
          Overridden to call convertObject(Object) first on the item to append to the ColorList.
 java.lang.Object clone()
          Create a copy of the current model
protected  java.lang.Object convertObject(java.lang.Object f)
          Convert the specified object to a valid object to add to the FontList.
 int countNodeChildren(int maximumChildCount)
          Counts the children of the current node. countNodeChildren differs from getNodeChildCount when the number of children is not readily known.
static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
           
 Font getFont(java.lang.String fontName)
          Return the Font corresponding to the name provided.
 Font getFont(java.lang.String fontName, int style, int size)
          Return the Font corresponding to the name, style and size provided.
 java.util.Enumeration getFonts()
          Returns an enumeration of java.awt.Font objects.
 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 specified range of children for the current node.
 java.lang.String getNodeExpandedText()
          Returns the value of the nodeExpandedText property.
 java.lang.String getNodeText()
          Returns the value of the nodeText property.
 java.lang.String getNodeType()
          Returns the value of the nodeType property.
 NodeInterface getRoot()
          Gets the root for the tree implementation of the list
 boolean isLeafNode()
          Indicates whether the current node is a leaf.
 void set(int index, java.lang.Object item)
          Overridden to call convertObject(Object) first on the item to set on the ColorList.
 
Methods inherited from class com.sas.collection.OrderedCollection
add, addItems, apply, clone, computeNewCapacity, contains, count, dumpComponent, equals, equals, get, getIndex, getItems, getItems, getLastIndex, moveHole, moveHoleEnsureCapacity, remove, removeAll, removeAll, removeAt, setSize, sort, sort, sort, sort, toArray, toArray, toString
 
Methods inherited from class com.sas.collection.BaseCollection
addContentsChangedListener, anyContentsChangedListeners, disableEvents, enableEvents, enableEvents, fireContentsChanged, map, removeContentsChangedListener, unmap
 
Methods inherited from class com.sas.Component
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, beansIsDesignTime, beansSetDesignTime, clone, detachModel, detachView, 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
 
Methods inherited from interface com.sas.collection.ContentsChangedSource
addContentsChangedListener, removeContentsChangedListener
 
Methods inherited from interface com.sas.beans.PropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

NODENAME

protected java.lang.String NODENAME
Constructor Detail

FontList

public FontList()
The default constructor that fills list with the default fontnames.

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 CollectionInterface
Specified by:
clone in interface OrderedCollectionInterface
Specified by:
clone in interface StaticCollectionInterface
Specified by:
clone in interface StaticOrderedCollectionInterface
Specified by:
clone in interface com.sas.PublicClonable
Overrides:
clone in class OrderedCollection
Returns:
a clone of this collection.
Throws:
java.lang.CloneNotSupportedException - if the clone fails.

getRoot

public NodeInterface getRoot()
Gets the root for the tree implementation of the list

Specified by:
getRoot in interface TreeInterface
Returns:
NodeInterface

convertObject

protected java.lang.Object convertObject(java.lang.Object f)
Convert the specified object to a valid object to add to the FontList. If the object cannot be converted a ClassCastException is thrown.

Parameters:
f - the object to convert to a com.sas.awt.Font
Returns:
the converted com.sas.awt.Font object

add

public void add(java.lang.Object f,
                int index)
Overridden to call convertObject(Object) first on the item to add to the ColorList.

Specified by:
add in interface OrderedCollectionInterface
Overrides:
add in class OrderedCollection
Parameters:
f - the item to add to this collection. The item may exist multiple times in this collection.
index - insert the object before the indexed item. The newly inserted item can be accessed by get(index) afterwards.
See Also:
convertObject(java.lang.Object)

add

public void add(Font f)
Add a com.sas.awt.Font object into this list only if the name is not in the list.

Parameters:
com.sas.awt.Font - object to be added.

addItems

public void addItems(java.util.Enumeration items,
                     int index)
Overridden to call convertObject(Object) first on all items in the Enumeration.

Specified by:
addItems in interface OrderedCollectionInterface
Overrides:
addItems in class OrderedCollection
Parameters:
items - an Enumeration of items to add to this collection
index - insert the objects starting before the indexed item. The first of the newly inserted item can be accessed by get(index) afterwards.
See Also:
convertObject(java.lang.Object)

set

public void set(int index,
                java.lang.Object item)
Overridden to call convertObject(Object) first on the item to set on the ColorList.

Specified by:
set in interface OrderedCollectionInterface
Specified by:
set in interface IndexedSetInterface
Overrides:
set in class OrderedCollection
Parameters:
index - The position where the Object will be placed.
item - The Object to be added to this ordered collection.
See Also:
convertObject(java.lang.Object)

append

public void append(int index,
                   java.lang.Object item)
Overridden to call convertObject(Object) first on the item to append to the ColorList.

Overrides:
append in class OrderedCollection
Parameters:
index - The position where the object will be placed. If necessary, this collection is extended to accommodate the item.
item - the object to be added to this ordered collection.
See Also:
convertObject(java.lang.Object)

getFont

public Font getFont(java.lang.String fontName)
Return the Font corresponding to the name provided.

Parameters:
fontName - a String corresponding to the font
Returns:
Font The com.sas.awt.Font associated with fontName.

getFonts

public java.util.Enumeration getFonts()
Returns an enumeration of java.awt.Font objects.

Returns:
enumeration of java.awt.Font objects.

getFont

public Font getFont(java.lang.String fontName,
                    int style,
                    int size)
Return the Font corresponding to the name, style and size provided.

Parameters:
fontName - a String corresponding to the font
style - style of the font - plain, bold or italic
size - point size of the font
Returns:
Font The com.sas.awt.Font associated with fontName.

getNodeExpandedText

public java.lang.String getNodeExpandedText()
Returns the value of the nodeExpandedText property. The expanded text is usually a more descriptive version of the nodeText property. For example, a node that represents a file can return the file name for the nodeText property and the full path name for the nodeExpandedText property.

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

getNodeText

public java.lang.String getNodeText()
Returns the value of the nodeText property.

Specified by:
getNodeText in interface NodeInterface
Returns:
the nodeText property

getNodeType

public java.lang.String getNodeType()
Returns the value of the nodeType property. The type can be used for categorizing nodes.

Specified by:
getNodeType in interface NodeInterface
Returns:
the nodeType 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) should be 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.

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

isLeafNode

public boolean isLeafNode()
Indicates whether the current node is a leaf. A true value indicates that the current node is a leaf and hence will not have any children.

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 0-based 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 specified range of children for the current node. 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 - 0-based index which identifies the start of the range
count - the amount of children to get
Returns:
an array containing the specified range of children or null if the leafNode property value is true.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.