JIDE 3.5.15

com.jidesoft.grid
Class FlashCellStyle

java.lang.Object
  extended by com.jidesoft.grid.CellStyle
      extended by com.jidesoft.grid.FlashCellStyle
All Implemented Interfaces:
Prioritized, Cloneable, SwingConstants

public class FlashCellStyle
extends CellStyle

FlashCellStyle provides an alternative cell style to allow cell flashing. There are two cell styles defined in this class. The normal style is on the cell style itself since FlashCellStyle extends CellStyle. This style is used when isFlashOn() returns false. The other cell style is set using setFlashCellStyle(CellStyle). It will be used when isFlashOn() returns true.

To use this class, you should implement StyleModel in your table model. In the cell you want to flash, return a predefined FlashCellStyle. You could return a new instance of FlashCellStyle every time. But for the performance consideration, it will be way more efficient to reuse the same instance as long as the flash style (background, foreground, font style etc) is the same for all flashing cells.

Once StyleModel is done, you just need to use TableFlashable to enable the flashing.

 TableFlashable flasher = new TableFlashable(_table, new FlashCellStyle[]{_flashCellStyle}, new int[]{0, 2});
 flasher.startFlashing();
 
The code above will flash only the cells in the first and the third columns, assuming only those columns have flashing cells.


Field Summary
 
Fields inherited from class com.jidesoft.grid.CellStyle
EMPTY_BORDER, EMPTY_CELL_PAINTER, EMPTY_COLOR, EMPTY_FONT, EMPTY_ICON, 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
FlashCellStyle()
          Creates a FlashCellStyle.
 
Method Summary
 void flash()
          Toggles from flash style to normal style or other way.
 Color getBackground()
          Gets the background.
 Border getBorder()
          Gets the border.
 CellStyle getFlashCellStyle()
          Gets the flashCellStyle.
 Font getFont()
          Gets the font.
 int getFontStyle()
          Gets the fontstyle.
 Color getForeground()
          Gets the foreground.
 int getHorizontalAlignment()
          Gets the horizontal alignment.
 Icon getIcon()
          Gets the icon.
 int getPriority()
          Gets the priority.
 Color getSelectionBackground()
          Gets the selection background.
 Color getSelectionForeground()
          Gets the selection foreground.
 int getVerticalAlignment()
          Gets the vertical alignment.
 boolean isFlashOn()
          Checks if the flash style is on.
 void setFlashCellStyle(CellStyle flashCellStyle)
          Sets the flashCellStyle.
 void setFlashOn(boolean on)
          Sets the flash style on.
 
Methods inherited from class com.jidesoft.grid.CellStyle
clone, equals, equalsForExporting, getHorizontalTextPosition, getOverlayBorder, getOverlayCellPainter, getText, getToolTipText, getUnderlayCellPainter, getVerticalTextPosition, isShowIconOnly, mergeCellStyle, setBackground, setBorder, setFont, setFontStyle, setForeground, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setOverlayBorder, setOverlayCellPainter, setPriority, setSelectionBackground, setSelectionForeground, setShowIconOnly, setText, setToolTipText, setUnderlayCellPainter, setVerticalAlignment, setVerticalTextPosition
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlashCellStyle

public FlashCellStyle()
Creates a FlashCellStyle.

Method Detail

isFlashOn

public boolean isFlashOn()
Checks if the flash style is on. There are two styles defined - normal style and flash style. The two styles appear alternatively to create a flashing effect.

Returns:
true if flash style on.

setFlashOn

public void setFlashOn(boolean on)
Sets the flash style on.

Parameters:
on - true or false.

flash

public void flash()
Toggles from flash style to normal style or other way.


getFlashCellStyle

public CellStyle getFlashCellStyle()
Gets the flashCellStyle.

Returns:
the flashCellStyle.

setFlashCellStyle

public void setFlashCellStyle(CellStyle flashCellStyle)
Sets the flashCellStyle.

Parameters:
flashCellStyle - the new flashCellStyle.

getBorder

public Border getBorder()
Gets the border. If the flash is on, we will return getFlashCellStyle().getBorder(). Otherwise we will return super.getBorder().

Overrides:
getBorder in class CellStyle
Returns:
the border.

getBackground

public Color getBackground()
Gets the background. If the flash is on, we will return getFlashCellStyle().getBackground(). Otherwise we will return super.getBackground().

Overrides:
getBackground in class CellStyle
Returns:
the background.

getForeground

public Color getForeground()
Gets the foreground. If the flash is on, we will return getFlashCellStyle().getForeground(). Otherwise we will return super.getForeground().

Overrides:
getForeground in class CellStyle
Returns:
the foreground.

getSelectionBackground

public Color getSelectionBackground()
Gets the selection background. If the flash is on, we will return getFlashCellStyle().getSelectionBackground(). Otherwise we will return super.getSelectionBackground().

Overrides:
getSelectionBackground in class CellStyle
Returns:
the selection background.

getSelectionForeground

public Color getSelectionForeground()
Gets the selection foreground. If the flash is on, we will return getFlashCellStyle().getSelectionForeground(). Otherwise we will return super.getSelectionForeground().

Overrides:
getSelectionForeground in class CellStyle
Returns:
the selection foreground.

getFont

public Font getFont()
Gets the font. If the flash is on, we will return getFlashCellStyle().getFont(). Otherwise we will return super.getFont().

Overrides:
getFont in class CellStyle
Returns:
the font.

getFontStyle

public int getFontStyle()
Gets the fontstyle. If the flash is on, we will return getFlashCellStyle().getFontStyle(). Otherwise we will return super.getFontStyle().

Overrides:
getFontStyle in class CellStyle
Returns:
the fontstyle.

getIcon

public Icon getIcon()
Gets the icon. If the flash is on, we will return getFlashCellStyle().getIcon(). Otherwise we will return super.getIcon().

Overrides:
getIcon in class CellStyle
Returns:
the icon.

getVerticalAlignment

public int getVerticalAlignment()
Gets the vertical alignment. If the flash is on, we will return getFlashCellStyle().getVerticalAlignment(). Otherwise we will return super.getVerticalAlignment().

Overrides:
getVerticalAlignment in class CellStyle
Returns:
the vertical alignment.

getHorizontalAlignment

public int getHorizontalAlignment()
Gets the horizontal alignment. If the flash is on, we will return getFlashCellStyle().getHorizontalAlignment(). Otherwise we will return super.getHorizontalAlignment().

Overrides:
getHorizontalAlignment in class CellStyle
Returns:
the horizontal alignment.

getPriority

public int getPriority()
Gets the priority. If the flash is on, we will return getFlashCellStyle().getPriority(). Otherwise we will return super.getPriority().

Specified by:
getPriority in interface Prioritized
Overrides:
getPriority in class CellStyle
Returns:
the priority.

JIDE 3.5.15