Oxygen XML Editor 12.2 Author API

ro.sync.ecss.css
Class Styles

java.lang.Object
  extended by ro.sync.ecss.css.Styles
All Implemented Interfaces:
java.lang.Cloneable

public class Styles
extends java.lang.Object
implements java.lang.Cloneable

Represents the computed style properties for a particular element. These styles are taken from the CSS. See: http://www.w3.org/TR/CSS21/cascade.html#q1


Field Summary
static int counter
          Constants counter
static float EX_FACTOR
          This is the factor: ex-height / em-height The ex unit is defined by the font's x-height.
static int KEY_BACKGROUND_COLOR
          Background color.
static int KEY_BORDER_BOTTOM_COLOR
          Border bottom color
static int KEY_BORDER_BOTTOM_STYLE
          Border bottom style
static int KEY_BORDER_BOTTOM_WIDTH
          Border bottom width
static int KEY_BORDER_LEFT_COLOR
          Border left color
static int KEY_BORDER_LEFT_STYLE
          Border right style
static int KEY_BORDER_LEFT_WIDTH
          Border left width
static int KEY_BORDER_RIGHT_COLOR
          Border right color
static int KEY_BORDER_RIGHT_STYLE
          Border right style
static int KEY_BORDER_RIGHT_WIDTH
          Border right width
static int KEY_BORDER_SPACING
          Key for the border spacing array
static int KEY_BORDER_TOP_COLOR
          Border top color
static int KEY_BORDER_TOP_STYLE
          Border top style
static int KEY_BORDER_TOP_WIDTH
          Border top width
static int KEY_COUNTER_INCREMENT
          The key for counter-increment .
static int KEY_COUNTER_RESET
          The key for counter-reset .
static int KEY_DIRECT_WHITESPACE
          Whitespace specified directly on the node
static int KEY_DISPLAY
          Display type
static int KEY_DISPLAY_TAGS
          Key used to hide sentinel markers.
static int KEY_EDITABLE
          True if this view is editable
static int KEY_EMPTY_CELLS
          Key used to store the property 'empty-cells' value.
static int KEY_FILTERED_OUT
          Key set for filtered out nodes.
static int KEY_FOLDABLE
          Key used to store the property 'foldable' value.
static int KEY_FONT
          Used font
static int KEY_FONT_WEIGHT
          Font weight
static int KEY_FOREGROUND_COLOR
          Foreground
static int KEY_HEIGHT
          Height.
static int KEY_IMPOSED_DISPLAY
          Key used to override the display property defined in the css.
static int KEY_LINE_HEIGHT_MULTIPLIER
          Line height multiplier
static int KEY_LINK_URL
          Key used to store the URL for link elements.
static int KEY_LIST_STYLE_TYPE
          List style type
static int KEY_MARGIN_BOTTOM
          Margin dimensions
static int KEY_MARGIN_LEFT
          Margin left
static int KEY_MARGIN_RIGHT
          Margin right
static int KEY_MARGIN_TOP
          Margin top
static int KEY_MAX_WIDTH
          Maximum width.
static int KEY_MIN_WIDTH
          Minimum width.
static int KEY_MIXED_CONTENT
          Generated mixed Content
static int KEY_NON_FOLDABLE_CHILD_NAME
          Key used to store the property 'non foldable child name' value.
static int KEY_PADDING_BOTTOM
          Padding dimensions
static int KEY_PADDING_LEFT
          Pad left
static int KEY_PADDING_RIGHT
          Pad right
static int KEY_PADDING_TOP
          Pad top
static int KEY_PLACEHOLDER_CONTENT
          Key used to store the property 'placeholder-content' value.
static int KEY_SHOW_PLACEHOLDER
          Key used to store the property 'show-placeholder' value.
static int KEY_TEXT_ALIGN
          Text align
static int KEY_TEXT_DECORATION
          Key used to store 'text-decoration' property.
static int KEY_TEXT_DECORATION_COLOR
          Key used to store color for text decoration.
