Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to change the style of grids in ShapeEditor
How to change the style of grids in ShapeEditor [message #507155] Tue, 12 January 2010 10:46 Go to next message
Deepak Singla is currently offline Deepak SinglaFriend
Messages: 27
Registered: December 2009
Junior Member
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.
Re: How to change the style of grids in ShapeEditor [message #516878 is a reply to message #507155] Thu, 25 February 2010 07:50 Go to previous message
h1055071 is currently offline h1055071Friend
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.
Previous Topic:Double-click on an editpart that is partially hidden causes editpart to be revealed but misses doubl
Next Topic:[Announce] GEF 3.5.2 is available
Goto Forum:
  


Current Time: Mon Nov 24 04:23:22 GMT 2014

Powered by FUDForum. Page generated in 0.02441 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software