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 Details

    • 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 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 interface ICellPainter
    • 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 interface ICellPainter
      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 interface ICellPainter
      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 interface IMouseAction
      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)