Class RectangleGroupStrategy
- java.lang.Object
-
- org.eclipse.nebula.widgets.pgroup.AbstractGroupStrategy
-
- org.eclipse.nebula.widgets.pgroup.RectangleGroupStrategy
-
public class RectangleGroupStrategy extends AbstractGroupStrategy
RectangleGroupStrategy is a very flexible painting strategy that displays a (rounded) rectangle around the PGroup's body.- Since:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private int
betweenSpacing
private org.eclipse.swt.graphics.Color
borderColor
private int
fontHeight
private org.eclipse.swt.graphics.Color
g1
private org.eclipse.swt.graphics.Color
g2
private org.eclipse.swt.graphics.Color[]
gradientColors
private int[]
gradientPercents
private boolean
gradientVertical
private int
hMargin
private int
margin
private int
titleAreaHeight
private int
titleHeight
private int
titleTextMargin
private org.eclipse.swt.graphics.Rectangle
toolItemArea
private int
vMargin
-
Constructor Summary
Constructors Constructor Description RectangleGroupStrategy()
Deprecated.use constructor with PGroup element insteadRectangleGroupStrategy(PGroup g)
Constructs a RectangleGroupStrategy with the given toggle and style.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.swt.graphics.Rectangle
computeTrim(int x, int y, int width, int height)
void
dispose()
org.eclipse.swt.graphics.Color
getBorderColor()
Returns the color of the one pixel border drawn around the body when the group is expanded.org.eclipse.swt.graphics.Rectangle
getClientArea()
protected org.eclipse.swt.graphics.Rectangle
getTextBounds()
org.eclipse.swt.graphics.Rectangle
getToolItemArea()
void
initialize()
boolean
isToggleLocation(int x, int y)
void
paint(org.eclipse.swt.graphics.GC gc)
Paints the actual group widget.void
setBackground(org.eclipse.swt.graphics.Color[] colors, int[] percents)
Specify a gradient of colours to be drawn in the background of the group.void
setBackground(org.eclipse.swt.graphics.Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colours to be drawn in the background of the group.void
setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color.void
update()
-
Methods inherited from class org.eclipse.nebula.widgets.pgroup.AbstractGroupStrategy
getGroup
-
-
-
-
Field Detail
-
vMargin
private int vMargin
-
hMargin
private int hMargin
-
titleTextMargin
private int titleTextMargin
-
betweenSpacing
private int betweenSpacing
-
margin
private int margin
-
gradientColors
private org.eclipse.swt.graphics.Color[] gradientColors
-
gradientPercents
private int[] gradientPercents
-
gradientVertical
private boolean gradientVertical
-
borderColor
private org.eclipse.swt.graphics.Color borderColor
-
g1
private org.eclipse.swt.graphics.Color g1
-
g2
private org.eclipse.swt.graphics.Color g2
-
titleHeight
private int titleHeight
-
fontHeight
private int fontHeight
-
titleAreaHeight
private int titleAreaHeight
-
toolItemArea
private org.eclipse.swt.graphics.Rectangle toolItemArea
-
-
Constructor Detail
-
RectangleGroupStrategy
public RectangleGroupStrategy()
Deprecated.use constructor with PGroup element instead
-
RectangleGroupStrategy
public RectangleGroupStrategy(PGroup g)
Constructs a RectangleGroupStrategy with the given toggle and style.- Parameters:
toggleStrategy
-style
-
-
-
Method Detail
-
initialize
public void initialize()
- Overrides:
initialize
in classAbstractGroupStrategy
- See Also:
AbstractGroupStrategy.initialize()
-
paint
public void paint(org.eclipse.swt.graphics.GC gc)
Description copied from class:AbstractGroupStrategy
Paints the actual group widget. This method is to be implemented by extending classes.- Specified by:
paint
in classAbstractGroupStrategy
- See Also:
AbstractGroupStrategy.paint(org.eclipse.swt.graphics.GC)
-
getToolItemArea
public org.eclipse.swt.graphics.Rectangle getToolItemArea()
- Overrides:
getToolItemArea
in classAbstractGroupStrategy
- Returns:
- the area where toolitems can be drawn
-
isToggleLocation
public boolean isToggleLocation(int x, int y)
- Overrides:
isToggleLocation
in classAbstractGroupStrategy
- Returns:
- See Also:
AbstractGroupStrategy.isToggleLocation(int, int)
-
getTextBounds
protected org.eclipse.swt.graphics.Rectangle getTextBounds()
-
getClientArea
public org.eclipse.swt.graphics.Rectangle getClientArea()
- Specified by:
getClientArea
in classAbstractGroupStrategy
- See Also:
AbstractGroupStrategy.getClientArea()
-
computeTrim
public org.eclipse.swt.graphics.Rectangle computeTrim(int x, int y, int width, int height)
- Specified by:
computeTrim
in classAbstractGroupStrategy
- See Also:
AbstractGroupStrategy.computeTrim(int, int, int, int)
-
dispose
public void dispose()
- Specified by:
dispose
in classAbstractGroupStrategy
- See Also:
AbstractGroupStrategy.dispose()
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color[] colors, int[] percents)
Specify a gradient of colours to be drawn in the background of the group.For example, to draw a gradient that varies from dark blue to blue and then to white and stays white for the right half of the label, use the following call to setBackground:
setBackground(new Color[] {display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_BLUE), display.getSystemColor(SWT.COLOR_WHITE), display.getSystemColor(SWT.COLOR_WHITE) }, new int[] {25, 50, 100 });
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance from left to right; The valuenull
clears the background gradient; the valuenull
can be used inside the array of Color to specify the background color.percents
- an array of integers between 0 and 100 specifying the percent of the width of the widget at which the color should change; the size of the percents array must be one less than the size of the colors array.
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color[] colors, int[] percents, boolean vertical)
Specify a gradient of colours to be drawn in the background of the group.For example, to draw a gradient that varies from dark blue to white in the vertical, direction use the following call to setBackground:
setBackground(new Color[] {display.getSystemColor(SWT.COLOR_DARK_BLUE), display.getSystemColor(SWT.COLOR_WHITE) }, new int[] {100 }, true);
- Parameters:
colors
- an array of Color that specifies the colors to appear in the gradient in order of appearance from left/top to right/bottom; The valuenull
clears the background gradient; the valuenull
can be used inside the array of Color to specify the background color.percents
- an array of integers between 0 and 100 specifying the percent of the width/height of the widget at which the color should change; the size of the percents array must be one less than the size of the colors array.vertical
- indicate the direction of the gradient. True is vertical and false is horizontal.
-
getBorderColor
public org.eclipse.swt.graphics.Color getBorderColor()
Returns the color of the one pixel border drawn around the body when the group is expanded.- Returns:
- the border color
-
setBorderColor
public void setBorderColor(org.eclipse.swt.graphics.Color borderColor)
Sets the border color. The border is the one pixel border drawn around the body when the group is expanded.- Parameters:
borderColor
- the border color, or null for no border
-
update
public void update()
- Specified by:
update
in classAbstractGroupStrategy
-
-