com.inet.html.css
Class CSS

java.lang.Object
  extended by com.inet.html.css.CSS

public class CSS
extends java.lang.Object

Contains all known CSS attributes and some additional setters


Nested Class Summary
static class CSS.Attribute
          A list of CSS attributes.
 
Constructor Summary
CSS()
           
 
Method Summary
static CSS.Attribute getAttribute(java.lang.String name)
          Get the CSS Attribute with the same name.
static boolean isBold(javax.swing.text.Element element)
          Checks whether the element has font weight bold set directly or by inherit
static boolean isItalic(javax.swing.text.Element element)
          Checks whether the element has font style italic or oblique set directly or by inherit
static boolean isUnderline(javax.swing.text.Element element)
          Checks whether the element has text decoration underline set directly or by inherit
static void setFontFamily(javax.swing.text.MutableAttributeSet a, java.lang.String family)
          Correctly sets the CSS.FONT_FAMILY attribute
static void setFontSize(javax.swing.text.MutableAttributeSet a, int size)
          Correctly sets the CSS.FONT_SIZE attribute
static void setFontStyle(javax.swing.text.MutableAttributeSet a, boolean italic)
          Correctly sets the CSS.FONT_STYLE attribute
static void setFontWeight(javax.swing.text.MutableAttributeSet a, boolean bold)
          Correctly sets the CSS.FONT_WEIGHT attribute
static void setMarginLeft(javax.swing.text.MutableAttributeSet a, int pixels)
          Correctly sets the CSS.MARGIN_LEFT attribute
static void setTextColor(javax.swing.text.MutableAttributeSet a, java.awt.Color color)
          Correctly sets the CSS.COLOR attribute
static void setTextDecoration(javax.swing.text.MutableAttributeSet a, int decoration)
          Correctly sets the CSS.TEXT_DECORATION attribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CSS

public CSS()
Method Detail

getAttribute

public static final CSS.Attribute getAttribute(java.lang.String name)
Get the CSS Attribute with the same name.

Parameters:
name - the lower case name
Returns:
the Attribute or null

setTextColor

public static void setTextColor(javax.swing.text.MutableAttributeSet a,
                                java.awt.Color color)
Correctly sets the CSS.COLOR attribute

Parameters:
a - The attribute set to modify
color - The color to set

setFontSize

public static void setFontSize(javax.swing.text.MutableAttributeSet a,
                               int size)
Correctly sets the CSS.FONT_SIZE attribute

Parameters:
a - The attribute set to modify
size - the size in pixels to set

setFontWeight

public static void setFontWeight(javax.swing.text.MutableAttributeSet a,
                                 boolean bold)
Correctly sets the CSS.FONT_WEIGHT attribute

Parameters:
a - The attribute set to modify
bold - set to true, to make the font bold

setFontStyle

public static void setFontStyle(javax.swing.text.MutableAttributeSet a,
                                boolean italic)
Correctly sets the CSS.FONT_STYLE attribute

Parameters:
a - The attribute set to modify
italic - set to true, to make the font italics

setTextDecoration

public static void setTextDecoration(javax.swing.text.MutableAttributeSet a,
                                     int decoration)
Correctly sets the CSS.TEXT_DECORATION attribute

Parameters:
a - The attribute set to modify
decoration - The TextDecoration constant

setFontFamily

public static void setFontFamily(javax.swing.text.MutableAttributeSet a,
                                 java.lang.String family)
Correctly sets the CSS.FONT_FAMILY attribute

Parameters:
a - The attribute set to modify
family - The name of the font or font family to set

isBold

public static boolean isBold(javax.swing.text.Element element)
Checks whether the element has font weight bold set directly or by inherit

Parameters:
element - the element to check - in most cases the character element
Returns:
true, if the font at this element level would be displayed bold

isItalic

public static boolean isItalic(javax.swing.text.Element element)
Checks whether the element has font style italic or oblique set directly or by inherit

Parameters:
element - the element to check - in most cases the character element
Returns:
true, if the font at this element level would be displayed italic

isUnderline

public static boolean isUnderline(javax.swing.text.Element element)
Checks whether the element has text decoration underline set directly or by inherit

Parameters:
element - the element to check - in most cases the character element
Returns:
true, if the font at this element level would be displayed underlined

setMarginLeft

public static void setMarginLeft(javax.swing.text.MutableAttributeSet a,
                                 int pixels)
Correctly sets the CSS.MARGIN_LEFT attribute

Parameters:
a - The attribute set to modify
pixels - the margin width in pixel