Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Rendering SWT controls on GEF canvas
Rendering SWT controls on GEF canvas [message #196606] Fri, 23 September 2005 10:58 Go to next message
Eclipse UserFriend
Originally posted by: so.to.speak

Hi,
I am planning to build a lightweight gui designer in GEF, but the point =
=

that's still fuzzy for me is rendering the controls in GEF canvas.
GEF seems to be fine for creating IFigure based diagrams and such stuff,=
=

but for rendering a textbox or checkbox etc... control in editor canvas,=
i =

need a better method than emulating the appearance of those controls. Th=
is =

method does not seem feasible.
I've found out that VE uses screen scrapping to do this, but it's =

implementatin does not look very lightweight.
Are there any alternatives other than using screen scraping for my task,=
=

or would anyone recommend a simpler approach or example to take a look a=
t? =

What are the best practices for providing this kind of functionality?
Best Regards
Re: Rendering SWT controls on GEF canvas [message #197074 is a reply to message #196606] Thu, 29 September 2005 11:14 Go to previous messageGo to next message
Hallvard Traetteberg is currently offline Hallvard TraettebergFriend
Messages: 673
Registered: July 2009
Location: Trondheim, Norway
Senior Member
On Fri, 23 Sep 2005 13:58:15 +0300, "Furkan Demir" <so@to.speak>
wrote:

>Hi,
>I am planning to build a lightweight gui designer in GEF, but the point
>that's still fuzzy for me is rendering the controls in GEF canvas.
>GEF seems to be fine for creating IFigure based diagrams and such stuff,
>but for rendering a textbox or checkbox etc... control in editor canvas, i
>need a better method than emulating the appearance of those controls. This
>method does not seem feasible.

I am writing a diagram editor for a dialog modelling language. The
abstract dialog elements in my language may have concrete gui widgets
inside, in my case SWT controls. These controls are live in the
editor, in the sense that the user may interact with them and drives
the execution engine for the dialog model. Hence, scraping wasn't an
option.

In my implementation I have a special IFigure, imaginatively called
ControlFigure, which wraps an SWT control and manages its life cycle,
in cooperation with an EditPart. More specifically, the SWT control is
created at a time when the EditPart has a viewer, which is used as the
parent. When the ControlFigure or one of its parents are moved, the
SWT control is also moved. This is implemented by using a special
anchor for tracking movements. Since anchors use absolute coordinates,
they must listen to movements in a parent hierarchy (done by GEF for
you), so listening to and using the anchor is an easy way to move the
control appropriately. The swt control must also be destroyed, and
this is triggered by the EditPart's deactivate method (or the
fireDeactived method depending on your needs).

To sum up: The EditPart and a special IFigure cooperate to manage the
SWT control's life-cycle, the EditPart's viewer's control is the
parent control (Composite) of the SWT control and an anchor is used to
move the SWT control when one of the containing IFigure's move.

Hallvard
Re: Rendering SWT controls on GEF canvas [message #197133 is a reply to message #196606] Thu, 29 September 2005 19:02 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Furkan Demir wrote:
> Hi,
> I am planning to build a lightweight gui designer in GEF, but the point
> that's still fuzzy for me is rendering the controls in GEF canvas.
> GEF seems to be fine for creating IFigure based diagrams and such
> stuff, but for rendering a textbox or checkbox etc... control in editor
> canvas, i need a better method than emulating the appearance of those
> controls. This method does not seem feasible.
> I've found out that VE uses screen scrapping to do this, but it's
> implementatin does not look very lightweight.
> Are there any alternatives other than using screen scraping for my
> task, or would anyone recommend a simpler approach or example to take a
> look at? What are the best practices for providing this kind of
> functionality?

See Snippet 46 on the SWT Snippets page (the last one under Composite).

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet46.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup

This is the only other way I know to build an SWT GUI builder that I
know of. But it works very well across all platforms and is very fast.

If you're interested in a GUI builder framework that uses this approach,
you might want to check out XSWT (http://xswt.sourceforge.net). The
folks on the XSWT mailing list can get you started.


Best regards,

Dave Orme
--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Rendering SWT controls on GEF canvas [message #197147 is a reply to message #196606] Thu, 29 September 2005 19:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Furkan Demir" <so@to.speak> wrote in message
news:op.sxjx3dbhg8y85e@limonata.datasel.com.tr...
> Hi,
> I am planning to build a lightweight gui designer in GEF, but the point
> that's still fuzzy for me is rendering the controls in GEF canvas.
> GEF seems to be fine for creating IFigure based diagrams and such stuff,
> but for rendering a textbox or checkbox etc... control in editor canvas, i
> need a better method than emulating the appearance of those controls. This
> method does not seem feasible.
> I've found out that VE uses screen scrapping to do this, but it's
> implementatin does not look very lightweight.

Why do you think that screen scraping is not lightweight?
You don't have to implement a GUI editor exactly like VE.
You can borrow the VE method for screen scraping to capturing the widget
images
but other than that you are free to implement your GUI designer however you
wish.
---
Sunil
Re: Rendering SWT controls on GEF canvas [message #197156 is a reply to message #197133] Thu, 29 September 2005 19:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"David J. Orme" <djo@coconut-palm-software.com> wrote in message
news:dhhdnp$ltm$1@news.eclipse.org...
> Furkan Demir wrote:
>> Hi,
>> I am planning to build a lightweight gui designer in GEF, but the point
>> that's still fuzzy for me is rendering the controls in GEF canvas.
>> GEF seems to be fine for creating IFigure based diagrams and such stuff,
>> but for rendering a textbox or checkbox etc... control in editor canvas,
>> i need a better method than emulating the appearance of those controls.
>> This method does not seem feasible.
>> I've found out that VE uses screen scrapping to do this, but it's
>> implementatin does not look very lightweight.
>> Are there any alternatives other than using screen scraping for my task,
>> or would anyone recommend a simpler approach or example to take a look
>> at? What are the best practices for providing this kind of
>> functionality?
>
> See Snippet 46 on the SWT Snippets page (the last one under Composite).
>
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/eclipse/swt/snippets/Snippet46.java?rev=HEAD&a mp;content-type=text/vnd.viewcvs-markup
>
> This is the only other way I know to build an SWT GUI builder that I know
> of. But it works very well across all platforms and is very fast.
>
> If you're interested in a GUI builder framework that uses this approach,
> you might want to check out XSWT (http://xswt.sourceforge.net). The folks
> on the XSWT mailing list can get you started.
>
However, XSWT is not really a GUI designer.
It just provides a way to describe a GUI in XML and then preview it.
There is no point-and-click functionality either to create or edit widgets.
---
Sunil
Re: Rendering SWT controls on GEF canvas [message #197161 is a reply to message #197156] Thu, 29 September 2005 20:13 Go to previous messageGo to next message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Sunil Kamath wrote:
> "David J. Orme" <djo@coconut-palm-software.com> wrote in message
> However, XSWT is not really a GUI designer.
> It just provides a way to describe a GUI in XML and then preview it.
> There is no point-and-click functionality either to create or edit widgets.

See:

http://xswt.sourceforge.net/cgi-bin/wiki?XSWTFeatures

(near the bottom)

See also: http://xswt.sourceforge.net/cgi-bin/wiki?XSWTEditorHowto

XSWT is gradually migrating to VEP for its GUI builder, but you asked
how to build a GUI builder by directly manipulating SWT controls, and
this code shows how to do it.

(This code pre-dates VEP and is still useful for rapid prototyping using
XSWT, which is why I've been maintaining it.)

I'm happy to help you get up and running if you want that.


Best regards,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Re: Rendering SWT controls on GEF canvas [message #197169 is a reply to message #197161] Thu, 29 September 2005 20:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"David J. Orme" <djo@coconut-palm-software.com> wrote in message
news:dhhht7$s3u$1@news.eclipse.org...
> Sunil Kamath wrote:
>> "David J. Orme" <djo@coconut-palm-software.com> wrote in message However,
>> XSWT is not really a GUI designer.
>> It just provides a way to describe a GUI in XML and then preview it.
>> There is no point-and-click functionality either to create or edit
>> widgets.
>
> See:
>
> http://xswt.sourceforge.net/cgi-bin/wiki?XSWTFeatures
>
> (near the bottom)
>

Oh, cool!

> See also: http://xswt.sourceforge.net/cgi-bin/wiki?XSWTEditorHowto
>
> XSWT is gradually migrating to VEP for its GUI builder, but you asked how
> to build a GUI builder by directly manipulating SWT controls, and this
> code shows how to do it.
>

It wasn't me who asked for it :-).
However, it all comes back to VEP finally, doesn't it?

I have built a GUI designer as well (http://eclipsensis.sf.net) and have
"borrowed" VE's method for screen scraping.
It is the best mechanism I have found for GUI design using native widgets
(and I have tried a few - including the heavyweight approach).
However, I have made some modifications and compromises, since I only intend
to support Win32 platforms.
---
Sunil
Re: Rendering SWT controls on GEF canvas [message #197177 is a reply to message #197169] Thu, 29 September 2005 21:18 Go to previous message
Dave Orme is currently offline Dave OrmeFriend
Messages: 424
Registered: July 2009
Senior Member
Sunil Kamath wrote:
> "David J. Orme" <djo@coconut-palm-software.com> wrote in message
>>XSWT is gradually migrating to VEP for its GUI builder, but you asked how
>>to build a GUI builder by directly manipulating SWT controls, and this
>>code shows how to do it.
>
> It wasn't me who asked for it :-).

Yeah, I noticed that after I posted.

> However, it all comes back to VEP finally, doesn't it?

Well, that's where the community is. And to quote Mike Milinkovich,
"It's the community, stupid." :-)

> I have built a GUI designer as well (http://eclipsensis.sf.net) and have
> "borrowed" VE's method for screen scraping.
> It is the best mechanism I have found for GUI design using native widgets
> (and I have tried a few - including the heavyweight approach).
> However, I have made some modifications and compromises, since I only intend
> to support Win32 platforms.

Nice project!

Puhlezze support Linux/GTK. ;-) (Which wouldn't have been a problem if
you'd used heavyweight controls. ;-)

BTW, we're always glad when other projects "borrow" our source. :-)

It's probably possible to adapt GEF to work with heavyweight visuals
just like it's been adpated to both the SWT tree and Draw2d. I'd love
to see somebody do that... (Furkan??)


Best,

Dave Orme

--
Visual Editor Project lead
http://www.db4o.com -- The Open-source Java Object Database
http://xswt.sf.net -- XML-based SWT page description language
Previous Topic:double click action in GEF
Next Topic:logical zoom
Goto Forum:
  


Current Time: Wed Feb 05 15:59:12 GMT 2025

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

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

Back to the top