LDSTechForumProjects

Beyond MVP Lab 2

Use GWT History to link the contacts name to the ViewContactPresenter

  1. Checkout the following as a maven project (or switch to tag): https://gibb.myversioncontrol.com/subversion/mvp_contacts/tags/1.4.history-lab/ (user/pass: training/training)
  2. You will
    1. Add view token handling to AppController
    2. View a contact when name is clicked
    3. Get contact id from history token in ViewContactPresenter
    4. All this will be done in the contacts-web project

Add view token handling to AppController

  1. Open AppController.java
  2. In onValueChange method add support for the "view" history token. Hint: use startsWith in if statement
  3. To load the presenter use
injector.getViewContactPresenter().go(display.getMainContainer());

View a contact when name is clicked

  1. Open ContactsPresenter.java
  2. Change onViewClicked
    1. remove Window... call
    2. Add a History.newItem call
      1. What should be the parameter to newItem? The contact Id must be passed with it?
      2. What else could we have done here?

Get contact id from history token in ViewContactPresenter

  1. Open ViewContactPresenter.java
  2. Update the go() method to get the contact id from the history token.
    1. If you need help see EditContactPresenter.go()

Run the project

  1. Add contacts-web to LDS Tech Server under Servers tab
  2. Run the server
  3. Create a new web application run configuration
  4. Under the Server tab, uncheck "Run built-in server"
  5. Under the GWT tab, enter "/contacts" in URL
  6. This should be the URL http://localhost:8080/contacts/?gwt.codesvr=127.0.0.1:9997
  7. Ignore any errors about EditPresenterTest.java
This page was last modified on 10 June 2010, at 09:27.

Note: Content found in this wiki may not always reflect official Church information. See Terms of Use.