Re: Use of IsEditor in UiBinder
On Thursday, September 12, 2013 10:19:23 AM UTC+2, Jordan Amar wrote:
Hi all,I have a view which is supposed to show some components differently based on a general view mode (e.g. read-only or write). This view implements IsEditor.For the fields which are supposed to be different depending on this mode, I have added @UiField(provided=true) in the Java file and declared them as Widget in the UIBinder and Java class. But doing this somehow prevent the Driver.flush() method to work for those fields.Maybe this is because the type is not read at runtime and only rely on what was written/declared ?
Yes, absolutely. Editor, IsEditor and CompositeEditor (and I think HasEditorDelegate too) are used at compile-time to generate support code.
So I tried to mark them as IsEditor<SomeTypeInCommon> in Java and IsEditor in UIBinder but the binding of the view fails with:Not allowed in an HTML context: <e:IsEditor>Is there a way through this ? I would like to avoid to write 2 different (but very identical) views if possible...
Use one field for UiBinder (of a type that extends Widget, or possibly Widget itself) and a field or a getter for the Editor framework (of a type that implement Editor or IsEditor, or extends CompositeEditor).
If you use two fields, you use the "Editor suffix" naming rule of the Editor framework at your advantage:
@UiField(provided=true) Widget foo; Editor<SomeType> fooEditor; … MyWidget w = new MyWidget(); foo = w; fooEditor = w;
or
@UiField(provided=true) Widget foo; @SuppressWarnings("unchecked") Editor<SomeType> foo() { return (Editor<SomeType>) foo; }
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home