I have main widget which implements Editor for such entity as User. UserWidget contains field Address, which is different entity with it's own widget. Both widget's made with UIBinder. Widget for address made as dialogbox. How can I get data from Address Widget dialogbox textboxes when I'm calling driver.flush() in main widget?

有帮助吗?

解决方案

You question is somewhat pale on details. Such as do you show the address in the main widget. Which seems logic as you have the address field (why else do you need the address field?), but then again you call flush() in the main to get the changed address from the dialog, which suggests the (new) address is not shown in the main widget when you close the address dialog there would still be the old address in the main widget, as didn't mention if you do some kind of updating.

So based on the information you could make the Address Widget also make an Editor widget and in the UserWidget for the field address use the Address Widget to set and get the values for address in the User object. That way when you call flush() you automatically get the results from the Address Widget.

其他提示

You should use event to... propagate events through the application. Coupled with dependency injection it makes a very good solution to those kind of problems.

How to use the GWT EventBus

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top