Search code examples
gwtp

in GWTP, when creating a new presenter, we set a NameTokens for it with a Hash Bang(!) but the code did not show Hash Bang, so where the hash bang?


Ok, in GWTP (GWT Platform, not Gwt), when creating a new presenter in eclipse, there will be a field "Token name:" for us to set a name token. So, I added a Hash Bang at the Front of the NameToken

abc.client.place.NameTokens#!myname

& the eclipse created the java file that has

@NameToken(NameTokens.myname)

So where is the Hash Bang located (!)?

Also, suppose that when we first time create a new Presenter & we forgot to put Hash Bang in the front of the NameToken, then how can we include the Hash Bang without recreating the new Presenter?


Solution

  • Normally, your name tokens should be found as constant Strings in a com.yourproject.client.place.NameTokens class:

    package com.yourproject.client.place;
    
    public class NameTokens {
        public static final String home = "home";
        public static final String myname = "myname";
    }
    

    If you want to add the exclamation mark between the hash symbol and a name token, simply add it to the String:

    package com.yourproject.client.place;
    
    public class NameTokens {
        public static final String home = "home";
        public static final String myname = "!myname";
    }