Don't see grid [message #222029] |
Thu, 24 August 2006 09:57 |
Eclipse User |
|
|
|
Originally posted by: paolo.reitelli.datamat.it
This is a multi-part message in MIME format.
------=_NextPart_000_0088_01C6C774.6A987D30
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi all,
I'm developing an Eclipse graphical form editor (an XML file) with GEF.=20
I think I set the right properties of the GraphicalViewer but I don't =
see the grid.
How can I set the step of my grid?
Thank in advance,
Paolo.
Here's some code snippets...
protected void createGraphicalViewer(Composite parent) {
=20
IEditorSite editorSite =3D getEditorSite();
GraphicalViewer viewer =3D new =
GraphicalViewerCreator(editorSite).createViewer(parent);
GraphicalViewerKeyHandler handler=3Dnew =
GraphicalViewerKeyHandler(viewer);
KeyHandler parentKeyHandler =3D =
handler.setParent(getCommonKeyHandler());
viewer.setKeyHandler(parentKeyHandler);
getEditDomain().addViewer(viewer);
this.graphicalViewer=3Dviewer;
getSite().setSelectionProvider(viewer);
viewer.setContents(form);
loadProperties();
}
protected void loadProperties() {
=20
// Snap to Geometry property
=
getGraphicalViewer().setProperty(SnapToGeometry.PROPERTY_SNA P_ENABLED,Boo=
lean.TRUE);
=20
// Grid properties
=
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_EN ABLED,Boolean=
..TRUE);
=20
// We keep grid visibility and enablement in sync
=
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_VI SIBLE,Boolean=
..TRUE);
=20
}
------=_NextPart_000_0088_01C6C774.6A987D30
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2963" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi all,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I'm developing an =
Eclipse graphical form=20
editor (an XML file) with GEF. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I think I set the right properties =
of the=20
GraphicalViewer but I don't see the grid.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>How can I set the step of my =
grid?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial size=3D2>Thank in advance,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Paolo.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Here's some code =
snippets...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> protected void=20
createGraphicalViewer(Composite parent)=20
{<BR> <BR> IEditorSite   ; =
editorSite=20
=3D getEditorSite();<BR> GraphicalViewer viewer =3D new=20
GraphicalViewerCreator(editorSite).createViewer(parent);<BR > G=
raphicalViewerKeyHandler=20
handler=3Dnew =
GraphicalViewerKeyHandler(viewer);<BR> KeyHandler =20
parentKeyHandler =3D=20
handler.setParent(getCommonKeyHandler());<BR> viewer.setKeyHan=
dler(parentKeyHandler);<BR> getEditDomain().addViewer(viewer);=
<BR> this.graphicalViewer=3Dviewer;<BR> getSite().s=
etSelectionProvider(viewer);<BR> viewer.setContents(form); <BR>=
<FONT=20
color=3D#ff0000> <STRONG>loadProperties(); </STRONG><BR></FONT>=
}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> protected void <FONT=20
color=3D#ff0000><STRONG>loadProperties()</STRONG></FONT>=20
{<BR> <BR> // Snap to Geometry=20
property<BR> getGraphicalViewer().setProperty(SnapToG eometry.P=
ROPERTY_SNAP_ENABLED,Boolean.TRUE);<BR> <BR> //=20
Grid=20
properties<BR> getGraphicalViewer().setProperty(SnapToG rid.PRO=
PERTY_GRID_ENABLED,Boolean.TRUE);<BR> <BR > //=20
We keep grid visibility and enablement in=20
sync<BR> getGraphicalViewer().setProperty(SnapToG rid.PROPERTY_=
GRID_VISIBLE,Boolean.TRUE);<BR> <BR> } <BR></FONT></DIV></=
BODY></HTML>
------=_NextPart_000_0088_01C6C774.6A987D30--
|
|
|
|
|
Re: Don't see grid [message #222124 is a reply to message #222110] |
Fri, 25 August 2006 11:43 |
Eclipse User |
|
|
|
Originally posted by: paolo.reitelli.datamat.it
Thanks a lot Andreas,
I set not opaque the topmost figure of my hierarchy and I saw the grid.
But the figure didn't catch the move request of its children (it did
before), so I subclass the RootEditPart of my viewer changing the order of
layers creation like this:
public class DeServerRootEditPart extends FreeformGraphicalRootEditPart {
protected GridLayer createGridLayer() {
return new DeServerGridLayer();
}
protected void createLayers(LayeredPane layeredPane) {
layeredPane.add(getPrintableLayers(), PRINTABLE_LAYERS);
layeredPane.add(new FreeformLayer(), HANDLE_LAYER);
layeredPane.add(new FreeformLayer(), FEEDBACK_LAYER);
layeredPane.add(new GuideLayer(), GUIDE_LAYER);
layeredPane.add(createGridLayer(), GRID_LAYER);
}
}
Now it goes but, in my opinion, the best way to do it is to display the grid
in the topmost figure of my hierarchy.
What do you think about it?
Thanks in advance,
Paolo.
"Andreas Werner" <andreas.werner@itso-berlin.de> ha scritto nel messaggio
news:ecmhkc$254$1@utils.eclipse.org...
> Perhaps if you have a Layer as your topmost figure in the figure hierarchy
> and set this one opaque, then you can't see the grid...
>
>
> PaoloReitelli schrieb:
>> Hi all,
>> I'm developing an Eclipse graphical form editor (an XML file) with GEF.
>> I think I set the right properties of the GraphicalViewer but I don't see
>> the grid.
>> How can I set the step of my grid?
>> Thank in advance,
>> Paolo.
>> Here's some code snippets...
>> protected void createGraphicalViewer(Composite parent) {
>> IEditorSite editorSite = getEditorSite();
>> GraphicalViewer viewer = new
>> GraphicalViewerCreator(editorSite).createViewer(parent);
>> GraphicalViewerKeyHandler handler=new
>> GraphicalViewerKeyHandler(viewer);
>> KeyHandler parentKeyHandler =
>> handler.setParent(getCommonKeyHandler());
>> viewer.setKeyHandler(parentKeyHandler);
>> getEditDomain().addViewer(viewer);
>> this.graphicalViewer=viewer;
>> getSite().setSelectionProvider(viewer);
>> viewer.setContents(form);
>> *loadProperties();*
>> }
>> protected void *loadProperties()* {
>> // Snap to Geometry property
>>
>> getGraphicalViewer().setProperty(SnapToGeometry.PROPERTY_SNA P_ENABLED,Boolean.TRUE);
>> // Grid properties
>>
>> getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_EN ABLED,Boolean.TRUE);
>> // We keep grid visibility and enablement in sync
>>
>> getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_VI SIBLE,Boolean.TRUE);
>> }
|
|
|
|
Powered by
FUDForum. Page generated in 0.03162 seconds