xelem.3.0

nl.fountain.xelem.excel.ss
Class SSRow

java.lang.Object
  extended by nl.fountain.xelem.excel.AbstractXLElement
      extended by nl.fountain.xelem.excel.ss.SSRow
All Implemented Interfaces:
Row, XLElement

public class SSRow
extends AbstractXLElement
implements Row

An implementation of the XLElement Row.


Field Summary
 
Fields inherited from interface nl.fountain.xelem.excel.XLElement
PREFIX_HTML, PREFIX_O, PREFIX_SS, PREFIX_X, XMLNS, XMLNS_HTML, XMLNS_O, XMLNS_SS, XMLNS_X
 
Constructor Summary
SSRow()
          Constructs a new SSRow.
 
Method Summary
 Cell addCell()
          Adds a new Cell to this row.
 Cell addCell(Cell cell)
          Adds the given Cell to this row.
 Cell addCell(double data)
          Adds a new Cell to this row.
 Cell addCell(double data, String styleID)
          Adds a new Cell to this row.
 Cell addCell(int data)
          Adds a new Cell to this row.
 Cell addCell(int data, String styleID)
          Adds a new Cell to this row.
 Cell addCell(Object data)
          Adds a new Cell to this row.
 Cell addCell(Object data, String styleID)
          Adds a new Cell to this row.
 Cell addCellAt(int index)
          Adds a new Cell at the given index.
 Cell addCellAt(int index, Cell cell)
          Adds the given Cell at the given index.
 Element assemble(Element parent, GIO gio)
          Assembles the state of this XLElement and all of it's children into an Element.
 Iterator<Cell> cellIterator()
          Returns an iterator for the cells in this row.
 Element createElement(Document doc)
          Creates an Element with the specified doc as owner-document.
 Cell getCellAt(int index)
          Gets the cell at the given index.
 TreeMap<Integer,Cell> getCellMap()
          Gets all the cells of this row.
 Collection<Cell> getCells()
          Gets all the cells of this row in the order of their index.
 double getHeight()
          Gets the height of this row.
 int getIndex()
          Gets the value of the ss:Index-attribute of this Row-element.
 String getNameSpace()
          Gets the namespace of this XLElement.
 String getPrefix()
          Gets the prefix of this XLElement.
 int getSpan()
          Gets the number of extra rows this row spans.
 String getStyleID()
          Gets the ss:StyleID which was set on this row.
 String getTagName()
          Gets the tagname (localName) of this XLElement.
 boolean hasCellAt(int index)
          Specifies whether this row has a cell at the given index
 boolean isHidden()
          Specifies whether this row is hidden.
 int maxCellIndex()
          Gets the highest index number of the cells in this row.
 Cell removeCellAt(int index)
          Removes the cell at the given index.
 void setAttributes(Attributes attrs)
          Does effectively nothing.
 void setHeight(double h)
          Sets the height of this row.
 void setHidden(boolean hide)
          Sets whether this row will be hidden.
 void setIndex(int index)
          Sets the value of the ss:Index-attribute of this Row-element.
 void setSpan(int s)
          Sets the span of this row.
 void setStyleID(String id)
          Sets the ss:StyleID on this row.
 int size()
          Gets the number of cells in this row.
 
Methods inherited from class nl.fountain.xelem.excel.AbstractXLElement
addElementComment, assemble, createAttributeNS, createAttributeNS, createElementNS, createElementNS, createElementNS, createElementNS, getElementComments, setChildElement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nl.fountain.xelem.excel.XLElement
addElementComment, getElementComments, setChildElement
 

Constructor Detail

SSRow

public SSRow()
Constructs a new SSRow.

See Also:
Worksheet.addRow()
Method Detail

setStyleID

public void setStyleID(String id)
Description copied from interface: Row
Sets the ss:StyleID on this row. If no styleID is set on a row, the ss:StyleID-attribute is not deployed in the resulting xml and Excel employes the Default-style on the row.

Specified by:
setStyleID in interface Row
Parameters:
id - the id of the style to employ on this row.

getStyleID

