wtproject.org/articles/mvp-architecture.html'>basic MVP pattern, add a {@link HasSelectHandlers} or {@link HasDialogHideHandlers} method to the view's displayinterface defined by the presenter:
public interface Display extends IsWidget { HasSelectHandlers getYesButton(); HasDialogHideHandlers getDialog(); }
Add an implementation of the method(s) to the view:
{@literal @}Override public HasSelectHandlers getYesButton() { return dialog.getButton(PredefinedButton.YES); } {@literal @}Override public HasDialogHideHandlers getDialog() { return dialog; }
And add a handler for the method(s) to the presenter:
display.getYesButton().addSelectHandler(new SelectHandler() { {@literal @}Override public void onSelect(SelectEvent event) { // Take action when user hides dialog by clicking on YES button } }); display.getDialog().addDialogHideHandler(new DialogHideHandler() { {@literal @}Override public void onDialogHide(DialogHideEvent event) { // Invoke event.getHideButton() and take action based on value of returned enum } });
Note: this example illustrates using both a select handler and a dialog hide handler; you can use either approach.