So I tried working out a small prototype:-
1>. The main app has 3 views with corresponding activity and place. The main app also has an activity mapper which handles View 1 and View 2.
Here is the activitymapper
if (place instanceof MainTwoPlace)
{
return new MainTwoActivity(clientFactory);
} else if (place instanceof MainThreePlace) {
return null; // this should be handled in the sub-activitymapper - hence return null and do nothing
}
return new MainOneActivity(clientFactory); // if place doesn't match, just drop down to main page
{
return new MainTwoActivity(clientFactory);
} else if (place instanceof MainThreePlace) {
return null; // this should be handled in the sub-activitymapper - hence return null and do nothing
}
return new MainOneActivity(clientFactory); // if place doesn't match, just drop down to main page
2>. View 3 has has 3 sub-views with corresponding activity and place. View 3 has a sub-activity mapper which handles sub-view1, sub-view2 and sub-view 3.
HEre is the sub-activity mapper
if (place instanceof MainThreePlace) {
String token = ((MainThreePlace) place).getName();
if ((token.equals("SubOnePlace")) || (token.equals("MainThreePlace"))) {
return new MainThreeSubOneActivity(mainClientFactory);
} else if (token.equals("SubTwoPlace")) {
return new MainThreeSubOneActivity(mainClientFactory);
} else if (token.equals("SubThreePlace")) {
return new MainThreeSubOneActivity(mainClientFactory);
} else {
return new MainThreeActivity(mainClientFactory);
}
}else {
return null;
}
Now Switching to place/view 1 and 2 ( in main app ) works fine.String token = ((MainThreePlace) place).getName();
if ((token.equals("SubOnePlace")) || (token.equals("MainThreePlace"))) {
return new MainThreeSubOneActivity(mainClientFactory);
} else if (token.equals("SubTwoPlace")) {
return new MainThreeSubOneActivity(mainClientFactory);
} else if (token.equals("SubThreePlace")) {
return new MainThreeSubOneActivity(mainClientFactory);
} else {
return new MainThreeActivity(mainClientFactory);
}
}else {
return null;
}
However switching to place 3 - the application goes into a crazy loop in the getplace / gettoken loop.
What I am confused about - switching to 3 should launch the default/sub-view 1 - but this seems not to work.
Could you please help me figure out where I am going wrong? The compressed folder of the entire sources is attached here
On Thursday, August 1, 2013 6:16:38 PM UTC-4, Thomas Broyer wrote:
The behavior when called from onModuleLoad is unexpected; but calling PlaceController#goTo in onModuleLoad is also unexpected: 99.9% of the cases, you'll want to call PlaceHistoryHandler#--handleCurrentHistory, and possibly set new RootPlace("ChartTest") as the default place when initializing the PlaceHistoryHandler. There are probably legitimate use cases for calling goTo from onModuleLoad, so if you believe you're in this case, feel free to open an issue in the tracker (don't forget to precise the browser(s) it happens in, and the version of GWT being used).
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment