public class GradientBackgroundPainter extends CellPainterWrapper
ConfigRegistry
:
CellStyleAttributes.GRADIENT_FOREGROUND_COLOR
or CellStyleAttributes.FOREGROUND_COLOR
CellStyleAttributes.GRADIENT_BACKGROUND_COLOR
or CellStyleAttributes.BACKGROUND_COLOR
ConfigRegistry
the painting is skipped.
Can be used as a cell painter or a decorator.
Constructor and Description |
---|
GradientBackgroundPainter()
Creates a
GradientBackgroundPainter with a gradient sweeping from
left to right. |
GradientBackgroundPainter(boolean vertical)
Creates a
GradientBackgroundPainter where the sweeping direction
can be set. |
GradientBackgroundPainter(ICellPainter painter)
Creates a
GradientBackgroundPainter as wrapper for the given painter with a gradient sweeping from
left to right. |
GradientBackgroundPainter(ICellPainter painter,
boolean vertical)
Creates a
GradientBackgroundPainter as wrapper for the given painter where the sweeping direction
can be set. |
Modifier and Type | Method and Description |
---|---|
protected org.eclipse.swt.graphics.Color |
getBackgroundColour(ILayerCell cell,
IConfigRegistry configRegistry)
Searches the background color to be used for gradient sweeping.
|
protected org.eclipse.swt.graphics.Color |
getForeGroundColour(ILayerCell cell,
IConfigRegistry configRegistry)
Searches the foreground color to be used for gradient sweeping.
|
void |
paintCell(ILayerCell cell,
org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle bounds,
IConfigRegistry configRegistry) |
getCellPainterAt, getPreferredHeight, getPreferredWidth, getWrappedPainter, getWrappedPainterBounds, setWrappedPainter
public GradientBackgroundPainter()
GradientBackgroundPainter
with a gradient sweeping from
left to right.public GradientBackgroundPainter(boolean vertical)
GradientBackgroundPainter
where the sweeping direction
can be set.vertical
- if true
sweeps from top to bottom, else
sweeps from left to right. false
is defaultpublic GradientBackgroundPainter(ICellPainter painter)
GradientBackgroundPainter
as wrapper for the given painter with a gradient sweeping from
left to right.painter
- The ICellPainter
that is wrapped by this GradientBackgroundPainter
public GradientBackgroundPainter(ICellPainter painter, boolean vertical)
GradientBackgroundPainter
as wrapper for the given painter where the sweeping direction
can be set.painter
- The ICellPainter
that is wrapped by this GradientBackgroundPainter
vertical
- if true
sweeps from top to bottom, else
sweeps from left to right. false
is defaultpublic void paintCell(ILayerCell cell, org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle bounds, IConfigRegistry configRegistry)
paintCell
in interface ICellPainter
paintCell
in class CellPainterWrapper
protected org.eclipse.swt.graphics.Color getForeGroundColour(ILayerCell cell, IConfigRegistry configRegistry)
ConfigRegistry
if there
is a value for the attribute CellStyleAttributes.GRADIENT_FOREGROUND_COLOR
is registered. If there is one
this value will be returned, if not it is checked if there is a value registered for CellStyleAttributes.FOREGROUND_COLOR
and returned. If there is no value registered for any of these attributes, null
will be returned which
will skip the painting.cell
- The LayerCell
for which the style attributes should be retrieved out of the ConfigRegistry
configRegistry
- The ConfigRegistry
to retrieve the attribute values from.Color
to use as foreground color of the gradient sweeping or null
if none was configured.protected org.eclipse.swt.graphics.Color getBackgroundColour(ILayerCell cell, IConfigRegistry configRegistry)
ConfigRegistry
if there
is a value for the attribute CellStyleAttributes.GRADIENT_BACKGROUND_COLOR
is registered. If there is one
this value will be returned, if not it is checked if there is a value registered for CellStyleAttributes.BACKGROUND_COLOR
and returned. If there is no value registered for any of these attributes, null
will be returned which
will skip the painting.cell
- The LayerCell
for which the style attributes should be retrieved out of the ConfigRegistry
configRegistry
- The ConfigRegistry
to retrieve the attribute values from.Color
to use as background color of the gradient sweeping or null
if none was configured.Copyright © 2013. All Rights Reserved.