Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » General Question: Suitability of SWT (within RCP) for canvas work..
General Question: Suitability of SWT (within RCP) for canvas work.. [message #465668] Sat, 17 December 2005 01:34 Go to next message
Eclipse UserFriend
Originally posted by: mrhatken.mac.com

Hello All,

I have a general question regarding SWT. I have read about how SWT
compares to Swing etc, and the question doesn't related specifically to
that.

What I want to know is the suitability of SWT for complex use of
"canvases" (i.e. drawing and reacting to user-initiated events whilst
working within the canvas).

For example (and just for example), would it be appropriate to use SWT for
GUI controls if one also wants to do something like CAD drawing in a
canvas.

Of course, the canvas would need to be able to respond to events - I
believe the event model for SWT is different to that of Swing etc?

I'm guessing either they have very different suitabilities (SWT vs Swing)
or SWT just uses the same basic drawing and interaction API as Swing does
within a canvas?

Eclipse itself seems to have complex editors (textual and graphical).
What API do they use to interact with the canvas? Is this limited
compared to Swing or the same?

I hope that makes sense. Any pointers or comments would be most
appreciated.

Cheers,
Ashley.

--
Ashley Aitken
Perth, Western Australia
mrhatken at mac dot com
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465669 is a reply to message #465668] Sat, 17 December 2005 11:18 Go to previous messageGo to next message
venkataramana m is currently offline venkataramana mFriend
Messages: 86
Registered: July 2009
Member
If you are not aware, have a look at 2D drawing capabilities from Eclipse's Draw2D plugin (built on top of SWT for 2D drawing). Built on top of Draw2D is GEF which is an MVC based graphical editing framework.

Thanks
~Venkat
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465670 is a reply to message #465668] Sat, 17 December 2005 16:07 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 48
Registered: July 2009
Member
also have a look at the eclipse Graphical Modeling Framework (GMF)

Ashley Aitken wrote:
>
> Hello All,
>
> I have a general question regarding SWT. I have read about how SWT
> compares to Swing etc, and the question doesn't related specifically to
> that.
> What I want to know is the suitability of SWT for complex use of
> "canvases" (i.e. drawing and reacting to user-initiated events whilst
> working within the canvas).
>
> For example (and just for example), would it be appropriate to use SWT
> for GUI controls if one also wants to do something like CAD drawing in a
> canvas.
> Of course, the canvas would need to be able to respond to events - I
> believe the event model for SWT is different to that of Swing etc?
>
> I'm guessing either they have very different suitabilities (SWT vs
> Swing) or SWT just uses the same basic drawing and interaction API as
> Swing does within a canvas?
>
> Eclipse itself seems to have complex editors (textual and graphical).
> What API do they use to interact with the canvas? Is this limited
> compared to Swing or the same?
>
> I hope that makes sense. Any pointers or comments would be most
> appreciated.
>
> Cheers,
> Ashley.
>
> --
> Ashley Aitken
> Perth, Western Australia
> mrhatken at mac dot com
>
>
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465679 is a reply to message #465668] Mon, 19 December 2005 02:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mrhatken.mac.com

Thank you both for your pointers.

I was aware that you could do drawing with SWT (e.g. the plugins you
mentioned). However, I also believe these will miss out on the hardware
acceleratin etc that Swing Java2D would get.

If the *main* functionality of my app is going to be WYSIWYG word
processing (multiple fonts) and drawing would SWT and the Eclipse RCP
still be the way to go? Again, just using this for an example.

I understand SWT may be the best for native controls etc but I worry about
more "general" interfaces components (e.g. for word processing and
drawing) that I will be implementing.

If it is the core of my application I don't want to compromise (cf Swing
for example).

Thanks again.

Cheers,
Ashley.
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465683 is a reply to message #465679] Mon, 19 December 2005 12:02 Go to previous messageGo to next message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
> I understand SWT may be the best for native controls etc but I worry
> about more "general" interfaces components (e.g. for word processing and
> drawing) that I will be implementing.

IMHO this is a major drawback of SWT. There are only some widgets like
buttons but you are not allowed to extend them. And they have very limited
functionality and miss e.g. a Look and Feel implementation. The method
setBackground is rudimental and fills the whole widget so that rounded
buttons look ugly. The Graphic context also provides only some basic
methods for drawing and is much less powerful than Graphics2D of swing.

