Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Why is org.eclipse.swt.graphics.Image declared final?
Why is org.eclipse.swt.graphics.Image declared final? [message #460820] Thu, 08 September 2005 07:31 Go to next message
Eclipse UserFriend
Originally posted by: mark_z.charter.net

Why is the Image class (org.eclipse.swt.graphics.Image) declared final?

I'm already making extensive use of an extended ImageDescriptor
(org.eclipse.jface.resource) class to cache getImageData(). I'd like to do
the same for createImage() which would return an extended Image, whose
dispose() method would be overloaded and make use of reference counting to
determine when it can really be disposed of. This isn't easily possible
with the Image class being declared final.

After reading the Javadocs on the Resource class, it seems that subclassing
really isn't supported by anything outside the SWT implementation. As such,
maybe a related caching feature could be an enhancement request to the
class? (I do prefer the choice they made with leaving Resource non-final,
as commented in the Javadocs. Why wasn't the same done for Image?)

Alternatively, I could do the same thing using a decorator pattern.
However, I'd still need to pass in something other than an Image (e.g. a
caching wrapper) to any of the classes. This, however, would require
extensive changes to the framework, as Image and Resource should probably
then be coded to interfaces.

Any comments/ideas?

--
Mark A. Ziesemer
Re: Why is org.eclipse.swt.graphics.Image declared final? [message #460829 is a reply to message #460820] Thu, 08 September 2005 11:23 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You could use the Drawable interface to represent the wrapper, but I think that a number of libraries specifically expect an Image class because the OS specifically expects an Image in certain places.
Re: Why is org.eclipse.swt.graphics.Image declared final? [message #460838 is a reply to message #460829] Thu, 08 September 2005 13:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mark_z.charter.net

Exactly. Within the plugin I'm working on for Eclipse, almost everything
accepts only an Image, not drawable.

--
Mark A. Ziesemer
Re: Why is org.eclipse.swt.graphics.Image declared final? [message #461582 is a reply to message #460820] Mon, 26 September 2005 22:23 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
See http://www.eclipse.org/swt/faq.php#subclassing

"Mark A. Ziesemer" <mark_z@charter.net> wrote in message
news:dfopcu$1gr$1@news.eclipse.org...
> Why is the Image class (org.eclipse.swt.graphics.Image) declared final?
>
> I'm already making extensive use of an extended ImageDescriptor
> (org.eclipse.jface.resource) class to cache getImageData(). I'd like to
do
> the same for createImage() which would return an extended Image, whose
> dispose() method would be overloaded and make use of reference counting to
> determine when it can really be disposed of. This isn't easily possible
> with the Image class being declared final.
>
> After reading the Javadocs on the Resource class, it seems that
subclassing
> really isn't supported by anything outside the SWT implementation. As
such,
> maybe a related caching feature could be an enhancement request to the
> class? (I do prefer the choice they made with leaving Resource non-final,
> as commented in the Javadocs. Why wasn't the same done for Image?)
>
> Alternatively, I could do the same thing using a decorator pattern.
> However, I'd still need to pass in something other than an Image (e.g. a
> caching wrapper) to any of the classes. This, however, would require
> extensive changes to the framework, as Image and Resource should probably
> then be coded to interfaces.
>
> Any comments/ideas?
>
> --
> Mark A. Ziesemer
>
>
Previous Topic:setOpaque() problem
Next Topic:Tree SWT.FULL_SELECTION
Goto Forum:
  


Current Time: Thu Jun 20 20:13:22 GMT 2019

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

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

Back to the top