com.sas.awt.print
Class Annotation

java.lang.Object
  |
  +--com.sas.Component
        |
        +--com.sas.awt.print.Annotation
All Implemented Interfaces:
Alignment, AnnotationInterface, ComponentInterface, LinkPropertiesInterface, ModelInterface, MultipleValueEventSourceInterface, com.sas.beans.PropertyChangeSource, StaticAnnotationInterface, VetoableChangeSource, ViewInterface

public class Annotation
extends com.sas.Component
implements java.lang.Cloneable, java.io.Serializable, AnnotationInterface, Alignment

The Annotation class can be used to construct page annotations, such as Headers and Footers.

You can specify message strings with argument values that will be substituted appropriately. The following argument values are supported:

   {page} = page number
   {date} = Current date
   {time} = Current time
 
 

You can also specify a TransformInterface implementation to perform specific translations

Here's a sample usage via the constructor

 Annotation myHeader = new Annotation("",
                                      "Page {page}",
                                      "");
 

Note that all line number indexes are 1-based.

See Also:
TransformInterface, Serialized Form

Field Summary
static int BOTTOM
           
static String DATE_VARIABLE
           
protected static DateFormat dateFormat
           
protected static Font defaultFont
           
protected  Length mBottomMargin
           
protected  OrderedCollection mCenterMessages
           
protected  Color mColor
           
protected  Font mFont
           
protected  Hashtable mFormatters
           
protected  Length mLeftMargin
           
protected  OrderedCollection mLeftMessages
           
protected  OrderedCollection mLineAttributes
           
protected  Length mRightMargin
           
protected  OrderedCollection mRightMessages
           
protected  int mStartPageNumber
           
protected  Length mTopMargin
           
protected  int mVertJust
           
static String PAGE_VARIABLE
           
static String RB_KEY
           
static String TIME_VARIABLE
           
protected static DateFormat timeFormat
           
static int TOP
           
 
Fields inherited from interface com.sas.visuals.Alignment
BEGIN, CENTER, END
 
Constructor Summary
Annotation()
          Constructors
Annotation(String leftMessage, String centerMessage, String rightMessage)
           
Annotation(String leftMessage, String centerMessage, String rightMessage, int verticalJustification)
           
 
Method Summary
 void addTransformInterface(String text, TransformInterface formatter)
          add a TransformInterface for the given string
 Object clone()
          clone the implementation
protected  OrderedCollection copyElements(OrderedCollection inCollection)
           
 boolean equals(Object o)
           
 Length getBottomMargin()
          return bottom margin value
protected  OrderedCollection getCollection(int align)
           
protected  Annotation.Element getElement(int line, int align)
          get element at given line and position; may return null if nothing is defined at the specified position
 Font getFont(int lineNumber, int align)
          get the Font for a specific line in the annotation at the specific Alignment
 Color getForeground(int lineNumber, int align)
          get the color for the text for a specific line in the annotation at the specific position (Alignment)
 Length getLeftMargin()
          return left margin value
protected  String getLine(int align)
           
 int getLineCount()
          return the number of lines in the annotation
 String getMessage(int lineNumber, int align)
          return the message format string for the given line at the given position (Alignment) in the annotation; may return null if nothing has been defined
 Length getRightMargin()
          return right margin value
 int getStartPageNumber()
          gets the starting page number.
 String getText(int lineNumber, int align)
          get the text to be displayed at the requested Alignment on the page for a given line; any subsitution (formatting) is performed
 Length getTopMargin()
          return top margin value
 TransformInterface getTransformInterface(String text)
          get the TransformInterface for the given string
 Enumeration getTransformInterfaceKeys()
          get the keys for all TransformInterfaces
 int getVerticalJustification()
          get the vertical justification for the annotation.
 void removeAllTransformInterfaces()
          remove all TransformInterfaces
 void removeTransformInterface(String text)
          remove a TransformInterface for the given string
 void setBottomMargin(Length margin)
          set the bottom margin
 void setFont(Font font)
          set the font for all lines in the annotation
 void setFont(Font font, int lineNumber)
          set the font for a specific line (all Alignments) in the annotation
 void setFont(Font font, int lineNumber, int align)
          set the font for a specific line (all Alignments) in the annotation
 void setForeground(Color color)
          set the color for all lines in the annotation
 void setForeground(Color color, int lineNumber)
          set the color for a specific line (all Alignments) in the annotation
 void setForeground(Color color, int lineNumber, int align)
          set the color for a specific line at a specific Alignment in the annotation
 void setLeftMargin(Length margin)
          set the left margin
 void setMessage(String message, int lineNumber, int align)
          set the message format string for a line at a given Alignment.
 void setRightMargin(Length margin)
          set the right margin
 void setTopMargin(Length margin)
          sets the top margin
 void setVerticalJustification(int justification)
          set the vertical justification for the annotation.
 String toString()
          override toString to return a string that represents the lines in the annotation
 
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, getExtendedBeanInfo, 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 class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RB_KEY

public static final String RB_KEY

PAGE_VARIABLE

public static final String PAGE_VARIABLE

DATE_VARIABLE

public static final String DATE_VARIABLE

TIME_VARIABLE

public static final String TIME_VARIABLE

mLeftMessages

protected OrderedCollection mLeftMessages

mRightMessages

protected OrderedCollection mRightMessages

mCenterMessages

protected OrderedCollection mCenterMessages

mLineAttributes

protected OrderedCollection mLineAttributes

defaultFont

protected static final Font defaultFont

mStartPageNumber

protected int mStartPageNumber

mVertJust

protected int mVertJust

mColor

protected Color mColor

mFont

protected Font mFont

mTopMargin

protected Length mTopMargin

mBottomMargin

protected Length mBottomMargin

mLeftMargin

protected Length mLeftMargin

mRightMargin

protected Length mRightMargin

TOP

public static final int TOP

BOTTOM

public static final int BOTTOM

dateFormat

protected static DateFormat dateFormat

timeFormat

protected static DateFormat timeFormat

mFormatters

protected Hashtable mFormatters
Constructor Detail

Annotation

public Annotation()
Constructors

Annotation

public Annotation(String leftMessage,
                  String centerMessage,
                  String rightMessage)

Annotation

public Annotation(String leftMessage,
                  String centerMessage,
                  String rightMessage,
                  int verticalJustification)
Method Detail

setMessage

public void setMessage(String message,
                       int lineNumber,
                       int align)
set the message format string for a line at a given Alignment. The line index is 1-based
Specified by:
setMessage in interface AnnotationInterface
Parameters:
String - message format string
int - - line number
int - - Alignment value

addTransformInterface

public void addTransformInterface(String text,
                                  TransformInterface formatter)
add a TransformInterface for the given string
Specified by:
addTransformInterface in interface AnnotationInterface
Parameters:
String - to translate
TransformInterface - - formatter

getTransformInterface

public TransformInterface getTransformInterface(String text)
get the TransformInterface for the given string
Parameters:
String - to translate
Returns:
TransformInterface - formatter

getTransformInterfaceKeys

public Enumeration getTransformInterfaceKeys()
get the keys for all TransformInterfaces
Returns:
Enumeration of TransformInterface keys

removeTransformInterface

public void removeTransformInterface(String text)
remove a TransformInterface for the given string
Parameters:
String - to translate

removeAllTransformInterfaces

public void removeAllTransformInterfaces()
remove all TransformInterfaces

getMessage

public String getMessage(int lineNumber,
                         int align)
return the message format string for the given line at the given position (Alignment) in the annotation; may return null if nothing has been defined
Specified by:
getMessage in interface StaticAnnotationInterface
Parameters:
int - - line number
int - - Alignment value
Returns:
String message format string

setForeground

public void setForeground(Color color)
set the color for all lines in the annotation
Specified by:
setForeground in interface AnnotationInterface
Parameters:
color - - the new line color.

setForeground

public void setForeground(Color color,
                          int lineNumber)
set the color for a specific line (all Alignments) in the annotation
Specified by:
setForeground in interface AnnotationInterface
Parameters:
color - - the new line color.
lineNumber - - the line number of the message

setForeground

public void setForeground(Color color,
                          int lineNumber,
                          int align)
set the color for a specific line at a specific Alignment in the annotation
Specified by:
setForeground in interface AnnotationInterface
Parameters:
color - - the new line color.
int - - the line number of the message
int - - Alignment value

getForeground

public Color getForeground(int lineNumber,
                           int align)
get the color for the text for a specific line in the annotation at the specific position (Alignment)
Specified by:
getForeground in interface StaticAnnotationInterface
Parameters:
int - - the line number of the message
int - - alignment value
Returns:
the color asked for