If you want some fancy widgets you have to build them yourself. My
application needed an Outlook like button list. With swing this would
involve only a new CellRenderer with JList but in SWT I needed to build it
from scratch. The ListViewer/TableViewer from JFace are not helpful as
they increase the complexity and are inflexible. And extending existing
SWT classes is mostly forbidden.

Programming is hard as you need to provide the parent and the style for
every widget at construction time. This is painful when you want dynamic
widgets.

And dont be blinded by "native looking" widgets and the usability
increase. On windows people happily use programs like Nero or Media player
which look not native but are nevertheless useable. And as a linux guy I
was pissed of that someone told me that GTK is my look and feel of choice.

I get the urge to fall on my knees and pray for forgiveness as of this
heretic thoughts :)


Suffering in [insert place for bad people],

Ricky
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465685 is a reply to message #465683] Mon, 19 December 2005 15:02 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
My opinions differ from yours. I run stuff on a Mac, and (in general) Metal-based and other LAF-based applications are horrible when compared with other native-based apps. The ones that do look professional tend to be ones like Azureus which is written in SWT and thus has extensive feel of a Mac application, despite the fact that it's a platform-neutral codebase.

There's good reasons why extending SWT is forbidden; not so much because you *can't*, but because you *shouldn't*. Specifically, there's no love lost if an update to SWT breaks your code; on the other hand, no-one's forcing you to update your SWT unless you want to.

