hi Thomas

thank you for the reply. After reading your email and the referenced
examples, it makes much more sense now.
I have one more question poped out.
How does the editor framework work with inheritance?
say I have

interface Base {
String getBaseProperty() }

interface Child extends Base {
String getChildProperty() }

currently, without the editor framework, I have one view that displays
both Base and Child. I do a check with instanceof with the object to
be displayed and toggle visibilities of widgets accordingly. How might
similar functionality be implemented with the editor framework? I
poked around but had no luck.
class View implements Editor<Base> did not work because the child
property sub editor was complaining about no child property getter in
Base
class View implements Editor<Child> could work, but I have to wrap
Base as a Child, which somewhat breaks the meaning of inheritance
class ChildView extends View implements Editor<Child> doesn't work
because java does not allow implementing the same interface twice

thanks



On Mar 24, 9:05 pm, Thomas Broyer <t.bro...@gmail.com> wrote:
> On Thursday, March 24, 2011 9:21:00 PM UTC+1, Potate wrote:
>
> > Hi everyone
>
> > I'm having trouble understanding Editors introduced in GWT 2.1. It
> > sounds like a nice feature to reduce boilerplate code. The Dev Guide
> > is very very useful, but I couldn't get all the answers >_<
>
> > ==========
>
> > my first question is about validation and error reporting.
> > take the Dev Guide example,
>
> > public class PersonEditor extends Dialog implements Editor<Person> {
> >   Label nameEditor;
> >   ...
> > }
>
> > I wish to detect bad names, create a visual feedback upon error, and
> > bubble this information up so the caller knows not to proceed further.
> > I see there is recordError in EditorDelegate. Is it the right method
> > to tackle this? Can I get an example please?
>
> Yes, have a look at the DynatableRf sample and its ZipPlusFourBox widget.
> It extends ValueBox, so actually, have a look at the ValueBoxEditor adapter
> from GWT.
>
> > I have a lot fields to
> > edit. I hope I don't have to create bunch delegates. The less code the
> > better =)
>
> The delegate is provided to you by the editor framework, you have to
> implement HasEditorDelegate.
>
>
>
>
>
>
>
>
>
> > ==============
>
> > second question is about "Q: How can I edit objects with a large
> > number of properties?" from the FAQ section
> > It has the following example
> > class BagOfStateBiographicalEditor implements Editor<BagOfState> {
> >   AddressEditor address;
> >   Label name;
> > }
>
> > class BagOfStateUserPreferencesEditor implements Editor<BagOfState> {
> >   CheckBox likesCats;
> >   CheckBox likesDogs;
> > }
>
> > How do I chain up the two editors? Should I use a CompositeEditor? or
> > a list of drivers?
>
> What do you mean by "chaining them"? à la wizard? then either you use them
> as they do in the example and just adjust their visibility (use a DeckPanel
> or TabPanel/TabLayoutPanel?), or you use 2 drivers. I think you don't
> generally need 2 drivers; and you don't need a CompositeEditor here,
> CompositeEditor is for editing an object that's composed of zero or more
> other objects (zero or one => OptionalEditor, a List<> of objects =>
> ListEditor)

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to