org.odftoolkit.simple.table
Class Row

java.lang.Object
  extended by org.odftoolkit.simple.Component
      extended by org.odftoolkit.simple.table.Row

public class Row
extends Component

Row represents table row feature in ODF document.

Row provides methods to get table cells that belong to this table row.


Method Summary
 Cell getCellByIndex(int index)
          Get a cell with a specific index.
 int getCellCount()
          Return the count of real cells in this row.
 OdfStyle getDefaultCellStyle()
          Get the default cell style of this row.
 double getHeight()
          Return the height of the row (in Millimeter).
static Row getInstance(TableTableRowElement rowElement)
          Get the Row instance from the TableTableRowElement instance.
 Row getNextRow()
          Return the next row of the current row.
 TableTableRowElement getOdfElement()
          Return an instance of TableTableRowElement which represents this feature.
 Row getPreviousRow()
          Return the previous row of the current row.
 int getRowIndex()
          Return the index of this row in the owner table.
 Table getTable()
          Get owner table of the current row.
 boolean isOptimalHeight()
          Return if the row always keeps its optimal height.
 void setDefaultCellStyle(OdfStyle style)
          Set the default cell style to this row.
 void setHeight(double height, boolean isMinHeight)
          Set the height/minimal height of the row (in Millimeter) according to the second parameter.
 void setUseOptimalHeight(boolean isUseOptimalHeight)
          Set if the row always keeps its optimal height.
 
Methods inherited from class org.odftoolkit.simple.Component
getComponentByElement, getOwnerDocument, registerComponent, unregisterComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Row getInstance(TableTableRowElement rowElement)
Get the Row instance from the TableTableRowElement instance.

Each TableTableRowElement instance has a one-to-one relationship to a Row instance.

Parameters:
rowElement - the row element that need to get the corresponding Row instance
Returns:
the Row instance represent the specified row element

getTable

public Table getTable()
Get owner table of the current row.

Returns:
the parent table of this row

getHeight

public double getHeight()
Return the height of the row (in Millimeter).

Return the minimal height, if the row height is not set,

Returns:
the height of the current row (in Millimeter).

setHeight

public void setHeight(double height,
                      boolean isMinHeight)
Set the height/minimal height of the row (in Millimeter) according to the second parameter.

Parameters:
height - the height/minimal height that will be set to the row (in Millimeter).
isMinHeight - if it is true, the row can fit the height to the text, vice versa.

isOptimalHeight

public boolean isOptimalHeight()
Return if the row always keeps its optimal height.

Returns:
true if the row always keeps its optimal height; vice versa

setUseOptimalHeight

public void setUseOptimalHeight(boolean isUseOptimalHeight)
Set if the row always keeps its optimal height.

Parameters:
isUseOptimalHeight - the flag that indicate row should keep its optimal height or not

getOdfElement

public TableTableRowElement getOdfElement()
Return an instance of TableTableRowElement which represents this feature.

Specified by:
getOdfElement in class Component
Returns:
an instance of TableTableRowElement

getCellByIndex

public Cell getCellByIndex(int index)
Get a cell with a specific index. The table will be automatically expanded, when the given index is outside of the original table.

Parameters:
index - the cell index in this row
Returns:
the cell object in the given cell index

getCellCount

public int getCellCount()
Return the count of real cells in this row. The cells covered by top cells are not counted.

Please note it might not equal to the column count of the owner table, because some of them are the covered cells.

Returns:
the cell count

getPreviousRow

public Row getPreviousRow()
Return the previous row of the current row.

Returns:
the previous row before this row in the owner table

getNextRow

public Row getNextRow()
Return the next row of the current row.

Returns:
the next row after this row in the owner table

setDefaultCellStyle

public void setDefaultCellStyle(OdfStyle style)
Set the default cell style to this row.

The style should already exist in this document.

Parameters:
style - the cell style of the document

getDefaultCellStyle

public OdfStyle getDefaultCellStyle()
Get the default cell style of this row.

Returns:
the default cell style of this row

getRowIndex

public int getRowIndex()
Return the index of this row in the owner table.

Returns:
the index of the row


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