Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Text widgets " not intended to be subclassed."
Text widgets " not intended to be subclassed." [message #444280] Mon, 11 October 2004 09:34 Go to next message
Eclipse UserFriend
Originally posted by: _guillaume.precheur.magellium.fr

If the SWT Text Widget is not intended to be subclassed, what's the best
way for you to create a reusable specialisation of a text Widget ?

guillaume.
Re: Text widgets " not intended to be subclassed." [message #444285 is a reply to message #444280] Mon, 11 October 2004 09:58 Go to previous messageGo to next message
Grant Slender is currently offline Grant SlenderFriend
Messages: 14
Registered: July 2009
Junior Member
Download the source and make similar widget - the other way is to "wrap" the
widget in another class - create a composite and place the text widget
inside.

"guillaume "pr
Re: Text widgets " not intended to be subclassed." [message #444297 is a reply to message #444285] Mon, 11 October 2004 15:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

And the third way is to have a factory method on a class that creates it
for you.


--
Thanks,
Rich Kulp
Re: Text widgets " not intended to be subclassed." [message #444366 is a reply to message #444297] Tue, 12 October 2004 08:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: _guillaume.precheur.magellium.fr

Rich Kulp wrote:

> And the third way is to have a factory method on a class that creates it
> for you.


but the class still need to derive from 'composite' and not from the my
base class ...
Re: Text widgets " not intended to be subclassed." [message #444372 is a reply to message #444366] Tue, 12 October 2004 14:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

That's not what I meant. The class method would create a text field,
customize it through settings such as font, etc, add listeners to it to
do things. And then just return the text field. It is still a text
field. The class itself that returns this text field would just be a
subclass of object.



--
Thanks,
Rich Kulp
Re: Text widgets " not intended to be subclassed." [message #444373 is a reply to message #444280] Tue, 12 October 2004 14:05 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Use composition. Wrap the Text widget in a non-widget object that provides
the specialization. Do not wrap it in a Composite. See
org.eclipse.jface.text.TextViewer for an example. The Viewer hierarchy
provides a "getControl" method which allows the application code to do
things like set the layout data on the underlying widget without having to
provide methods on the wrapper for each of the methods on the underlying
widget.

"guillaume "pr
Previous Topic:DHTML
Next Topic:Scroll two tables at the same time
Goto Forum:
  


Current Time: Fri Mar 29 00:29:10 GMT 2024

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

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

Back to the top