1

I am creating a GWT application using MVP pattern. I have an index page which uses DockLayoutPanel. I have view and presenter for each section of dockLayoutPanel (ex: NorthView and NorthPresenter). I have four buttons in the center panel (NorthBtn, EastBtn, WestBtn, SouthBtn). onClick of any one of the buttons the UI should change in respective section of dockLayoutPanel.

Entry Point Class:

@Override
public void onModuleLoad() {
    RPCServiceAsync rpcService = GWT.create(RPCService.class);
    HandlerManager eventBus = new HandlerManager(null);
    AppController appViewer = new AppController(rpcService, eventBus);

    appViewer.go(RootLayoutPanel.get());
}

AppController class has the logic for History management and event handling logic. (From Google article - To handle logic that is not specific to any presenter and instead resides at the application layer, we'll introduce the AppController component.)

For example, onClick of a EastBtn in center panel I add a new history token, "east", and onValueChange() method is called. The respective presenter and view is created, say EastView and EastPresenter:

  1. How can I update the existing EastPanel with the newly created panel (as I dont have handle to the old Panel)?
  2. If the user has bookmarked the page after the button click and re-visits the page with bookmarked link, the flow would reach onValueChange method and create EastView and EastPanel. But, how can the rest of the page be re-created and EastPanel be updated?
Mithun
  • 7,747
  • 6
  • 52
  • 68

1 Answers1

4

I would use a place and a goTO in the place controller.

Take a look at this example: http://95.110.143.4/layoutmvp/layoutmvp.html

Here is the code: http://95.110.143.4/layoutmvp/layoutmvp.tar.gz

Pablo Castilla
  • 2,723
  • 2
  • 28
  • 33