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.