Recursive Editors

122 views
Skip to first unread message

Jeff Larsen

unread,
Jul 7, 2011, 1:21:56 PM7/7/11
to google-we...@googlegroups.com
I'm trying to build an editor where it can have a collection of itself.

For example, I have an object Foo

class Foo{
    String foo;

    List<Foo> foos;

//getters setters ommited for brevity
}

I've tried making FooEditor implement Editor<Foo> and CompositeEditor<Foo, Foo, FooEditor>, but then when I do GWT.create(Driver.class) I break the heap.

I what is the "correct" way of doing recursive editors with collections?

Thanks



Gal Dolber

unread,
Jul 7, 2011, 5:53:35 PM7/7/11
to google-we...@googlegroups.com
to avoid the infinite loop of instantiation, you need to instantiate
the child editor under demand, only when needed

> --
> 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/-/OfMk6z-w9r0J.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>


--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/

Thomas Broyer

unread,
Jul 8, 2011, 4:40:09 AM7/8/11
to google-we...@googlegroups.com
You need a subeditor for the foos. I.e. have FooEditor (implements Editor<Foo>) contain a subeditor for @Path("foos"), of type CompositeEditor<List<Foo>, Foo, FooEditor> (or ListEditor<Foo, FooEditor>).

Jeff Larsen

unread,
Jul 8, 2011, 10:22:39 AM7/8/11
to google-we...@googlegroups.com
Thanks Thomas and Gal.  Now I'm getting. 

[ERROR] [editorsampleproject] - Cycle detected in editor graph. Editor type com.google.gwt.editor.client.adapters.ListEditor at path foos can be reached again at path foos..foos


I'm probably just going to abandon this and just manually get/set the objects. It isn't that much work since the object is recursive. I could've written it by hand a long time ago, but thought this was a good deep dive into editors. 

Seperate question because I know I'm going to need this in the future somewhere. How do you implement an editor on a Set? 
Reply all
Reply to author
Forward
0 new messages