public String getStyleID()
Description copied from interface: Row
Gets the ss:StyleID which was set on this row.

Specified by:
getStyleID in interface Row
Returns:
The id of the style to employ on this row or null if no styleID was previously set.

setHeight

public void setHeight(double h)
Description copied from interface: Row
Sets the height of this row.

Specified by:
setHeight in interface Row
Parameters:
h - The height of the row (in points).

getHeight

public double getHeight()
Description copied from interface: Row
Gets the height of this row. A return value of 0.0 may indicate this row has a default height.

Specified by:
getHeight in interface Row
Returns:
the height of the row (in points).

setSpan

public void setSpan(int s)
Description copied from interface: Row
Sets the span of this row. The value of s must be greater than 0 in order to have effect on the resulting xml.

No other rows must be added within the span of this row:

         Row row = table.addRow(5); // adds a row with index 5
         row.setHeight(25.2);       // do some formatting on the row
         row.setSpan(3);            // span a total of 4 rows
         // illegal: first free index = 5 + 3 + 1 = 9
         // Row row2 = table.addRow(8);
 

Specified by:
setSpan in interface Row
Parameters:
s - The number of additional rows to include in the span.

getSpan

public int getSpan()
Description copied from interface: Row
Gets the number of extra rows this row spans.

Specified by:
getSpan in interface Row
Returns:
the number of extra rows this row spans

setHidden

public void setHidden(boolean hide)
Description copied from interface: Row
Sets whether this row will be hidden.

Specified by:
setHidden in interface Row
Parameters:
hide - true if this row must not be displayed.

isHidden

public boolean isHidden()
Description copied from interface: Row
Specifies whether this row is hidden.

Specified by:
isHidden in interface Row

addCell

public Cell addCell()
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Specified by:
addCell in interface Row
Returns:
A new cell with an initial datatype of "String" and an empty ("") value.

addCell

public Cell addCell(Object data)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Datatype and value of the new cell depend on the passed object.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
Returns:
A new cell.
See Also:
Cell.setData(Object)

addCell

public Cell addCell(Object data,
                    String styleID)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Datatype and value of the new cell depend on the passed object. The new cell will have it's styleID set to the given id.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
styleID - The id of the style to employ on this cell.
Returns:
A new cell.
See Also:
Cell.setData(Object), Cell.setStyleID(String)

addCell

public Cell addCell(double data)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
Returns:
A new cell with a datatype "Number" and the given double as value.
See Also:
Cell.setData(double)

addCell

public Cell addCell(double data,
                    String styleID)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1. The new cell will have it's styleID set to the given id.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
styleID - The id of the style to employ on this cell.
Returns:
A new cell with a datatype "Number" and the given double as value.
See Also:
Cell.setData(double), Cell.setStyleID(String)

addCell

public Cell addCell(int data)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
Returns:
A new cell with a datatype "Number" and the given int as value.

addCell

public Cell addCell(int data,
                    String styleID)
Description copied from interface: Row
Adds a new Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1. The new cell will have it's styleID set to the given id.

Specified by:
addCell in interface Row
Parameters:
data - The data to be displayed in this cell.
styleID - The id of the style to employ on this cell.
Returns:
A new cell with a datatype "Number" and the given int as value.
See Also:
Cell.setStyleID(String)

addCellAt

public Cell addCellAt(int index)
Description copied from interface: Row
Adds a new Cell at the given index. If the index was allready occupied by another cell, replaces this cell.

Specified by:
addCellAt in interface Row
Parameters:
index - The index (column number) of the cell.
Returns:
A new cell with an initial datatype of "String" and an empty ("") value.

addCell

public Cell addCell(Cell cell)
Description copied from interface: Row
Adds the given Cell to this row. If no cells were previously added the cell will be added at index 1. Otherwise the cell will be added at Row.maxCellIndex() + 1.

Specified by:
addCell in interface Row
Parameters:
cell - The cell that is to be appended to this row.
Returns:
The passed cell.

addCellAt

public Cell addCellAt(int index,
                      Cell cell)
Description copied from interface: Row
Adds the given Cell at the given index. If the index was allready occupied by another cell, replaces this cell.

