|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sos.reports.DefaultTableFormat
An implementation of TableFormat
that allows clients to define attributes
for the table, rows, columns, and cells, based on whether an element is
in the header, body, or footer. Clients can use the setXxxAttributes
methods to populate the table format with attributes. Multiple
calls to the same method (with the same arguments) will replace the previously
set attributes. Not all attributes must be set. If no attributes are set,
then the table format behaves like an empty attribute set (see
TableFormats.EMPTY_TABLE_FORMAT
)
getCellAttributes
resolves attributes in the
following order (suppose the cell spans rows r1-r2
and columns c1-c2
):
setCellAttributes(a,r1,c1,r2,c2)
setColumnCellAttributes(a,c1,TYPE)
where TYPE
is HEADER
if
r2
is a header row, FOOTER
if r1
is a footer row, or BODY
otherwisesetColumnCellAttributes(a,c1)
setRowCellAttributes(a,r1,TYPE)
where TYPE
is HEADER
if
c2
is a header column, FOOTER
if c1
is a footer column, or BODY
otherwisesetRowCellAttributes(a,r1)
setColumnCellAttributes(a,TYPE)
where TYPE
is HEADER
if
r2
is a header row, FOOTER
if r1
is a footer row, or BODY
otherwisesetRowCellAttributes(a,TYPE)
where TYPE
is HEADER
if
c2
is a header column, FOOTER
if c1
is a footer column, or BODY
otherwisesetCellAttributes(a)
getTierAttributes
resolves attributes in the
following order (suppose the tier is a row at index r
):
setRowAttributes(a,r)
setRowAttributes(a,TYPE)
where TYPE
is HEADER
if
r
is a header row, FOOTER
if r
is a footer row, or BODY
otherwisesetTierAttributes(a)
getTableAttributes
uses the attributes
set in setTableAttributes(a)
.
a
is some attribute set:
setCellAttributes( a, 13, 5 ); // specifies the attributes for the cell at row 13, column 5 setColumnCellAttributes( a, 5 ); // specifies the attributes for all cells in column 5 setColumnCellAttributes( a, 5, HEADER ); // specifies the attributes for all cells in the header portion of column 5 setRowCellAttributes( a, HEADER ); // specifies the attributes for all cells fully in header rows setCellAttributes( a ); // specifies the attributes for all cells setRowAttributes( a, 13 ); // specifies the attributes for Row 13 setRowAttributes( a, BODY ); // specifies the attributes for all body rows setRowAttributes( a ); // specifies the attributes for all rows setTierAttributes( a ); // specifies the attributes for all rows and columns setTableAttributes( a ); // specifies the table attributes
TableFormats
Field Summary | |
static java.lang.Object |
BODY
Constant that indicates a body tier (that is, a non-header and non-footer tier). |
static java.lang.Object |
FOOTER
Constant that indicates a footer tier. |
static java.lang.Object |
HEADER
Constant that indicates a header tier. |
Constructor Summary | |
DefaultTableFormat()
Creates an instance of DefaultTableFormat with no attributes defined. |
Method Summary | |
javax.swing.text.AttributeSet |
getCellAttributes(CellElement cellElement)
Returns the attributes to use for the specified cell element. |
javax.swing.text.AttributeSet |
getTableAttributes(TableElement tableElement)
Returns the attributes to use for the table element. |
javax.swing.text.AttributeSet |
getTierAttributes(TierElement tierElement)
Returns the attributes to use for the specified tier element. |
void |
setCellAttributes(javax.swing.text.AttributeSet attributes,
int row,
int column)
Sets the attributes for cells in the specified row and column. |
void |
setCellAttributes(javax.swing.text.AttributeSet attributes,
int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
Sets the attributes for cells spanning the specified region. |
void |
setColumnAttributes(javax.swing.text.AttributeSet attributes)
Sets the attributes for all columns. |
void |
setColumnAttributes(javax.swing.text.AttributeSet attributes,
int column)
Sets the attributes for columns at the specified index. |
void |
setColumnAttributes(javax.swing.text.AttributeSet attributes,
java.lang.Object tierPortion)
Sets the attributes for header, body, or footer columns. |
void |
setColumnCellAttributes(javax.swing.text.AttributeSet attributes,
int column)
Sets the attributes for cells that fall in the specified column. |
void |
setColumnCellAttributes(javax.swing.text.AttributeSet attributes,
int column,
java.lang.Object tierPortion)
Sets the attributes for cells that fall in the header, body, or footer portion of the specified column. |
void |
setColumnCellAttributes(javax.swing.text.AttributeSet attributes,
java.lang.Object tierPortion)
Sets the attributes for cells that fall in the header, body, or footer columns. |
void |
setRowAttributes(javax.swing.text.AttributeSet attributes)
Sets the attributes for all rows. |
void |
setRowAttributes(javax.swing.text.AttributeSet attributes,
int row)
Sets the attributes for rows at the specified index. |
void |
setRowAttributes(javax.swing.text.AttributeSet attributes,
java.lang.Object tierPortion)
Sets the attributes for header, body, or footer rows. |
void |
setRowCellAttributes(javax.swing.text.AttributeSet attributes,
int row)
Sets the attributes for cells that fall in the specified row. |
void |
setRowCellAttributes(javax.swing.text.AttributeSet attributes,
int row,
java.lang.Object tierPortion)
Sets the attributes for cells that fall in the header, body, or footer portion of the specified row. |
void |
setRowCellAttributes(javax.swing.text.AttributeSet attributes,
java.lang.Object tierPortion)
Sets the attributes for cells that fall in the header, body, or footer rows. |
void |
setTableAttributes(javax.swing.text.AttributeSet attributes)
Sets the attributes for tables. |
void |
setTierAttributes(javax.swing.text.AttributeSet attributes)
Sets the attributes for all rows and columns. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.Object HEADER
BODY
,
FOOTER
public static final java.lang.Object BODY
HEADER
,
FOOTER
public static final java.lang.Object FOOTER
HEADER
,
BODY
Constructor Detail |
public DefaultTableFormat()
DefaultTableFormat
with no attributes defined.
Method Detail |
public javax.swing.text.AttributeSet getCellAttributes(CellElement cellElement)
TableFormat
getCellAttributes
in interface TableFormat
cellElement
- cell for which the attributes are desired
cellElement
public javax.swing.text.AttributeSet getTableAttributes(TableElement tableElement)
TableFormat
getTableAttributes
in interface TableFormat
tableElement
- table for which the attributes are desired
tableElement
public javax.swing.text.AttributeSet getTierAttributes(TierElement tierElement)
TableFormat
getTierAttributes
in interface TableFormat
tierElement
- row or column for which the attributes are desired
tierElement
public void setCellAttributes(javax.swing.text.AttributeSet attributes, int row, int column)
setCellAttributes( attributes, row, column, row, column );
attributes
- cell attributes to setrow
- row of cell for which to set the attributescolumn
- column of cell for which to set the attributes
java.lang.NullPointerException
- if attributes
is null
setCellAttributes(AttributeSet,int,int,int,int)
public void setCellAttributes(javax.swing.text.AttributeSet attributes, int firstRow, int firstColumn, int lastRow, int lastColumn)
attributes
- cell attributes to setfirstRow
- first row of cell for which to set the attributesfirstColumn
- first column of cell for which to set the attributeslastRow
- first row of cell for which to set the attributeslastColumn
- last column of cell for which to set the attributes
java.lang.IllegalArgumentException
- if lastRow < firstRow
or
lastColumn < firstColumn
java.lang.NullPointerException
- if attributes
is null
setCellAttributes(AttributeSet,int,int)
public void setColumnAttributes(javax.swing.text.AttributeSet attributes)
attributes
- column attributes to set
java.lang.NullPointerException
- if attributes
is null
setColumnAttributes(AttributeSet,int)
,
setRowAttributes(AttributeSet)
,
setTierAttributes(AttributeSet)
public void setColumnAttributes(javax.swing.text.AttributeSet attributes, int column)
attributes
- column attributes to setcolumn
- index of column for which to set the attributes
java.lang.NullPointerException
- if attributes
is null
setColumnAttributes(AttributeSet)
,
setRowAttributes(AttributeSet,int)
public void setColumnAttributes(javax.swing.text.AttributeSet attributes, java.lang.Object tierPortion)
attributes
- column attributes to settierPortion
- the type of column for which to set the attributes
java.lang.IllegalArgumentException
- if tierPortion is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setRowAttributes(AttributeSet,Object)
,
setColumnAttributes(AttributeSet,int)
,
setColumnAttributes(AttributeSet)
public void setColumnCellAttributes(javax.swing.text.AttributeSet attributes, int column)
attributes
- cell attributes to setcolumn
- cells in this column will have these attributes
java.lang.NullPointerException
- if attributes
is null
setRowCellAttributes(javax.swing.text.AttributeSet, int)
public void setColumnCellAttributes(javax.swing.text.AttributeSet attributes, java.lang.Object tierPortion)
attributes
- column attributes to settierPortion
- cells in this column portion will have these attributes
java.lang.IllegalArgumentException
- if tierPortion is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setRowCellAttributes(AttributeSet,Object)
,
setColumnCellAttributes(AttributeSet,int)
public void setColumnCellAttributes(javax.swing.text.AttributeSet attributes, int column, java.lang.Object tierPortion)
attributes
- cell attributes to setcolumn
- cells in this column and portion will have these attributestierPortion
- the applicable portion of the column
java.lang.IllegalArgumentException
- if tierPortion
is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setRowCellAttributes(AttributeSet,int,Object)
,
setColumnCellAttributes(AttributeSet,int)
public void setRowAttributes(javax.swing.text.AttributeSet attributes)
attributes
- row attributes to set
java.lang.NullPointerException
- if attributes
is null
setRowAttributes(AttributeSet,int)
,
setColumnAttributes(AttributeSet)
,
setTierAttributes(AttributeSet)
public void setRowAttributes(javax.swing.text.AttributeSet attributes, int row)
A negative row index indicates an offset from the last row of the table.
attributes
- row attributes to setrow
- index of row for which to set the attributes
java.lang.NullPointerException
- if attributes
is null
setRowAttributes(AttributeSet)
,
setColumnAttributes(AttributeSet,int)
public void setRowAttributes(javax.swing.text.AttributeSet attributes, java.lang.Object tierPortion)
attributes
- row attributes to settierPortion
- the type of row for which to set the attributes
java.lang.IllegalArgumentException
- if tierPortion is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setColumnAttributes(AttributeSet,Object)
,
setRowAttributes(AttributeSet,int)
,
setRowAttributes(AttributeSet)
public void setRowCellAttributes(javax.swing.text.AttributeSet attributes, int row)
attributes
- cell attributes to setrow
- cells in this row will have these attributes
java.lang.NullPointerException
- if attributes
is null
setColumnCellAttributes(javax.swing.text.AttributeSet, int)
public void setRowCellAttributes(javax.swing.text.AttributeSet attributes, java.lang.Object tierPortion)
attributes
- row attributes to settierPortion
- cells in this row portion will have these attributes
java.lang.IllegalArgumentException
- if tierPortion is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setColumnCellAttributes(AttributeSet,Object)
,
setRowCellAttributes(AttributeSet,int)
public void setRowCellAttributes(javax.swing.text.AttributeSet attributes, int row, java.lang.Object tierPortion)
attributes
- cell attributes to setrow
- cells in this row and portion will have these attributestierPortion
- the applicable portion of the row
java.lang.IllegalArgumentException
- if tierPortion
is not one of HEADER
,
BODY
, or FOOTER
java.lang.NullPointerException
- if attributes
is null
setColumnCellAttributes(AttributeSet,int,Object)
,
setRowCellAttributes(AttributeSet,int)
public void setTableAttributes(javax.swing.text.AttributeSet attributes)
attributes
- table attributes to set
java.lang.NullPointerException
- if attributes
is null
public void setTierAttributes(javax.swing.text.AttributeSet attributes)
attributes
- tier attributes to set
java.lang.NullPointerException
- if attributes
is null
setRowAttributes(AttributeSet)
,
setColumnAttributes(AttributeSet)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |