Hi, On Thu, Jul 7, 2011 at 2:19 AM, Jonathan Barker <[email protected] > wrote:
> Dragan, > > Nice work. I look forward to inclusion in the core. > I'm glad you like it > > I'm not sure if this will help in your grid enhancements, or just muddy the > waters, but.... > > a) Do you always want the grids to be bookmarkable, or only on demand? > Looking at Google Maps, for example, the basic map page is not > bookmarkable, but there is a Link option that includes all of the location > and scaling information to allow you to email someone a link to generate > what you are looking at. > On demand off course. For me the best usage scenario is by just dropping a mixin to the grid (or grids) in your page. You could even go with an implementation mixin and a new grid component extending the current grid and use the component every time you want the functionality, and that's a standard tapestry5 feature, no extra work here. > > b) The grid is a specific component, but in general, you are trying to > capture page state. For things like entity ids, we use activation context. > But let's say we have an expandable tree, or a page with multiple sections > with adjustable borders, or a grid. Could there be a general-purpose > strategy for handling cases like this, so a grid, or tree, or whatever can > "plug in" to this standard method of capturing a page's display state? > Exactly, the way I was thinking about this problem, but for now I cannot figure out if it can be done good enough.There are events in the page that allow decorating page render links and component event links, but a general solution would mean advice for generating the event handlers on every page and that's just a way I think its too expensive. Ideally you could apply a mixin to a component stating that some of the component's parameters should just persist in the URL and thats it. IMO that sould cover most of the cases and its pretty good solution. You can do it manually in the page off course with @ActivationRequestParameter variable that you pass as a parameter in the component. But that is a specific implementation not a general one. Thanks for the ideas, please drop in a few more whenever you like, they are welcomed. > > Regards, > > Jonathan > > Cheers, Dragan Sahpaski > > > > > 2. Grid Enhancements - Making pagination and Sorting Bookmarkable (see > > demo<http://dragansah.com/contextmenu/dropdownmenuexamples> > > page) > > - This is achieved by modifying the existing > > GridColumns< > > > http://code.google.com/a/apache-extras.org/p/right-click-menu-gsoc2011/source/browse/trunk/contextmenu/src/main/java/org/apache/tapestry5/contextmenu/components/GridColumns.java > > >and > > GridPager< > > > http://code.google.com/a/apache-extras.org/p/right-click-menu-gsoc2011/source/browse/trunk/contextmenu/src/main/java/org/apache/tapestry5/contextmenu/components/GridPager.java > > > > > (see > > line 141) components with just a few lines of code, combined with mixins > > for > > the actual URL manipulation (bookmarking). > > - The main issue why I had to modify GridPager and GridColumns is because > > they don't keep (off course) the URL parameters (request parameters) for > > the > > links for the sort columns (in GridColumns) and for the links in the page > > numbers (in Grid Pager). The added LOC are just to keep those parameters > > for > > their action and sort events. This approach obviously needs rethinking. > One > > solution I could think of is decorating the links but this happens in > pages > > not components, so I would have to add advice to all pages (tried that > also > > and it worked), but it seems like just too much overhead. > > > > - Another idea is to just make a redirect on setupRender on the grid's > > mixins to put the parameters in the url. This is the simplest solution > and > > it would also work if the grid is sorted in code (not by clicking the > > columns), but a redirect is another request. IDK if this can lead to > usage > > problems. Advice please :) > > > > - So. All Work is done in the 2 mixins > > ColumnsSort.java< > > > http://code.google.com/a/apache-extras.org/p/right-click-menu-gsoc2011/source/browse/trunk/contextmenu/src/main/java/org/apache/tapestry5/contextmenu/mixins/ColumnsSort.java > > > > > (for > > Grid Columns) and > > CurrentPageURL.java< > > > http://code.google.com/a/apache-extras.org/p/right-click-menu-gsoc2011/source/browse/trunk/contextmenu/src/main/java/org/apache/tapestry5/contextmenu/mixins/CurrentPageURL.java > > > > > (for > > GridPager) that catch the sort and action events and add parameters and > > also > > read parameters from the Request to adjust column sorting and pagination. > I > > supose this is quite ok. But the main issue remains. > > "How to keep the request parameters for the links produced by GridPager > and > > GridColumns?" > > > > > > -- > Jonathan Barker > ITStrategic >
