org.jopendocument.dom.spreadsheet
Class Table<D extends ODDocument>

java.lang.Object
  extended by org.jopendocument.dom.ODNode
      extended by org.jopendocument.dom.StyledNode<S,D>
          extended by org.jopendocument.dom.ImmutableDocStyledNode<S,D>
              extended by org.jopendocument.dom.spreadsheet.Table<D>
Type Parameters:
D - type of table parent
Direct Known Subclasses:
Sheet

public class Table<D extends ODDocument>
extends ImmutableDocStyledNode<S,D>

A single sheet in a spreadsheet.

Author:
Sylvain

Constructor Summary
Table(D parent, org.jdom.Element local)
           
 
Method Summary
 void detach()
           
 void duplicateFirstRows(int nbFirstRows, int nbDuplicate)
           
 void duplicateRows(int start, int count, int copies)
          Clone a range of rows.
 void ensureColumnCount(int newSize)
          Assure that this sheet has at least newSize columns.
 void ensureRowCount(int newSize)
           
 MutableCell<D> getCellAt(int x, int y)
           
 MutableCell<D> getCellAt(String ref)
           
 Column<D> getColumn(int i)
           
 int getColumnCount()
           
 int getHeaderColumnCount()
           
 int getHeaderRowCount()
           
protected  Cell<D> getImmutableCellAt(int x, int y)
           
protected  Cell<D> getImmutableCellAt(String ref)
           
 SheetTableModel.MutableTableModel<D> getMutableTableModel(int column, int row)
           
 SheetTableModel.MutableTableModel<D> getMutableTableModel(Point start, Point end)
          Return the table from start to end inclusive.
 String getName()
           
 Object getPrintRanges()
           
 int getRowCount()
           
 CellStyle getStyleAt(int column, int row)
           
 String getStyleNameAt(int column, int row)
          Find the style name for the specified cell.
 List<Tuple2<Integer,Integer>> getStyleReferences(String cellStyleName)
          Return the coordinates of cells using the passed style.
protected  org.jdom.Namespace getTABLE()
           
 SheetTableModel<D> getTableModel(int column, int row)
           
 SheetTableModel<D> getTableModel(int column, int row, int lastCol, int lastRow)
           
 Object getValueAt(int column, int row)
           
 Object getValueAt(String ref)
          Retourne la valeur de la cellule spécifiée.
 Float getWidth()
          Table width.
 void insertDuplicatedRows(int rowDuplicated, int nbDuplicate)
           
 boolean isCellValid(int x, int y)
           
 void merge(TableModel t, int column, int row)
           
 void merge(TableModel t, int column, int row, boolean includeColNames)
          Merges t into this sheet at the specified point.
 void removeColumn(int colIndex, boolean keepTableWidth)
           
 void removeColumn(int firstIndex, int lastIndex, boolean keepTableWidth)
          Remove columns from this.
 void removePrintRanges()
           
 Point resolveHint(String ref)
           
 void setColumnCount(int newSize)
          Changes the column count without keeping the table width.
 void setColumnCount(int newSize, int colIndex, boolean keepTableWidth)
          Changes the column count.
 void setName(String name)
           
 void setPrintRanges(String s)
           
 void setRowCount(int newSize)
           
 void setRowCount(int newSize, int rowIndex)
          Changes the row count.
 void setValueAt(Object val, int x, int y)
          Sets the value at the specified coordinates.
 
Methods inherited from class org.jopendocument.dom.ImmutableDocStyledNode
getContent, getODDocument
 
Methods inherited from class org.jopendocument.dom.StyledNode
getPrivateStyle, getStyle, getStyle, getStyleName, setStyleName
 
Methods inherited from class org.jopendocument.dom.ODNode
getElement, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Table

public Table(D parent,
             org.jdom.Element local)
Method Detail

getName

public final String getName()

setName

public final void setName(String name)

detach

public void detach()

getPrintRanges

public final Object getPrintRanges()

setPrintRanges

public final void setPrintRanges(String s)

removePrintRanges

public final void removePrintRanges()

duplicateFirstRows

public final void duplicateFirstRows(int nbFirstRows,
                                     int nbDuplicate)

insertDuplicatedRows

public final void insertDuplicatedRows(int rowDuplicated,
                                       int nbDuplicate)

duplicateRows

public final void duplicateRows(int start,
                                int count,
                                int copies)
Clone a range of rows. Eg if you want to copy once rows 2 through 5, you call duplicateRows(2, 4, 1).

Parameters:
start - the first row to clone.
count - the number of rows after start to clone.
copies - the number of copies of the range to make.

resolveHint

public final Point resolveHint(String ref)

isCellValid

public final boolean isCellValid(int x,
                                 int y)

getCellAt

public final MutableCell<D> getCellAt(int x,
                                      int y)

getCellAt

