开发者

GWT MVP pattern - change different parts of page on an event

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 pan开发者_运维知识库el (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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