Specified by:
addCellAt in interface Row
Parameters:
index - The index (column number) of the cell.
cell - The cell that is to be appended to this row.
Returns:
The passed cell.

removeCellAt

public Cell removeCellAt(int index)
Description copied from interface: Row
Removes the cell at the given index.

Specified by:
removeCellAt in interface Row
Parameters:
index - The index (column number) of the cell.
Returns:
The removed cell or null if the index was not occupied by a cell.

getCells

public Collection<Cell> getCells()
Description copied from interface: Row
Gets all the cells of this row in the order of their index.

Specified by:
getCells in interface Row
Returns:
A collection of cells.

getCellAt

public Cell getCellAt(int index)
Description copied from interface: Row
Gets the cell at the given index.

Specified by:
getCellAt in interface Row
Parameters:
index - The index (column number) of the cell.
Returns:
The cell at the given index. Never null

hasCellAt

public boolean hasCellAt(int index)
Description copied from interface: Row
Specifies whether this row has a cell at the given index

Specified by:
hasCellAt in interface Row

size

public int size()
Description copied from interface: Row
Gets the number of cells in this row.

Specified by:
size in interface Row
Returns:
The number of cells in this row.

getCellMap

public TreeMap<Integer,Cell> getCellMap()
Description copied from interface: Row
Gets all the cells of this row. The key of the Map.Entrys is of type Integer and stands for the index number of the cell.

Specified by:
getCellMap in interface Row
Returns:
A TreeMap of cells.

maxCellIndex

public int maxCellIndex()
Description copied from interface: Row
Gets the highest index number of the cells in this row.

Specified by:
maxCellIndex in interface Row
Returns:
The highest index number of the cells in this row.

getTagName

public String getTagName()
Description copied from interface: XLElement
Gets the tagname (localName) of this XLElement.

Specified by:
getTagName in interface XLElement
Returns:
qualified name

getNameSpace

public String getNameSpace()
Description copied from interface: XLElement
Gets the namespace of this XLElement.

Specified by:
getNameSpace in interface XLElement
Returns:
namespace

getPrefix

public String getPrefix()
Description copied from interface: XLElement
Gets the prefix of this XLElement.

Specified by:
getPrefix in interface XLElement
Returns:
prefix

cellIterator

public Iterator<Cell> cellIterator()
Description copied from interface: Row
Returns an iterator for the cells in this row. Cells are aware of their index number when passed by this iterator.

Specified by:
cellIterator in interface Row
Returns:
An iterator for the cells in this row.

assemble

public Element assemble(Element parent,
                        GIO gio)
Description copied from interface: XLElement
Assembles the state of this XLElement and all of it's children into an Element. Attaches the new element to it's parent-element if needed.

Specified by:
assemble in interface XLElement
Parameters:
parent - the parent-element to which the new formed element will be appended
gio - a global information object
Returns:
the newly assembled element. may be null.

createElement

public Element createElement(Document doc)
Description copied from interface: Row
Creates an Element with the specified doc as owner-document. The attribute span will not be reflected in this Element.

Specified by:
createElement in interface Row
Parameters:
doc - the Document to which this row will be appended.
Returns:
this row as an Element.

setAttributes

public void setAttributes(Attributes attrs)
Description copied from class: AbstractXLElement
Does effectively nothing.

Specified by:
setAttributes in interface XLElement
Overrides:
setAttributes in class AbstractXLElement
Parameters:
attrs - the attributes found on the element

setIndex

public void setIndex(int index)
Sets the value of the ss:Index-attribute of this Row-element. This method is called by Table.rowIterator() to set the index of this row during assembly.

Specified by:
setIndex in interface Row
Parameters:
index - the index of this row

getIndex

public int getIndex()
Description copied from interface: Row
Gets the value of the ss:Index-attribute of this Row-element. The returned value only makes sence if this row was read with the reader-API in the nl.fountain.xelem.lex-package and before any manipulation of this row or the workbook took place.

Specified by:
getIndex in interface Row
Returns:
the value of the ss:Index-attribute of this Row-element

xelem.3.0