static int KEY_TEXT_TRANSFORM
          Text transform
static int KEY_VERTICAL_ALIGN
          Key for vertical align.
static int KEY_VISIBITY
          Key for the 'visibility' property.
static int KEY_WHITESPACE
          Whitespace
static int KEY_WIDTH
          Width.
 
Constructor Summary
Styles()
           
 
Method Summary
 boolean canBeCached()
          Verify if styles can be cached.
 java.lang.Object clone()
          Shallow clone.
 boolean equals(java.lang.Object obj)
           
 Color getBackgroundColor()
           
 Color getBorderBottomColor()
           
 java.lang.String getBorderBottomStyle()
           
 int getBorderBottomWidth()
           
 Color getBorderLeftColor()
           
 java.lang.String getBorderLeftStyle()
           
 int getBorderLeftWidth()
           
 Color getBorderRightColor()
           
 java.lang.String getBorderRightStyle()
           
 int getBorderRightWidth()
           
 Color getBorderTopColor()
           
 java.lang.String getBorderTopStyle()
           
 int getBorderTopWidth()
           
 Color getColor()
           
 CSSCounter[] getCounters()
           
 CSSCounterIncrement[] getCountersIncrement()
           
 java.lang.String getDirectWhitespace()
           
 java.lang.String getDisplay()
          First it looks at the KEY_IMPOSED_DISPLAY property.
 java.lang.String getDisplayTags()
           
 Font getFont()
           
 int getFontWeight()
           
 RelativeLength getHeight()
           
 int getHorizontalBorderSpacing()
           
 int getLineHeight(FontMetrics fm)
          Sets the distance between lines: normal number length %
 java.lang.String getLinkURL()
           
 java.lang.String getListStyleType()
           
 RelativeLength getMarginBottom()
           
 RelativeLength getMarginLeft()
           
 RelativeLength getMarginRight()
           
 RelativeLength getMarginTop()
           
 RelativeLength getMaxWidth()
           
 RelativeLength getMinWidth()
           
 StaticContent[] getMixedContent()
           
 java.lang.String[] getNonFoldableChildName()
           
 RelativeLength getPaddingBottom()
           
 RelativeLength getPaddingLeft()
           
 RelativeLength getPaddingRight()
           
 RelativeLength getPaddingTop()
           
 java.lang.String getPlaceholderContent()
           
 java.lang.Object getProperty(int property)
           
 boolean getShowEmptyCells()
           
 java.lang.String getShowPlaceholders()
           
 java.lang.String getTextAlign()
          Aligns the text in an element: left right center justify.
 java.lang.String[] getTextDecoration()
           
 Color getTextDecorationColor()
           
 java.lang.String getTextTransform()
           
 java.lang.String getVerticalAlign()
           
 int getVerticalBorderSpacing()
           
 java.lang.String getVisibility()
           
 java.lang.String getWhitespace()
           
 RelativeLength getWidth()
           
 int hashCode()
           
 boolean isEditable()
           
 boolean isFilteredOut()
           
 boolean isFoldable()
           
 boolean isInline()
           
 boolean isInlineInCSS()
           
 boolean isInTable()
          Check if is a style from a table but not a cell.
 boolean isInvisible()
           
 boolean isListItem()
           
 boolean isTable()
          Checks if the display mode indicated to be a table.
 boolean isTableCaption()
          Checks if the display mode indicated to be a table caption.
 boolean isTableColumn()
          Checks if the display mode indicated to be a table column.
 boolean isTableColumnGroup()
          Checks if the display mode indicated to be a table group of columns.
 boolean isTableFooterGroup()
          Checks if the display mode indicated to be a table group footer.
 boolean isTableHeaderGroup()
          Checks if the display mode indicated to be a table group header.
 boolean isTableRow()
           
 boolean isTableRowGroup()
           
 void setCanBeCached(boolean canBeCached)
          Sets if those styles can be shared between two or more nodes.
 void setProperty(int property, java.lang.Object value)
          Set a property to the map.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EX_FACTOR

