Here's Tapestry's implementation of GridDataSource for Collections:
https://github.com/apache/tapestry-5/blob/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java

That implementation works with any class, but you can write a special one
that works with just Material instances. In your implementation of the prepare
method<https://github.com/apache/tapestry-5/blob/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/grid/CollectionGridDataSource.java#L44>,
you can do whatever special sorting you want to do, based on your Material
instance and anything else you'd like to consult. You can also create a new
one-off class just for the rows of your Grid--a class that wraps a
Material, ValorAtributo, and Atributo tuple, for example. You'll probably
need to create a complex Comparator that wraps the one based on the
PropertyConduits associated with incoming SortConstraints--it depends on
whether you want to augment the existing sorts that available or replace
them completely. If you do need a complex ordering, Google's Guava library
has an Ordering class as well as ComparisonChain both of which are
well-suited for rich Comparators.

Best of luck,
- P

On Fri, Aug 10, 2012 at 1:14 PM, William Lopes
<williamlopes....@gmail.com>wrote:

> I didn't want say that "implement a Grid", sorry.
>
> I need of an example functional, the data comes from a list of
> ValorAtributo (a type of data) of the class Material, this last, is the
> source of the grid.
>
> Basically, I have 3 classes, Material (makes the link of the Atributo and
> ValorAtributo), Atributo (type of data dynamic), ValorAtributo (value of
> the type data previous), the my grid is formed by list of Material, where
> have a list of ValorAtributo. And with this list of ValorAtributo, is
> possible check if you wanna that appear in the grid. So, I need implement
> manually a way of sort for it.
>
> I still very newbie with tapestry, cause this I would like of example more
> explicit.
>
> Can you undestand me?
>
> 2012/8/9 Thiago H de Paula Figueiredo <thiag...@gmail.com>
>
> > On Thu, 09 Aug 2012 19:59:45 -0300, William Lopes <
> > williamlopes....@gmail.com> wrote:
> >
> >  Yes, I want do sort by myself, could you give a example of
> GridDataSource
> >> implementing a Grid?
> >>
> >
> > You don't implement a Grid: it's a component. You can implement
> > GridDataSource, which is an interface.
> > How to implement it depends on where the data comes from: a collection
> > created in memory? Data from a database? All you need to know is in the
> > JavaDoc of the interface anyway. :) Any doubts, just ask. ;)
> >
> >
> > --
> > Thiago H. de Paula Figueiredo
> >
> > ------------------------------**------------------------------**---------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.**apache.org<
> users-unsubscr...@tapestry.apache.org>
> > For additional commands, e-mail: users-h...@tapestry.apache.org
> >
> >
>

Reply via email to