Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Don't see grid
Don't see grid [message #222029] Thu, 24 August 2006 09:57 Go to next message
Eclipse UserFriend
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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I'm developing an =
Eclipse&nbsp;graphical form=20
editor (an XML file) with GEF. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2>I&nbsp;think I set the right properties =
of the=20
GraphicalViewer&nbsp;but I don't see the grid.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How can I set the step of my =
grid?</FONT></DIV>
<DIV>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Here's some code =
snippets...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;protected void=20
createGraphicalViewer(Composite parent)=20
{<BR>&nbsp;&nbsp;<BR> &nbsp;&nbsp;IEditorSite&nbsp;&nbsp;&nbsp ;&nbsp; =
editorSite=20
=3D getEditorSite();<BR>&nbsp;&nbsp;GraphicalViewer viewer =3D new=20
GraphicalViewerCreator(editorSite).createViewer(parent);<BR >&nbsp;&nbsp;G=
raphicalViewerKeyHandler=20
handler=3Dnew =
GraphicalViewerKeyHandler(viewer);<BR>&nbsp;&nbsp;KeyHandler&nbsp;=20
parentKeyHandler =3D=20
handler.setParent(getCommonKeyHandler());<BR>&nbsp;&nbsp;viewer.setKeyHan=
dler(parentKeyHandler);<BR>&nbsp;&nbsp;getEditDomain().addViewer(viewer);=
<BR>&nbsp;&nbsp;this.graphicalViewer=3Dviewer;<BR>&nbsp;&nbsp;getSite().s=
etSelectionProvider(viewer);<BR>&nbsp;&nbsp;viewer.setContents(form); <BR>=
<FONT=20
color=3D#ff0000>&nbsp;&nbsp;<STRONG>loadProperties(); </STRONG><BR></FONT>=
&nbsp;}<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;protected void <FONT=20
color=3D#ff0000><STRONG>loadProperties()</STRONG></FONT>=20
{<BR>&nbsp;&nbsp;<BR>&nbsp;&nbsp;// Snap to Geometry=20
property<BR> &nbsp;&nbsp;getGraphicalViewer().setProperty(SnapToG eometry.P=
ROPERTY_SNAP_ENABLED,Boolean.TRUE);<BR>&nbsp;&nbsp; <BR>&nbsp;&nbsp;//=20
Grid=20
properties<BR> &nbsp;&nbsp;getGraphicalViewer().setProperty(SnapToG rid.PRO=
PERTY_GRID_ENABLED,Boolean.TRUE);<BR>&nbsp;&nbsp;<BR >&nbsp;&nbsp;//=20
We keep grid visibility and enablement in=20
sync<BR> &nbsp;&nbsp;getGraphicalViewer().setProperty(SnapToG rid.PROPERTY_=
GRID_VISIBLE,Boolean.TRUE);<BR>&nbsp;&nbsp;<BR>&nbsp;} <BR></FONT></DIV></=
BODY></HTML>

------=_NextPart_000_0088_01C6C774.6A987D30--
Re: Don't see grid [message #222103 is a reply to message #222029] Fri, 25 August 2006 05:52 Go to previous messageGo to next message
Andreas Schosser is currently offline Andreas SchosserFriend
Messages: 30
Registered: July 2009
Member
Paolo,

I dont's see anything ;-) but maybe I can help you:

> 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.

As I remember, the background color of the viewer's parent composite may
be painted in front of the grid if not set properly. Take a look at your
createPartControl method; try to leave out setBackgroundColor calls.

> How can I set the step of my grid?

Add to the loadProperties-method:
// Grid spacing
getGraphicalViewer().setProperty(SnapToGrid.PROPERTY_GRID_SP ACING,new
Dimension(10,10));
Re: Don't see grid [message #222110 is a reply to message #222029] Fri, 25 August 2006 09:58 Go to previous messageGo to next message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
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);
>
> }
Re: Don't see grid [message #222124 is a reply to message #222110] Fri, 25 August 2006 11:43 Go to previous messageGo to next message
Eclipse UserFriend
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);
>> }
Re: Don't see grid [message #222198 is a reply to message #222124] Mon, 28 August 2006 11:17 Go to previous message
Andreas Werner is currently offline Andreas WernerFriend
Messages: 55
Registered: July 2009
Member
I'm not really sure what you mean. You extended
FreeformGraphicalRootEditpart and added a GridLayer and GuideLayer.
Now you want to remove the GridLayer and do the Grid painting stuff
inside of the PrimaryLayer?
Or do you want to change the Layer hierarchy inside the RootEditPart to
make the GridLayer the topmost?

>
> 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?
>
Previous Topic:A job for GEF?
Next Topic:Is it possible to print TreeView in elipse GEF?
Goto Forum:
  


Current Time: Wed Jan 22 11:56:55 GMT 2025

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

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

Back to the top