Copyright © 2005 Scientific Applications. All Rights Reserved.

com.sciapp.table.styles
Class DefaultStyleModel

java.lang.Object
  extended by com.sciapp.table.styles.DefaultStyleModel
All Implemented Interfaces:
StyleModel
Direct Known Subclasses:
TreeTable.DefaultTreeStyleModel

public class DefaultStyleModel
extends Object
implements StyleModel

DefaultStyleModel is the default StyleModel implementation that is used by AdvancedJTable. This class stores styles in a list and applies them in the order in which they appear in that list.


Field Summary
protected  ArrayList styles
          The list of styles.
 
Constructor Summary
DefaultStyleModel()
          Constructs a DefaultStyleModel.
 
Method Summary
 void addStyle(Style s)
          Adds a style to the end of the list of styles.
 void applyStyles(Component c, JTable table, int row, int column)
          Applies the styles currently in the model to the component c.
 void clearStyles()
          Removes all styles.
 Style getStyle(int i)
          Retrieves the style at index.
 Style[] getStyles()
          Returns the styles of the style model as an array.
 void insertStyle(Style s, int index)
          Inserts a new style at index.
 void removeStyle(Style s)
          Removes a style from the style model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

styles

protected ArrayList styles
The list of styles.

Constructor Detail

DefaultStyleModel

public DefaultStyleModel()
Constructs a DefaultStyleModel.

Method Detail

addStyle

public void addStyle(Style s)
Adds a style to the end of the list of styles.

Specified by:
addStyle in interface StyleModel
Parameters:
s - the new style to add.

applyStyles

public void applyStyles(Component c,
                        JTable table,
                        int row,
                        int column)
Applies the styles currently in the model to the component c.

Specified by:
applyStyles in interface StyleModel
Parameters:
c - the component that we wish to apply a style to.
table - the associated table
row - the current row of the table
column - the current column of the table

clearStyles

public void clearStyles()
Removes all styles.

Specified by:
clearStyles in interface StyleModel

getStyle

public Style getStyle(int i)
Retrieves the style at index.

Specified by:
getStyle in interface StyleModel
Parameters:
i - the location of the style.
Returns:
the style at the ith index.

getStyles

public Style[] getStyles()
Returns the styles of the style model as an array.

Specified by:
getStyles in interface StyleModel
Returns:
the styles as an array of Style objects.

insertStyle

public void insertStyle(Style s,
                        int index)
Inserts a new style at index.

Specified by:
insertStyle in interface StyleModel
Parameters:
s - the new style to add
index - the location of the style

removeStyle

public void removeStyle(Style s)
Removes a style from the style model.

Specified by:
removeStyle in interface StyleModel
Parameters:
s - the style to remove.

Copyright © 2005 Scientific Applications. All Rights Reserved.