org.ujac.print
Interface AttributeHandler

All Known Implementing Classes:
DefaultAttributeHandler

public interface AttributeHandler

Name: AttributeParser
Description: Parses argument values from given strings.

Author:
lauerc

Method Summary
 TypedAttributeHandler getBooleanHandler()
          Gets the boolean attribute handler.
 TypedAttributeHandler getBorderHandler()
          Gets the boolean attribute handler.
 TypedAttributeHandler getColorHandler()
          Gets the color attribute handler.
 TypedAttributeHandler getDimensionHandler()
          Gets the dimension attribute handler.
 TypedAttributeHandler getDoubleHandler()
          Gets the double attribute handler.
 TypedAttributeHandler getEscapeSequenceTextHandler()
          Gets the integer attribute handler.
 TypedAttributeHandler getFloatHandler()
          Gets the float attribute handler.
 TypedAttributeHandler getHorizontalAlignmentHandler()
          Gets the horizontal alignment attribute handler.
 TypedAttributeHandler getIntegerHandler()
          Gets the integer attribute handler.
 TypedAttributeHandler getTextHandler()
          Gets the integer attribute handler.
 TypedAttributeHandler getVerticalAlignmentHandler()
          Gets the vertical alignment attribute handler.
 boolean parseBooleanAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Gets the boolean value for the given attribute's name.
 int parseBorderAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses the border value from the given attribute.
 Color parseColorAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses the color value from the given attribute.
 float parseDimensionAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses a dimension value from the given string.
 double parseDoubleAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses a double value from the given string.
 float parseFloatAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses a float value from the given string.
 int parseHorizontalAlignmentAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses the horizontal alignment value from the given attribute.
 int parseIntAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses an integer value from the given string.
 String parseTextAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate, boolean translateEscapeSequences)
          Gets the value for the given attribute's name.
 int parseVerticalAlignmentAttribute(Locator locator, String attrName, Object attrValue, boolean evaluate)
          Parses the vertical alignment value from the given attribute.
 void setDocumentHandler(DocumentHandler documentHandler)
          Sets the document handler.
 Object typeCastAttributeValue(Locator locator, AttributeDefinition attrDef, String attrName, Object value)
          Casts the given object value into a the correct type for the specified attribute definition.
 

Method Detail

setDocumentHandler

void setDocumentHandler(DocumentHandler documentHandler)
Sets the document handler.

Parameters:
documentHandler - The document handler to set.

typeCastAttributeValue

Object typeCastAttributeValue(Locator locator,
                              AttributeDefinition attrDef,
                              String attrName,
                              Object value)
                              throws DocumentHandlerException
Casts the given object value into a the correct type for the specified attribute definition.

Parameters:
locator - The source locator.
attrDef - The attribute definition.
attrName - The attribute name.
value - The value to convert.
Returns:
The converted value.
Throws:
DocumentHandlerException - In case the type conversion failed.

parseTextAttribute

String parseTextAttribute(Locator locator,
                          String attrName,
                          Object attrValue,
                          boolean evaluate,
                          boolean translateEscapeSequences)
                          throws TagAttributeException
Gets the value for the given attribute's name. Works like method getStringAttribute(java.lang.String, java.lang.String, boolean) but takes care of escape sequences.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
translateEscapeSequences - Tells whether or not to translate escape sequences.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

parseFloatAttribute

float parseFloatAttribute(Locator locator,
                          String attrName,
                          Object attrValue,
                          boolean evaluate)
                          throws TagAttributeException
Parses a float value from the given string.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseDimensionAttribute

float parseDimensionAttribute(Locator locator,
                              String attrName,
                              Object attrValue,
                              boolean evaluate)
                              throws TagAttributeException
Parses a dimension value from the given string.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseDoubleAttribute

double parseDoubleAttribute(Locator locator,
                            String attrName,
                            Object attrValue,
                            boolean evaluate)
                            throws TagAttributeException
Parses a double value from the given string.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseIntAttribute

