Voila https://issues.apache.org/jira/browse/WICKET-5920
On Tue, Jun 9, 2015 at 3:53 AM, Ernesto Reinaldo Barreiro < [email protected]> wrote: > Hi, > > On Mon, Jun 8, 2015 at 10:12 PM, Martin Grigorov <[email protected]> > wrote: > >> Hi, >> >> Yes... Being in different modules is a problem. >> I think Ernesto's class could be simpler by extending from >> ListDataProvider >> and implementing ISortableDataProvider. >> > > It is just a copy paste of two exiting classes... I think every time I do > it it is a different class :-) > > >> >> One approach would be to copy the ISort** interfaces from -extensions to >> -core in 7.x. But I'm not sure it is worth the trouble. >> If we decide to go that route then I'd suggest to copy the interfaces to >> -core and keep the originals in -extensions as empty interfaces extending >> the ones from -core, and mark as deprecated. >> > > I remember very old discussions about moving some of the (now classical) > repeaters to core: maybe from the time where Eelco and Igor were very > active commiters. Any solution would be fine for me as long as I do not > have to keep adding the same class over and over :-) > > >> This way the apps coming from 6.x should do nothing to migrate. >> >> Martin Grigorov >> Wicket Training and Consulting >> https://twitter.com/mtgrigorov >> >> On Mon, Jun 8, 2015 at 12:47 PM, Ernesto Reinaldo Barreiro < >> [email protected]> wrote: >> >> > Ok. >> > >> > On Mon, Jun 8, 2015 at 10:58 AM, Sven Meier <[email protected]> wrote: >> > >> > > Mh, ListDataProvider is in wicket-core, but (I)SortableDataProvider >> is in >> > > wicket-extensions. >> > > So my suggestion doesn't work :/. >> > > >> > > Please open a Jira issue, we'll see what the other devs think about an >> > > additional convenience class. >> > > >> > > Regards >> > > Sven >> > > >> > > >> > > On 08.06.2015 10:36, Ernesto Reinaldo Barreiro wrote: >> > > >> > >> Sven, >> > >> >> > >> On Mon, Jun 8, 2015 at 10:07 AM, Sven Meier <[email protected]> wrote: >> > >> >> > >> Hi, >> > >>> >> > >>> my only objection would be that this SortableListDataProvider >> doesn't >> > >>> actually sort anything. >> > >>> >> > >>> AFAIK this does no harm though, so why not let the current >> > >>> ListDataProvider implement ISortableDataProvider? >> > >>> >> > >>> That's also posible. All I want is not having to roll out my own >> over >> > an >> > >> over... :-) >> > >> >> > >> >> > >> Have fun >> > >>> Sven >> > >>> >> > >>> >> > >>> >> > >>> On 08.06.2015 08:50, Ernesto Reinaldo Barreiro wrote: >> > >>> >> > >>> On many project I just need to show a list of beans on an AJAX >> default >> > >>>> datatable... There is already a ListDataProvider... but this >> component >> > >>>> require a Sortable version... and I always end up rolling out >> > something >> > >>>> like the class bellow. Would it make sense to include a similar >> class >> > on >> > >>>> wicket code base? >> > >>>> >> > >>>> /** >> > >>>> * Sortable version of ListDataProvider. >> > >>>> >> > >>>> */ >> > >>>> >> > >>>> public class SortableListDataProvider<T extends Serializable, S> >> > >>>> extends SortableDataProvider<T, S> { >> > >>>> >> > >>>> private static final long serialVersionUID = 1L; >> > >>>> >> > >>>> /** reference to the list used as dataprovider for the >> dataview >> > */ >> > >>>> private final List<T> list; >> > >>>> >> > >>>> /** >> > >>>> * Constructs an empty provider. Useful for lazy loading >> > together >> > >>>> with {@linkplain #getData()} >> > >>>> */ >> > >>>> public SortableListDataProvider() >> > >>>> { >> > >>>> this(Collections.<T> emptyList()); >> > >>>> } >> > >>>> >> > >>>> /** >> > >>>> * >> > >>>> * @param list >> > >>>> * the list used as dataprovider for the dataview >> > >>>> */ >> > >>>> public SortableListDataProvider(List<T> list) >> > >>>> { >> > >>>> if (list == null) >> > >>>> { >> > >>>> throw new IllegalArgumentException("argument [list] >> > cannot >> > >>>> be null"); >> > >>>> } >> > >>>> >> > >>>> this.list = list; >> > >>>> } >> > >>>> >> > >>>> /** >> > >>>> * Subclass to lazy load the list >> > >>>> * >> > >>>> * @return The list >> > >>>> */ >> > >>>> protected List<T> getData() >> > >>>> { >> > >>>> return list; >> > >>>> } >> > >>>> >> > >>>> @Override >> > >>>> public Iterator<? extends T> iterator(final long first, final >> > long >> > >>>> count) >> > >>>> { >> > >>>> List<T> list = getData(); >> > >>>> >> > >>>> long toIndex = first + count; >> > >>>> if (toIndex > list.size()) >> > >>>> { >> > >>>> toIndex = list.size(); >> > >>>> } >> > >>>> return list.subList((int)first, >> > (int)toIndex).listIterator(); >> > >>>> } >> > >>>> >> > >>>> /** >> > >>>> * @see IDataProvider#size() >> > >>>> */ >> > >>>> @Override >> > >>>> public long size() >> > >>>> { >> > >>>> return getData().size(); >> > >>>> } >> > >>>> >> > >>>> /** >> > >>>> * @see IDataProvider#model(Object) >> > >>>> */ >> > >>>> @Override >> > >>>> public IModel<T> model(T object) >> > >>>> { >> > >>>> return new Model<T>(object); >> > >>>> } >> > >>>> >> > >>>> /** >> > >>>> * @see org.apache.wicket.model.IDetachable#detach() >> > >>>> */ >> > >>>> @Override >> > >>>> public void detach() >> > >>>> { >> > >>>> } >> > >>>> } >> > >>>> >> > >>>> >> > >>>> >> --------------------------------------------------------------------- >> > >>> To unsubscribe, e-mail: [email protected] >> > >>> For additional commands, e-mail: [email protected] >> > >>> >> > >>> >> > >>> >> > >> >> > > >> > > --------------------------------------------------------------------- >> > > To unsubscribe, e-mail: [email protected] >> > > For additional commands, e-mail: [email protected] >> > > >> > > >> > >> > >> > -- >> > Regards - Ernesto Reinaldo Barreiro >> > >> > > > > -- > Regards - Ernesto Reinaldo Barreiro > -- Regards - Ernesto Reinaldo Barreiro
