|
JIDE 3.3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jidesoft.grid.CellStyle
public class CellStyle
CellStyle defines the styles of a table cell. Those styles include the background (include the selection
background), the foreground (include the selection foreground), the font, the horizontal alignment, the vertical
alignment, the text, the toolTipText, the icon and the border. CellStyleTable and its subclasses will
use the styles defined in CellStyle and set to cell renderer component. Obviously, not all styles apply
to all types of cell renderer components.
CellStyle works with StyleModel which can be used as an interface for TableModel. You can
refer to StyleModel to see how to use it.
In additional to all the styles that you can set to CellStyle, you can assign a priority to it. This is useful where
there are multiple cell styles for the same cell. Please read javadoc of getPriority() for more
information.
| Field Summary | |
|---|---|
static Border |
EMPTY_BORDER
|
static Color |
EMPTY_COLOR
|
static Font |
EMPTY_FONT
|
static Icon |
EMPTY_ICON
An empty icon instance. |
static String |
EMPTY_STRING
|
| Fields inherited from interface javax.swing.SwingConstants |
|---|
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Constructor Summary | |
|---|---|
CellStyle()
|
|
CellStyle(CellStyle style)
Create a copy of the CellStyle; |
|
| Method Summary | |
|---|---|
CellStyle |
clone()
|
boolean |
equals(Object obj)
|
Color |
getBackground()
|
Border |
getBorder()
|
Font |
getFont()
|
int |
getFontStyle()
|
Color |
getForeground()
|
int |
getHorizontalAlignment()
|
int |
getHorizontalTextPosition()
|
Icon |
getIcon()
|
Border |
getOverlayBorder()
|
int |
getPriority()
Gets the priority of the cell style. |
Color |
getSelectionBackground()
|
Color |
getSelectionForeground()
|
String |
getText()
|
String |
getToolTipText()
|
int |
getVerticalAlignment()
|
int |
getVerticalTextPosition()
|
boolean |
isShowIconOnly()
Deprecated. replaced by getText(). If it returns an empty string, that means only icon will be shown. |
void |
setBackground(Color background)
|
void |
setBorder(Border border)
|
void |
setFont(Font font)
Sets the font. |
void |
setFontStyle(int fontStyle)
Sets the font style which could be Font.PLAIN, Font.BOLD or Font.ITALIC. |
void |
setForeground(Color foreground)
|
void |
setHorizontalAlignment(int horizontalAlignment)
|
void |
setHorizontalTextPosition(int horizontalTextPosition)
|
void |
setIcon(Icon icon)
|
void |
setOverlayBorder(Border overlayBorder)
|
void |
setPriority(int priority)
Sets the priority of the cell style. |
void |
setSelectionBackground(Color selectionBackground)
|
void |
setSelectionForeground(Color selectionForeground)
|
void |
setShowIconOnly(boolean showIconOnly)
Deprecated. replaced by setText(String) |
void |
setText(String text)
|
void |
setToolTipText(String toolTipText)
|
void |
setVerticalAlignment(int verticalAlignment)
|
void |
setVerticalTextPosition(int verticalTextPosition)
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Icon EMPTY_ICON
public static final Color EMPTY_COLOR
public static final Font EMPTY_FONT
public static final Border EMPTY_BORDER
public static final String EMPTY_STRING
| Constructor Detail |
|---|
public CellStyle()
public CellStyle(CellStyle style)
style - the existing cell style.| Method Detail |
|---|
public Border getBorder()
public void setBorder(Border border)
public Color getBackground()
public void setBackground(Color background)
public Color getForeground()
public void setForeground(Color foreground)
public Color getSelectionBackground()
public void setSelectionBackground(Color selectionBackground)
public Color getSelectionForeground()
public void setSelectionForeground(Color selectionForeground)
public Font getFont()
public void setFont(Font font)
font - the font in the CellStyle.public int getFontStyle()
public void setFontStyle(int fontStyle)
fontStyle - the font style in the CellStyle.public Icon getIcon()
public void setIcon(Icon icon)
public int getVerticalAlignment()
public void setVerticalAlignment(int verticalAlignment)
public int getHorizontalAlignment()
public void setHorizontalAlignment(int horizontalAlignment)
public int getVerticalTextPosition()
public void setVerticalTextPosition(int verticalTextPosition)
public int getHorizontalTextPosition()
public void setHorizontalTextPosition(int horizontalTextPosition)
public String getText()
public void setText(String text)
public String getToolTipText()
public void setToolTipText(String toolTipText)
public Border getOverlayBorder()
public void setOverlayBorder(Border overlayBorder)
public int getPriority()
TableModelWrapper which can wrap another table model. So you can end up with
a pipe of TableModelWrappers. Any of the table models can implement StyleModel and each
one can return a different cell style. CellStyleTable will look at those CellStyles and
sort them by the priority. The cell style that has the higher priority will win over any cell styles that have a
lower priority when there are style conflicts (meaning the same style is used in different cell styles).
For example, you have one cell style that implements the row stripes and another cell style that implements cell
update indication. Both use cell background style. Obviously you want the cell update indication has a higher
priority than row stripes. So you just set a higher priority in cell update indication cell style.
If the cell styles have the same priority, the one from inner style table model has a higher priority.
getPriority in interface Prioritizedpublic void setPriority(int priority)
priority - the new prioritypublic boolean equals(Object obj)
equals in class Object@Deprecated public boolean isShowIconOnly()
getText(). If it returns an empty string, that means only icon will be shown.
getIcon() is a non-null value.
@Deprecated public void setShowIconOnly(boolean showIconOnly)
setText(String)
getIcon() is a non-null value.
showIconOnly - the flag
public CellStyle clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedException
|
JIDE 3.3.1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||