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
Paints a button and simulates a button click. It also notifies its listeners
when it is clicked.
-
Constructor Summary
ConstructorDescriptionButtonCellPainter
(ICellPainter interiorPainter) ButtonCellPainter
(ICellPainter buttonRaisedPainter, ICellPainter buttonPressedPainter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Respond to mouse click.void
setButtonFlashTime
(int flashTimeInMS) Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
getCellPainterAt
-
Constructor Details
-
ButtonCellPainter
- Parameters:
interiorPainter
- to paint the contents of the cell. This will be decorated with a button like look and feel.
-
ButtonCellPainter
- Parameters:
buttonRaisedPainter
- cell painter to use for painting the button raised state.buttonPressedPainter
- cell painter to use for painting the button pressed state.
-
-
Method Details
-
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
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
-
removeClickListener
-
setButtonFlashTime
public void setButtonFlashTime(int flashTimeInMS)
-