Community
Participate
Working Groups
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.
Created attachment 122230 [details] Color Dialog mockup
PS: The fields with numbers in the mock-up (i.e. [255]) are Spinner widgets.
Created attachment 122392 [details] ColorDialog.java Initial implementation
Created attachment 122393 [details] ColorDialog demo application ColorDialog demo application
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.
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.
Vasko, thanks for your contribution. I think it can be committed now. I will contact Ruediger to trigger the next steps. Elias.
I committed the patch "Updated ColorDialog.java" without modifications. Elias.
Committed to HEAD.