Re: do you think RangeChange of CellTable should update the History Token ?
Thomas, I tried your suggestion, about using CachedActivityMapper. CachingActivityMapper cached = new CachingActivityMapper(mainActivitiesMapper); ActivityManager mainActivityManager = new ActivityManager(cached, eventBus); However, the Activity is still getting restarted, (i put a log message in start method as well as the constructor, and I can see them, everytime i go to a new page of the result set) my employeeList places are like below: employee/list employee/list/p2 employee/list/p3 p2 = second page of the result set, pageNumber = 2 public class EmployeeListPlace(String name, int pageNumber) my equals/hashcode method, use name and pageNumber. as a result, EmployeeListPlace("list", 1) is different than EmployeeListPlace("list", 2); and they are interpreted differently. Threfore CachingActivityMapper will treat these two places as two distinct places, and start method is called, as i go from .../p2 to .../p3 then what is the benefit of using CachingActivityMapper in this case ? how can CachingActivityMapper treat these two places the same, when they are in fact different ? (different pageNumber field). I replaced equals/hashcode with one that uses only the name, but I could not make a place transition, the token remained the same, and no data was being shown (that celltable loading bar kept showing forever). however, the approach I outlined, 0- user navigates to employee/list 1- ActivityFactory uses EmployeeListActivityProvider to get hold of EmployeeListActivity employeeListActivity = employeeListActivityProvider.get(); //normal provider, NOT SINGLETON 2- ActivityFactory sets the pageNumber field on this EmployeeListActivity, and gives it to a "normal" ActivityMapper employeeList.setPageNumber(employeeListPlace.getPageNumber()); 3- EmployeeListActivity is started, uses pageNumber and Max_Result_Per_Page , to display first page of result set. (setRowData...) 4- when user clicks on Table Pager, onRangeChanged is called on CellTable, and EmployeeListActivity uses this Range to figure out the next placeNumber, and calls placeController.goTo(new EmployeeListPlace("list", nextPage). 5- ActivityMapper will see this as a new Place (how can it not ? different nextPage), finds the ActivityFactory, and back to step 1 EmployeeListActivity gets started over and over again, and it works. what is wrong with this approach ? based on GWT philosophy, Activities are supposed to be throwaways, right ? so is it expensive to start/stop an Activity over and over again ? will there be a performance problem ? and why your suggestion on using CachingActivityMapper did not work ? if I override equal/hashcode to not take pageNumber into account, as user clicks on Pager, we remain in the same place, the history token doesnt change, it would be the same as not integrating celltable with place at all. what I am doing wrong : ( Thank You -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
the code in the previous post, is pseudo code, have to rework it, (range manipulation) for it to actually work (i am working on it at the moment), but it is how ActivityMapper, Place and Activity work together. was wondering what is wrong with this approach ? -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
Thank you Thomas. from your comments: 1- "But this is what CachingActivityMapper does it the Place passed to it equals() the previous one." 2- "Because your Activity instance spans many places, it can listen to PlaceChangeEvent-s and thus be kept inform of the place change without being restarted, and therefore update its data with the page number from the new place." are these two different solutions, or they need to be used together ? 1 AND 2 , or 1 OR 2 ? do I need to use CachingActivityMapper together with listening on PlaceChangeEvents, or need to choose only one of the two? and what happens if when navigating to a different page of result,the Activity just get started/stopped everytime. what is the downside to the Activity being started over and over ? this Activity uses RF to get the Result and populate a CellTable in a view. if we use an ActivityProvider in Singleton scope, this Provider gives us the Activity, and we set PageNumber on the Activity, as a result, the Activity can use this page number, in its RequestFactory.findEmployeeEntries(start, length) and use this page number on CellTable setRowData. What is wrong with this approach ? //our Main ActivityMapper public class MainActivityMapper implements ActivityMapper { Provider listEmployeeActivityProvider; // bound in Singleton scope Activity getActivity(Place place){ if(place instanceof ListEmployeePlace){ ListEmployeePlace listPlace = (ListEmployeePlace) place; ListEmployeeActivity listEmployeeActivity = listEmployeeActivityProvider.get(); listEmployeeActivity.setRangeStart( listPlace.getPageNumber()); return listEmployeeActivity; } } } //ListEmployeeActivity public class ListEmployeeActivity extends AbstractActivity { private int rangeStart; public int getRangeStart() { return rangeStart; } public void setRangeStart(int rangeStart) { this.rangeStart = rangeStart; } // RequestFactory, PlaceController public EmployeeListActivity(EmployeeListView view, PlaceController placeController, RequestFactory requestFactory) rangeChangeHandler = getView().asHasData() .addRangeChangeHandler( new RangeChangeEvent.Handler() { public void onRangeChange(RangeChangeEvent event) { EmployeeListActivity.this.onRangeChanged(getView().asHasData()); } }); //RF,place controller initialization } public void start(final AcceptsOneWidget display, EventBus eventBus){ requestFactory .employeeRequest() .findEmployeeEntries(getRangeStart(), MAX_RESULTS_PER_PAGE) .fire(new Receiver>() { @Override public void onSuccess(List response) { if (view == null) { // This activity is dead return; } getView().asHasData() .setRowData(getRangeStart(), response); if (display != null) { display.setWidget(getView()); } } }); } public void onRangeChanged(HasData listView) { final Range range = listView.getVisibleRange(); placeController.goTo(new EmployeeListPlace(range.getStart())); } -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
On Friday, January 21, 2011 6:59:03 PM UTC+1, zixzigma wrote: > > > > Just that your ActivityMapper would probably return the very same > Activity > > instance, so the activity isn't "re started" as a result of navigation > > between pages. > > please refer to the sample code below [1], which is used to put this > post into context. > > "They would still be distinct Place instances" > yes, therefore as we go from one place to the next, > (going from ListEmployeePlace(4) to ListEmployeePlace(5)) > we are going to a new Place, which results in ActivityMapper > attempting > to find the correct Activity for this place, and the ActivityMapper, > creates a "New" ListEmployeeActivity > every time " return new ListEmployeeActivity(listPage.getPageNumber);" > > here we are returning a "New EmployeeListActivity" everytime. > when a New Activity is returned, the corresponding ActivityManager, > invokes "start" method on it. > which contradicts with "so the activity isn't re started". > > how can the behaviour you described be achieved ? > By returning the same instance as from the previous call to the ActivityMapper. In that case, the ActivityManager won't stop/start the activity. > "Just that your ActivityMapper would probably return the very same > Activity > instance, so the activity isn't "re started" as a result of navigation > between pages." > > by returning the "same activity instance", do we need to use > Provider listEmployeeActivity; > and bind this provider in Singleton scope ? > No. You can just store the last returned activity instance in a field in your ActivityMapper and then decide whether you should return that instance or a new one (which you'd store in the field before returning it). But this is what CachingActivityMapper does it the Place passed to it equals() the previous one. Because your Activity instance spans many places, it can listen to PlaceChangeEvent-s and thus be kept inform of the place change without being restarted, and therefore update its data with the page number from the new place. then what about GWT Activity philosophy that Activities are to be > discarded, that they are not singletons ? > and AbstractActivity's onStop method, would stop the current activity > ListEmployeeActivity(4), > when it is stopped how can it NOT be restarted when in > ListEmployeePlace(5)? > Simply by returning the same instance as from the previous call to your ActivityMapper. > you mentioned activity "isn't re started", > but as a result of going to a new Place, (from ListEmployeePlace(4) to > ListEmployeePlace(5)), > onStop method causes the Activity to stop. > do we need to make the onStop to do nothing, a method with empty > body ? > implementing Activity directly, isntead of extending AbstractActivity? > At the risk of repeating myself, you just have to return the same instance as from the previous call to your ActivityMapper. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
No. Hitting the back button moves a user to a different place and starts a new activity. As I said earlier, these kinds of settings belong to a single place/activity. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
Thank You. does your Table work with Browser back button ? hitting back/forward button taking the user to the correct page of results in the table ? On Jan 21, 9:47 am, Y2i wrote: > > in other words, your client tells the server, give me the "next" page > > of result, > > the client doesnt specifically says, give me page 4, give me page X, > > client just says give me "Next" page, and it is the server that knows > > what this next page would be, > > and returns the result to the client. > > > is this what you are doing ? am I understanding you correctly ? > > I simply used your example with a SimplePager. In the context if the > example this is exactly what I'm doing. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
> It all depends on the UX you're looking for (i.e. should the "back button" > of your browser take you to the previous page?) should the "back" button take us to the previous page ? that's what I was getting at. GWT puts a strong emphasis on UX, and making sure history, browser back button work as user expects. when using Places/Activities, we go to great lengths to make the UX as natural as possible while staying on the same ".html" page. Not integrating CellTable's Pager with Places, simply undermines all our efforts on UX/Back Button/Activity/Places front. isn't the answer obvious always YES ? that the Pager should always result in Place change ? does it make any sense to define all these Activity/Places/ ActivityMappers for our GWT MVP app, only for the table of data to always being shown in the same place, and a sudden click on back button, taking the user not to the previous page of result, but to some place user came from maybe minutes ago, before starting browsing through the results ? -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
> Just that your ActivityMapper would probably return the very same Activity > instance, so the activity isn't "re started" as a result of navigation > between pages. please refer to the sample code below [1], which is used to put this post into context. "They would still be distinct Place instances" yes, therefore as we go from one place to the next, (going from ListEmployeePlace(4) to ListEmployeePlace(5)) we are going to a new Place, which results in ActivityMapper attempting to find the correct Activity for this place, and the ActivityMapper, creates a "New" ListEmployeeActivity every time " return new ListEmployeeActivity(listPage.getPageNumber);" here we are returning a "New EmployeeListActivity" everytime. when a New Activity is returned, the corresponding ActivityManager, invokes "start" method on it. which contradicts with "so the activity isn't re started". how can the behaviour you described be achieved ? "Just that your ActivityMapper would probably return the very same Activity instance, so the activity isn't "re started" as a result of navigation between pages." by returning the "same activity instance", do we need to use Provider listEmployeeActivity; and bind this provider in Singleton scope ? then what about GWT Activity philosophy that Activities are to be discarded, that they are not singletons ? and AbstractActivity's onStop method, would stop the current activity ListEmployeeActivity(4), when it is stopped how can it NOT be restarted when in ListEmployeePlace(5)? you mentioned activity "isn't re started", but as a result of going to a new Place, (from ListEmployeePlace(4) to ListEmployeePlace(5)), onStop method causes the Activity to stop. do we need to make the onStop to do nothing, a method with empty body ? implementing Activity directly, isntead of extending AbstractActivity? Thank You [1] sample code //List Employee Place public class ListEmployeePlace extends Place { int pageNumber; public ListEmployeePlace(int pageNumber){ this.pageNumber = pageNumber; } int getPageNumber(){return this.pageNumber;} } //our Main ActivityMapper public class MainActivityMapper implements ActivityMapper { Activity getActivity(Place place){ if(place instanceof ListEmployeePlace){ ListEmployeePlace listPlace = (ListEmployeePlace) place; return new ListEmployeeActivity(listPage.getPageNumber()); } } } -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
> > > in other words, your client tells the server, give me the "next" page > of result, > the client doesnt specifically says, give me page 4, give me page X, > client just says give me "Next" page, and it is the server that knows > what this next page would be, > and returns the result to the client. > > is this what you are doing ? am I understanding you correctly ? > > I simply used your example with a SimplePager. In the context if the example this is exactly what I'm doing. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
Y2i, by storing the range on the server, you make the server responsible for knowing at what page of result you currently are, instead of putting the responsibility on the client ? in other words, your client tells the server, give me the "next" page of result, the client doesnt specifically says, give me page 4, give me page X, client just says give me "Next" page, and it is the server that knows what this next page would be, and returns the result to the client. is this what you are doing ? am I understanding you correctly ? On Jan 21, 8:06 am, Y2i wrote: > *when we click "next" on SimplePager, the range changes, and > **table is updated with new data* > > I would store this range (start + length) on the server. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
*when we click "next" on SimplePager, the range changes, and **table is updated with new data* I would store this range (start + length) on the server. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
On Friday, January 21, 2011 1:47:19 AM UTC+1, zixzigma wrote: > > could you please explain what is the criteria for data to be "highly > dynamic" ? > > and in case of GWT, the entire app is one page, and we have the > concept of places. > and we don't have to forward to a new place, we can have a place that > also support paging. > > for example, > > employees/p1 > employee/p2 > > p1, displays the first page of result set, p2 the second page, and so > on. > as user clicks on Pager forward/previous buttons, the History token > also changes, > it is not actually another page, p1 and p2 and pN, are used like query > parameters, > that activities can use to know the start position. > They would still be distinct Place instances (oh you could probably hack around to make it work without changing the current place, but I bet you'd have more trouble than just using distinct Place instances). Just that your ActivityMapper would probably return the very same Activity instance, so the activity isn't "re started" as a result of navigation between pages. if you look at Gmail, when you want to see "Older" emails, (seeing the > next page of result), > the history token changes. I understand gmail is not built using GWT, > but just demontrating the idea. It all depends on the UX you're looking for (i.e. should the "back button" of your browser take you to the previous page?) -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
Hello Y2i, what kind of configuration are you talking about ? could you please be a bit more specific ? Thank You On Jan 20, 1:57 pm, Y2i wrote: > Personally I store all configuration related to one place/activity on the > server. -- 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.
Re: do you think RangeChange of CellTable should update the History Token ?
could you please explain what is the criteria for data to be "highly dynamic" ? and in case of GWT, the entire app is one page, and we have the concept of places. and we don't have to forward to a new place, we can have a place that also support paging. for example, employees/p1 employee/p2 p1, displays the first page of result set, p2 the second page, and so on. as user clicks on Pager forward/previous buttons, the History token also changes, it is not actually another page, p1 and p2 and pN, are used like query parameters, that activities can use to know the start position. if you look at Gmail, when you want to see "Older" emails, (seeing the next page of result), the history token changes. I understand gmail is not built using GWT, but just demontrating the idea. could you please clarify what you mean by Highly Dynamic data ? Thank You On Jan 20, 2:25 pm, John LaBanca wrote: > I think it depends on the nature of the data. If the data is highly > dynamic, then forwarding somebody to a specific page isn't going to have > much value because the data on the page is likely to change. However, if > the data is relatively stable, then forwarding the user to a specific page > might be helpful. > > Thanks, > John LaBanca > jlaba...@google.com > > On Thu, Jan 20, 2011 at 4:57 PM, Y2i wrote: > > Personally I store all configuration related to one place/activity on the > > server. > > > -- > > 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.
Re: do you think RangeChange of CellTable should update the History Token ?
I think it depends on the nature of the data. If the data is highly dynamic, then forwarding somebody to a specific page isn't going to have much value because the data on the page is likely to change. However, if the data is relatively stable, then forwarding the user to a specific page might be helpful. Thanks, John LaBanca jlaba...@google.com On Thu, Jan 20, 2011 at 4:57 PM, Y2i wrote: > Personally I store all configuration related to one place/activity on the > server. > > -- > 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.
Re: do you think RangeChange of CellTable should update the History Token ?
Personally I store all configuration related to one place/activity on the server. -- 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.
do you think RangeChange of CellTable should update the History Token ?
Lets say we are displaying data using CellTable. We also use SimplePager for paging. when we click "next" on SimplePager, the range changes, and table is updated with new data. it is all good. however we are still in the same place(history token remains the same). in your experience, do you integrate CellTable Pager with Places in your app ? so that as a result of going to second, third, nTH page of result, history token changes to reflect this, and as user clicks back button, goes to previous/next page of result ? -- 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.