public static final float EX_FACTOR
This is the factor: ex-height / em-height The ex unit is defined by the font's x-height. The x-height is so called because it is often equal to the height of the lowercase "x". However, an ex is defined even for fonts that don't contain an "x".

See Also:
Constant Field Values

counter

public static int counter
Constants counter


KEY_BACKGROUND_COLOR

public static final int KEY_BACKGROUND_COLOR
Background color.


KEY_BORDER_BOTTOM_COLOR

public static final int KEY_BORDER_BOTTOM_COLOR
Border bottom color


KEY_BORDER_BOTTOM_STYLE

public static final int KEY_BORDER_BOTTOM_STYLE
Border bottom style


KEY_BORDER_BOTTOM_WIDTH

public static final int KEY_BORDER_BOTTOM_WIDTH
Border bottom width


KEY_BORDER_LEFT_COLOR

public static final int KEY_BORDER_LEFT_COLOR
Border left color


KEY_BORDER_LEFT_STYLE

public static final int KEY_BORDER_LEFT_STYLE
Border right style


KEY_BORDER_LEFT_WIDTH

public static final int KEY_BORDER_LEFT_WIDTH
Border left width


KEY_BORDER_RIGHT_COLOR

public static final int KEY_BORDER_RIGHT_COLOR
Border right color


KEY_BORDER_RIGHT_STYLE

public static final int KEY_BORDER_RIGHT_STYLE
Border right style


KEY_BORDER_RIGHT_WIDTH

public static final int KEY_BORDER_RIGHT_WIDTH
Border right width


KEY_BORDER_TOP_COLOR

public static final int KEY_BORDER_TOP_COLOR
Border top color


KEY_BORDER_TOP_STYLE

public static final int KEY_BORDER_TOP_STYLE
Border top style


KEY_BORDER_TOP_WIDTH

public static final int KEY_BORDER_TOP_WIDTH
Border top width


KEY_FOREGROUND_COLOR

public static final int KEY_FOREGROUND_COLOR
Foreground


KEY_MIXED_CONTENT

public static final int KEY_MIXED_CONTENT
Generated mixed Content


KEY_DISPLAY

public static final int KEY_DISPLAY
Display type


KEY_FONT

public static final int KEY_FONT
Used font


KEY_FONT_WEIGHT

public static final int KEY_FONT_WEIGHT
Font weight


KEY_LINE_HEIGHT_MULTIPLIER

public static final int KEY_LINE_HEIGHT_MULTIPLIER
Line height multiplier


KEY_LIST_STYLE_TYPE

public static final int KEY_LIST_STYLE_TYPE
List style type


KEY_MARGIN_BOTTOM

public static final int KEY_MARGIN_BOTTOM
Margin dimensions


KEY_MARGIN_LEFT

public static final int KEY_MARGIN_LEFT
Margin left


KEY_MARGIN_RIGHT

public static final int KEY_MARGIN_RIGHT
Margin right


KEY_MARGIN_TOP

public static final int KEY_MARGIN_TOP
Margin top


KEY_PADDING_BOTTOM

public static final int KEY_PADDING_BOTTOM
Padding dimensions


KEY_PADDING_LEFT

public static final int KEY_PADDING_LEFT
Pad left


KEY_PADDING_RIGHT

public static final int KEY_PADDING_RIGHT
Pad right


KEY_PADDING_TOP

public static final int KEY_PADDING_TOP
Pad top


KEY_WIDTH

public static final int KEY_WIDTH
Width. Applies to blocks. It can be null.


KEY_HEIGHT

public static final int KEY_HEIGHT
Height. Applies to images for now. It can be null.


KEY_MIN_WIDTH

public static final int KEY_MIN_WIDTH
Minimum width. Applies to blocks. It can be null.


KEY_MAX_WIDTH

public static final int KEY_MAX_WIDTH
Maximum width. Applies to blocks. It can be null.


KEY_TEXT_ALIGN

public static final int KEY_TEXT_ALIGN
Text align


KEY_WHITESPACE

public static final int KEY_WHITESPACE
Whitespace


KEY_EDITABLE

public static final int KEY_EDITABLE
True if this view is editable


KEY_BORDER_SPACING

public static final int KEY_BORDER_SPACING
Key for the border spacing array


KEY_VISIBITY

public static final int KEY_VISIBITY
Key for the 'visibility' property.


KEY_EMPTY_CELLS

public static final int KEY_EMPTY_CELLS
Key used to store the property 'empty-cells' value.


KEY_FOLDABLE

public static final int KEY_FOLDABLE
Key used to store the property 'foldable' value.


KEY_NON_FOLDABLE_CHILD_NAME

public static final int KEY_NON_FOLDABLE_CHILD_NAME
Key used to store the property 'non foldable child name' value.


KEY_VERTICAL_ALIGN

public static final int KEY_VERTICAL_ALIGN
Key for vertical align.


KEY_COUNTER_RESET

public static final int KEY_COUNTER_RESET
The key for counter-reset .


KEY_COUNTER_INCREMENT

public static final int KEY_COUNTER_INCREMENT
The key for counter-increment .


KEY_IMPOSED_DISPLAY

public static final int KEY_IMPOSED_DISPLAY
Key used to override the display property defined in the css.


KEY_TEXT_DECORATION

public static final int KEY_TEXT_DECORATION
Key used to store 'text-decoration' property.


KEY_TEXT_DECORATION_COLOR

public static final int KEY_TEXT_DECORATION_COLOR
Key used to store color for text decoration.


KEY_LINK_URL

public static final int KEY_LINK_URL
Key used to store the URL for link elements.


KEY_DISPLAY_TAGS

public static final int KEY_DISPLAY_TAGS
Key used to hide sentinel markers.


KEY_DIRECT_WHITESPACE

public static final int KEY_DIRECT_WHITESPACE
Whitespace specified directly on the node


KEY_FILTERED_OUT

public static final int KEY_FILTERED_OUT
Key set for filtered out nodes.


KEY_TEXT_TRANSFORM

public static final int KEY_TEXT_TRANSFORM
Text transform


KEY_SHOW_PLACEHOLDER

public static final int KEY_SHOW_PLACEHOLDER
Key used to store the property 'show-placeholder' value.


KEY_PLACEHOLDER_CONTENT

public static final int KEY_PLACEHOLDER_CONTENT
Key used to store the property 'placeholder-content' value.

Constructor Detail

Styles

public Styles()
Method Detail

getBackgroundColor

public Color getBackgroundColor()
Returns:
the value of the backgroundColor property. Returns null if the background color is transparent.

getBorderBottomColor

public Color getBorderBottomColor()
Returns:
the value of the borderBottomColor property.

getBorderBottomStyle

public java.lang.String getBorderBottomStyle()
Returns:
the value of the borderBottomStyle property.

getBorderLeftColor

public Color getBorderLeftColor()
Returns:
the value of the borderLeftColor property.

getBorderLeftStyle

public java.lang.String getBorderLeftStyle()
Returns:
the value of the borderLeftStyle property.

getBorderRightColor

public Color getBorderRightColor()
Returns:
the value of the borderRightColor property.

getBorderRightStyle

public java.lang.String getBorderRightStyle()
Returns:
the value of the borderRightStyle property.

getBorderTopColor

public Color getBorderTopColor()
Returns:
the value of the borderTopColor property.

getBorderTopStyle

public java.lang.String getBorderTopStyle()
Returns:
the value of the borderTopStyle property.

getColor

public Color getColor()
Returns:
the value of the color property.

getMixedContent

public StaticContent[] getMixedContent()
Returns:
a List of ContentPart objects representing the content property.

getDisplay