public final MutableCell<D> getCellAt(String ref)

setValueAt

public final void setValueAt(Object val,
                             int x,
                             int y)
Sets the value at the specified coordinates.

Parameters:
val - the new value, null will be treated as "".
x - the column.
y - the row.

getImmutableCellAt

protected final Cell<D> getImmutableCellAt(int x,
                                           int y)

getImmutableCellAt

protected final Cell<D> getImmutableCellAt(String ref)

getValueAt

public final Object getValueAt(int column,
                               int row)
Parameters:
row - la ligne (0 a lineCount-1)
column - la colonnee (0 a colonneCount-1)
Returns:
la valeur de la cellule spécifiée.

getStyleNameAt

public final String getStyleNameAt(int column,
                                   int row)
Find the style name for the specified cell.

Parameters:
column - column index.
row - row index.
Returns:
the style name, can be null.

getStyleAt

public final CellStyle getStyleAt(int column,
                                  int row)

getStyleReferences

public final List<Tuple2<Integer,Integer>> getStyleReferences(String cellStyleName)
Return the coordinates of cells using the passed style.

Parameters:
cellStyleName - a style name.
Returns:
the cells using cellStyleName.

getValueAt

public final Object getValueAt(String ref)
Retourne la valeur de la cellule spécifiée.

Parameters:
ref - une référence de la forme "A3".
Returns:
la valeur de la cellule spécifiée.

getColumn

public final Column<D> getColumn(int i)

getRowCount

public final int getRowCount()

getHeaderRowCount

public final int getHeaderRowCount()

getColumnCount

public final int getColumnCount()

getHeaderColumnCount

public final int getHeaderColumnCount()

setColumnCount

public final void setColumnCount(int newSize)
Changes the column count without keeping the table width.

Parameters:
newSize - the new column count.
See Also:
setColumnCount(int, int, boolean)

ensureColumnCount

public final void ensureColumnCount(int newSize)
Assure that this sheet has at least newSize columns.

Parameters:
newSize - the minimum column count this table should have.

setColumnCount

public final void setColumnCount(int newSize,
                                 int colIndex,
                                 boolean keepTableWidth)
Changes the column count. If newSize is less than getColumnCount() extra cells will be chopped off. Otherwise empty cells will be created.

Parameters:
newSize - the new column count.
colIndex - the index of the column to be copied, -1 for empty column (i.e. default style).
keepTableWidth - true if the table should be same width after the column change.

removeColumn

public final void removeColumn(int colIndex,
                               boolean keepTableWidth)

removeColumn

public final void removeColumn(int firstIndex,
                               int lastIndex,
                               boolean keepTableWidth)
Remove columns from this. As with OpenOffice, no cell must be covered in the column to remove. ATTN keepTableWidth only works for tables in text document that are not aligned automatically (ie fill the entire page). ATTN spreadsheet applications may hide from you the real width of sheets, eg display only columns A to AJ when in reality there's hundreds of blank columns beyond. Thus if you pass true to keepTableWidth you'll end up with huge widths.

Parameters:
firstIndex - the first column to remove.
lastIndex - the last column to remove, exclusive.
keepTableWidth - true if the table should be same width after the column change.

getWidth

public final Float getWidth()
Table width.

Returns:
the table width, can be null (table has no style or style has no width, eg in SpreadSheet).

ensureRowCount

public final void ensureRowCount(int newSize)

setRowCount

public final void setRowCount(int newSize)

setRowCount

public final void setRowCount(int newSize,
                              int rowIndex)
Changes the row count. If newSize is less than getRowCount() extra rows will be chopped off. Otherwise empty cells will be created.

Parameters:
newSize - the new row count.
rowIndex - the index of the row to be copied, -1 for empty row (i.e. default style).

getTableModel

public final SheetTableModel<D> getTableModel(int column,
                                              int row)

getTableModel

public final SheetTableModel<D> getTableModel(int column,
                                              int row,
                                              int lastCol,
                                              int lastRow)

getMutableTableModel

public final SheetTableModel.MutableTableModel<D> getMutableTableModel(int column,
                                                                       int row)

getMutableTableModel

public final SheetTableModel.MutableTableModel<D> getMutableTableModel(Point start,
                                                                       Point end)
Return the table from start to end inclusive.

Parameters:
start - the first cell of the result.
end - the last cell of the result.
Returns:
the table.

merge

public final void merge(TableModel t,
                        int column,
                        int row)

merge

public final void merge(TableModel t,
                        int column,
                        int row,
                        boolean includeColNames)
Merges t into this sheet at the specified point.

Parameters:
t - the data to be merged.
column - the columnn t will be merged at.
row - the row t will be merged at.
includeColNames - if true the column names of t will also be merged.

getTABLE

protected final org.jdom.Namespace getTABLE()


Copyright © 2010 jOpenDocument All Rights Reserved.