Skip to main content



      Home
Home » Eclipse Projects » GEF » dot style grid of Graphical Viewer
dot style grid of Graphical Viewer [message #248867] Fri, 08 May 2009 16:05 Go to next message
Eclipse UserFriend
Originally posted by: y.masha.gmail.com

I am trying to set grid of Graphical Viewer to look like dot style.
something like this:
.. . . . . . .
.. . . . . . .
.. . . . . . .

The goal is when figures are dropped in the view and got connected with
relation, user can simply select the figures and relation and click on
Align button. The result will be that all selected figures are Aligned
to this dots.
Currently my viewer properties look like this:

viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE,
new Boolean(true));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED,
new Boolean(true));
viewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension (22,22));


.... Any ideas how I can do that?
I hope I was clear in my question…
Thanks
Re: dot style grid of Graphical Viewer [message #248872 is a reply to message #248867] Sat, 09 May 2009 08:06 Go to previous message
Eclipse UserFriend
Maria yakubov wrote:
> I am trying to set grid of Graphical Viewer to look like dot style.
> something like this:
> . . . . . . .
> . . . . . . .
> . . . . . . .

Override GridLayer#paintGrid(Graphics g) to paint the grid differently.
Then specify your custom layer in createGridLayer() of your RootEditPart.

>
> The goal is when figures are dropped in the view and got connected with
> relation, user can simply select the figures and relation and click on
> Align button. The result will be that all selected figures are Aligned
> to this dots.
> Currently my viewer properties look like this:
>
> viewer.setProperty(SnapToGrid.PROPERTY_GRID_VISIBLE,
> new Boolean(true));
> viewer.setProperty(SnapToGrid.PROPERTY_GRID_ENABLED,
> new Boolean(true));
> viewer.setProperty(SnapToGrid.PROPERTY_GRID_SPACING, new Dimension
> (22,22));

You also need to be sure that you answer a SnapToHelper class in
getAdapter on your diagram edit part.

After that, snapping should "just work" when new parts are created. The
users shouldn't have to click any manual alignment action.

HTH
Ben
Previous Topic:how can I get an iamge without GEF Editor?
Next Topic:"eclipse-tooltips" for GraphicalEditParts
Goto Forum:
  


Current Time: Sat Mar 22 09:12:04 EDT 2025

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

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

Back to the top