public java.lang.String getDisplay()
First it looks at the KEY_IMPOSED_DISPLAY property. If it is not set it looks at the KEY_DISPLAY property.

Returns:
the value of the display property or CSS.INLINE if nothing is specified.

isInvisible

public boolean isInvisible()
Returns:
true if the associated element is invisible.

isListItem

public boolean isListItem()
Returns:
true if the associated element is a list item.

getFont

public Font getFont()
Returns:
the value of the font property. Never null.

getFontWeight

public int getFontWeight()
Returns:
the value of the fontWeight property.

getLineHeight

public int getLineHeight(FontMetrics fm)
Sets the distance between lines: normal number length %

Parameters:
fm - Font metrics for this style's font
Returns:
the value of the lineHeight property.

getListStyleType

public java.lang.String getListStyleType()
Returns:
the value of the listStyleType property.

getTextAlign

public java.lang.String getTextAlign()
Aligns the text in an element: left right center justify.

Returns:
the value of the textAlign property.

isInline

public boolean isInline()
Returns:
true if this element has the display property set to CSS.INLINE and thus it must be rendered as an inline block. Note that if this method returns false it doesn't necessarily mean that the element must be rendered as a block. The isInvisible() should be taken into account as well. See LayoutUtils.isInvisible()

isTableRowGroup

public boolean isTableRowGroup()
Returns:
true if this element is table-formatted, or false otherwise.

isTableRow

public boolean isTableRow()
Returns:
true if this element is table-formatted, or false otherwise.

getBorderBottomWidth

public int getBorderBottomWidth()
Returns:
the value of border-bottom-width

getBorderLeftWidth

public int getBorderLeftWidth()
Returns:
the value of border-left-width

getBorderRightWidth

public int getBorderRightWidth()
Returns:
the value of border-right-width

getBorderTopWidth

public int getBorderTopWidth()
Returns:
the value of border-top-width

getMarginBottom

public RelativeLength getMarginBottom()
Returns:
the value of margin-bottom

getMarginLeft

public RelativeLength getMarginLeft()
Returns:
the value of margin-left

getMarginRight

public RelativeLength getMarginRight()
Returns:
the value of margin-right

getMarginTop

public RelativeLength getMarginTop()
Returns:
the value of margin-top

getPaddingBottom

public RelativeLength getPaddingBottom()
Returns:
the value of padding-bottom

getPaddingLeft

public RelativeLength getPaddingLeft()
Returns:
the value of padding-left

getPaddingRight

public RelativeLength getPaddingRight()
Returns:
the value of padding-right

getPaddingTop

public RelativeLength getPaddingTop()
Returns:
the value of padding-top

isTable

public boolean isTable()
Checks if the display mode indicated to be a table.

Returns:
True if it is.

getWhitespace

public java.lang.String getWhitespace()
Returns:
The whitespace value.

getDirectWhitespace

public java.lang.String getDirectWhitespace()
Returns:
The whitespace value.

isTableHeaderGroup

public boolean isTableHeaderGroup()
Checks if the display mode indicated to be a table group header.

Returns:
True if it is.

isTableFooterGroup

public boolean isTableFooterGroup()
Checks if the display mode indicated to be a table group footer.

Returns:
True if it is.

isTableColumn

public boolean isTableColumn()
Checks if the display mode indicated to be a table column.

Returns:
True if it is.

isTableColumnGroup

public boolean isTableColumnGroup()
Checks if the display mode indicated to be a table group of columns.

Returns:
True if it is.

getWidth

public RelativeLength getWidth()
Returns:
The specified width, as a relative length, or null if not specified by the CSS.

getHeight

public RelativeLength getHeight()
Returns:
The specified height, as a relative length, or null if not specified by the CSS.

getMinWidth

public RelativeLength getMinWidth()
Returns:
The minimum width, or null if not specified.

getMaxWidth

public RelativeLength getMaxWidth()
Returns:
The maximum width, or null if not specified.

isEditable

public boolean isEditable()
Returns:
true if the view is editable

