|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.table.CellStyle
public class CellStyle
A customizable set of cell properties.
This class is implemented as a bag, rather than as a fixed set of properties, so that new properties can be added without having to subclass, and so that properties can have the notion of being unset. Unset properties are properties that are not members of the bag, as opposed to set properties which are bag members. By default, no properties are set; i.e. the bag is empty. Such property bags are referred to as styles.
Styles are often used as formatting defaults and rendering hints by views. For example, TableView allows a CellStyle to be associated with individual cells, a ColumnStyle with individual columns, and a RowStyle with individual rows; as well as providing various default styles.
The ability to set some style properties without setting others allows a client to specify preferences for some characteristics of an object while leaving the rest up to the environment (e.g. the view) in which the style is used. For example,
void eraseCell (java.awt.Graphics g, Cell cell, CellStyle style)
{
// if a background color has been specified use it,
// otherwise default to white
java.awt.Color backColor;
if (style.isBackgroundColorSet())
backColor = style.getBackgroundColor();
else
backColor = java.awt.Color.white;
// set the color and paint the cell's background
g.setColor (backColor);
g.fillRect (cell.getHorizontalPosition(), cell.getVerticalPosition(),
cell.getWidth(), cell.getHeight());
}
Styles sometimes contain other styles. This occurs by simply adding a property of type StaticPropertyBagInterface to a style. Examples include CellStyle's borderStyle and fontStyle, and CellVectorStyle's defaultCellStyle and defaultLabelStyle.
BorderStyle
,
FontStyle
,
CellVectorStyle
,
ColumnStyle
,
RowStyle
,
TableView
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
ACTIVATED_ON_CURRENT
String used to identify the activatedOnCurrent property in the bag. |
static java.lang.String |
ACTIVATION_LEVEL
String used to identify the activationLevel property in the bag. |
static java.lang.String |
BACKGROUND
String used to identify the background property in the bag. |
static java.lang.String |
BACKGROUND_COLOR
String used to identify the backgroundColor property in the bag. |
static java.lang.String |
BORDER_STYLE
String used to identify the borderStyle property in the bag. |
static java.lang.String |
BOTTOM_MARGIN
String used to identify the bottomMargin property in the bag. |
static java.lang.String |
FONT_STYLE
String used to identify the fontStyle property in the bag. |
static java.lang.String |
FOREGROUND_COLOR
String used to identify the foregroundColor property in the bag. |
static java.lang.String |
FORMAT
String used to identify the format property in the bag. |
static java.lang.String |
HORIZONTAL_JUSTIFICATION
String used to identify the horizontalJustification property in the bag. |
static java.lang.String |
INFORMAT
String used to identify the informat property in the bag. |
static java.lang.String |
LEFT_MARGIN
String used to identify the leftMargin property in the bag. |
static java.lang.String |
OPACITY
String used to identify the opacity property in the bag. |
static int |
OPAQUE
opacity property value which indicates that a cell's background completely obscures its area. |
static java.lang.String |
RIGHT_MARGIN
String used to identify the rightMargin property in the bag. |
static int |
SEMI_TRANSPARENT
opacity property value which indicates that a cell's background partially obscures its area. |
static java.lang.String |
SPLIT_CHARACTER
String used to identify the splitCharacter property in the bag. |
static java.lang.String |
TOP_MARGIN
String used to identify the topMargin property in the bag. |
static int |
TRANSPARENT
opacity property value which indicates that a cell has no background. |
static java.lang.String |
VERTICAL_JUSTIFICATION
String used to identify the verticalJustification property in the bag. |
static java.lang.String |
VIEW_CLASS
String used to identify the viewClass property in the bag. |
static java.lang.String |
WRAPPED
String used to identify the wrapped property in the bag. |
Constructor Summary | |
---|---|
CellStyle()
|
Method Summary | |
---|---|
int |
getActivationLevel()
Returns the active state that represents the degree to which a cell can be activated. |
TablePainterInterface |
getBackground()
Returns the object that performs custom painting of cell backgrounds. |
java.awt.Color |
getBackgroundColor()
Returns the color to use for cell backgrounds. |
BorderStyle |
getBorderStyle()
Returns the characteristics of the border to draw around cells. |
com.sas.measures.Length |
getBottomMargin()
Returns the bottom margin to use. |
FontStyle |
getFontStyle()
Returns the characteristics of the font to use. |
java.awt.Color |
getForegroundColor()
Returns the color to use for cell foregrounds. |
int |
getHorizontalJustification()
Returns the horizontal justification to use. |
com.sas.measures.Length |
getLeftMargin()
Returns the left margin to use. |
int |
getOpacity()
Returns the opacity of cell backgrounds. |
com.sas.measures.Length |
getRightMargin()
Returns the right margin to use. |
char |
getSplitCharacter()
Returns the the split character to use. |
com.sas.measures.Length |
getTopMargin()
Returns the top margin to use. |
int |
getVerticalJustification()
Returns the vertical justification to use. |
java.lang.Class |
getViewClass()
Returns the class of the object used to view cell data. |
boolean |
isActivatedOnCurrent()
Returns whether cells should be activated when they are made current in the view. |
boolean |
isActivatedOnCurrentSet()
Determines if the activatedOnCurrent property is in the bag. |
boolean |
isActivationLevelSet()
Determines if the activationLevel property is in the bag. |
boolean |
isBackgroundColorSet()
Determines if the backgroundColor property is in the bag. |
boolean |
isBackgroundSet()
Determines if the background property is in the bag. |
boolean |
isBorderStyleSet()
Determines if the borderStyle property is in the bag. |
boolean |
isBottomMarginSet()
Determines if the bottomMargin property is in the bag. |
boolean |
isFontStyleSet()
Determines if the fontStyle property is in the bag. |
boolean |
isForegroundColorSet()
Determines if the foregroundColor property is in the bag. |
boolean |
isHorizontalJustificationSet()
Determines if the horizontalJustification property is in the bag. |
boolean |
isLeftMarginSet()
Determines if the leftMargin property is in the bag. |
boolean |
isOpacitySet()
Determines if the opacity property is in the bag. |
boolean |
isRightMarginSet()
Determines if the rightMargin property is in the bag. |
boolean |
isSplitCharacterSet()
Determines if the splitCharacter property is in the bag. |
boolean |
isTopMarginSet()
Determines if the topMargin property is in the bag. |
boolean |
isVerticalJustificationSet()
Determines if the verticalJustification property is in the bag. |
boolean |
isViewClassSet()
Determines if the viewClass property is in the bag. |
boolean |
isWrapped()
Returns whether a text-based cell should wrap its text within its bounds. |
boolean |
isWrappedSet()
Determines if the wrapped property is in the bag. |
void |
setActivatedOnCurrent(boolean newValue)
Specifies whether cells should be activated when they are made current in the view. |
void |
setActivationLevel(int newValue)
Specifies the active state that represents the degree to which a cell can be activated. |
void |
setBackground(TablePainterInterface newValue)
Specifies the object that performs custom painting of cell backgrounds. |
void |
setBackgroundColor(java.awt.Color newValue)
Specifies the color to use for cell backgrounds. |
void |
setBorderStyle(BorderStyle newValue)
Specifies the characteristics of the border to draw around cells. |
void |
setBottomMargin(com.sas.measures.Length newValue)
Specifies the bottom margin to use. |
void |
setFontStyle(FontStyle newValue)
Specifies the characteristics of the font to use. |
void |
setForegroundColor(java.awt.Color newValue)
Specifies the color to use for cell foregrounds. |
void |
setHorizontalJustification(int newValue)
Specifies the horizontal justification to use. |
void |
setLeftMargin(com.sas.measures.Length newValue)
Specifies the left margin to use. |
void |
setMargins(com.sas.measures.Length newValue)
Convenience method for setting all four margins to the same value. |
void |
setOpacity(int newValue)
Specifies the opacity of cell backgrounds. |
void |
setRightMargin(com.sas.measures.Length newValue)
Specifies the right margin to use. |
void |
setSplitCharacter(char newValue)
Specifies the character that a text-based cell should use to split, or wrap, its text into multiple lines. |
void |
setTopMargin(com.sas.measures.Length newValue)
Specifies the top margin to use. |
void |
setVerticalJustification(int newValue)
Specifies the vertical justification to use. |
void |
setViewClass(java.lang.Class newValue)
Specifies the class of the object used to view cell data. |
void |
setWrapped(boolean newValue)
Specifies whether a text-based cell should wrap its text within its bounds. |
void |
unsetActivatedOnCurrent()
Removes the activatedOnCurrent property from the bag. |
void |
unsetActivationLevel()
Removes the activationLevel property from the bag. |
void |
unsetBackground()
Removes the background property from the bag. |
void |
unsetBackgroundColor()
Removes the backgroundColor property from the bag. |
void |
unsetBorderStyle()
Removes the borderStyle property from the bag. |
void |
unsetBottomMargin()
Removes the bottomMargin property from the bag. |
void |
unsetFontStyle()
Removes the fontStyle property from the bag. |
void |
unsetForegroundColor()
Removes the foregroundColor property from the bag. |
void |
unsetHorizontalJustification()
Removes the horizontalJustification property from the bag. |
void |
unsetLeftMargin()
Removes the leftMargin property from the bag. |
void |
unsetMargins()
Convenience method for unsetting all four margin properties. |
void |
unsetOpacity()
Removes the opacity property from the bag. |
void |
unsetRightMargin()
Removes the rightMargin property from the bag. |
void |
unsetSplitCharacter()
Removes the splitCharacter property from the bag. |
void |
unsetTopMargin()
Removes the topMargin property from the bag. |
void |
unsetVerticalJustification()
Removes the verticalJustification property from the bag. |
void |
unsetViewClass()
Removes the viewClass property from the bag. |
void |
unsetWrapped()
Removes the wraped property from the bag. |
Field Detail |
---|
public static final java.lang.String ACTIVATED_ON_CURRENT
public static final java.lang.String ACTIVATION_LEVEL
public static final java.lang.String BACKGROUND
public static final java.lang.String BACKGROUND_COLOR
public static final java.lang.String BORDER_STYLE
public static final java.lang.String BOTTOM_MARGIN
public static final java.lang.String FONT_STYLE
public static final java.lang.String FOREGROUND_COLOR
public static final java.lang.String FORMAT
public static final java.lang.String HORIZONTAL_JUSTIFICATION
public static final java.lang.String INFORMAT
public static final java.lang.String LEFT_MARGIN
public static final java.lang.String OPACITY
public static final java.lang.String RIGHT_MARGIN
public static final java.lang.String SPLIT_CHARACTER
public static final java.lang.String TOP_MARGIN
public static final java.lang.String VERTICAL_JUSTIFICATION
public static final java.lang.String VIEW_CLASS
public static final java.lang.String WRAPPED
public static final int OPAQUE
public static final int SEMI_TRANSPARENT
public static final int TRANSPARENT
Constructor Detail |
---|
public CellStyle()
Method Detail |
---|
public boolean isActivatedOnCurrent()
true
if a current cell should be auto-activated, or
false
if making a cell current and activating it should
be separate actions.isActivatedOnCurrentSet()
,
setActivatedOnCurrent(boolean)
,
unsetActivatedOnCurrent()
public void setActivatedOnCurrent(boolean newValue)
newValue
- The new value to assign the activatedOnCurrent property.isActivatedOnCurrent()
,
isActivatedOnCurrentSet()
,
unsetActivatedOnCurrent()
public boolean isActivatedOnCurrentSet()
true
if activatedOnCurrent has been set,
and false
otherwise.isActivatedOnCurrent()
,
setActivatedOnCurrent(boolean)
,
unsetActivatedOnCurrent()
public void unsetActivatedOnCurrent()
isActivatedOnCurrent()
,
isActivatedOnCurrentSet()
,
setActivatedOnCurrent(boolean)
public int getActivationLevel()
isActivationLevelSet()
,
setActivationLevel(int)
,
unsetActivationLevel()
public void setActivationLevel(int newValue)
newValue
- The new value to assign the activationLevel property.getActivationLevel()
,
isActivationLevelSet()
,
unsetActivationLevel()
public boolean isActivationLevelSet()
true
if activationLevel has been set,
and false
otherwise.getActivationLevel()
,
setActivationLevel(int)
,
unsetActivationLevel()
public void unsetActivationLevel()
getActivationLevel()
,
isActivationLevelSet()
,
setActivationLevel(int)
public TablePainterInterface getBackground()
isBackgroundSet()
,
setBackground(com.sas.table.TablePainterInterface)
,
unsetBackground()
public void setBackground(TablePainterInterface newValue)
newValue
- The new value to assign the background property.getBackground()
,
isBackgroundSet()
,
unsetBackground()
public boolean isBackgroundSet()
true
if background has been set,
and false
otherwise.getBackground()
,
setBackground(com.sas.table.TablePainterInterface)
,
unsetBackground()
public void unsetBackground()
getBackground()
,
isBackgroundSet()
,
setBackground(com.sas.table.TablePainterInterface)
public java.awt.Color getBackgroundColor()
isBackgroundColorSet()
,
setBackgroundColor(java.awt.Color)
,
unsetBackgroundColor()
public void setBackgroundColor(java.awt.Color newValue)
newValue
- The new value to assign the backgroundColor property.getBackgroundColor()
,
isBackgroundColorSet()
,
unsetBackgroundColor()
public boolean isBackgroundColorSet()
true
if backgroundColor has been set,
and false
otherwise.getBackgroundColor()
,
setBackgroundColor(java.awt.Color)
,
unsetBackgroundColor()
public void unsetBackgroundColor()
getBackgroundColor()
,
isBackgroundColorSet()
,
setBackgroundColor(java.awt.Color)
public BorderStyle getBorderStyle()
isBorderStyleSet()
,
setBorderStyle(com.sas.table.BorderStyle)
,
unsetBorderStyle()
public void setBorderStyle(BorderStyle newValue)
newValue
- The new value to assign the borderStyle property.getBorderStyle()
,
isBorderStyleSet()
,
unsetBorderStyle()
public boolean isBorderStyleSet()
true
if borderStyle has been set,
and false
otherwise.getBorderStyle()
,
setBorderStyle(com.sas.table.BorderStyle)
,
unsetBorderStyle()
public void unsetBorderStyle()
getBorderStyle()
,
isBorderStyleSet()
,
setBorderStyle(com.sas.table.BorderStyle)
public com.sas.measures.Length getBottomMargin()
isBottomMarginSet()
,
setBottomMargin(com.sas.measures.Length)
,
unsetBottomMargin()
public void setBottomMargin(com.sas.measures.Length newValue)
newValue
- The new value to assign the bottomMargin property.setMargins(com.sas.measures.Length)
,
getBottomMargin()
,
isBottomMarginSet()
,
unsetBottomMargin()
public boolean isBottomMarginSet()
true
if bottomMargin has been set,
and false
otherwise.getBottomMargin()
,
setBottomMargin(com.sas.measures.Length)
,
unsetBottomMargin()
public void unsetBottomMargin()
unsetMargins()
,
getBottomMargin()
,
isBottomMarginSet()
,
setBottomMargin(com.sas.measures.Length)
public FontStyle getFontStyle()
isFontStyleSet()
,
setFontStyle(com.sas.table.FontStyle)
,
unsetFontStyle()
public void setFontStyle(FontStyle newValue)
newValue
- The new value to assign the fontStyle property.getFontStyle()
,
isFontStyleSet()
,
unsetFontStyle()
public boolean isFontStyleSet()
true
if fontStyle has been set,
and false
otherwise.getFontStyle()
,
setFontStyle(com.sas.table.FontStyle)
,
unsetFontStyle()
public void unsetFontStyle()
getFontStyle()
,
isFontStyleSet()
,
setFontStyle(com.sas.table.FontStyle)
public java.awt.Color getForegroundColor()
isForegroundColorSet()
,
setForegroundColor(java.awt.Color)
,
unsetForegroundColor()
public void setForegroundColor(java.awt.Color newValue)
newValue
- The new value to assign the foregroundColor property.getForegroundColor()
,
isForegroundColorSet()
,
unsetForegroundColor()
public boolean isForegroundColorSet()
true
if foregroundColor has been set,
and false
otherwise.getForegroundColor()
,
setForegroundColor(java.awt.Color)
,
unsetForegroundColor()
public void unsetForegroundColor()
getForegroundColor()
,
isForegroundColorSet()
,
setForegroundColor(java.awt.Color)
public int getHorizontalJustification()
isHorizontalJustificationSet()
,
setHorizontalJustification(int)
,
unsetHorizontalJustification()
,
getVerticalJustification()
public void setHorizontalJustification(int newValue)
newValue
- The new value to assign the horizontalJustification property.getHorizontalJustification()
,
isHorizontalJustificationSet()
,
unsetHorizontalJustification()
public boolean isHorizontalJustificationSet()
true
if horizontalJustification has been set,
and false
otherwise.getHorizontalJustification()
,
setHorizontalJustification(int)
,
unsetHorizontalJustification()
public void unsetHorizontalJustification()
getHorizontalJustification()
,
isHorizontalJustificationSet()
,
setHorizontalJustification(int)
public com.sas.measures.Length getLeftMargin()
isLeftMarginSet()
,
setLeftMargin(com.sas.measures.Length)
,
unsetLeftMargin()
public void setLeftMargin(com.sas.measures.Length newValue)
newValue
- The new value to assign the leftMargin property.setMargins(com.sas.measures.Length)
,
getLeftMargin()
,
isLeftMarginSet()
,
unsetLeftMargin()
public boolean isLeftMarginSet()
true
if leftMargin has been set,
and false
otherwise.getLeftMargin()
,
setLeftMargin(com.sas.measures.Length)
,
unsetLeftMargin()
public void unsetLeftMargin()
unsetMargins()
,
getLeftMargin()
,
isLeftMarginSet()
,
setLeftMargin(com.sas.measures.Length)
public int getOpacity()
isOpacitySet()
,
setOpacity(int)
,
unsetOpacity()
public void setOpacity(int newValue)
newValue
- The new value to assign the opacity property.getOpacity()
,
isOpacitySet()
,
unsetOpacity()
public boolean isOpacitySet()
true
if opacity has been set,
and false
otherwise.getOpacity()
,
setOpacity(int)
,
unsetOpacity()
public void unsetOpacity()
getOpacity()
,
isOpacitySet()
,
setOpacity(int)
public com.sas.measures.Length getRightMargin()
isRightMarginSet()
,
setRightMargin(com.sas.measures.Length)
,
unsetRightMargin()
public void setRightMargin(com.sas.measures.Length newValue)
newValue
- The new value to assign the rightMargin property.setMargins(com.sas.measures.Length)
,
getRightMargin()
,
isRightMarginSet()
,
unsetRightMargin()
public boolean isRightMarginSet()
true
if rightMargin has been set,
and false
otherwise.getRightMargin()
,
setRightMargin(com.sas.measures.Length)
,
unsetRightMargin()
public void unsetRightMargin()
unsetMargins()
,
getRightMargin()
,
isRightMarginSet()
,
setRightMargin(com.sas.measures.Length)
public char getSplitCharacter()
isSplitCharacterSet()
,
setSplitCharacter(char)
,
unsetSplitCharacter()
,
isWrapped()
public void setSplitCharacter(char newValue)
When setting this property you will often want to make use of
RowStyle.cellsToSizeCount
, so that the rows that include
your split cells are appropriately sized (i.e. tall enough). By
default for optimal performance, TableView assumes that all cells are
the same height by only measuring the height of the first cell in each
row (i.e. cellsToSizeCount == 1
).
newValue
- The new value to assign the splitCharacter property.CellVectorStyle.setCellsToSizeCount(int)
,
getSplitCharacter()
,
isSplitCharacterSet()
,
unsetSplitCharacter()
public boolean isSplitCharacterSet()
true
if splitCharacter has been set,
and false
otherwise.getSplitCharacter()
,
setSplitCharacter(char)
,
unsetSplitCharacter()
public void unsetSplitCharacter()
getSplitCharacter()
,
isSplitCharacterSet()
,
setSplitCharacter(char)
public com.sas.measures.Length getTopMargin()
isTopMarginSet()
,
setTopMargin(com.sas.measures.Length)
,
unsetTopMargin()
public void setTopMargin(com.sas.measures.Length newValue)
newValue
- The new value to assign the topMargin property.setMargins(com.sas.measures.Length)
,
getTopMargin()
,
isTopMarginSet()
,
unsetTopMargin()
public boolean isTopMarginSet()
true
if topMargin has been set,
and false
otherwise.getTopMargin()
,
setTopMargin(com.sas.measures.Length)
,
unsetTopMargin()
public void unsetTopMargin()
unsetMargins()
,
getTopMargin()
,
isTopMarginSet()
,
setTopMargin(com.sas.measures.Length)
public int getVerticalJustification()
isVerticalJustificationSet()
,
setVerticalJustification(int)
,
unsetVerticalJustification()
,
getHorizontalJustification()
public void setVerticalJustification(int newValue)
getVerticalJustification()
,
isVerticalJustificationSet()
,
unsetVerticalJustification()
,
getHorizontalJustification()
public boolean isVerticalJustificationSet()
true
if verticalJustification has been set,
and false
otherwise.getVerticalJustification()
,
setVerticalJustification(int)
,
unsetVerticalJustification()
public void unsetVerticalJustification()
getVerticalJustification()
,
isVerticalJustificationSet()
,
setVerticalJustification(int)
public java.lang.Class getViewClass()
isViewClassSet()
,
setViewClass(java.lang.Class)
,
unsetViewClass()
public void setViewClass(java.lang.Class newValue)
newValue
- The new value to assign the viewClass property.getViewClass()
,
isViewClassSet()
,
unsetViewClass()
public boolean isViewClassSet()
true
if viewClass has been set,
and false
otherwise.getViewClass()
,
setViewClass(java.lang.Class)
,
unsetViewClass()
public void unsetViewClass()
getViewClass()
,
isViewClassSet()
,
setViewClass(java.lang.Class)
public boolean isWrapped()
isWrappedSet()
,
setWrapped(boolean)
,
unsetWrapped()
,
getSplitCharacter()
public void setWrapped(boolean newValue)
newValue
- The new value to assign the wrapped property.isWrapped()
,
isWrappedSet()
,
unsetWrapped()
public boolean isWrappedSet()
true
if wrappeed has been set,
and false
otherwise.isWrapped()
,
setWrapped(boolean)
,
unsetWrapped()
public void unsetWrapped()
isWrapped()
,
isWrappedSet()
,
setWrapped(boolean)
public void setMargins(com.sas.measures.Length newValue)
newValue
- The new value to assign the four margin properties.setLeftMargin(com.sas.measures.Length)
,
setRightMargin(com.sas.measures.Length)
,
setTopMargin(com.sas.measures.Length)
,
setBottomMargin(com.sas.measures.Length)
public void unsetMargins()
unsetLeftMargin()
,
unsetRightMargin()
,
unsetTopMargin()
,
unsetBottomMargin()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |