Bug 360820 - Add add/removePaintListener to Control in RAP
Summary: Add add/removePaintListener to Control in RAP
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 380648
  Show dependency tree
 
Reported: 2011-10-13 09:31 EDT by Tobias Liefke CLA
Modified: 2013-07-26 07:09 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Liefke CLA 2011-10-13 09:31:59 EDT
As I look through the implementations of PaintListeners in Eclipse plugins, I found two different use cases:
1. I want to paint additional decorations to the controls graphic context. I understand that it's not very easy to paint on HTML elements different from Canvas, but I think it would be enough to state this limitation in the method description or remove "gc" from PaintEvent. As most of the implementations I found for this use case just create "nice but ignorable decorations", I would suggest to use the first variant and return a dummy graphics context.
2. I want to run some code after the component was displayed first (because I need the displayed size or similar). I think that should be possible even in RAP. 

And thats why we need the add/removePaintListener for Control like in SWT.
Comment 1 Rüdiger Herrmann CLA 2011-10-13 09:40:06 EDT
+1
With paintListener on Control we can also support SWT.Paint.

BTW, there is an SWT.Show event if you want to run code when the widget becomes visible (for the first time).
Comment 2 Tobias Liefke CLA 2011-10-13 09:46:10 EDT
Thanks for approval.

As I said, this is how PaintListeners are partly used in different Eclipse plugins I've seen during migration to RAP, not how I'm using them.
Comment 3 Tim Buschtoens CLA 2012-02-01 05:35:41 EST
I would try to support this for real. The GC client implementation was recently changed so that i *think* this is fixable entirely on the server.
Comment 4 Igor Novakovic CLA 2012-02-03 05:00:39 EST
That would be cool!
Comment 5 Ralf Sternberg CLA 2013-07-26 07:09:28 EDT
Since SWT.Paint exists, it's already possible to add an untyped paint listener on any Control, so I think we could as well pull up the add/removePaintListener() methods.

However, I'd not start to implement painting on arbitrary widgets in the web client before we have some convincing use cases that make sense for RAP. Even if possible, painting would still behave different than it does in SWT (like not painting on top but below content, not refreshing, etc...), and in most cases it won't be appropriate for the web.