You shouldn't have several PlaceHistoryHandler: there's only one *history*, 
so there should be only one thing handling and managing it.

That said, I've heard people using nested activities, but it's not been 
designed with the use case in mind; 
see http://blog.ltgt.net/gwt-21-activities-nesting-yagni
If you think you really need nesting, then hae a look at GWT-P.

Last thing, I don't understand why you have MainThreePlace subclasses 
rather than just using its "name" property (e.g. new 
MainThreePlace("SubOnePlace"))

On Saturday, August 3, 2013 8:00:17 AM UTC+2, asif...@gmail.com wrote:
>
>
> <https://lh5.googleusercontent.com/-RSNSAkKbGAk/UfycL4-RLAI/AAAAAAAAARM/mMuPIY5ScZo/s1600/ActMap-2.jpg>
>
> I made some minor changes in the code - the main activity mapper looks 
> like this
>
>         if (place instanceof MainTwoPlace)
>         {
>             return new MainTwoActivity(clientFactory);
>         } else if (place instanceof MainThreePlace) {
>             return new MainThreeActivity(clientFactory); // 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
>
> However, the View 3 now crashes with 
> *
> Caused by: com.google.gwt.core.client.JavaScriptException: 
> (HierarchyRequestError): Node cannot be inserted at the specified point in 
> the hierarchy*
>
> on line ->         panel.setWidget(mainThreeDefaultView); in 
> MainThreeActivity Line 31;
>
> Another picture of my View 3:-
>
>
>
>
> Now my eventbus, placecontroller and historymapper code in View 3 is as 
> follows:-
>
> EventBus eventBus = mainClientFactory.getEventbus();
>         
>         placeController = mainClientFactory.getPlacecontroller();
>         
>
>         subActivityMapper = new SubActivityMapper(mainClientFactory);
>         subActivityManager = new ActivityManager(subActivityMapper, 
> eventBus);
>         //subActivityManager.setDisplay(singleWidgetPanel);
>         subActivityManager.setDisplay(contentPanel);
>         
>         subPlaceHistoryHandler = new 
> PlaceHistoryHandler(mainClientFactory.getMainhistoryMapper());
>         subPlaceHistoryHandler.register(placeController, eventBus, new 
> MainThreeSubOnePlace());
>
>
> The latest source code is attached here. The previous one can be ignored.
>
> Any idea where I am going wrong? I know it is in the MainThreeView and the 
> activitymapper somewhere - but a help/hint would be really appreciated.
>
> Thanks
>
> On Friday, August 2, 2013 11:58:09 PM UTC-4, asif...@gmail.com wrote:
>>
>>
>> <https://lh6.googleusercontent.com/-TadxaD9PEvE/Ufx6cxpGibI/AAAAAAAAAQw/MBD-HZMCVA4/s1600/ActMap.jpg>
>> Hi Thomas,
>>
>> 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
>>
>>
>> 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.
>>
>> 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+unsubscr...@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.


Reply via email to