Class CustomLineBorderDecorator
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.cell.AbstractCellPainter
org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
org.eclipse.nebula.widgets.nattable.painter.cell.decorator.CustomLineBorderDecorator
- All Implemented Interfaces:
ICellPainter
NatTable
decorator class which is used to draw borders for cells
whose LabelStack contains border related labels.
Compared to the LineBorderDecorator which paints a border for every side of a cell, with this implementation you are free to choose for which side a border should be painted or not.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Label for adding a border at the bottom of a cell.static final String
Label for adding a border at the left of a cell.static final String
Label for adding a border at the right of a cell.static final String
Label for adding a border at the top of a cell. -
Constructor Summary
ConstructorsConstructorDescriptionCustomLineBorderDecorator
(ICellPainter interiorPainter) Creates a new LabelLineBorderDecorator wrapping the given interior painter and no default border style.CustomLineBorderDecorator
(ICellPainter interiorPainter, BorderStyle defaultBorderStyle) Creates a new LabelLineBorderDecorator wrapping the given interior painter using the given BorderStyle as default. -
Method Summary
Modifier and TypeMethodDescriptionint
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 rectangle, IConfigRegistry configRegistry) Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.cell.CellPainterWrapper
getCellPainterAt, getWrappedPainter, getWrappedPainterBounds, setWrappedPainter
-
Field Details
-
TOP_LINE_BORDER_LABEL
Label for adding a border at the top of a cell.- See Also:
-
BOTTOM_LINE_BORDER_LABEL
Label for adding a border at the bottom of a cell.- See Also:
-
LEFT_LINE_BORDER_LABEL
Label for adding a border at the left of a cell.- See Also:
-
RIGHT_LINE_BORDER_LABEL
Label for adding a border at the right of a cell.- See Also:
-
-
Constructor Details
-
CustomLineBorderDecorator
Creates a new LabelLineBorderDecorator wrapping the given interior painter and no default border style.- Parameters:
interiorPainter
- The painter to be wrapped by this decorator.
-
CustomLineBorderDecorator
Creates a new LabelLineBorderDecorator wrapping the given interior painter using the given BorderStyle as default.- Parameters:
interiorPainter
- The painter to be wrapped by this decorator.defaultBorderStyle
- The BorderStyle to use as default if there is no BorderStyle configured via cell styles. Can benull
.
-
-
Method Details
-
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
- Overrides:
getPreferredWidth
in classCellPainterWrapper
- 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.
-
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
- Overrides:
getPreferredHeight
in classCellPainterWrapper
- 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.
-
paintCell
public void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle rectangle, IConfigRegistry configRegistry) - Specified by:
paintCell
in interfaceICellPainter
- Overrides:
paintCell
in classCellPainterWrapper
-