Bug 393050 - [Spinner] getText is not correctly implemented
Summary: [Spinner] getText is not correctly implemented
Status: ASSIGNED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 421265 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-29 10:26 EDT by Tim Buschtoens CLA
Modified: 2013-11-07 11:08 EST (History)
2 users (show)

See Also:


Attachments
Snippet demonstrating invalid getText during modify event (1.11 KB, application/octet-stream)
2013-03-07 16:18 EST, Tim Whittington CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Buschtoens CLA 2012-10-29 10:26:36 EDT
Spinner has a text value and a selection value. While the selection is always a number within the range of valid values of the spinner, the text can be any number, represented as a string. For example, typing "200" into a spinner that has 100 as the max value results in 100 as selection, but "200" as text.

In RWT both would be 100. 

Furthermore, Selection events are fired when actually only the Modify event should be fired, e.g. when changing from 100 to 1000.
Comment 1 Tim Whittington CLA 2013-03-07 16:03:48 EST
I've attached a snippet demonstrating the difference in behaviour of Spinner.getText() during a modify event in RWT vs SWT.

The SWT behaviour allowing an out of range value to be detected during modification was introduced in bug 186634.
Comment 2 Tim Whittington CLA 2013-03-07 16:05:01 EST
The Spinner.getText() snippet can also be used to observe that modification events are fired whenever a key is typed in the spinner (regardless of effect).

e.g. left arrow, right arrow and alt all produce modification events in RWT, but not in SWT.
Comment 3 Tim Whittington CLA 2013-03-07 16:15:17 EST
To clarify part of the original report, the text in a Spinner can be any value (including non-numeric values), and will only modify the selection if it is within the range defined by the Spinner.

When a Spinner loses focus, the text is reset to the selection (i.e. it will change to match the selection if it was not a number or out of range).

The detection of invalid/out of range text is important to provide UI affordance that an invalid input will not be persisted (e.g. disabling a save button or displaying an RCP Form error).
Comment 4 Tim Whittington CLA 2013-03-07 16:18:58 EST
Created attachment 228103 [details]
Snippet demonstrating invalid getText during modify event
Comment 5 Ivan Furnadjiev CLA 2013-11-07 11:08:44 EST
*** Bug 421265 has been marked as a duplicate of this bug. ***