Saturday, August 27, 2011

Another strange problem

The AppController in the second MVP example looks like this.

public AppController(ContactsServiceAsync rpcService, HandlerManager eventBus) {
    this.eventBus = eventBus;
    this.rpcService = rpcService;
    bind();
}
  
private void bind() {
    History.addValueChangeHandler(this);

    eventBus.addHandler(AddContactEvent.TYPE,
        new AddContactEventHandler() {
          public void onAddContact(AddContactEvent event) {
            doAddNewContact();
          }
        });  
   ...  // The rest of bind( ) is here.

}

I didn't understand why bind( ) was a separate function rather than part of the AppController constructor -- other than coding style issues. So I commented out these lines:

//      bind();
//  }
  
//  private void   bind() {


In other words, I in-lined bind(). When I tried to run it, I got a 404 page not found error. But when I put the lines back it, it ran fine. Why should that be?

-- Russ

P.S. It doesn't really run fine. The original version of Contacts used a FlexTable. That was ok. This version uses HTML instead. It doesn't come out very well.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment