|
Re: How to change the style of grids in ShapeEditor [message #516878 is a reply to message #507155] |
Thu, 25 February 2010 07:50 |
h1055071 Messages: 335 Registered: July 2009 |
Senior Member |
|
|
On 12/01/2010 10:46, Deepak Singla wrote:
> I have implemented the Grid (rt now there are vertical and horizontal
> lines) with context menu and working fine in GEF Shape Editor with 3.2.2
> version
>
> But I want to change the Grid Style (less spacing between the lines,
> light color) or like dots only.
>
> as shown: . . . . .
> . . . . .
> . . . . .
>
> Any help is appriciated.
I was looking at the source of the class
org.eclipse.gef.editparts.GridLayer. If you extend this class you could
change the colour and how it is drawn.
If you have a FreeformGraphicalRootEditPart then you could extend this
class and over-ride this method:
protected GridLayer createGridLayer() {
return new GridLayer();
}
to:
protected GridLayer createGridLayer() {
return new MyGridLayer();
}
and then create a MyGridLayer class which extends GridLayer and
over-ride the method:
protected void paintGrid(Graphics g) {
FigureUtilities.paintGrid(g, this, origin, gridX, gridY);
}
to:
protected void paintGrid(Graphics g) {
customPaintGrid(g, this, origin, gridX, gridY);
}
and write your own customPaintGrid() method based on the one at
FigureUtilities.paintGrid()
P.
|
|
|
Powered by
FUDForum. Page generated in 0.01749 seconds