com.sas.graphics.components
Class CellStyle

com.sas.graphics.components.CellStyle
Direct Known Subclasses:
ClassificationCellStyle

public class CellStyle

A CellStyle encapsulates the set of display properties applicable the table-like cells such as what you find in a Row or Column graph matrix axis. GraphMatrixAxes display a tree based axis comprised of separate text cells. These cells (similar in appearance to the type of cells found in a TableView) have a background color and frame whose appearance is defined within this class.

Usage

Ex. Set a bar chart's row axis value cells background color to dark blue. Ex. Set a bar chart's column axis value cells background color to dark green.
 BarChart barChart = new BarChart();
 barChart.getBarChartModel().getRowAxisModel().getValueCellStyle().setBackgroundColors( new Color[] {Color.blue.darker()} );
 barChart.getBarChartModel().getColumnAxisModel().getValueCellStyle().setBackgroundColors( new Color[] {Color.green.darker()} );
 

Usage

Ex. Set a bar chart's column axis value cells background color to cycle between white and yellow.
 BarChart barChart = new BarChart();
 barChart.getBarChartModel().getRowAxisModel().getValueCellStyle().setBackgroundColors( new Color[] {Color.white,Color.yellow} );
 

Behavior

This apply() method is a convenience to convey the properties from one CellStyle to another.

Since:
SAS 9.1
See Also:
GraphStyle, ModelBase

Field Summary
static java.lang.String RB_KEY
           
 
Constructor Summary
CellStyle()
          The default backgound color is a white.
CellStyle(java.awt.Color[] backgroundColors, LineStyle frameLineStyle)
           
CellStyle(java.awt.Color backgroundColor, LineStyle frameLineStyle)
           
 
Method Summary
 void apply(CellStyle theOtherObject)
          Utility method to convey properties contained in "theOtherObject" to this object.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this CellStyle.
 java.awt.Color[] getBackgroundColors()
          Returns the color(s) applied to cell backgounds.
 int getBackgroundVisibilityPolicy()
          Returns the visibility policy of the cell's background.
 LineStyle getFrameLineStyle()
          Returns the cell's frame line display properties.
 java.awt.Color getRowSelectionBackgroundColor()
          This method is for internal use only.
 int hashCode()
          Computes the hash code for this CellStyle.
 void setBackgroundColors(java.awt.Color[] newColors)
          Sets the color(s) applied to cell backgounds.
 void setBackgroundVisibilityPolicy(int newVisibilityPolicy)
          Set the visibility policy of the cell's background which may be visible (GraphConstants.TRUE), not visible (GraphConstants.FALSE), or determined by the graph based upon state information (GraphConstants.AUTOMATIC).
 void setFrameLineStyle(LineStyle newLineStyle)
          Set the cell's frame line display properties.
 void setRowSelectionBackgroundColor(java.awt.Color newColor)
          This method is for internal use only.
 
Methods inherited from class com.sas.graphics.components.ModelBase
addPropertyChangeListener, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, removePropertyChangeListener, setContainedModel
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

CellStyle

public CellStyle()
The default backgound color is a white. The default frame color is SystemColor.windowBorder The default frame thickness is 1 pixel.


CellStyle

public CellStyle(java.awt.Color[] backgroundColors,
                 LineStyle frameLineStyle)

CellStyle

public CellStyle(java.awt.Color backgroundColor,
                 LineStyle frameLineStyle)
Method Detail

apply

public void apply(CellStyle theOtherObject)
Utility method to convey properties contained in "theOtherObject" to this object.

Note: Contained "models" (i.e. properties that are subclasses of ModelBase) will in turn be called on to convey their properties to the like contained models in the other object. In that respect this can be considered a "tree" type copy.

Also Note: This is a deep copy. Thus after the copy, mutable properties will not be shared by the two instances.

Parameters:
theOtherObject - properties applied to this instance

setBackgroundColors

public void setBackgroundColors(java.awt.Color[] newColors)
                         throws java.lang.IllegalArgumentException
Sets the color(s) applied to cell backgounds. When multiple colors are specified then colors are cycled across levels within the associated display where applicable. For instance if an array contains a white and a yellow color is specified on the Column axis (a GraphMatrixAxis) then the highest level will be white, its children will be yellow, its grand children will be white, its great grand children will be yellow etc.

Note: the array is copied when either a get or set is called. To affect a change in the graph this set method must be called.

Parameters:
newColors - of the cell's backgound
Throws:
java.lang.IllegalArgumentException - if newColor is null, contains a null or has a length of less then 1.
See Also:
getBackgroundColors()

getBackgroundColors

public java.awt.Color[] getBackgroundColors()
Returns the color(s) applied to cell backgounds.

Returns:
Color[] the set of colors applied to cell backgrounds.
See Also:
setBackgroundColors(java.awt.Color[])

setRowSelectionBackgroundColor

public void setRowSelectionBackgroundColor(java.awt.Color newColor)
                                    throws java.lang.IllegalArgumentException
This method is for internal use only. This method sets the background color for the selection made for the row.

Parameters:
newColor - of the cell's background
Throws:
java.lang.IllegalArgumentException - if newColor is null, contains a null or has a length of less then 1.
See Also:
getRowSelectionBackgroundColor()

getRowSelectionBackgroundColor

public java.awt.Color getRowSelectionBackgroundColor()
This method is for internal use only. Returns the color applied to row selection cell backgound color.

Returns:
Color the applied to the row selection cell background.
See Also:
setRowSelectionBackgroundColor(java.awt.Color)

setBackgroundVisibilityPolicy

public void setBackgroundVisibilityPolicy(int newVisibilityPolicy)
                                   throws java.lang.IllegalArgumentException
Set the visibility policy of the cell's background which may be visible (GraphConstants.TRUE), not visible (GraphConstants.FALSE), or determined by the graph based upon state information (GraphConstants.AUTOMATIC).
valid newVisibilityPolicy values are:
  • GraphConstants.AUTOMATIC
  • GraphConstants.TRUE
  • GraphConstants.FALSE

Parameters:
newVisibilityPolicy - visibility of this line
Throws:
java.lang.IllegalArgumentException - is thrown if an invalid newVisibilityPolicy parameter is specified.
See Also:
getBackgroundVisibilityPolicy()

getBackgroundVisibilityPolicy

public int getBackgroundVisibilityPolicy()
Returns the visibility policy of the cell's background.

Returns:
int
See Also:
setBackgroundVisibilityPolicy(int)

setFrameLineStyle

public void setFrameLineStyle(LineStyle newLineStyle)
                       throws java.lang.IllegalArgumentException
Set the cell's frame line display properties.

Parameters:
newLineStyle - the frame properties
Throws:
java.lang.IllegalArgumentException - if newLineStyle is null.
See Also:
getFrameLineStyle(), LineStyle.apply(com.sas.graphics.components.LineStyle)

getFrameLineStyle

public LineStyle getFrameLineStyle()
Returns the cell's frame line display properties.

Returns:
line properties for the frame
See Also:
setFrameLineStyle(com.sas.graphics.components.LineStyle)

equals

public boolean equals(java.lang.Object obj)
Determines whether another object is equal to this CellStyle.

The result is true if and only if the argument is not null and is a CellStyle object that has the same property values as this object.

Overrides:
equals in class ModelBase
Parameters:
obj - the object to test for equality with this CellStyle
Returns:
true if the objects are the same; false otherwise.

hashCode

public int hashCode()
Computes the hash code for this CellStyle.

Overrides:
hashCode in class ModelBase
Returns:
a hash code value for this object.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.