org.odftoolkit.simple.table
Class Column

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

public class Column
extends Component

Column represents table column feature in ODF document.

Column provides methods to get table cells that belong to this table column.


Method Summary
 Cell getCellByIndex(int index)
          Get a cell with a specific index.
 int getCellCount()
          Get the count of cells in this column.
 int getColumnIndex()
          Get the index of this column in the owner table.
 OdfStyle getDefaultCellStyle()
          Get the default cell style of this column.
static Column getInstance(TableTableColumnElement colElement)
          Get the Column instance from the TableTableColumnElement instance.
 Column getNextColumn()
          Get the next column of the current column.
 TableTableColumnElement getOdfElement()
          Return an instance of TableTableColumnElement which represents this feature.
 Column getPreviousColumn()
          Get the previous column of the current column.
 Table getTable()
          Get owner table of the current column.
 double getWidth()
          Get the width of the column (in Millimeter).
 boolean isOptimalWidth()
          Returns if the column always keeps its optimal width.
 void setDefaultCellStyle(OdfStyle style)
          Set the default cell style to this column.
 void setUseOptimalWidth(boolean isUseOptimalWidth)
          Set if the column always keeps its optimal width.
 void setWidth(double width)
          Set the width of the column (in Millimeter).
 
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 Column getInstance(TableTableColumnElement colElement)
Get the Column instance from the TableTableColumnElement instance.

Each TableTableColumnElement instance has a one-to-one relationship to the a Column instance.

Parameters:
colElement - the column element that need to get the corresponding Column instance
Returns:
the Column instance represent the specified column element

getTable

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

Returns:
the parent table of this column

getWidth

public double getWidth()
Get the width of the column (in Millimeter).

Returns:
the width of the current column (in Millimeter).

setWidth

public void setWidth(double width)
Set the width of the column (in Millimeter).

Parameters:
width - the width that will be set to the column (in Millimeter).

isOptimalWidth

public boolean isOptimalWidth()
Returns if the column always keeps its optimal width.

Returns:
true if the column always keeps its optimal width; vice versa

setUseOptimalWidth

public void setUseOptimalWidth(boolean isUseOptimalWidth)
Set if the column always keeps its optimal width.

Parameters:
isUseOptimalWidth - the flag that indicate column should keep its optimal width or not

getOdfElement

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

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

getCellCount

public int getCellCount()
Get the count of cells in this column.

Returns:
the cells count in the current column

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 column
Returns:
the cell object in the given cell index

getPreviousColumn

public Column getPreviousColumn()
Get the previous column of the current column.

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

getNextColumn

public Column getNextColumn()
Get the next column of the current column.

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

getColumnIndex

public int getColumnIndex()
Get the index of this column in the owner table.

Returns:
the index of the column

setDefaultCellStyle

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

The style should already exist in this document.

This method is not recommended for text document cases. These is a style assigned to each cell in tables under text documents. So setting the default cell style to a column may not work.

Parameters:
style - the cell style of the document

getDefaultCellStyle

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

Returns:
the default cell style of this column


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