setFont

public void setFont(Font font)
set the font for all lines in the annotation
Specified by:
setFont in interface AnnotationInterface
Parameters:
font - - the new line font.

setFont

public void setFont(Font font,
                    int lineNumber)
set the font for a specific line (all Alignments) in the annotation
Specified by:
setFont in interface AnnotationInterface
Parameters:
font - - the new line font.
lineNumber - - the line number of the message

setFont

public void setFont(Font font,
                    int lineNumber,
                    int align)
set the font for a specific line (all Alignments) in the annotation
Specified by:
setFont in interface AnnotationInterface
Parameters:
Font - - the new line font.
int - - the line number of the message
int - - Alignment value

getFont

public Font getFont(int lineNumber,
                    int align)
get the Font for a specific line in the annotation at the specific Alignment
Specified by:
getFont in interface StaticAnnotationInterface
Parameters:
int - - the line number of the annotation
int - - Alignment value
Returns:
the font for the specifed line.

setTopMargin

public void setTopMargin(Length margin)
sets the top margin
Specified by:
setTopMargin in interface AnnotationInterface
Parameters:
Length - com.sas.measures.Length specifying the top margin

getTopMargin

public Length getTopMargin()
return top margin value
Specified by:
getTopMargin in interface StaticAnnotationInterface
Returns:
Length Length object specifying the top margin

setBottomMargin

public void setBottomMargin(Length margin)
set the bottom margin
Specified by:
setBottomMargin in interface AnnotationInterface
Parameters:
Length - com.sas.measures.Length specifying the bottom margin

getBottomMargin

public Length getBottomMargin()
return bottom margin value
Specified by:
getBottomMargin in interface StaticAnnotationInterface
Returns:
Length Length object specifying the bottom margin

setLeftMargin

public void setLeftMargin(Length margin)
set the left margin
Specified by:
setLeftMargin in interface AnnotationInterface
Parameters:
Length - com.sas.measures.Length specifying the left margin

getLeftMargin

public Length getLeftMargin()
return left margin value
Specified by:
getLeftMargin in interface StaticAnnotationInterface
Returns:
Length Length object specifying the left margin

setRightMargin

public void setRightMargin(Length margin)
set the right margin
Specified by:
setRightMargin in interface AnnotationInterface
Parameters:
Length - com.sas.measures.Length specifying the right margin

getRightMargin

public Length getRightMargin()
return right margin value
Specified by:
getRightMargin in interface StaticAnnotationInterface
Returns:
Length Length object specifying the right margin

getStartPageNumber

public int getStartPageNumber()
gets the starting page number. The default starting page number is 1.
Returns:
int starting page number

getText

public String getText(int lineNumber,
                      int align)
get the text to be displayed at the requested Alignment on the page for a given line; any subsitution (formatting) is performed
Specified by:
getText in interface StaticAnnotationInterface
Parameters:
int - - line number
int - - Alignment value
Returns:
String formatted text string

getVerticalJustification

public int getVerticalJustification()
get the vertical justification for the annotation. The justification should be set to Annotation.TOP for headers and Annotation.BOTTOM for footers.
Specified by:
getVerticalJustification in interface StaticAnnotationInterface
Returns:
int vertical justification

setVerticalJustification

public void setVerticalJustification(int justification)
set the vertical justification for the annotation. The justification should be set to Annotation.TOP for headers and Annotation.BOTTOM for footers.
Specified by:
setVerticalJustification in interface AnnotationInterface
Parameters:
int - vertical justification

getLineCount

public int getLineCount()
return the number of lines in the annotation
Specified by:
getLineCount in interface StaticAnnotationInterface
Returns:
int - numer of lines

toString

public String toString()
override toString to return a string that represents the lines in the annotation
Overrides:
toString in class Object

getLine

protected String getLine(int align)

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getCollection

protected final OrderedCollection getCollection(int align)

clone

public Object clone()
Description copied from interface: AnnotationInterface
clone the implementation
Specified by:
clone in interface AnnotationInterface
Overrides:
clone in class com.sas.Component

getElement

protected final Annotation.Element getElement(int line,
                                              int align)
get element at given line and position; may return null if nothing is defined at the specified position

copyElements

protected OrderedCollection copyElements(OrderedCollection inCollection)




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 01:47:04