Here's an example from "GWT Development with Activities and Places" tutorial
(
http://code.google.com/webtoolkit/doc/latest/DevGuideMvpActivitiesAndPlaces.html
)

public class HelloPlace extends Place {

    private String helloName;

    public HelloPlace(String token) {

        this.helloName = token;
    }

    public String getHelloName() {

        return helloName;
    }

    public static class Tokenizer implements PlaceTokenizer<HelloPlace> {

        @Override
        public String getToken(HelloPlace place) {

            return place.getHelloName();
        }

        @Override
        public HelloPlace getPlace(String token) {

            return new HelloPlace(token);

        }
    }
}

As you correctly guessed, in the constructor you call the "get..." method
and stores it in an attribute, just like you did with the clientFactory.
Then you can check if this attribute is not null in the start method and
call the appropriated method of the view.

Alisson Prestes
www.google.com/profiles/javalisson



On Thu, Oct 6, 2011 at 3:00 PM, Mike Dee <mdichiapp...@gmail.com> wrote:

> FooActivity.start() looks like this.  Note that while it can get
> FooView from the clientfactory, it has no notion of FooPlace, which is
> where the argument (fooid) is stored.
>
> @Override
> public void start( AcceptsOneWidget containerWidget, EventBus
> eventBus )
> {
>  FooView view = clientFactory.getFooView();
>  view.setPresenter( this );
>  containerWidget.setWidget( view.asWidget() );
> }
>
> I guess the call to view.setName() could be made in FooActivity's
> constructor, where a FooPlace is passed in.
>
> public FooActivity( FooPlace place, ClientFactory clientFactory )
> {
>  this.clientFactory = clientFactory;
> }
>
> But I don't know how to get the argument (token) out of FooPlace.
>
>
> On Oct 6, 10:51 am, Alisson Prestes <javalis...@gmail.com> wrote:
> > Yes, I think this will work.
> >
> > Alisson Presteswww.google.com/profiles/javalisson
> >
> >
> >
> >
> >
> >
> >
> > On Thu, Oct 6, 2011 at 2:48 PM, Mike Dee <mdichiapp...@gmail.com> wrote:
> > > Would the call to set the arg in the view go in FooActivity.start()?
> >
> > > On Oct 6, 10:46 am, Mike Dee <mdichiapp...@gmail.com> wrote:
> > > > So, should I put code in FooActivity?  I am not sure if the
> > > > boilerplate code generated by the activity should have done that or
> > > > not.
> >
> > > > On Oct 6, 10:44 am, Alisson Prestes <javalis...@gmail.com> wrote:
> >
> > > > > The FooActivity extracts the arguments from the FooPlace. Then it
> calls
> > > the
> > > > > right method in the FooView. Place and View do not interact with
> each
> > > other
> > > > > directly.
> >
> > > > > Alisson Presteswww.google.com/profiles/javalisson
> >
> > > > > On Thu, Oct 6, 2011 at 2:17 PM, Mike Dee <mdichiapp...@gmail.com>
> > > wrote:
> > > > > > I'm using Activities and Place and can't figure this out.  I've
> been
> > > > > > looking at samples but don't see it in there. I think I'm missing
> > > > > > something.
> >
> > > > > > I have a button in one place that, when clicked, will trigger a
> new
> > > > > > activity and place (along with a new view).  The code for that
> button
> > > > > > simply looks like this:
> >
> > > > > > listener.goTo( new FooPlace( fooid ) );
> >
> > > > > > The above code is in the button handler of BarViewImpl (view
> > > > > > implementation for a separate place/activity).
> >
> > > > > > This above line works in that it goes to FooPlace and the URL
> shows
> > > > > > the parameter (123456):
> >
> > > > > > MyApp.html?gwt.codesvr=127.0.0.1:9997#FooPlace:123456
> >
> > > > > > But fooid doesn't make it to FooView.  How does the FooPlace or
> > > > > > FooActivity pass the fooid to FooView?
> >
> > > > > > --
> > > > > > 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+unsubscr...@googlegroups.com.
> > > > > > For more options, visit this group at
> > > > > >http://groups.google.com/group/google-web-toolkit?hl=en.
> >
> > > --
> > > 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+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> 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+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to