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
FieldsModifier and TypeFieldDescriptionprotected InternalCellClipboardTheInternalCellClipboardthat is used to identify whether a cell is currently copied.protected org.eclipse.swt.graphics.RectangleThe bounds of the current visible selection handle ornullif no fill handle is currently rendered.Fields inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
gridLineWidth, renderGridLines -
Constructor Summary
ConstructorsConstructorDescriptionCreate a SelectionLayerPainter that renders gray grid lines and uses the default clipping behavior.FillHandleLayerPainter(boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainterthat renders gray grid lines and uses the specified clipping behavior.FillHandleLayerPainter(InternalCellClipboard clipboard) Create anFillHandleLayerPainterthat renders gray grid lines and uses the default clipping behavior.FillHandleLayerPainter(InternalCellClipboard clipboard, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainterthat renders gray grid lines and uses the specified clipping behavior.FillHandleLayerPainter(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainterthat 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 anFillHandleLayerPainterthat renders grid lines in the specified color and uses the specified clipping behavior.FillHandleLayerPainter(org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainterthat 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 anFillHandleLayerPainterthat renders grid lines in the specified color and uses the specified clipping behavior. -
Method Summary
Modifier and TypeMethodDescriptionprotected BorderStylegetCopyBorderStyle(IConfigRegistry configRegistry) Get the border style that should be used to render the border for cells that are currently copied to theInternalCellClipboard.protected BorderStylegetHandleBorderStyle(IConfigRegistry configRegistry) Returns the border style that should be used to render the border of the fill handle.protected org.eclipse.swt.graphics.ColorgetHandleColor(IConfigRegistry configRegistry) Returns the color that should be used to render the fill handle.protected BorderStylegetHandleRegionBorderStyle(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.Rectangleprotected booleanisFillHandleCell(ILayerCell cell) protected booleanisFillHandleRegion(ILayerCell cell) protected voidpaintCopyBorder(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) protected voidpaintFillHandle(ILayerCell fillHandleCell, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, IConfigRegistry configRegistry) voidpaintLayer(ILayer natLayer, org.eclipse.swt.graphics.GC gc, int xOffset, int yOffset, org.eclipse.swt.graphics.Rectangle pixelRectangle, IConfigRegistry configRegistry) voidsetClipboard(InternalCellClipboard clipboard) Methods inherited from class org.eclipse.nebula.widgets.nattable.selection.SelectionLayerPainter
fixBoundsInGridLines, getBorderCells, getBorderStyle, isInCurrentLayerMethods inherited from class org.eclipse.nebula.widgets.nattable.painter.layer.GridLineCellLayerPainter
adjustCellBounds, drawGridLines, getGridColorMethods 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 ornullif no fill handle is currently rendered. -
clipboard
TheInternalCellClipboardthat is used to identify whether a cell is currently copied. Can benullto 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 anFillHandleLayerPainterthat 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 anFillHandleLayerPainterthat renders gray grid lines and uses the specified clipping behavior.- Parameters:
clipLeft- Configure the rendering behavior when cells overlap. If set totruethe left cell will be clipped, if set tofalsethe right cell will be clipped. The default value isfalse.clipTop- Configure the rendering behavior when cells overlap. If set totruethe top cell will be clipped, if set tofalsethe bottom cell will be clipped. The default value isfalse.
-
FillHandleLayerPainter
public FillHandleLayerPainter(org.eclipse.swt.graphics.Color gridColor, boolean clipLeft, boolean clipTop) Create anFillHandleLayerPainterthat 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 totruethe left cell will be clipped, if set tofalsethe right cell will be clipped. The default value isfalse.clipTop- Configure the rendering behavior when cells overlap. If set totruethe top cell will be clipped, if set tofalsethe bottom cell will be clipped. The default value isfalse.
-
FillHandleLayerPainter
Create anFillHandleLayerPainterthat renders gray grid lines and uses the default clipping behavior. It also renders a border around internally copied cells.- Parameters:
clipboard- TheInternalCellClipboardthat stores the cells that are currently copied.
-
FillHandleLayerPainter
public FillHandleLayerPainter(InternalCellClipboard clipboard, org.eclipse.swt.graphics.Color gridColor) Create anFillHandleLayerPainterthat renders grid lines in the specified color and uses the default clipping behavior.- Parameters:
clipboard- TheInternalCellClipboardthat stores the cells that are currently copied.gridColor- The color that should be used to render the grid lines.
-
FillHandleLayerPainter
Create anFillHandleLayerPainterthat renders gray grid lines and uses the specified clipping behavior.- Parameters:
clipboard- TheInternalCellClipboardthat stores the cells that are currently copied.clipLeft- Configure the rendering behavior when cells overlap. If set totruethe left cell will be clipped, if set tofalsethe right cell will be clipped. The default value isfalse.clipTop- Configure the rendering behavior when cells overlap. If set totruethe top cell will be clipped, if set tofalsethe 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 anFillHandleLayerPainterthat renders grid lines in the specified color and uses the specified clipping behavior.- Parameters:
clipboard- TheInternalCellClipboardthat 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 totruethe left cell will be clipped, if set tofalsethe right cell will be clipped. The default value isfalse.clipTop- Configure the rendering behavior when cells overlap. If set totruethe top cell will be clipped, if set tofalsethe 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:
paintLayerin interfaceILayerPainter- Overrides:
paintLayerin 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-IConfigRegistryin 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- TheILayerCellto check.- Returns:
trueif the cell is part of the fill handle region,falseif not.
-
isFillHandleCell
- Parameters:
cell- TheILayerCellto check.- Returns:
trueif the cell is the bottom right cell in a fill region,falseif 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 theIConfigRegistryfor a registeredIStylefor theFillHandleConfigAttributes.FILL_HANDLE_REGION_BORDER_STYLElabel. If none is registered, a default line style will be returned.- Parameters:
configRegistry- TheIConfigRegistryto 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 theIConfigRegistryisnullor does not contain configurations for the color of the fill handle, a default dark green color is used.- Parameters:
configRegistry- TheIConfigRegistryneeded to determine the configured fill handle color. Can benullwhich 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 theIConfigRegistryisnullor does not contain configurations for styling the border of the fill handle, a default style is used.- Parameters:
configRegistry- TheIConfigRegistryneeded to determine the configured fill handle border style. Can benullwhich 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 theConfigRegistryfor a registeredIStylefor theSelectionStyleLabels.COPY_BORDER_STYLElabel. If none is registered, a default line style will be used to render the border.- Parameters:
configRegistry- TheConfigRegistryto 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
nullif no fill handle is currently rendered.
-
getClipboard
- Returns:
- The
InternalCellClipboardthat is used to identify whether a cell is currently copied ornullif special rendering of copied cells is disabled.
-
setClipboard
- Parameters:
clipboard- TheInternalCellClipboardthat should be used to identify whether a cell is currently copied ornullto disable special rendering of copied cells.
-