On Monday, June 6, 2011 2:12:34 PM UTC+2, ricu wrote: > > I have ValueListBox<A> where A is my POJO class. So I have editor > with fields: > > ValueListBox<A> field1; > ValueListBox<B> field2; > ValueListBox<C> field3; >
Having these in an Editor<X> would mean that X has 3 fields field1, field2 and field3 of respective type A, B and C. Otherwise, you'd have to @Editor.Ignore these fields (and they would not participate in the editing of an object of type X) > I also have a POJO D with String properties which are A.code, B.code, > C.code. It is some kind of specification pattern where I specify a > search filter. > So my question is how can I bind only CODE property from classes A,B,C > into my D class? > As Vinayak told you earlier, you have to "adapt" the String to/from the A (resp. B, C) code by creating a LeafValueEditor<String> that wraps a (in your case) ValueListBox<A> (resp. B, C). Vinayak's code is not quite complete/correct though: - in setValue(String) you'd have to select the appropriate A (resp. B, C) object in the ValueListBox - in getValue, you'd have to get the selected A (resp. N, C) value from the ValueListBox and return its getCode() (no need for a ValueChangeHandler and selectedValue field) Note that, alternatively, you can have your ValueListBoxes directly in your Editor<D>, but @editor.Ignore-d, and have the Editor<D> implement ValueAwareEditor<D>: in setValue you'd select the appropriate values in the ValueListBoxes and save the D value in a field, and in flush() you'd push the appropriate values within the edited D object (that you previously saved in the setValue). -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/Y05ha01oa2MzTGtK. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
