Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 260662 - ColorDialog for RWT
Summary: ColorDialog for RWT
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.2 M5   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: plan-version=1.2 plan-theme=extend-r...
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-11 23:42 EST by Elias Volanakis CLA
Modified: 2009-05-12 11:06 EDT (History)
2 users (show)

See Also:


Attachments
Color Dialog mockup (5.17 KB, image/png)
2009-01-12 00:09 EST, Elias Volanakis CLA
no flags Details
ColorDialog.java (13.91 KB, patch)
2009-01-13 05:45 EST, Vasko Tchoumatchenko CLA
no flags Details | Diff
ColorDialog demo application (14.87 KB, application/x-zip-compressed)
2009-01-13 05:46 EST, Vasko Tchoumatchenko CLA
no flags Details
Updated ColorDialog.java (13.93 KB, patch)
2009-01-17 18:24 EST, Vasko Tchoumatchenko CLA
ruediger.herrmann: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Volanakis CLA 2009-01-11 23:42:42 EST
Implement ColorDialog for RWT

This should go to the org.eclipse.swt.widgets package in the org.eclipse.rap.rwt package.

The following methods must be supported:

public ColorDialog(Shell)
public ColorDialog(Shell, int)
public RGB getRGB()
public RGB open()
public RGB setRGB(RGB)

See SWT's ColorDialog for documentation / specification of those methods.

Implementation Notes

1. In SWT the contents of the ColorDialog are unspecified -- they are different on different operating systems. That means we are free to create our own color dialog, as long as it has the above methods. See color_dialog_mockup.png for a sketch of what I would like to have.

2. It should be possible to implement this entirely in Java by subclassing Dialog. This will avoid the need for creating a custom widget.
Comment 1 Elias Volanakis CLA 2009-01-12 00:09:32 EST
Created attachment 122230 [details]
Color Dialog mockup
Comment 2 Elias Volanakis CLA 2009-01-12 00:17:07 EST
PS: The fields with numbers in the mock-up (i.e. [255]) are Spinner widgets.
Comment 3 Vasko Tchoumatchenko CLA 2009-01-13 05:45:46 EST
Created attachment 122392 [details]
ColorDialog.java

Initial implementation
Comment 4 Vasko Tchoumatchenko CLA 2009-01-13 05:46:35 EST
Created attachment 122393 [details]
ColorDialog demo application

ColorDialog demo application
Comment 5 Elias Volanakis CLA 2009-01-13 23:36:09 EST
I experimented with the prototype. Great work so far!

I found two issues while testing:

1. The Basic Colors should be non-modifiable. Currently they can be modified by the user by doing this: click on a Basic Color. Change the R, G, B values. Click ok. Open the dialog again. The selected Basic Color has been changed.

2. It is possible to cause the "color-update" to stop. It is a bit tricky to reproduce:
Open the color dialog. Press TAB two times (cursor in Red). Type '255'. Press Ctrl+A. Type '0'. Press tab. The color has not been updated. Press 'OK'. Result is: 255, 0, 0. Expected: 0,0,0.

Best,
Elias.
Comment 6 Vasko Tchoumatchenko CLA 2009-01-17 18:24:01 EST
Created attachment 122867 [details]
Updated ColorDialog.java

This updated ColorDialog.java fixes the first and (partially) the second bugs described in comment 5.

It is still possible to create discrepancy between the values, shown on the RGB spinners and the color of the big square, if you type "too fast". The Spinner widget does not generate ModifyEvent for each value change, if the keystrokes are coming too fast for him.
Comment 7 Elias Volanakis CLA 2009-01-19 00:27:31 EST
Vasko,

thanks for your contribution. I think it can be committed now. I will contact Ruediger to trigger the next steps.

Elias.
Comment 8 Elias Volanakis CLA 2009-01-20 01:39:54 EST
I committed the patch "Updated ColorDialog.java" without modifications.

Elias.
Comment 9 Elias Volanakis CLA 2009-01-20 14:51:28 EST
Committed to HEAD.