org.formaria.aria.style
Class StyleEx

java.lang.Object
  extended by org.formaria.aria.style.Style
      extended by org.formaria.aria.style.StyleEx
All Implemented Interfaces:
java.lang.Cloneable

public class StyleEx
extends Style

An extended style class that can handle more than just the basic set of style parameters

Copyright (c) Formaria Ltd., 2008. This class is covered by the Formaria Public License see license.txt for details
$Revision: 2.5 $


Field Summary
 
Fields inherited from class org.formaria.aria.style.Style
COLOR_BACK, COLOR_FORE, FONT_FACE, FONT_ITALIC, FONT_SIZE, FONT_WEIGHT, NUM_DEFAULT_STYLES, values
 
Constructor Summary
StyleEx()
          Creates a new instance of StyleEx
StyleEx(Style clone)
           
 
Method Summary
 int addStyleName(java.lang.String name)
          Add a new style name and the storgae for this new attribute.
 java.lang.Object clone()
          Create a copy of this component
 java.lang.Object getStyleAsColor(java.lang.String key)
          Retrieve a style element as a Color.
 int getStyleAsInt(java.lang.String key)
          Retrieve a style element as an int.
 java.lang.String getStyleAsString(java.lang.String key)
          Retrieve a style element as a String.
 int getStyleIndex(java.lang.String name)
          Gets a integer constant corresponding to a style name
 java.lang.String getStyleName(int idx)
          Get the name of a style
 void mergeStyle(Style newStyle)
          For applying a hierarchy of styles to a new Style.
 void setClosed(boolean state)
          Mark the style as closed.
 void setStyle(int key, java.lang.Object value)
          Set a style element.
 
Methods inherited from class org.formaria.aria.style.Style
getFontHashcode, getNumStyles, getStyleAsColor, getStyleAsInt, getStyleAsString, getStyleValue, parseColor, setNumStyles, setStyle
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyleEx

public StyleEx()
Creates a new instance of StyleEx


StyleEx

public StyleEx(Style clone)
Method Detail

clone

public java.lang.Object clone()
Create a copy of this component

Overrides:
clone in class Style
Returns:
the copy

mergeStyle

public void mergeStyle(Style newStyle)
For applying a hierarchy of styles to a new Style. Only apply the style if it's found.

Overrides:
mergeStyle in class Style
Parameters:
newStyle - the style to merge with the current object.

setClosed

public void setClosed(boolean state)
Mark the style as closed. A closed style cannot accept any more style attributes

Overrides:
setClosed in class Style

setStyle

public void setStyle(int key,
                     java.lang.Object value)
Set a style element.

Overrides:
setStyle in class Style
Parameters:
key - The index of the element
value - The Object value of the element

getStyleIndex

public int getStyleIndex(java.lang.String name)
Gets a integer constant corresponding to a style name

Overrides:
getStyleIndex in class Style
Parameters:
name - the style name e.g. "font_face"
Returns:
the style constant e.g. Style.FONT_FACE

getStyleName

public java.lang.String getStyleName(int idx)
Get the name of a style

Overrides:
getStyleName in class Style
Parameters:
idx - the style index
Returns:
the style name

addStyleName

public int addStyleName(java.lang.String name)
Add a new style name and the storgae for this new attribute. The style name is not case sensitive

Parameters:
name - the new style name
Returns:
the new style index

getStyleAsInt

public int getStyleAsInt(java.lang.String key)
Retrieve a style element as an int.

Parameters:
key - The name of the style required
Returns:
The style converted to an int

getStyleAsString

public java.lang.String getStyleAsString(java.lang.String key)
Retrieve a style element as a String.

Parameters:
key - The index of the style required
Returns:
The style converted to a String

getStyleAsColor

public java.lang.Object getStyleAsColor(java.lang.String key)
Retrieve a style element as a Color. The keys are case insensitive

Parameters:
key - The index of the style required
Returns:
The style converted to a Color