getHorizontalBorderSpacing

public int getHorizontalBorderSpacing()
Returns:
The horizontal border spacing between table cells.

getVerticalBorderSpacing

public int getVerticalBorderSpacing()
Returns:
The vertical border spacing between table cells.

setProperty

public void setProperty(int property,
                        java.lang.Object value)
Set a property to the map.

Parameters:
property - The key of the property to be set. It can be one of the keys defined in this class.
value - The value of the property. Accepted values depend on the property and can have as type String, Color, CSSCounter or CSSCounterIncrement. The actual values are the Java representations of the ones accepted in the CSS specification. Read more about the CSS support in the Developer Guide.

getProperty

public java.lang.Object getProperty(int property)
Parameters:
property - The property name.
Returns:
The value of the property.

getVisibility

public java.lang.String getVisibility()
Returns:
The value of the 'visibility'

getShowPlaceholders

public java.lang.String getShowPlaceholders()
Returns:
The value of the 'show-placeholder' property.

getPlaceholderContent

public java.lang.String getPlaceholderContent()
Returns:
The value of the 'placeholder-content' property.

getShowEmptyCells

public boolean getShowEmptyCells()
Returns:
Return true if table empty cells are shown. See http://www.w3.org/TR/CSS21/tables.html#empty-cells.

isFoldable

public boolean isFoldable()
Returns:
true if this element is foldable

getNonFoldableChildName

public java.lang.String[] getNonFoldableChildName()
Returns:
The name of the child which is non foldable

isTableCaption

public boolean isTableCaption()
Checks if the display mode indicated to be a table caption.

Returns:
True if it is.

isInlineInCSS

public boolean isInlineInCSS()
Returns:
true if element is specified as INLINE in CSS source.

getVerticalAlign

public java.lang.String getVerticalAlign()
Returns:
The vertical align.

getTextDecoration

public java.lang.String[] getTextDecoration()
Returns:
The value of 'text-decoration' property.

getTextDecorationColor

public Color getTextDecorationColor()
Returns:
The color to be used for paint text decoration.

getCounters

public CSSCounter[] getCounters()
Returns:
The counters declared on this element or empty array if none.

getCountersIncrement

public CSSCounterIncrement[] getCountersIncrement()
Returns:
The 'counters increment' declared on this element or empty array if none.

isInTable

public boolean isInTable()
Check if is a style from a table but not a cell.

Returns:
true if the current style is a one of CSS.TABLE, CSS.INLINE_TABLE, CSS.TABLE_ROW, CSS.TABLE_ROW_GROUP, CSS.TABLE_FOOTER_GROUP, CSS.TABLE_HEADER_GROUP

getLinkURL

public java.lang.String getLinkURL()
Returns:
The value of the 'link' property. Null if property was absent.

getDisplayTags

public java.lang.String getDisplayTags()
Returns:
Returns the value of the property 'display-tags'. The possible values are:
  • CSS.DEFAULT - display tag markers depending on the current display mode;
  • CSS.NONE - tag markers will not be shown.
The default value is CSS.DEFAULT.

getTextTransform

public java.lang.String getTextTransform()
Returns:
Returns the value of the property 'text-transform'. The possible values are:
  • CSS.CAPITALIZE
  • CSS.UPPERCASE
  • CSS.LOWERCASE
The default value is null

isFilteredOut

public boolean isFilteredOut()
Returns:
true if a node should be represented with faded colors.

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

clone

public java.lang.Object clone()
Shallow clone.

Overrides:
clone in class java.lang.Object

canBeCached

public boolean canBeCached()
Verify if styles can be cached. Can be cached if properties values does not depends by attributes or document structure.

Returns:
True if styles can be cached.

setCanBeCached

public void setCanBeCached(boolean canBeCached)
Sets if those styles can be shared between two or more nodes.

Parameters:
canBeCached - True when be shared between two or more nodes.

Oxygen XML Editor 12.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.