net.xoetrope.xui.style
Class XStyleEx

java.lang.Object
  extended by net.xoetrope.xui.style.XStyle
      extended by net.xoetrope.xui.style.XStyleEx
All Implemented Interfaces:
java.lang.Cloneable

public class XStyleEx
extends XStyle

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

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


Field Summary
 
Fields inherited from class net.xoetrope.xui.style.XStyle
COLOR_BACK, COLOR_FORE, FONT_FACE, FONT_ITALIC, FONT_SIZE, FONT_WEIGHT, NUM_DEFAULT_STYLES, values
 
Constructor Summary
XStyleEx()
          Creates a new instance of XStyleEx
XStyleEx(XStyle clone)
           
 
Method Summary
 int addStyleName(java.lang.String name)
          Add a new style name and the storgae for this new attribute
 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(XStyle newStyle)
          For applying a hierarchy of styles to a new XStyle.
 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 net.xoetrope.xui.style.XStyle
clone, 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

XStyleEx

public XStyleEx()
Creates a new instance of XStyleEx


XStyleEx

public XStyleEx(XStyle clone)
Method Detail

mergeStyle

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

Overrides:
mergeStyle in class XStyle
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 XStyle

setStyle

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

Overrides:
setStyle in class XStyle
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 XStyle
Parameters:
name - the style name e.g. "font_face"
Returns:
the style constant e.g. XStyle.FONT_FACE

getStyleName

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

Overrides:
getStyleName in class XStyle
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

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.

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