I am using GWT 2.2.0 with RequestFactory and the Editor framework. What is the recommended way to keep to 2 editors in sync with a shared proxy object attribute (the same object attribute is displayed in 2 editors)? I tried the following but ran into a few issues:
Using RequestFactoryEditorDriver I have an Editor that contains a TabPanel with 2 tabs and contains 2 sub-editors (one for each tab). Each sub-editor has a TextBox editor that edits MyProxy.xyz. I tried the following: - added a ValueChangeHandler for the TextBox on tab 1, onValueChange update the proxy object attribute with the value in the TextBox and then fire an EntityProxyChange UPDATE event on the eventBus. - Have the sub-editor on tab 2 implement ValueAwareEditor and subscribe() via the EditorDelegate. This seems to work. The TextBox on the second tab was updated with the value entered in the TextBox on the first tab. However there are a couple of side effects: 1) When the sub-editor gets the event from the eventBus, it internally fires a RequestFactory call to find the proxy by id from the database. It seems that it should not need to do this but rather just refresh the editors with the fully populated proxy object in memory. This is why I am questioning if I am using the right approach of creating EntityProxyChange events and subscribing. 2) Was getting an IllegalStateException: A request is already in progress exception why I tried to do an update request later on. It was due to a SubscriptionReceiver getting called as a result of the update response via the EntityProxyChange UPDATE event. The SubscriptionReceiver was referening to the current RequestFactoryEditorDelegate that had the RequestContext from the update request that was just fired and is now locked. OnSuccess() in the Receiver() was not called yet so I was not able to call edit() on the driver which would create a new RequestFactoryEditorDelegate with a new RequestContext passed in. To get around this I removed the handler on the sub-editor in the flush() method since I did not need to handle the event at that point. Again, seems like my approach is more complicated than it should be. Question 1) Is there a better way to do this, essentially flush and refresh the editors without making a request to the server? Am I missing something? Question 2) I followed this same pattern with a display only CellTable editor as part of the sub-editor, but it did not get updated when the proxy event was sent. Is there something that needs to be done to support the CellTable? The data was initially set correctly in the CellTable by the driver, but it does not get updated like the other editors. public class SubEditor2 extends Composite implements ValueAwareEditor<MyProxy>{ private CellTable<SomeProxy> table = new CellTable<SomeProxy>(); // this does not get refreshed correctly but is initially displayed correctly @Path("someProxyList") HasDataEditor<SomeProxy> tableEditor = HasDataEditor.of(table); private TextBox textBox2 = new TextBox(); // this gets refreshed correctly @Path("xyz") final HasTextEditor xyzEditor = HasTextEditor.of(textBox2); Thanks! -- 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.