Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 333782 - Problems in whitespace handling
Summary: Problems in whitespace handling
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Sapphire (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Konstantin Komissarchik CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-07 13:32 EST by Ling Hao CLA
Modified: 2021-11-19 09:22 EST (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 Ling Hao CLA 2011-01-07 13:32:04 EST
Contacts sample, spaces in the name proprerty should be preserved. 

1. Type "Name " into the name field with a space at the end.
2. Go to source and see the generated code: <c:contact name="Name ">
3. Go back to the design view and notice that the space has been removed from the text field.
Comment 1 Konstantin Komissarchik CLA 2011-05-09 19:49:22 EDT
There are several problems...

1. The behavior on read and write is inconsistent. Write always preserves entered whitespace. Read applies normalization. Any normalization should be consistently applied on read and on write.

2. There is no API to opt-out from trim normalization. 

3. All parts of the system are not on the same page regarding what normalization to use. This lead to the following very annoying problem:

     A. Type some text into any form text field backed by XML data.
     B. Quickly type a few more letters followed by a a space or two.
     C. The cursor jumps to the start of text and trailing spaces are removed.

The desired behavior is to preserve text as typed into a text field during the course of the editing session, regardless of normalization behavior. This means that presentation level code that binds UI controls to model needs to be able to compare values in their normalized form. We lack API for this.

4. The API that we do have for specifying whitespace handling is at the wrong API level... @XmlValueBinding( path = "description", collapseWhitespace = true )... The problem is that whitespace normalization is not limited to XML data storage and the parts of the system that need to interact with normalization aren't aware of how model data is stored.
Comment 2 Konstantin Komissarchik CLA 2011-05-09 20:37:04 EDT
Introduced new @Whitespace annotation along with ValueNormalizationService API. See content in the what's new and migration docs for more detail.

Make sure to re-build the dev environment as this fix required changes to the annotation processor.
Comment 3 Konstantin Komissarchik CLA 2011-05-09 20:37:50 EDT
Fixed. Please verify.

There is new value/whitespace section in the gallery sample.
Comment 4 Raj Alagumalai CLA 2011-06-01 13:23:43 EDT
verified on 0.3.0.201105261624 with gallery sample
Comment 5 Konstantin Komissarchik CLA 2011-06-03 13:13:59 EDT
Closing.