org.odftoolkit.simple.style
Class TableCellProperties

java.lang.Object
  extended by org.odftoolkit.simple.style.TableCellProperties

public class TableCellProperties
extends Object

This class represents the table cell style settings. It provides methods to access borders styles. More functions will be added latter.

This class is a corresponded high level class for element "style:table-cell-properties". It provides methods to access the attributes and children of "style:table-cell-properties".

Since:
0.3

Constructor Summary
protected TableCellProperties()
          Create an instance of TableCellProperties
protected TableCellProperties(StyleTableCellPropertiesElement properties)
          Create an instance of TableCellProperties from an element
 
Method Summary
 Color getBackgroundColor()
          Return the background color.
 Border getBorder()
          Return the border setting for all four borders.
 Border getBottomBorder()
          Return the border setting for the bottom border.
 Border getDiagonalBlTr()
          Return the border setting for the diagonal from bottom left to top right.
 Border getDiagonalTlBr()
          Return the border setting for the diagonal from top left to bottom right.
 Border getLeftBorder()
          Return the border setting for the left border.
static TableCellProperties getOrCreateTableCellProperties(OdfStyleBase style)
          Return an instance of TableCellProperties
 Border getRightBorder()
          Return the border setting for the right border.
static TableCellProperties getTableCellProperties(OdfStyleBase style)
          Return an instance of TableCellProperties
 Border getTopBorder()
          Return the border setting for the top border.
 StyleTypeDefinitions.VerticalAlignmentType getVerticalAlignment()
          Return the vertical alignment.
 Boolean isWrapped()
          Return whether the text is allowed to be wrapped.
 void setBackgroundColor(Color aColor)
          Set the background color.
 void setBorder(Border border)
          Set the border definition for all four borders.
 void setBorders(StyleTypeDefinitions.CellBordersType bordersType, Border border)
          Set the border style.
 void setBottomBorder(Border border)
          Set the border definition for the bottom border.
 void setDiagonalBlTr(Border border)
          Set the border definition for the diagonal from bottom left to top right.
 void setDiagonalTlBr(Border border)
          Set the border definition for the diagonal from top left to bottom right.
 void setLeftBorder(Border border)
          Set the border definition for the left border.
 void setRightBorder(Border border)
          Set the border definition for the right border.
 void setTopBorder(Border border)
          Set the border definition for the top border.
 void setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType alignType)
          Set the vertical alignment.
 void setWrapped(boolean isWrapped)
          Set the text is allowed to be wrapped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableCellProperties

protected TableCellProperties()
Create an instance of TableCellProperties


TableCellProperties

protected TableCellProperties(StyleTableCellPropertiesElement properties)
Create an instance of TableCellProperties from an element

Parameters:
properties - - the element of style:table-cell-properties
Method Detail

setBorders

public void setBorders(StyleTypeDefinitions.CellBordersType bordersType,
                       Border border)
Set the border style.

The first parameter bordersType describes which borders you want to apply the style to, e.g. up border, bottom border, left border, right border, diagonal lines or four borders.

The border style information will be removed if the parameter bordersType is NONE.

Parameters:
bordersType - - the type of the borders
border - - the border style description

getBorder

public Border getBorder()
Return the border setting for all four borders.

Null will be returned if there is no border setting for all four borders.

Returns:
the border setting

getTopBorder

public Border getTopBorder()
Return the border setting for the top border.

Null will be returned if there is no border setting for the top border.

Returns:
the border setting

getLeftBorder

public Border getLeftBorder()
Return the border setting for the left border.

Null will be returned if there is no border setting for the left border.

Returns:
the border setting

getRightBorder

public Border getRightBorder()
Return the border setting for the right border.

Null will be returned if there is no border setting for the right border.

Returns:
the border setting

getBottomBorder

public Border getBottomBorder()
Return the border setting for the bottom border.

Null will be returned if there is no border setting for the bottom border.

Returns:
the border setting

getDiagonalBlTr

public Border getDiagonalBlTr()
Return the border setting for the diagonal from bottom left to top right.

Null will be returned if there is no border setting for the diagonal from bottom left to top right.

Returns:
the border setting

getDiagonalTlBr

public Border getDiagonalTlBr()
Return the border setting for the diagonal from top left to bottom right.

Null will be returned if there is no border setting for the diagonal from top left to bottom right.

Returns:
the border setting

setBottomBorder

public void setBottomBorder(Border border)
Set the border definition for the bottom border.

If the parameter border is null, the border definition for the bottom border will be removed.

If the line type in the border definition is NONE, the border definition for the bottom border will be removed.

Parameters:
border - - the border setting

setTopBorder

public void setTopBorder(Border border)
Set the border definition for the top border.

If the parameter border is null, the border definition for the top border will be removed.

If the line type in the border definition is NONE, the border definition for the top border will be removed.

Parameters:
border - - the border setting

setLeftBorder

public void setLeftBorder(Border border)
Set the border definition for the left border.

If the parameter border is null, the border definition for the left border will be removed.

If the line type in the border definition is NONE, the border definition for the left border will be removed.

Parameters:
border - - the border setting

setRightBorder

public void setRightBorder(Border border)
Set the border definition for the right border.

If the parameter border is null, the border definition for the right border will be removed.

If the line type in the border definition is NONE, the border definition for the right border will be removed.

Parameters:
border - - the border setting

setDiagonalBlTr

public void setDiagonalBlTr(Border border)
Set the border definition for the diagonal from bottom left to top right.

If the parameter border is null, the border definition for the diagonal from bottom left to top right will be removed.

If the line type in the border definition is NONE, the border definition for the diagonal from bottom left to top right will be removed.

Parameters:
border - - the border setting

setDiagonalTlBr

public void setDiagonalTlBr(Border border)
Set the border definition for the diagonal from top left to bottom right.

If the parameter border is null, the border definition for the diagonal from top left to bottom right will be removed.

If the line type in the border definition is NONE, the border definition for the diagonal from top left to bottom right will be removed.

Parameters:
border - - the border setting

setBorder

public void setBorder(Border border)
Set the border definition for all four borders.

If the parameter border is null, the border definition for all four borders will be removed.

If the line type in the border definition is NONE, the border definition for all four borders will be removed.

Parameters:
border - - the border setting

setBackgroundColor

public void setBackgroundColor(Color aColor)
Set the background color.

If the parameter aColor is null, the background color definition will be removed.

Parameters:
aColor - - the background color

getBackgroundColor

public Color getBackgroundColor()
Return the background color.

Null will be returned if there is no the background color definition or the background color definition is not valid.

Returns:
the background color

setWrapped

public void setWrapped(boolean isWrapped)
Set the text is allowed to be wrapped.

If the parameter isWrapped is true, the text will be allowed to be wrapped. Or else, the text is not allowed to be wrapped.

Parameters:
isWrapped - - the wrapped option

setVerticalAlignment

public void setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType alignType)
Set the vertical alignment.

If the parameter alignType is null or DEFAULT, the vertical alignment definition will be removed.

Parameters:
alignType - - the vertical alignment

getVerticalAlignment

public StyleTypeDefinitions.VerticalAlignmentType getVerticalAlignment()
Return the vertical alignment.

If there is no vertical alignment definition, null will be returned.

Returns:
the vertical alignment

isWrapped

public Boolean isWrapped()
Return whether the text is allowed to be wrapped.

Return true if the text is allowed to be wrapped. Or else, return false.

Returns:
a boolean value to indicate whether the text is allowed to be wrapped

getOrCreateTableCellProperties

public static TableCellProperties getOrCreateTableCellProperties(OdfStyleBase style)
Return an instance of TableCellProperties

to represent the "style:table-cell-properties" in a style element.

If there is no "style:table-cell-properties" defined in the style element, a new "style:table-cell-properties" element will be created.

Parameters:
style - - a style element
Returns:
an instance of TableCellProperties


getTableCellProperties

public static TableCellProperties getTableCellProperties(OdfStyleBase style)
Return an instance of TableCellProperties

to represent the "style:table-cell-properties" in a style element.

If there is no "style:table-cell-properties" defined in the style element, null will be returned.

Parameters:
style - - a style element
Returns:
an instance of TableCellProperties

;Null if there is no "style:table-cell-properties" defined


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.