int parseIntAttribute(Locator locator,
                      String attrName,
                      Object attrValue,
                      boolean evaluate)
                      throws TagAttributeException
Parses an integer value from the given string.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseBooleanAttribute

boolean parseBooleanAttribute(Locator locator,
                              String attrName,
                              Object attrValue,
                              boolean evaluate)
                              throws TagAttributeException
Gets the boolean value for the given attribute's name.

Parameters:
locator - The tag source locator.
attrName - The attribute's name.
attrValue - The argument value.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The determined value.
Throws:
TagAttributeException - if the item contains an invalid value or an required attribute was not defined.

parseColorAttribute

Color parseColorAttribute(Locator locator,
                          String attrName,
                          Object attrValue,
                          boolean evaluate)
                          throws TagAttributeException
Parses the color value from the given attribute.

Parameters:
locator - The tag source locator.
attrName - The name of the attribute to parse.
attrValue - The attribute value to parse.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The resulting border style.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseBorderAttribute

int parseBorderAttribute(Locator locator,
                         String attrName,
                         Object attrValue,
                         boolean evaluate)
                         throws TagAttributeException
Parses the border value from the given attribute.

Parameters:
locator - The tag source locator.
attrName - The name of the attribute to parse.
attrValue - The attribute value to parse.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The resulting border style.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseHorizontalAlignmentAttribute

int parseHorizontalAlignmentAttribute(Locator locator,
                                      String attrName,
                                      Object attrValue,
                                      boolean evaluate)
                                      throws TagAttributeException
Parses the horizontal alignment value from the given attribute.

Parameters:
locator - The tag source locator.
attrName - The name of the attribute to parse.
attrValue - The attribute value to parse.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The resulting horizontal alignment.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

parseVerticalAlignmentAttribute

int parseVerticalAlignmentAttribute(Locator locator,
                                    String attrName,
                                    Object attrValue,
                                    boolean evaluate)
                                    throws TagAttributeException
Parses the vertical alignment value from the given attribute.

Parameters:
locator - The tag source locator.
attrName - The name of the attribute to parse.
attrValue - The attribute value to parse.
evaluate - If this flag is set to true, the attribute will get evaluated.
Returns:
The resulting vertical alignment.
Throws:
TagAttributeException - Thrown in case the item contained an invalid value.

getTextHandler

TypedAttributeHandler getTextHandler()
Gets the integer attribute handler.

Returns:
The integer attribute handler

getEscapeSequenceTextHandler

TypedAttributeHandler getEscapeSequenceTextHandler()
Gets the integer attribute handler.

Returns:
The integer attribute handler

getIntegerHandler

TypedAttributeHandler getIntegerHandler()
Gets the integer attribute handler.

Returns:
The integer attribute handler

getFloatHandler

TypedAttributeHandler getFloatHandler()
Gets the float attribute handler.

Returns:
The integer attribute handler

getDimensionHandler

TypedAttributeHandler getDimensionHandler()
Gets the dimension attribute handler.

Returns:
The integer attribute handler

getDoubleHandler

TypedAttributeHandler getDoubleHandler()
Gets the double attribute handler.

Returns:
The double attribute handler

getBooleanHandler

TypedAttributeHandler getBooleanHandler()
Gets the boolean attribute handler.

Returns:
The boolean attribute handler

getColorHandler

TypedAttributeHandler getColorHandler()
Gets the color attribute handler.

Returns:
The color attribute handler

getBorderHandler

TypedAttributeHandler getBorderHandler()
Gets the boolean attribute handler.

Returns:
The boolean attribute handler

getHorizontalAlignmentHandler

TypedAttributeHandler getHorizontalAlignmentHandler()
Gets the horizontal alignment attribute handler.

Returns:
The horizontal alignment attribute handler

getVerticalAlignmentHandler

TypedAttributeHandler getVerticalAlignmentHandler()
Gets the vertical alignment attribute handler.

Returns:
The vertical alignment attribute handler


Copyright © 2003-2004 UJAC.org. All Rights Reserved.