dot style grid of Graphical Viewer [message #248867] |
Fri, 08 May 2009 16:05  |
Eclipse User |
|
|
|
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  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03248 seconds