Being able to be flexible (whether you're moving from Java/Swing to Java/SWT or Java/Swing to .Net/C#) is one of the key abilities of a good computer developer. There's different ways of doing many things; you can consult the history of where SWT came from and experiences with other windowing models that resulted in the choices that were made. The fact that you have to specify a parent at run-time is largely down to compatibility (it's an issue on some platforms, such as handhelds) as well as managing resources (disposal of parents/children). Plus, as can be seen from projects like XSWT it's not that dynamic content is an issue; you just need to think in a way that will allow you to go with the flow, rather than against it.

In any case, there's other ways of doing things (as in everything in life). If you want better 2D support (esp. for hardware-accelerated programming) then looking at the OpenGL work might be worthwhile. That's probably better than the Graphics2D stuff that comes with Swing, and it's portable to other (.Net/C#) systems as well.

One man's bug is another man's feature ...

Alex.

http://www.eclipse.org/articles/Article-Writing%20Your%20Own %20Widget/Writing%20Your%20Own%20Widget.htm
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465688 is a reply to message #465679] Mon, 19 December 2005 15:49 Go to previous messageGo to next message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 48
Registered: July 2009
Member
SWT is really good at giving your application the little details in a
native way - buttons, scrollbars, etc. When drawing becomes too
difficult and you move on to draw2D and GEF then you have more
flexibility, but any sub-widgets (scrollbars for example) are still native.
The stuff in the middle is still difficult, though they're working on it
(keep in mind that SWT is newer than Swing). Take a look at the
proposed eclipse project "Nebula" (which comes from www.swtplus.com).
Also keep in mind that you can embed Swing components onto a SWT canvas.
perhaps the best solution would be to use SWT (for the little native
details), Swing (for components that don't have a native equivalent
anyway), and RCP (to manage the whole thing).

As for me, I'm finishing up a Calendar component that is mix of SWT and
draw2D / GEF - the controls, such as toolbars, buttons, menus, etc are
all SWT and match the user's theme, whereas the "drawing" portion of the
calendar (where tasks are drawn on the grid of days) is done with draw2D
/ GEF.

Ricky mentioned Nero and Media Player and I think he's absolutely right
- there may be no need to go to the trouble. But there may be - our
application needs to sit comfortably next to other "office" type
applications so we chose SWT.

I know you said "example", but if WYSIWYG word processing is something
you're serious about, perhaps embedding OpenOffice.org would help you out:
http://ubion.ion.ag/plonesoftwarecenter/003officeintegration editor
(google translators will help if you don't speak german)

hardware acceleration - I don't really know, but since SWT uses native
widgets (and draw2D uses SWT) it seems that you'd be getting whatever
support the OS has for this... and for advanced graphics (alphas and
such) on Windows SWT gets into GDI+ and on Linux it's Cairo... anybody
know better?


Ashley Aitken wrote:
>
> Thank you both for your pointers.
>
> I was aware that you could do drawing with SWT (e.g. the plugins you
> mentioned). However, I also believe these will miss out on the hardware
> acceleratin etc that Swing Java2D would get.
> If the *main* functionality of my app is going to be WYSIWYG word
> processing (multiple fonts) and drawing would SWT and the Eclipse RCP
> still be the way to go? Again, just using this for an example.
>
> I understand SWT may be the best for native controls etc but I worry
> about more "general" interfaces components (e.g. for word processing and
> drawing) that I will be implementing.
>
> If it is the core of my application I don't want to compromise (cf Swing
> for example).
>
> Thanks again.
>
> Cheers,
> Ashley.
>
>
>
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465689 is a reply to message #465685] Mon, 19 December 2005 16:00 Go to previous messageGo to next message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
Its sad that I have to say this but I am sure we both dont see this as a
flamewar. I am sure others would.

> My opinions differ from yours. I run stuff on a Mac, and (in general)
> Metal-based and other LAF-based applications are horrible when compared
> with other native-based apps. The ones that do look professional tend to
> be ones like Azureus which is written in SWT and thus has extensive
> feel of a Mac application, despite the fact that it's a platform-neutral
> codebase.

The mac is the best argument for swing as the default aqua look is
delicous and integrates seamlessly with the rest of the desktop. And you
are absolutly right that metal is ugly as hell. But the cool thing is you
can change it with one line of code.

The more important point for me is that usability is not all about look.
Beeing red or grey is one part, arrangement and interactive flow control
is more important. And you can mess that up as easily in SWT as in Swing.

> There's good reasons why extending SWT is forbidden; not so much because
> you *can't*, but because you *shouldn't*. Specifically, there's no love
> lost if an update to SWT breaks your code; on the other hand, no-one's
> forcing you to update your SWT unless you want to.

All I know is that I wanted a customized Group with my own error
indicators and I could not subclass Group. This would be handy as I could
use my widget via polymorphism everywhere a Group is allowed but instead I
needed composition. Breaking code is an issue but this is also possible if
some methods become deprecated and vanish at some point. Evolution is
always present and according to Darvin the one who does not change will
not make it in the long run.

> Being able to be flexible (whether you're moving from Java/Swing to
> Java/SWT or Java/Swing to .Net/C#) is one of the key abilities of a good
> computer developer.

ACK.

> There's different ways of doing many things; you can consult the history
> of where SWT came from and experiences with other windowing models that
> resulted in the choices that were made. The fact that you have to
> specify a parent at run-time is largely down to compatibility (it's an
> issue on some platforms, such as handhelds) as well as managing
> resources (disposal of parents/children). Plus, as can be seen from
> projects like XSWT it's not that dynamic content is an issue; you just
> need to think in a way that will allow you to go with the flow, rather
> than against it.

This is the point. There are reasons for everything that happens and there
is always a way to get things done

> In any case, there's other ways of doing things (as in everything in
> life). If you want better 2D support (esp. for hardware-accelerated
> programming) then looking at the OpenGL work might be worthwhile. That's
> probably better than the Graphics2D stuff that comes with Swing, and
> it's portable to other (.Net/C#) systems as well.
>
> One man's bug is another man's feature ...
>
> Alex.
>
> http://www.eclipse.org/articles/Article-Writing%20Your%20Own %20Widget/Writing%20Your%20Own%20Widget.htm
Re: General Question: Suitability of SWT (within RCP) for canvas work.. [message #465690 is a reply to message #465689] Mon, 19 December 2005 16:10 Go to previous message
Ricky is currently offline RickyFriend
Messages: 204
Registered: July 2009
Senior Member
So this is the best example for bad usability. The send button is way to
close to other function elements and there is no confimation request (but
I love Opera nevertheless).

I did not want to send my reply but save it. I know these kind of
dissusions are often useless and often dangerous. So I answered the post
to clear my mind about the topic but I know that Alex or I had to quit
this thread. So not answering would be ok and everybody would understand.

The post is not finished so please dont think about it or be offended.

I regret this send button,

Ricky
Previous Topic:Size of Popup
Next Topic:swt-library causes application crash! urgent!
Goto Forum:
  


Current Time: Sat Dec 07 21:06:34 GMT 2024

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

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

Back to the top