Hi Janak!

Thanks for answering.
I already fixed the problem here. The bug was that I called super.updateToModel before reformatting the text. Now the call to super.updateToModel is the last call of the overridden updateToModel and all works as expected.

Instead of ULC's data types we use domain values - immutable objects. The classes for those objects are deployed on the client and server. and they are serialized as strings between client and server. factories that are also available on the server and client are used to create those domain values from strings and to create strings from the domain values.

A domain value can have several string representations - a date can be typed in as "10.10.2006", "10102006", "1010" - but there is only one default string representation - "10.10.2006" in this case. When reformatting we reformat the string to the default string representation.

Anyways: it works now.

Cheers,
 Robert

----- Original Message ----- From: "Janak Mulani" <[EMAIL PROTECTED]>
To: "ulc rbeeger" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, July 14, 2006 5:18 PM
Subject: RE: [ULC-developer] UITextField.updateToModel problems


Hi Robert,

Could you please tell me:

1. what is the purpose behind overriding updateToModel() method?
  Is it just to do formatting?
If so you can use one of the existing IDataType implementations of ULC or
implement your own.

2. What exactly are you doing in the reformat() method?

When you call UITextComponent#setText() directly (as against
getBasicTextComponent().setText()), ULC first removes the document listener, sets the text, and sets the document listener again. This is the reason why:

1. valueChanged event is not generated
2. no formatting is done because it is the document listener which in turn
invokes the formatter (i.e. the data type).

Kindly provide more details so that we can find an appropriate solution.

Thanks and regards,

Janak

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of ulc rbeeger
Sent: Wednesday, July 12, 2006 3:08 PM
To: [EMAIL PROTECTED]
Subject: [ULC-developer] UITextField.updateToModel problems


Hi!

We have an extension that extends ULC/UITextField. We have overridden
updateToModel to reformat the typed string after the typing is finished:
   protected void updateToModel(final boolean displayFormattedValue)
   {
         super.updateToModel(displayFormattedValue);
         if (displayFormattedValue)
         {

getBasicTextComponent().setText(reformat(getBasicTextComponent
().getText()));
         }
   }

The problem with this is that it sometimes an extra valueChangedEvent after
leaving the textfield.An alternative looks like this
   protected void updateToModel(final boolean displayFormattedValue)
   {
         super.updateToModel(displayFormattedValue);
         if (displayFormattedValue)
         {
             setText(reformat(getBasicTextComponent().getText()));
         }
   }
Now the extra event isn't created, but the text changes to the originally
typed in text when the textfield gets the cursor again.
For example if I typed in "1020", it is displayed as "10:20" after the
reformatting and again as"1020" once I click into the textfield.

Is there some way to reformat the text and make it stay reformatted without
the extra valueChangedEvent?

Cheers and thanks in advance,
 Robert

_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer



_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer

Reply via email to