com.sas.table
Interface StaticTableStyleInterface


public interface StaticTableStyleInterface

Defines an interface for accessing a table's styles. This will usually be implemented in tandem with the primary interface to tables, StaticTableInterface.

A style is a set of property keys (Strings) with associated values (Objects) that are used as formatting defaults and rendering hints by a view.

A table can have default styles, or styles associated with individual elements -- cells, columns, rows, and labels -- or both. If there is no style available for a particular element or category of elements, null may be returned for any of the get-methods.

Consumers of this interface (e.g. views) should listen for PropertyBagChangedEvents from the default styles. However, if the styles associated with individual elements change or if a default style is replaced, it is the implementation's responsibility to notify a consumer via an appropriate changed event. Use PropertyChangeEvent for default style replacements, and the appropriate TableElementChangedEvent subclass for styles associated with individual elements. It might seem as though consumers could also listen to changes from the non-default styles. Well they could, but it could be very inefficient if there were lots of them, in addition to being difficult to manage if the same style was used with multiple elements as the consumer would not readily know they were shared. The difficulty here is best explained via example: first, the consumer queries the style associated with row one and registers itself as a listener; then it does the same with row two; then when row one is scrolled out of view, it releases resources associated with row one which includes removing itself as a listener to row one's style; however, if row one and row two were sharing a style, this would inadvertently remove the consumer as a listener of row two. Thus, it's best if the model implementation which presumably knows these relationships generates the changed events for such styles. The consumer can handle listening to the default styles directly since there is a fixed number of them.

See Also:
StaticTableTypeStylesInterface, CellStyle, ColumnStyle, RowStyle

Method Summary
 com.sas.collection.StaticPropertyBagInterface getCellStyle(int rowIndex, int colIndex)
          Returns the style for a given cell.
 com.sas.collection.StaticPropertyBagInterface getColumnLabelStyle(int colIndex)
          Returns the style for a given column's label.
 com.sas.collection.StaticPropertyBagInterface getColumnStyle(int colIndex)
          Returns the style for a given column.
 com.sas.collection.StaticPropertyBagInterface getDefaultCellStyle()
          Returns the default style for all cells.
 com.sas.collection.StaticPropertyBagInterface getDefaultColumnStyle()
          Returns the default style for all columns.
 com.sas.collection.StaticPropertyBagInterface getDefaultLabelStyle()
          Returns the default style for all labels.
 com.sas.collection.StaticPropertyBagInterface getDefaultRowStyle()
          Returns the default style for all rows.
 com.sas.collection.StaticPropertyBagInterface getRowLabelStyle(int rowIndex)
          Returns the style for a given row's label.
 com.sas.collection.StaticPropertyBagInterface getRowStyle(int rowIndex)
          Returns the style for a given row.
 boolean isCellStylesSupported()
          Returns whether styles are available for individual cells.
 boolean isColumnLabelStylesSupported()
          Returns whether styles are available for individual column labels.
 boolean isColumnStylesSupported()
          Returns whether styles are available for individual columns.
 boolean isRowLabelStylesSupported()
          Returns whether styles are available for individual row labels.
 boolean isRowStylesSupported()
          Returns whether styles are available for individual rows.
 

Method Detail

getDefaultCellStyle

com.sas.collection.StaticPropertyBagInterface getDefaultCellStyle()
                                                                  throws com.sas.table.TableException
Returns the default style for all cells.

Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).

getDefaultColumnStyle

com.sas.collection.StaticPropertyBagInterface getDefaultColumnStyle()
                                                                    throws com.sas.table.TableException
Returns the default style for all columns.

Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).

getDefaultLabelStyle

com.sas.collection.StaticPropertyBagInterface getDefaultLabelStyle()
                                                                   throws com.sas.table.TableException
Returns the default style for all labels.

Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).

getDefaultRowStyle

com.sas.collection.StaticPropertyBagInterface getDefaultRowStyle()
                                                                 throws com.sas.table.TableException
Returns the default style for all rows.

Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).

getCellStyle

com.sas.collection.StaticPropertyBagInterface getCellStyle(int rowIndex,
                                                           int colIndex)
                                                           throws com.sas.table.TableException
Returns the style for a given cell. Will not be called if isCellStylesSupported() returns false.

Parameters:
rowIndex - A one-based index that identifies the cell's row.
colIndex - A one-based index that identifies the cell's column.
Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
isCellStylesSupported()

getColumnStyle

com.sas.collection.StaticPropertyBagInterface getColumnStyle(int colIndex)
                                                             throws com.sas.table.TableException
Returns the style for a given column. Will not be called if isColumnStylesSupported() returns false.

Parameters:
colIndex - A one-based index that identifies the column.
Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
isColumnStylesSupported()

getColumnLabelStyle

com.sas.collection.StaticPropertyBagInterface getColumnLabelStyle(int colIndex)
                                                                  throws com.sas.table.TableException
Returns the style for a given column's label. Will not be called if isColumnLabelStylesSupported() returns false.

Parameters:
colIndex - A one-based index that identifies the column.
Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
isColumnLabelStylesSupported()

getRowStyle

com.sas.collection.StaticPropertyBagInterface getRowStyle(int rowIndex)
                                                          throws com.sas.table.TableException
Returns the style for a given row. Will not be called if isRowStylesSupported() returns false.

Parameters:
rowIndex - A one-based index that identifies the row.
Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
isRowStylesSupported()

getRowLabelStyle

com.sas.collection.StaticPropertyBagInterface getRowLabelStyle(int rowIndex)
                                                               throws com.sas.table.TableException
Returns the style for a given row's label. Will not be called if isRowLabelStylesSupported() returns false.

Parameters:
rowIndex - A one-based index that identifies the row.
Returns:
A StaticPropertyBagInterface or null.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
isRowLabelStylesSupported()

isCellStylesSupported

boolean isCellStylesSupported()
                              throws com.sas.table.TableException
Returns whether styles are available for individual cells.

Returns:
true if getCellStyle() should be called for each cell, and false otherwise.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
getCellStyle(int, int)

isColumnStylesSupported

boolean isColumnStylesSupported()
                                throws com.sas.table.TableException
Returns whether styles are available for individual columns.

Returns:
true if getColumnStyle() should be called for each column, and false otherwise.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
getColumnStyle(int)

isColumnLabelStylesSupported

boolean isColumnLabelStylesSupported()
                                     throws com.sas.table.TableException
Returns whether styles are available for individual column labels.

Returns:
true if getColumnLabelStyle() should be called for each column label, and false otherwise.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
getColumnLabelStyle(int)

isRowStylesSupported

boolean isRowStylesSupported()
                             throws com.sas.table.TableException
Returns whether styles are available for individual rows.

Returns:
true if getRowStyle() should be called for each row, and false otherwise.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
getRowStyle(int)

isRowLabelStylesSupported

boolean isRowLabelStylesSupported()
                                  throws com.sas.table.TableException
Returns whether styles are available for individual row labels.

Returns:
true if getRowLabelStyle() should be called for each row label, and false otherwise.
Throws:
TableException - Thrown if the query can not be satisfied (e.g. i/o-failure).
See Also:
getRowLabelStyle(int)



Copyright © 2009 SAS Institute Inc. All Rights Reserved.