org.odftoolkit.simple.table
Class Table.TableBuilder

java.lang.Object
  extended by org.odftoolkit.simple.table.Table.TableBuilder
Enclosing class:
Table

public static class Table.TableBuilder
extends Object

This is a tool class which supplies all of the table creation detail.

The end user isn't allowed to create it directly, otherwise an IllegalStateException will be thrown.

Since:
0.3.5

Constructor Summary
Table.TableBuilder(TableContainer container)
          TableBuilder constructor.
 
Method Summary
 Table getTableInstance(TableTableElement odfElement)
          Get a table feature instance by an instance of TableTableElement.
 Table newTable()
          Construct the Table feature.
 Table newTable(int numRows, int numCols)
          Construct the Table feature with a specified row number and column number.
 Table newTable(int numRows, int numCols, int headerRowNumber, int headerColumnNumber)
          Construct the Table feature with a specified row number, column number, header row number, header column number.
 Table newTable(int numRows, int numCols, int headerRowNumber, int headerColumnNumber, double marginLeft, double marginRight)
          Construct the Table feature with a specified row number, column number, header row number, header column number, left margin space and right margin space.
 Table newTable(String[] rowLabel, String[] columnLabel, double[][] data)
          Construct the Table feature with a specified 2 dimension array as the data of this table.
 Table newTable(String[] rowLabel, String[] columnLabel, String[][] data)
          Construct the Table feature with a specified 2 dimension array as the data of this table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table.TableBuilder

public Table.TableBuilder(TableContainer container)
TableBuilder constructor. This constructor should only be use in owner TableContainer constructor. The end user isn't allowed to call it directly, otherwise an IllegalStateException will be thrown.

Parameters:
container - the owner TableContainer.
Throws:
IllegalStateException - if new TableBuilder out of owner Document constructor, this exception will be thrown.
Method Detail

getTableInstance

public Table getTableInstance(TableTableElement odfElement)
Get a table feature instance by an instance of TableTableElement.

Parameters:
odfElement - an instance of TableTableElement
Returns:
an instance of Table that can represent odfElement

newTable

public Table newTable()
Construct the Table feature. The default column count is 5. The default row count is 2.

The table will be inserted at the end of the table container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Returns:
the created Table feature instance

newTable

public Table newTable(int numRows,
                      int numCols,
                      int headerRowNumber,
                      int headerColumnNumber)
Construct the Table feature with a specified row number, column number, header row number, header column number.

The table will be inserted at the end of the container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Parameters:
numRows - the row number
numCols - the column number
headerRowNumber - the header row number
headerColumnNumber - the header column number
Returns:
a new instance of Table

newTable

public Table newTable(int numRows,
                      int numCols,
                      int headerRowNumber,
                      int headerColumnNumber,
                      double marginLeft,
                      double marginRight)
Construct the Table feature with a specified row number, column number, header row number, header column number, left margin space and right margin space.

The table will be inserted at the end of the container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Parameters:
numRows - the row number
numCols - the column number
headerRowNumber - the header row number
headerColumnNumber - the header column number
marginLeft - the left table margin in centimeter(cm), between the left margin of table container and the table
marginRight - the right table margin in centimeter(cm), between the right margin of table container and the table
Returns:
a new instance of Table
Since:
0.5.5

newTable

public Table newTable(int numRows,
                      int numCols)
Construct the Table feature with a specified row number and column number.

The table will be inserted at the end of the container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Parameters:
numRows - the row number
numCols - the column number
Returns:
a new instance of Table

newTable

public Table newTable(String[] rowLabel,
                      String[] columnLabel,
                      double[][] data)
Construct the Table feature with a specified 2 dimension array as the data of this table. The value type of each cell is float.

The table will be inserted at the end of the container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Parameters:
rowLabel - set as the header row, it can be null if no header row needed
columnLabel - set as the header column, it can be null if no header column needed
data - the two dimension array of double as the data of this table
Returns:
a new instance of Table

newTable

public Table newTable(String[] rowLabel,
                      String[] columnLabel,
                      String[][] data)
Construct the Table feature with a specified 2 dimension array as the data of this table. The value type of each cell is string.

The table will be inserted at the end of the container. An unique table name will be given, you may set a custom table name using the setTableName method.

If the container is a text document, cell borders will be created by default.

Parameters:
rowLabel - set as the header row, it can be null if no header row needed
columnLabel - set as the header column, it can be null if no header column needed
data - the two dimension array of string as the data of this table
Returns:
a new instance of Table


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