Class ButtonCellPainter
- java.lang.Object
-
- org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
-
- org.eclipse.nebula.widgets.nattable.painter.cell.ButtonCellPainter
-
- All Implemented Interfaces:
ICellPainter
,IMouseAction
public class ButtonCellPainter extends AbstractCellPainter implements IMouseAction
Paints a button and simulates a button click. It also notifies its listeners when it is clicked.
-
-
Constructor Summary
Constructors Constructor Description ButtonCellPainter(ICellPainter interiorPainter)
ButtonCellPainter(ICellPainter buttonRaisedPainter, ICellPainter buttonPressedPainter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addClickListener(IMouseAction mouseAction)
int
getPreferredHeight(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
Get the preferred height of the cell when rendered by this painter.int
getPreferredWidth(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
Get the preferred width of the cell when rendered by this painter.void
paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry)
void
removeClickListener(IMouseAction mouseAction)
void
run(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
Respond to mouse click.void
setButtonFlashTime(int flashTimeInMS)
-
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
getCellPainterAt
-
-
-
-
Constructor Detail
-
ButtonCellPainter
public ButtonCellPainter(ICellPainter interiorPainter)
- Parameters:
interiorPainter
- to paint the contents of the cell. This will be decorated with a button like look and feel.
-
ButtonCellPainter
public ButtonCellPainter(ICellPainter buttonRaisedPainter, ICellPainter buttonPressedPainter)
- Parameters:
buttonRaisedPainter
- cell painter to use for painting the button raised state.buttonPressedPainter
- cell painter to use for painting the button pressed state.
-
-
Method Detail
-
paintCell
public void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry)
- Specified by:
paintCell
in interfaceICellPainter
-
getPreferredHeight
public int getPreferredHeight(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
Description copied from interface:ICellPainter
Get the preferred height of the cell when rendered by this painter. Used for auto-resize.- Specified by:
getPreferredHeight
in interfaceICellPainter
- Parameters:
cell
- The cell for which the preferred height is requested.gc
- The GC that is used for rendering.configRegistry
- The IConfigRegistry that contains the configuration used for rendering.- Returns:
- The preferred height of the given cell when rendered by this painter.
-
getPreferredWidth
public int getPreferredWidth(ILayerCell cell, org.eclipse.swt.graphics.GC gc, IConfigRegistry configRegistry)
Description copied from interface:ICellPainter
Get the preferred width of the cell when rendered by this painter. Used for auto-resize.- Specified by:
getPreferredWidth
in interfaceICellPainter
- Parameters:
cell
- The cell for which the preferred width is requested.gc
- The GC that is used for rendering.configRegistry
- The IConfigRegistry that contains the configuration used for rendering.- Returns:
- The preferred width of the given cell when rendered by this painter.
-
run
public void run(NatTable natTable, org.eclipse.swt.events.MouseEvent event)
Respond to mouse click. Simulate button press.- Specified by:
run
in interfaceIMouseAction
- Parameters:
natTable
- The NatTable instance on which the MouseEvent was fired and on which the command should be executed.event
- The received MouseEvent.
-
addClickListener
public void addClickListener(IMouseAction mouseAction)
-
removeClickListener
public void removeClickListener(IMouseAction mouseAction)
-
setButtonFlashTime
public void setButtonFlashTime(int flashTimeInMS)
-
-