Class FillHandleLayerPainter
java.lang.Object
org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
org.eclipse.nebula.widgets.nattable.selection.SelectionLayerPainter
org.eclipse.nebula.widgets.nattable.fillhandle.FillHandleLayerPainter
- All Implemented Interfaces:
ILayerPainter
Extended
SelectionLayerPainter
that renders an additional border
around cells that are selected via fill handle. By default the additional
fill handle border style is a green solid 2 pixel sized line. This
BorderStyle
can be configured via IConfigRegistry using the config
label FillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLE
.
You can also register a different cell style for cells in the fill handle
region by configuring a style for the label
SelectionStyleLabels.FILL_HANDLE_REGION
This ILayerPainter
also renders a border around cells that are
currently copied to the InternalCellClipboard
. For this an
InternalCellClipboard
needs to be set to this painter. Note that a
global instance of InternalCellClipboard
can be retrieved via
NatTable.getInternalCellClipboard()
.
-
Field Summary
Modifier and TypeFieldDescriptionprotected InternalCellClipboard
TheInternalCellClipboard
that is used to identify whether a cell is currently copied.protected org.eclipse.swt.graphics.Rectangle
The bounds of the current visible selection handle ornull
if no fill handle is currently rendered.Fields inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
gridLineWidth, renderGridLines
-
Constructor Summary
ConstructorDescriptionCreate a SelectionLayerPainter that renders gray grid lines and uses the default clipping behavior.FillHandleLayerPainter
(boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders gray grid lines and uses the specified clipping behavior.FillHandleLayerPainter
(InternalCellClipboard clipboard) Create anFillHandleLayerPainter
that renders gray grid lines and uses the default clipping behavior.FillHandleLayerPainter
(InternalCellClipboard clipboard, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders gray grid lines and uses the specified clipping behavior.FillHandleLayerPainter
(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the default clipping behavior.FillHandleLayerPainter
(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the specified clipping behavior.FillHandleLayerPainter
(org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the default clipping behavior.FillHandleLayerPainter
(org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the specified clipping behavior. -
Method Summary
Modifier and TypeMethodDescriptionprotected BorderStyle
getCopyBorderStyle
(IConfigRegistry configRegistry) Get the border style that should be used to render the border for cells that are currently copied to theInternalCellClipboard
.protected BorderStyle
getHandleBorderStyle
(IConfigRegistry configRegistry) Returns the border style that should be used to render the border of the fill handle.protected org.eclipse.swt.graphics.Color
getHandleColor
(IConfigRegistry configRegistry) Returns the color that should be used to render the fill handle.protected BorderStyle
getHandleRegionBorderStyle
(IConfigRegistry configRegistry) Get the border style that should be used to render the border for cells that are currently part of the fill handle region.org.eclipse.swt.graphics.Rectangle
protected boolean
isFillHandleCell
(ILayerCell cell) protected boolean
isFillHandleRegion
(ILayerCell cell) protected void
paintCopyBorder
(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) protected void
paintFillHandle
(ILayerCell fillHandleCell, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, IConfigRegistry configRegistry) void
paintLayer
(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) void
setClipboard
(InternalCellClipboard clipboard) Methods inherited from class org.eclipse.nebula.widgets.nattable.selection.SelectionLayerPainter
fixBoundsInGridLines, getBorderCells, getBorderStyle, isInCurrentLayer
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
adjustCellBounds, drawGridLines, getGridColor
Methods inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.CellLayerPainter
getPositionRectangleFromPixelRectangle, getStartXOfColumnPosition, getStartYOfRowPosition, isClipLeft, isClipTop, paintCell
-
Field Details
-
handleBounds
protected org.eclipse.swt.graphics.Rectangle handleBoundsThe bounds of the current visible selection handle ornull
if no fill handle is currently rendered. -
clipboard
TheInternalCellClipboard
that is used to identify whether a cell is currently copied. Can benull
to disable special rendering of copied cells.
-
-
Constructor Details
-
FillHandleLayerPainter
public FillHandleLayerPainter()Create a SelectionLayerPainter that renders gray grid lines and uses the default clipping behavior. -
FillHandleLayerPainter
public FillHandleLayerPainter(org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the default clipping behavior.- Parameters:
gridColor
- The color that should be used to render the grid lines.
-
FillHandleLayerPainter
public FillHandleLayerPainter(boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders gray grid lines and uses the specified clipping behavior.- Parameters:
clipLeft
- Configure the rendering behavior when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behavior when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
FillHandleLayerPainter
public FillHandleLayerPainter(org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the specified clipping behavior.- Parameters:
gridColor
- The color that should be used to render the grid lines.clipLeft
- Configure the rendering behavior when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behavior when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
FillHandleLayerPainter
Create anFillHandleLayerPainter
that renders gray grid lines and uses the default clipping behavior. It also renders a border around internally copied cells.- Parameters:
clipboard
- TheInternalCellClipboard
that stores the cells that are currently copied.
-
FillHandleLayerPainter
public FillHandleLayerPainter(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the default clipping behavior.- Parameters:
clipboard
- TheInternalCellClipboard
that stores the cells that are currently copied.gridColor
- The color that should be used to render the grid lines.
-
FillHandleLayerPainter
Create anFillHandleLayerPainter
that renders gray grid lines and uses the specified clipping behavior.- Parameters:
clipboard
- TheInternalCellClipboard
that stores the cells that are currently copied.clipLeft
- Configure the rendering behavior when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behavior when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
FillHandleLayerPainter
public FillHandleLayerPainter(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainter
that renders grid lines in the specified color and uses the specified clipping behavior.- Parameters:
clipboard
- TheInternalCellClipboard
that stores the cells that are currently copied.gridColor
- The color that should be used to render the grid lines.clipLeft
- Configure the rendering behavior when cells overlap. If set totrue
the left cell will be clipped, if set tofalse
the right cell will be clipped. The default value isfalse
.clipTop
- Configure the rendering behavior when cells overlap. If set totrue
the top cell will be clipped, if set tofalse
the bottom cell will be clipped. The default value isfalse
.
-
-
Method Details
-
paintLayer
public void paintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) - Specified by:
paintLayer
in interfaceILayerPainter
- Overrides:
paintLayer
in classSelectionLayerPainter
- Parameters:
natLayer
- The layer to paint.gc
- GC used for paintingxOffset
- x offset of the layer from the origin of the tableyOffset
- y offset of the layer from the origin of the tablepixelRectangle
- area the layer can paint inconfigRegistry
-IConfigRegistry
in use by NatTable. Useful for looking up associated painters.
-
paintFillHandle
protected void paintFillHandle(ILayerCell fillHandleCell, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, IConfigRegistry configRegistry) -
paintCopyBorder
protected void paintCopyBorder(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) -
isFillHandleRegion
- Parameters:
cell
- TheILayerCell
to check.- Returns:
true
if the cell is part of the fill handle region,false
if not.
-
isFillHandleCell
- Parameters:
cell
- TheILayerCell
to check.- Returns:
true
if the cell is the bottom right cell in a fill region,false
if not.
-
getHandleRegionBorderStyle
Get the border style that should be used to render the border for cells that are currently part of the fill handle region. Checks theIConfigRegistry
for a registeredIStyle
for theFillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLE
label. If none is registered, a default line style will be returned.- Parameters:
configRegistry
- TheIConfigRegistry
to retrieve the style information from.- Returns:
- The border style that should be used
- Since:
- 1.5
-
getHandleColor
Returns the color that should be used to render the fill handle. If theIConfigRegistry
isnull
or does not contain configurations for the color of the fill handle, a default dark green color is used.- Parameters:
configRegistry
- TheIConfigRegistry
needed to determine the configured fill handle color. Can benull
which results in returning a default dark green color.- Returns:
- the color that should be used
- Since:
- 1.5
-
getHandleBorderStyle
Returns the border style that should be used to render the border of the fill handle. If theIConfigRegistry
isnull
or does not contain configurations for styling the border of the fill handle, a default style is used.- Parameters:
configRegistry
- TheIConfigRegistry
needed to determine the configured fill handle border style. Can benull
which results in returning a default style.- Returns:
- the border style that should be used
- Since:
- 1.5
-
getCopyBorderStyle
Get the border style that should be used to render the border for cells that are currently copied to theInternalCellClipboard
. Checks theConfigRegistry
for a registeredIStyle
for theSelectionStyleLabels.COPY_BORDER_STYLE
label. If none is registered, a default line style will be used to render the border.- Parameters:
configRegistry
- TheConfigRegistry
to retrieve the style information from.- Returns:
- the border style that should be used
- Since:
- 1.6
-
getSelectionHandleBounds
public org.eclipse.swt.graphics.Rectangle getSelectionHandleBounds()- Returns:
- The bounds of the current visible selection handle or
null
if no fill handle is currently rendered.
-
getClipboard
- Returns:
- The
InternalCellClipboard
that is used to identify whether a cell is currently copied ornull
if special rendering of copied cells is disabled.
-
setClipboard
- Parameters:
clipboard
- TheInternalCellClipboard
that should be used to identify whether a cell is currently copied ornull
to disable special rendering of copied cells.
-