org.opengts.util
Class CssStyle

java.lang.Object
  extended by org.opengts.util.CssStyle

public class CssStyle
extends java.lang.Object

Cascading Style Sheet "style" wrapper


Field Summary
static java.lang.String FONT_STYLE_ITALIC
           
static java.lang.String FONT_WEIGHT_BOLD
           
static java.lang.String TEXT_DECORATION_BLINK
           
static java.lang.String TEXT_DECORATION_OVERLINE
           
static java.lang.String TEXT_DECORATION_UNDERLINE
           
 
Constructor Summary
CssStyle()
           
CssStyle(CssStyle other)
           
 
Method Summary
protected  java.lang.String _wrapText_TAG(java.lang.String TAG, java.lang.String text)
          Returns a span wrapped HTML text
 void clear()
          Clears all state
 java.lang.String getBackgroundColor()
          Gets the text background color
 java.lang.String getFontStyle()
          Gets the text font style
 java.lang.String getFontWeight()
          Gets the text font weight
 java.lang.String getForegroundColor()
          Gets the text foreground color
 java.lang.String getStyleString()
          Gets the "style" value
Note: the prefixing style= and quotes are not included.
 java.lang.String getTextDecoration()
          Gets the text decoration
 boolean hasBackgroundColor()
          Returns true if the background color attribute has been defined
 boolean hasFontStyle()
          Returns true if the text font style attribute has been defined
 boolean hasFontWeight()
          Returns true if the text font weight attribute has been defined
 boolean hasForegroundColor()
          Returns true if the foreground color attribute has been defined
 boolean hasStyle()
          Returns true if this CssStyle contains style information
 boolean hasTextDecoration()
          Returns true if the text decoration attribute has been defined
 CssStyle setBackgroundColor(java.lang.String color)
          Sets the text background color
 CssStyle setFontStyle(java.lang.String fs)
          Sets the text font style ("font-style:")
 CssStyle setFontStyleItalic()
          Sets the text font style to "italic"
 CssStyle setFontWeight(java.lang.String fw)
          Sets the text font weight ("font-weight:")
 CssStyle setFontWeightBold()
          Sets the text font weight to "bold"
 CssStyle setForegroundColor(ColorTools.RGB rgb)
          Sets the text foregound color
 CssStyle setForegroundColor(java.lang.String color)
          Sets the text foregound color
 CssStyle setTextDecoration(java.lang.String decor)
          Sets the text decoration style ("text-decoration:")
 CssStyle setTextDecorationBlink()
          Sets the text decoration style to "blink"
 CssStyle setTextDecorationOverline()
          Sets the text decoration style to "overline"
 CssStyle setTextDecorationUnderline()
          Sets the text decoration style to "underline"
 java.lang.String toString()
          Returns the "style" String representation of this instance
 java.lang.String wrapText_div(java.lang.String text)
          Returns a div wrapped HTML text
 java.lang.String wrapText_span(java.lang.String text)
          Returns a span wrapped HTML text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_DECORATION_UNDERLINE

public static final java.lang.String TEXT_DECORATION_UNDERLINE
See Also:
Constant Field Values

TEXT_DECORATION_OVERLINE

public static final java.lang.String TEXT_DECORATION_OVERLINE
See Also:
Constant Field Values

TEXT_DECORATION_BLINK

public static final java.lang.String TEXT_DECORATION_BLINK
See Also:
Constant Field Values

FONT_WEIGHT_BOLD

public static final java.lang.String FONT_WEIGHT_BOLD
See Also:
Constant Field Values

FONT_STYLE_ITALIC

public static final java.lang.String FONT_STYLE_ITALIC
See Also:
Constant Field Values
Constructor Detail

CssStyle

public CssStyle()

CssStyle

public CssStyle(CssStyle other)
Method Detail

clear

public void clear()
Clears all state


setForegroundColor

public CssStyle setForegroundColor(ColorTools.RGB rgb)
Sets the text foregound color

Parameters:
rgb - The ColorTools.RGB value of the text foreground color
Returns:
This CssStyle instance

setForegroundColor

public CssStyle setForegroundColor(java.lang.String color)
Sets the text foregound color

Parameters:
color - The String representation of the text foreground color
Returns:
This CssStyle instance

hasForegroundColor

public boolean hasForegroundColor()
Returns true if the foreground color attribute has been defined

Returns:
True if the foreground color attribute has been defined

getForegroundColor

public java.lang.String getForegroundColor()
Gets the text foreground color

Returns:
The text foreground color

setBackgroundColor

public CssStyle setBackgroundColor(java.lang.String color)
Sets the text background color

Parameters:
color - The String representation of the text background color
Returns:
This CssStyle instance

hasBackgroundColor

public boolean hasBackgroundColor()
Returns true if the background color attribute has been defined

Returns:
True if the background color attribute has been defined

getBackgroundColor

public java.lang.String getBackgroundColor()
Gets the text background color

Returns:
The text background color

setTextDecoration

public CssStyle setTextDecoration(java.lang.String decor)
Sets the text decoration style ("text-decoration:")

Parameters:
decor - text decoraton style (ie. "underline", "overline", "line-through", "blink")
Returns:
This CssStyle instance

setTextDecorationUnderline

public CssStyle setTextDecorationUnderline()
Sets the text decoration style to "underline"

Returns:
This CssStyle instance

setTextDecorationOverline

public CssStyle setTextDecorationOverline()
Sets the text decoration style to "overline"

Returns:
This CssStyle instance

setTextDecorationBlink

public CssStyle setTextDecorationBlink()
Sets the text decoration style to "blink"

Returns:
This CssStyle instance

hasTextDecoration

public boolean hasTextDecoration()
Returns true if the text decoration attribute has been defined

Returns:
True if the text decoration attribute has been defined

getTextDecoration

public java.lang.String getTextDecoration()
Gets the text decoration

Returns:
The text decoration

setFontWeight

public CssStyle setFontWeight(java.lang.String fw)
Sets the text font weight ("font-weight:")

Parameters:
fw - The text font weight (ie. "bold", "normal", "100".."900")
Returns:
This CssStyle instance

setFontWeightBold

public CssStyle setFontWeightBold()
Sets the text font weight to "bold"

Returns:
This CssStyle instance

hasFontWeight

public boolean hasFontWeight()
Returns true if the text font weight attribute has been defined

Returns:
True if the text font weight attribute has been defined

getFontWeight

public java.lang.String getFontWeight()
Gets the text font weight

Returns:
The text font weight

setFontStyle

public CssStyle setFontStyle(java.lang.String fs)
Sets the text font style ("font-style:")

Parameters:
fs - The text font style (ie. "normal", "italic", "oblique")
Returns:
This CssStyle instance

setFontStyleItalic

public CssStyle setFontStyleItalic()
Sets the text font style to "italic"

Returns:
This CssStyle instance

hasFontStyle

public boolean hasFontStyle()
Returns true if the text font style attribute has been defined

Returns:
True if the text font style attribute has been defined

getFontStyle

public java.lang.String getFontStyle()
Gets the text font style

Returns:
The text font style

hasStyle

public boolean hasStyle()
Returns true if this CssStyle contains style information

Returns:
True if this CssStyle contains style information

getStyleString

public java.lang.String getStyleString()
Gets the "style" value
Note: the prefixing style= and quotes are not included.

Returns:
The the "style" value

toString

public java.lang.String toString()
Returns the "style" String representation of this instance

Overrides:
toString in class java.lang.Object
Returns:
The "style" String representation of this instance

_wrapText_TAG

protected java.lang.String _wrapText_TAG(java.lang.String TAG,
                                         java.lang.String text)
Returns a span wrapped HTML text

Returns:
span wrapped HTML text

wrapText_span

public java.lang.String wrapText_span(java.lang.String text)
Returns a span wrapped HTML text

Returns:
span wrapped HTML text

wrapText_div

public java.lang.String wrapText_div(java.lang.String text)
Returns a div wrapped HTML text

Returns:
div wrapped HTML text