public interface Person { String getName(); void setName(String name); List<PersonFriend> getFriends(); } public interface PersonFriend { String getName(); }
I am trying to implement a view-only editor for Person :
public class PersonViewEditor extends Composite implements Editor<Person> { private static PersonViewEditorUiBinder uiBinder = GWT.create(PersonViewEditorUiBinder.class); interface PersonViewEditorUiBinder extends UiBinder<Widget, PersonViewEditor> {} @UiField Label nameEditor; @UiField PersonFriendsViewEditor friendsEditor; @UiField FancyAnchor editAnchor; public PersonViewEditor(ClientFactory clientFactory) { initWidget(uiBinder.createAndBindUi(this)); editAnchor.setPlace( clientFactory.getPlaceHistoryMapper(), clientFactory.getPlaceController(), new EditPersonPlace()); } } public class PersonFriendsViewEditor extends Composite { private static PersonFriendsViewEditorUiBinder uiBinder = GWT.create(PersonFriendsViewEditorUiBinder.class); interface PersonFriendsViewEditorUiBinder extends UiBinder<Widget, PersonFriendsViewEditor> {} interface Driver extends SimpleBeanEditorDriver<List<PersonFriend>, ListEditor<PersonFriend, PersonFriendViewEditor>> {} private class PersonFriendViewEditorSource extends EditorSource<PersonFriendViewEditor> { @Override public PersonFriendViewEditor create(int index) { PersonFriendViewEditor friend = new PersonFriendViewEditor(); containerPanel.insert(friend, index); return friend; } } @UiField HorizontalPanel containerPanel; public PersonFriendsViewEditor() { initWidget(uiBinder.createAndBindUi(this)); Driver driver = GWT.create(Driver.class); ListEditor<PersonFriend, PersonFriendViewEditor> editor = ListEditor.of(new PersonFriendViewEditorSource()); driver.initialize(editor); } }
When I bind a Person object to a PersonViewEditor , friendsEditor never binds to a personβs friend list. It seems that PersonFriendsViewEditor needs to implement some kind of magic interface in order to allow GWT to interact with it, but I cannot find any related documents. There's an example of dynatablerf in GWT, but they explicitly link their list editor, and I'm curious to link it as part of an "external" object, so I just bind Person to PersonViewEditor and has all the data / all all the widgets.
Any thoughts?
source share