Hi Albert,
In ULC, once a data type has been set on a ULCTextField, setText() and
getText() methods throw UnsupportedOperationException.
ULC VE, creates a TextField with setText("ULCTextField") such that the
textfield has some size.
When you setDataType on the textfield, VE tries to set this on the target VM
(where ULC beans have been instantiated and from which live images are
obtained for display on the canavas for WYSIWYG effect).
Now to show the text property in the property sheet, getText() is invoked
on the bean in the target VM and this throws an exception.
The bug in VE is that it should consider DataType as a runtime property and
not design time because dataType property does not affect the layout. It
can do this by ignoring the setDataType call on the bean in the target VM.
Fixing this bug would require a new release.
However there is a work around. Please follow the steps below:
1. Create ULCTextField.
2. Delete the setText stmt
3. Set the "columns" property to provide size to the text field in the
layout
4. Close the visual class
5. Clean compile project.
6. Close and Open project
7. Clean compile project
(steps 5 to 7 are needed to clean the cache where VE caches the bean's model
for faster startup. we want to ensure that the text property is removed from
the cached model)
9. Open the class in Java Editor and not in Visual Editor.
10. In the getUlcTextField method introduce a "if" stmt as shown below:
private ULCTextField getUlcTextField() {
if (ulcTextField == null) {
ulcTextField = new ULCTextField();
ulcTextField.setColumns(20);
if (!Beans.isDesignTime()) {
ulcTextField.setDataType(new
ULCStringDataType());
}
}
return ulcTextField;
}
11. setDataType under "not design time" condition will ensure that it is not
set on the bean in the VE thus preventing the exception.
12. close the class and open it with VE if you want to do further UI design.
Another suggestion is that once you have finished layouting, you can edit
the Visual Class with the Java Editor to put runtime behavior like
setDataType. If you want to do further UI design on this class then you can
comment out setDataType stmt. This is tedious. However I suspect that this
(commenting out) may not be necessary if the "text" property is not set and
has been cleaned from the cache.
Kindly try the above and let me know if it worked for you.
Thanks and regards,
Janak
>-----Original Message-----
>From: [EMAIL PROTECTED]
>[mailto:[EMAIL PROTECTED] Behalf Of Albert Smulders
>Sent: Tuesday, June 06, 2006 3:20 PM
>To: [EMAIL PROTECTED]
>Subject: [ULC-developer] Ref. UVE-331 (VE Exception Data Type on
>ULCTextField)
>
>
>Is there already some solution coming soon for bug UVE-331 (Visual
>Editor throws exception if there is a data type set on an
>ULCTextField)? This is a very annoying bug, as there is no way to
>validate field entries without setting data types.... if there is
>no solution soon, we even think about downgrading ULC / ULC VE
>versions again...
>
>Kind regards,
>
>Alberto A.Smulders
>HostDat Lda. - Portugal
>--
>
>
>Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
> Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
>
>_______________________________________________
>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