Place Parameters

50 views
Skip to first unread message

Craig Greenhalgh

unread,
Jul 15, 2011, 6:40:47 AM7/15/11
to Google Web Toolkit
Hi,

Whats the best way to pass parameters from one place/activity to another
place/activity ?

I have a simple list place and would like to link into a view place

Many thanks

Craig

Jens

unread,
Jul 15, 2011, 6:50:21 AM7/15/11
to google-we...@googlegroups.com, Google Web Toolkit
In your ListActivity just call placeController.goTo(new DetailPlace(<parameters>)) when an item is selected in the list. The ListActivity define the parameter values and the DetailActivity uses them.

Is that what you mean?

-- J.

Craig Greenhalgh

unread,
Jul 15, 2011, 10:37:49 AM7/15/11
to google-we...@googlegroups.com
I've got the link working and add parameters to my place. I use gin so
I have placeProviders:

TypeViewPlace viewPlace = typeViewPlaceProvider.get();
viewPlace.setId(type.getId());

placeController.goTo(viewPlace);

How in my ViewActivity to I get these parameters back in then load the
data ?

Many thanks for your help

Craig

> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/8FvpgiLzYPAJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Jens

unread,
Jul 15, 2011, 11:14:34 AM7/15/11
to google-we...@googlegroups.com
In your ActivityMapper's getActivity(Place place) method you have to set the Place into your activity before returning it. I also use GIN so I have ActivityProviders in my ActivityMapper. All my activities extend a custom super class that provides a setPlace(Place place) method and a typically code snippet in my ActivityMapper looks like:

if(place instanceof MyPlace) {
  MyActivity activity = this.myActivityProvider.get();
  activity.setPlace((MyPlace) place);
  return activity;
}

In the activity itself I just copy the place data into variables of the activity (so just this.parameter = place.getParamter()). As setPlace() is always called before the activitie's start method I have all information I need to actually start the activity.

-- J.

Craig Greenhalgh

unread,
Jul 26, 2011, 5:52:03 AM7/26/11
to google-we...@googlegroups.com
Hi this now works fine on the from list > view page and all is expected
in the browser url

How do I go about getting the bck and fwd buttons working, or manually
altering the url to serve the correct page ?

Currently in my Activity Mapper I set the "id" for the activity based on
the incoming place request. When I use bck / fwd / manually alter this
is always "null"

Any ideas?

Many thanks

Craig

> --
> You received this message because you are subscribed to the Google
> Groups "Google Web Toolkit" group.
> To view this discussion on the web visit

> https://groups.google.com/d/msg/google-web-toolkit/-/q1q_Pb_zM-0J.

Reply all
Reply to author
Forward
0 new messages