[gwt-contrib] Re: Add ListEditor adapter implemented on top of a new CompositeEditor core (issue848801)
I think LGTM, but could you help me understand CompositeEditor and CompositeEditor.Chain first? http://gwt-code-reviews.appspot.com/848801/diff/1/2 File samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/AddressEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/2#newcode46 samples/dynatablerf/src/com/google/gwt/sample/dynatablerf/client/widgets/AddressEditor.java:46: final TakesValueEditorString streetEditor; Nice! http://gwt-code-reviews.appspot.com/848801/diff/1/5 File user/src/com/google/gwt/editor/client/CompositeEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/5#newcode20 user/src/com/google/gwt/editor/client/CompositeEditor.java:20: * some other type. Having trouble getting my head around this. Could you update doc give an example of base and component types? Or just describe the use case that lead you to create this? I'm lost. http://gwt-code-reviews.appspot.com/848801/diff/1/16 File user/src/com/google/gwt/editor/client/adapters/ListEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/16#newcode29 user/src/com/google/gwt/editor/client/adapters/ListEditor.java:29: * Manages to manage a list and some editors. Manages to manage :-) ? http://gwt-code-reviews.appspot.com/848801/diff/1/16#newcode34 user/src/com/google/gwt/editor/client/adapters/ListEditor.java:34: public class ListEditorT, E extends EditorT implements You need E as input to the code generator, right? http://gwt-code-reviews.appspot.com/848801/diff/1/26 File user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/26#newcode29 user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java:29: public class FakeEditorSourceT extends EditorSourceFakeLeafValueEditorT { Should the fakes and mocks live in user/test? Or would that make them not available to third parties? http://gwt-code-reviews.appspot.com/848801/diff/1/37 File user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/37#newcode299 user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java:299: class StringSource extends EditorSourceSimpleEditorString { Will I always have to create a source to use a ListEditor? Could it be generated? http://gwt-code-reviews.appspot.com/848801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add ListEditor adapter implemented on top of a new CompositeEditor core (issue848801)
http://gwt-code-reviews.appspot.com/848801/diff/1/5 File user/src/com/google/gwt/editor/client/CompositeEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/5#newcode20 user/src/com/google/gwt/editor/client/CompositeEditor.java:20: * some other type. * An interface that indicates that a given Editor is composed of an unknown * number of sub-Editors all of the same type. * p * For example, the {...@link com.google.gwt.editor.client.adapters.ListEditor * ListEditor} type is a * codeCompositeEditorlt;Listlt;T, T, E extends Editorlt;T/code; that * is, ListEditor will accept a Listlt;T and will edit some unknown number of * codeT/code's using the Editor type codeE/code. Another example might * be: * * pre * class WorkgroupEditor implements CompositeEditorlt;Workgroup, Person, PersonSummaryEditor{ * public void setValue(Workgroup workgroup) { * // Assuming Workgroup implements Iterablelt;Person * for (Person p : workgroup) { * PersonSummaryEditor editor = new PersonSummaryEditor(); * // Attach editor to DOM * somePanel.add(editor); * // Let the generated code drive the sub-editor * editorChain.attach(p, editor); * } * } * } * /pre http://gwt-code-reviews.appspot.com/848801/diff/1/16 File user/src/com/google/gwt/editor/client/adapters/ListEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/16#newcode34 user/src/com/google/gwt/editor/client/adapters/ListEditor.java:34: public class ListEditorT, E extends EditorT implements On 2010/09/09 18:24:01, rjrjr wrote: You need E as input to the code generator, right? Yes, the EditorDriver generator needs to make sure that there is an EditorDelegate peer for the editor type that will display the list elements. http://gwt-code-reviews.appspot.com/848801/diff/1/26 File user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/26#newcode29 user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java:29: public class FakeEditorSourceT extends EditorSourceFakeLeafValueEditorT { On 2010/09/09 18:24:01, rjrjr wrote: Should the fakes and mocks live in user/test? Or would that make them not available to third parties? The contents of user/test aren't packed into gwt-user.jar. http://gwt-code-reviews.appspot.com/848801/diff/1/37 File user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/37#newcode299 user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java:299: class StringSource extends EditorSourceSimpleEditorString { On 2010/09/09 18:24:01, rjrjr wrote: Will I always have to create a source to use a ListEditor? Could it be generated? I have this rough idea that you could write something like this in UiBinder: e:ListEditor path='person.aliases' e:container g:FlowPanel / /e:container e:subeditor g:FlowPanel g:TextBox e:path='name'John Doe/g:TextBox g:TextBox e:path='locale'East Nowhere/g:TextBox g:DateBox e:path='last_seen'9/9/2010/g:DateBox /g:FlowPanel e:subeditor /e:ListEditor UiBinder would generate an EditorChain that automatically creates instances of the widget described by the subeditor clause and manages their attachment to an InsertPanel described in the container clause. http://gwt-code-reviews.appspot.com/848801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
[gwt-contrib] Re: Add ListEditor adapter implemented on top of a new CompositeEditor core (issue848801)
LGTM On Thu, Sep 9, 2010 at 12:04 PM, b...@google.com wrote: http://gwt-code-reviews.appspot.com/848801/diff/1/5 File user/src/com/google/gwt/editor/client/CompositeEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/5#newcode20 user/src/com/google/gwt/editor/client/CompositeEditor.java:20: * some other type. * An interface that indicates that a given Editor is composed of an unknown * number of sub-Editors all of the same type. * p * For example, the {...@link com.google.gwt.editor.client.adapters.ListEditor * ListEditor} type is a * codeCompositeEditorlt;Listlt;T, T, E extends Editorlt;T/code; that * is, ListEditor will accept a Listlt;T and will edit some unknown number of * codeT/code's using the Editor type codeE/code. Another example might * be: * * pre * class WorkgroupEditor implements CompositeEditorlt;Workgroup, Person, PersonSummaryEditor{ * public void setValue(Workgroup workgroup) { * // Assuming Workgroup implements Iterablelt;Person * for (Person p : workgroup) { * PersonSummaryEditor editor = new PersonSummaryEditor(); * // Attach editor to DOM * somePanel.add(editor); * // Let the generated code drive the sub-editor * editorChain.attach(p, editor); * } * } * } * /pre http://gwt-code-reviews.appspot.com/848801/diff/1/16 File user/src/com/google/gwt/editor/client/adapters/ListEditor.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/16#newcode34 user/src/com/google/gwt/editor/client/adapters/ListEditor.java:34: public class ListEditorT, E extends EditorT implements On 2010/09/09 18:24:01, rjrjr wrote: You need E as input to the code generator, right? Yes, the EditorDriver generator needs to make sure that there is an EditorDelegate peer for the editor type that will display the list elements. http://gwt-code-reviews.appspot.com/848801/diff/1/26 File user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/26#newcode29 user/src/com/google/gwt/editor/client/testing/FakeEditorSource.java:29: public class FakeEditorSourceT extends EditorSourceFakeLeafValueEditorT { On 2010/09/09 18:24:01, rjrjr wrote: Should the fakes and mocks live in user/test? Or would that make them not available to third parties? The contents of user/test aren't packed into gwt-user.jar. http://gwt-code-reviews.appspot.com/848801/diff/1/37 File user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java (right): http://gwt-code-reviews.appspot.com/848801/diff/1/37#newcode299 user/test/com/google/gwt/editor/client/SimpleBeanEditorTest.java:299: class StringSource extends EditorSourceSimpleEditorString { On 2010/09/09 18:24:01, rjrjr wrote: Will I always have to create a source to use a ListEditor? Could it be generated? I have this rough idea that you could write something like this in UiBinder: e:ListEditor path='person.aliases' e:container g:FlowPanel / /e:container e:subeditor g:FlowPanel g:TextBox e:path='name'John Doe/g:TextBox g:TextBox e:path='locale'East Nowhere/g:TextBox g:DateBox e:path='last_seen'9/9/2010/g:DateBox /g:FlowPanel e:subeditor /e:ListEditor UiBinder would generate an EditorChain that automatically creates instances of the widget described by the subeditor clause and manages their attachment to an InsertPanel described in the container clause. http://gwt-code-reviews.appspot.com/848801/show -- http://groups.google.com/group/Google-Web-Toolkit-Contributors