Re: [Wicket-user] More examples of sorting?

2006-07-19 Thread Frank Silbermann
If you look at the Wicket Examples, the ones online, in the Repeaters
category (http://www.wicket-library.com/wicket-examples/repeater), many
examples show sorting, and you can download the working examples.  The
second-to-last example demonstrates a DataTable with sortable column
headers.  The example doesn't even use a RDMS -- it allows the user to
sort data that is stored in the application object.  (That's where I got
the idea for my approach.)   

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vincent
Jenks
Sent: Tuesday, July 18, 2006 5:26 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] More examples of sorting?

I appreciate it Frank, however I'm not familiar w/ DataTable or the
SortableDataProvider - this is my first run.  Really what I need is to
see sorting working and I haven't even gotten that far.

I'd be willing to take a lookit might be easier to see it working w/
plain JDBC to get a view of this w/ a different perspective, if
anything.

Thanks!

On 7/18/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
> If your SLSBs were not coded with paging and sorting in mind, you'll 
> probably have to implement a layer that understands sorting and paging

> to stand between your SortableDataProvider and your SLSBs.  To do that

> in an ad-hoc way relevant to one specific set of data is probably time

> consuming at worst, but a general approach doesn't sound very easy to 
> me.
>
> Is your data set too large to keep in the WebPage on the server while 
> your user plays with it, sorting it this way and that?  Must you throw

> away the data between postbacks, re-querying each time?  If not, why 
> don't you take a look at the classes I posted to the group last week 
> (and sent you in private e-mail as well)?  Even if you're not 
> interested in getting your data via vanilla JDBC SQL SELECT queries, 
> I'm sure my approach can be adapted.
>
> My code is not difficult to read if you are at all familiar with 
> DataTable and SortableDataProvider.  I'd be happy to answer any 
> questions. /Frank
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Vincent Jenks
> Sent: Tuesday, July 18, 2006 4:50 PM
> To: wicket-user@lists.sourceforge.net
> Subject: Re: [Wicket-user] More examples of sorting?
>
> Well, I don't have DAOs in this particular project - it's an EJB3 
> project where I'm simply using SLSBs as DAOsso I have the 
> EntityManager to work from and I should be able to bring the two 
> together to facilitate this...
>
> This may be easier than I thought
>
> On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > yep, you have to code your daos with paging and sorting in mind, it 
> > cannot be slapped on as an afterthought.
> >
> > let me give you some clues
> >
> > see the attached QueryParam class, all my finder dao methods take it

> > so that they can page/sort accordingly.
> >
> > hope it gets you started
> >
> >
> > -Igor
> >
> >
> >
> >
> > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED] > wrote:
> > > Currently I don't have anything like the ContactsDatabase class in

> > > 'examples' - I'm just pulling a list of data and displaying in a 
> > > ListViewbut it appears now that I'm browsing through I'm going

> > > to have to create one and implement some of the methods like you 
> > > have in order to get paging/sorting.
> > >
> > > I'll play w/ it...it was just a little more than I expected once I

> > > started digging into it.
> > >
> > > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > what could be simpler then the dataview? its just like a 
> > > > listview only instead of being fed off the list it is fed from 
> > > > the
> idataprovider.
> > > >
> > > > class mydataprovider implements idataprovider() {
> > > >iterator iterator(int first, int count) {
> > > >   return mydao.findcontacts(first, count).iterator();
> > > >}
> > > >
> > > > int size() {
> > > >return mydao.countcontacts();
> > > >  }
> > > >
> > > > model model(object o) {
> > > >   Contact contact=(Contact)o;
> > > > return new ContactDetachableModel(contact);
> > > >   //or return new Model(contact);
> > > > }
> > > > }
> > > >
> > > > and that gets you p

Re: [Wicket-user] More examples of sorting?

2006-07-19 Thread Eelco Hillenius
As an alternative - to see a complete working example that works with
Hibernate - you could look at wicket-contrib-examples,
wicket.examples.cdapp and SearchPage/ SearchModel in particular.

In general, we consider using one of extension's repeater classes to
be a better way to go in general, but the approach in cdapp works, and
is low level enough to hopefully give you some ideas on how to
approach this yourself.

Eelco



On 7/19/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> Wow...ok...I'm making a total disaster of this.  I can't help but
> think there's an easier way. :(
>
> I've got this method in what we could call a "dao":
>
> public List getFiltered(int first, int count, String 
> orderBy)
> {
> String query = "select i from Incident i order by :orderBy";
>
> Query q = this.em.createQuery(query);
> q.setParameter("orderBy", orderBy);
>
> q.setFirstResult(first);
> q.setMaxResults(count);
>
> return q.getResultList();
> }
>
> And I've got started what might someday become a provider class:
>
> public class IncidentsProvider
> extends SortableDataProvider
> implements IDetachable
> {
> private transient List incidents;
>
> /**
>  * default ctor
>  */
> public IncidentsProvider(Integer first, Integer count, String orderBy)
> {
> this.incidents = myDao.getFiltered(first, count, orderBy);
>
> setSort("openDate", true);
> }
>
> public Iterator iterator(int first, int count)
> {
> return this.incidents.listIterator(first); // - what do 
> do?
> }
>
> public int size()
> {
> return this.incidents.size();
> }
>
> public IModel model(Object object)
> {
> return new Model((Serializable)object);
> }
>
> public void detach()
> {
> this.incidents = null;
> }
> }
>
> As you can see, I'm trying to marry my provider to my DAO as closely
> as possible...I'm not worried about elegance and cleanliness right now
> - just trying to take it one step at a time and get it *working*.
>
> I can make some sort of 'if asc then make desc' and vice/versa afterward
>
> Sorry, it's been a long day...maybe I need a breaktwo or three
> weeks ought to do it.
>
> On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > then the only semidifficult part is the sorting - you need to come up with
> > some utils that append the sort for you.
> >
> > as far as paging it would translate directly to
> >
> > session.setFirstResult(queryparam.getFirst()).setMaxResults(
> > queryparam.getCount());
> >
> > -Igor
> >
> >
> >
> > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> > >
> > Well, I don't have DAOs in this particular project - it's an EJB3
> > project where I'm simply using SLSBs as DAOsso I have the
> > EntityManager to work from and I should be able to bring the two
> > together to facilitate this...
> >
> > This may be easier than I thought
> >
> > On 7/18/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > > yep, you have to code your daos with paging and sorting in mind, it cannot
> > > be slapped on as an afterthought.
> > >
> > > let me give you some clues
> > >
> > > see the attached QueryParam class, all my finder dao methods take it so
> > that
> > > they can page/sort accordingly.
> > >
> > > hope it gets you started
> > >
> > >
> > > -Igor
> > >
> > >
> > >
> > >
> > > On 7/18/06, Vincent Jenks < [EMAIL PROTECTED] > wrote:
> > > > Currently I don't have anything like the ContactsDatabase class in
> > > > 'examples' - I'm just pulling a list of data and displaying in a
> > > > ListViewbut it appears now that I'm browsing through I'm going to
> > > > have to create one and implement some of the methods like you have in
> > > > order to get paging/sorting.
> > > >
> > > > I'll play w/ it...it was just a little more than I expected once I
> >  > > started digging into it.
> > > >
> > > > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > what could be simpler then the dataview? its just like a listview only
> > > > > instead of being fed off the list it is fed from the idataprovider.
> > > > >
> > > > > class mydataprovider implements idataprovider() {
> > > > >iterator iterator(int first, int count) {
> > > > >   return mydao.findcontacts(first, count).iterator();
> > > > >}
> > > > >
> > > > > int size() {
> > > > >return mydao.countcontacts();
> > > > >  }
> > > > >
> > > > > model model(object o) {
> > > > >   Contact contact=(Contact)o;
> > > > > return new
> > ContactDetachableModel(contact);
> > > > >   //or return new Model(contact);
> > > > > }
> > > > > }
> > > > >
> > > > > and that gets you paging, sorting is like this
> > > > >
> > > > >

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Vincent Jenks
I appreciate it Frank, however I'm not familiar w/ DataTable or the
SortableDataProvider - this is my first run.  Really what I need is to
see sorting working and I haven't even gotten that far.

I'd be willing to take a lookit might be easier to see it working
w/ plain JDBC to get a view of this w/ a different perspective, if
anything.

Thanks!

On 7/18/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:
> If your SLSBs were not coded with paging and sorting in mind, you'll
> probably have to implement a layer that understands sorting and paging
> to stand between your SortableDataProvider and your SLSBs.  To do that
> in an ad-hoc way relevant to one specific set of data is probably time
> consuming at worst, but a general approach doesn't sound very easy to
> me.
>
> Is your data set too large to keep in the WebPage on the server while
> your user plays with it, sorting it this way and that?  Must you throw
> away the data between postbacks, re-querying each time?  If not, why
> don't you take a look at the classes I posted to the group last week
> (and sent you in private e-mail as well)?  Even if you're not interested
> in getting your data via vanilla JDBC SQL SELECT queries, I'm sure my
> approach can be adapted.
>
> My code is not difficult to read if you are at all familiar with
> DataTable and SortableDataProvider.  I'd be happy to answer any
> questions. /Frank
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Vincent
> Jenks
> Sent: Tuesday, July 18, 2006 4:50 PM
> To: wicket-user@lists.sourceforge.net
> Subject: Re: [Wicket-user] More examples of sorting?
>
> Well, I don't have DAOs in this particular project - it's an EJB3
> project where I'm simply using SLSBs as DAOsso I have the
> EntityManager to work from and I should be able to bring the two
> together to facilitate this...
>
> This may be easier than I thought
>
> On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > yep, you have to code your daos with paging and sorting in mind, it
> > cannot be slapped on as an afterthought.
> >
> > let me give you some clues
> >
> > see the attached QueryParam class, all my finder dao methods take it
> > so that they can page/sort accordingly.
> >
> > hope it gets you started
> >
> >
> > -Igor
> >
> >
> >
> >
> > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED] > wrote:
> > > Currently I don't have anything like the ContactsDatabase class in
> > > 'examples' - I'm just pulling a list of data and displaying in a
> > > ListViewbut it appears now that I'm browsing through I'm going
> > > to have to create one and implement some of the methods like you
> > > have in order to get paging/sorting.
> > >
> > > I'll play w/ it...it was just a little more than I expected once I
> > > started digging into it.
> > >
> > > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > what could be simpler then the dataview? its just like a listview
> > > > only instead of being fed off the list it is fed from the
> idataprovider.
> > > >
> > > > class mydataprovider implements idataprovider() {
> > > >iterator iterator(int first, int count) {
> > > >   return mydao.findcontacts(first, count).iterator();
> > > >}
> > > >
> > > > int size() {
> > > >return mydao.countcontacts();
> > > >  }
> > > >
> > > > model model(object o) {
> > > >   Contact contact=(Contact)o;
> > > > return new ContactDetachableModel(contact);
> > > >   //or return new Model(contact);
> > > > }
> > > > }
> > > >
> > > > and that gets you paging, sorting is like this
> > > >
> > > > mydataprovider extends sortabledataprovider {
> > > >  // ditto from above
> > > >
> > > >iterator iterator(int first, int last) {
> > > >  return mydao.findcontacts(first, last,
> > > > getsort().getproperty(), getsort().getcount();
> > > >}
> > > >
> > > > }
> > > >
> > > >
> > > > if you have more specific questions i will be happy to help you
> > > >
> > > > -Igor
> > > >
> > > >
> > > &

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Vincent Jenks
Wow...ok...I'm making a total disaster of this.  I can't help but
think there's an easier way. :(

I've got this method in what we could call a "dao":

public List getFiltered(int first, int count, String orderBy)
{
String query = "select i from Incident i order by :orderBy";

Query q = this.em.createQuery(query);
q.setParameter("orderBy", orderBy);

q.setFirstResult(first);
q.setMaxResults(count);

return q.getResultList();
}

And I've got started what might someday become a provider class:

public class IncidentsProvider
extends SortableDataProvider
implements IDetachable
{
private transient List incidents;

/**
 * default ctor
 */
public IncidentsProvider(Integer first, Integer count, String orderBy)
{
this.incidents = myDao.getFiltered(first, count, orderBy);

setSort("openDate", true);
}

public Iterator iterator(int first, int count)
{
return this.incidents.listIterator(first); // - what do do?
}

public int size()
{
return this.incidents.size();
}

public IModel model(Object object)
{
return new Model((Serializable)object);
}

public void detach()
{
this.incidents = null;
}
}

As you can see, I'm trying to marry my provider to my DAO as closely
as possible...I'm not worried about elegance and cleanliness right now
- just trying to take it one step at a time and get it *working*.

I can make some sort of 'if asc then make desc' and vice/versa afterward

Sorry, it's been a long day...maybe I need a breaktwo or three
weeks ought to do it.

On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> then the only semidifficult part is the sorting - you need to come up with
> some utils that append the sort for you.
>
> as far as paging it would translate directly to
>
> session.setFirstResult(queryparam.getFirst()).setMaxResults(
> queryparam.getCount());
>
> -Igor
>
>
>
> On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> >
> Well, I don't have DAOs in this particular project - it's an EJB3
> project where I'm simply using SLSBs as DAOsso I have the
> EntityManager to work from and I should be able to bring the two
> together to facilitate this...
>
> This may be easier than I thought
>
> On 7/18/06, Igor Vaynberg < [EMAIL PROTECTED]> wrote:
> > yep, you have to code your daos with paging and sorting in mind, it cannot
> > be slapped on as an afterthought.
> >
> > let me give you some clues
> >
> > see the attached QueryParam class, all my finder dao methods take it so
> that
> > they can page/sort accordingly.
> >
> > hope it gets you started
> >
> >
> > -Igor
> >
> >
> >
> >
> > On 7/18/06, Vincent Jenks < [EMAIL PROTECTED] > wrote:
> > > Currently I don't have anything like the ContactsDatabase class in
> > > 'examples' - I'm just pulling a list of data and displaying in a
> > > ListViewbut it appears now that I'm browsing through I'm going to
> > > have to create one and implement some of the methods like you have in
> > > order to get paging/sorting.
> > >
> > > I'll play w/ it...it was just a little more than I expected once I
>  > > started digging into it.
> > >
> > > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > what could be simpler then the dataview? its just like a listview only
> > > > instead of being fed off the list it is fed from the idataprovider.
> > > >
> > > > class mydataprovider implements idataprovider() {
> > > >iterator iterator(int first, int count) {
> > > >   return mydao.findcontacts(first, count).iterator();
> > > >}
> > > >
> > > > int size() {
> > > >return mydao.countcontacts();
> > > >  }
> > > >
> > > > model model(object o) {
> > > >   Contact contact=(Contact)o;
> > > > return new
> ContactDetachableModel(contact);
> > > >   //or return new Model(contact);
> > > > }
> > > > }
> > > >
> > > > and that gets you paging, sorting is like this
> > > >
> > > > mydataprovider extends sortabledataprovider {
> > > >  // ditto from above
> > > >
> > > >iterator iterator(int first, int last) {
> > > >  return mydao.findcontacts(first, last,
> getsort().getproperty(),
> > > > getsort().getcount();
> > > >}
> > > >
> > > > }
> > > >
> > > >
> > > > if you have more specific questions i will be happy to help you
> > > >
> > > > -Igor
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> > > > >
> > > >  Is there something smaller & simpler out there I could refer to for
> > > > sorting?  I've glanced at the DataView example a few times and once I
> > > > start digg

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Frank Silbermann
If your SLSBs were not coded with paging and sorting in mind, you'll
probably have to implement a layer that understands sorting and paging
to stand between your SortableDataProvider and your SLSBs.  To do that
in an ad-hoc way relevant to one specific set of data is probably time
consuming at worst, but a general approach doesn't sound very easy to
me.

Is your data set too large to keep in the WebPage on the server while
your user plays with it, sorting it this way and that?  Must you throw
away the data between postbacks, re-querying each time?  If not, why
don't you take a look at the classes I posted to the group last week
(and sent you in private e-mail as well)?  Even if you're not interested
in getting your data via vanilla JDBC SQL SELECT queries, I'm sure my
approach can be adapted.

My code is not difficult to read if you are at all familiar with
DataTable and SortableDataProvider.  I'd be happy to answer any
questions. /Frank

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vincent
Jenks
Sent: Tuesday, July 18, 2006 4:50 PM
To: wicket-user@lists.sourceforge.net
Subject: Re: [Wicket-user] More examples of sorting?

Well, I don't have DAOs in this particular project - it's an EJB3
project where I'm simply using SLSBs as DAOsso I have the
EntityManager to work from and I should be able to bring the two
together to facilitate this...

This may be easier than I thought

On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> yep, you have to code your daos with paging and sorting in mind, it 
> cannot be slapped on as an afterthought.
>
> let me give you some clues
>
> see the attached QueryParam class, all my finder dao methods take it 
> so that they can page/sort accordingly.
>
> hope it gets you started
>
>
> -Igor
>
>
>
>
> On 7/18/06, Vincent Jenks <[EMAIL PROTECTED] > wrote:
> > Currently I don't have anything like the ContactsDatabase class in 
> > 'examples' - I'm just pulling a list of data and displaying in a 
> > ListViewbut it appears now that I'm browsing through I'm going 
> > to have to create one and implement some of the methods like you 
> > have in order to get paging/sorting.
> >
> > I'll play w/ it...it was just a little more than I expected once I 
> > started digging into it.
> >
> > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > what could be simpler then the dataview? its just like a listview 
> > > only instead of being fed off the list it is fed from the
idataprovider.
> > >
> > > class mydataprovider implements idataprovider() {
> > >iterator iterator(int first, int count) {
> > >   return mydao.findcontacts(first, count).iterator();
> > >}
> > >
> > > int size() {
> > >return mydao.countcontacts();
> > >  }
> > >
> > > model model(object o) {
> > >   Contact contact=(Contact)o;
> > > return new ContactDetachableModel(contact);
> > >   //or return new Model(contact);
> > > }
> > > }
> > >
> > > and that gets you paging, sorting is like this
> > >
> > > mydataprovider extends sortabledataprovider {
> > >  // ditto from above
> > >
> > >iterator iterator(int first, int last) {
> > >  return mydao.findcontacts(first, last, 
> > > getsort().getproperty(), getsort().getcount();
> > >}
> > >
> > > }
> > >
> > >
> > > if you have more specific questions i will be happy to help you
> > >
> > > -Igor
> > >
> > >
> > >
> > >
> > >
> > > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> > > >
> > >  Is there something smaller & simpler out there I could refer to 
> > > for sorting?  I've glanced at the DataView example a few times and

> > > once I start digging in it just seems unwieldly to me.  I'm simply

> > > trying to  sort a List of entities and the getContactsDB() stuff 
> > > in the examples is a bit complicated to try and pick through.
> > >
> > > I gave paging a shot yesterday but quickly figured out it wouldn't

> > > be a snap to throw together like most wicket stuff I've done so 
> > > farI'm in a crunch or I'd spend more time banging my head on 
> > > the table.
> > >
> > > I think if I just had a couple real-world examples I'd pick it up
> faster.
> > >
> > >

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Igor Vaynberg
then the only semidifficult part is the sorting - you need to come up with some utils that append the sort for you.as far as paging it would translate directly tosession.setFirstResult(queryparam.getFirst()).setMaxResults(
queryparam.getCount());-IgorOn 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
Well, I don't have DAOs in this particular project - it's an EJB3project where I'm simply using SLSBs as DAOsso I have the
EntityManager to work from and I should be able to bring the twotogether to facilitate this...This may be easier than I thoughtOn 7/18/06, Igor Vaynberg <
[EMAIL PROTECTED]> wrote:> yep, you have to code your daos with paging and sorting in mind, it cannot> be slapped on as an afterthought.>> let me give you some clues>> see the attached QueryParam class, all my finder dao methods take it so that
> they can page/sort accordingly.>> hope it gets you started>>> -Igor> On 7/18/06, Vincent Jenks <
[EMAIL PROTECTED] > wrote:> > Currently I don't have anything like the ContactsDatabase class in> > 'examples' - I'm just pulling a list of data and displaying in a> > ListViewbut it appears now that I'm browsing through I'm going to
> > have to create one and implement some of the methods like you have in> > order to get paging/sorting.> >> > I'll play w/ it...it was just a little more than I expected once I
> > started digging into it.> >> > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:> > > what could be simpler then the dataview? its just like a listview only
> > > instead of being fed off the list it is fed from the idataprovider.> > >> > > class mydataprovider implements idataprovider() {> > >iterator iterator(int first, int count) {
> > >   return mydao.findcontacts(first, count).iterator();> > >}> > >> > > int size() {> > >return mydao.countcontacts();> > >  }
> > >> > > model model(object o) {> > >   Contact contact=(Contact)o;> > > return new ContactDetachableModel(contact);> > >   //or return new Model(contact);
> > > }> > > }> > >> > > and that gets you paging, sorting is like this> > >> > > mydataprovider extends sortabledataprovider {> > >  // ditto from above
> > >> > >iterator iterator(int first, int last) {> > >  return mydao.findcontacts(first, last, getsort().getproperty(),> > > getsort().getcount();> > >}
> > >> > > }> > >> > >> > > if you have more specific questions i will be happy to help you> > >> > > -Igor> > >> > >
> > >> > >> > >> > > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:> > > >> > >  Is there something smaller & simpler out there I could refer to for
> > > sorting?  I've glanced at the DataView example a few times and once I> > > start digging in it just seems unwieldly to me.  I'm simply trying to> > >  sort a List of entities and the getContactsDB() stuff in the examples
> > > is a bit complicated to try and pick through.> > >> > > I gave paging a shot yesterday but quickly figured out it wouldn't be> > > a snap to throw together like most wicket stuff I've done so
> > > farI'm in a crunch or I'd spend more time banging my head on the> > > table.> > >> > > I think if I just had a couple real-world examples I'd pick it up> faster.
> > >> > > How's that book coming along? :D> > >> > > Thanks!> > >> > >> -
> > > Take Surveys. Earn Cash. Influence the Future of IT> > > Join SourceForge.net's Techsay panel and you'll get the chance to share> your> > > opinions on IT & business topics through brief surveys -- and earn cash
> > >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > > ___
> > > Wicket-user mailing list> > > Wicket-user@lists.sourceforge.net> > >> 
https://lists.sourceforge.net/lists/listinfo/wicket-user> > >> > >> > >> -> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share> your> > > opinions on IT & business topics through brief surveys -- and earn cash> > >> 
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > >> > > ___
> > > Wicket-user mailing list> > > Wicket-user@lists.sourceforge.net> > >> 
https://lists.sourceforge.net/lists/listinfo/wicket-user> > >> > >> > >> >> >> -
> > Take Surveys. Earn Cash. Influence the Future of IT> > Join SourceForge.net's Techsay panel and you'll get the chance to share> your> > opinions on IT & business topics through brief surveys -- and earn cash
> >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> > ___
> > Wicket-user mailing list> > Wicket-user@lists.sourceforge.net> > 
https://lists.sourceforge.n

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Vincent Jenks
Well, I don't have DAOs in this particular project - it's an EJB3
project where I'm simply using SLSBs as DAOsso I have the
EntityManager to work from and I should be able to bring the two
together to facilitate this...

This may be easier than I thought

On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> yep, you have to code your daos with paging and sorting in mind, it cannot
> be slapped on as an afterthought.
>
> let me give you some clues
>
> see the attached QueryParam class, all my finder dao methods take it so that
> they can page/sort accordingly.
>
> hope it gets you started
>
>
> -Igor
>
>
>
>
> On 7/18/06, Vincent Jenks <[EMAIL PROTECTED] > wrote:
> > Currently I don't have anything like the ContactsDatabase class in
> > 'examples' - I'm just pulling a list of data and displaying in a
> > ListViewbut it appears now that I'm browsing through I'm going to
> > have to create one and implement some of the methods like you have in
> > order to get paging/sorting.
> >
> > I'll play w/ it...it was just a little more than I expected once I
> > started digging into it.
> >
> > On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > what could be simpler then the dataview? its just like a listview only
> > > instead of being fed off the list it is fed from the idataprovider.
> > >
> > > class mydataprovider implements idataprovider() {
> > >iterator iterator(int first, int count) {
> > >   return mydao.findcontacts(first, count).iterator();
> > >}
> > >
> > > int size() {
> > >return mydao.countcontacts();
> > >  }
> > >
> > > model model(object o) {
> > >   Contact contact=(Contact)o;
> > > return new ContactDetachableModel(contact);
> > >   //or return new Model(contact);
> > > }
> > > }
> > >
> > > and that gets you paging, sorting is like this
> > >
> > > mydataprovider extends sortabledataprovider {
> > >  // ditto from above
> > >
> > >iterator iterator(int first, int last) {
> > >  return mydao.findcontacts(first, last, getsort().getproperty(),
> > > getsort().getcount();
> > >}
> > >
> > > }
> > >
> > >
> > > if you have more specific questions i will be happy to help you
> > >
> > > -Igor
> > >
> > >
> > >
> > >
> > >
> > > On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> > > >
> > >  Is there something smaller & simpler out there I could refer to for
> > > sorting?  I've glanced at the DataView example a few times and once I
> > > start digging in it just seems unwieldly to me.  I'm simply trying to
> > >  sort a List of entities and the getContactsDB() stuff in the examples
> > > is a bit complicated to try and pick through.
> > >
> > > I gave paging a shot yesterday but quickly figured out it wouldn't be
> > > a snap to throw together like most wicket stuff I've done so
> > > farI'm in a crunch or I'd spend more time banging my head on the
> > > table.
> > >
> > > I think if I just had a couple real-world examples I'd pick it up
> faster.
> > >
> > > How's that book coming along? :D
> > >
> > > Thanks!
> > >
> > >
> -
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > > opinions on IT & business topics through brief surveys -- and earn cash
> > >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > > ___
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> > >
> -
> > > Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > > opinions on IT & business topics through brief surveys -- and earn cash
> > >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > >
> > > ___
> > > Wicket-user mailing list
> > > Wicket-user@lists.sourceforge.net
> > >
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> > >
> > >
> > >
> >
> >
> -
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> > opinions on IT & business topics through brief surveys -- and earn cash
> >
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > ___
> > Wicket-user mailing list
> > Wicket-user@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/wicket-user
> >
>
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's T

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Igor Vaynberg
yep, you have to code your daos with paging and sorting in mind, it cannot be slapped on as an afterthought.let me give you some cluessee the attached QueryParam class, all my finder dao methods take it so that they can page/sort accordingly.
hope it gets you started-IgorOn 7/18/06, Vincent Jenks <[EMAIL PROTECTED]
> wrote:Currently I don't have anything like the ContactsDatabase class in
'examples' - I'm just pulling a list of data and displaying in aListViewbut it appears now that I'm browsing through I'm going tohave to create one and implement some of the methods like you have inorder to get paging/sorting.
I'll play w/ it...it was just a little more than I expected once Istarted digging into it.On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> what could be simpler then the dataview? its just like a listview only> instead of being fed off the list it is fed from the idataprovider.>> class mydataprovider implements idataprovider() {
>iterator iterator(int first, int count) {>   return mydao.findcontacts(first, count).iterator();>}>> int size() {>return mydao.countcontacts();>  }
>> model model(object o) {>   Contact contact=(Contact)o;> return new ContactDetachableModel(contact);>   //or return new Model(contact);> }
> }>> and that gets you paging, sorting is like this>> mydataprovider extends sortabledataprovider {>  // ditto from above>>iterator iterator(int first, int last) {
>  return mydao.findcontacts(first, last, getsort().getproperty(),> getsort().getcount();>}>> }>>> if you have more specific questions i will be happy to help you
>> -Igor>> On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:> >>  Is there something smaller & simpler out there I could refer to for
> sorting?  I've glanced at the DataView example a few times and once I> start digging in it just seems unwieldly to me.  I'm simply trying to>  sort a List of entities and the getContactsDB() stuff in the examples
> is a bit complicated to try and pick through.>> I gave paging a shot yesterday but quickly figured out it wouldn't be> a snap to throw together like most wicket stuff I've done so> farI'm in a crunch or I'd spend more time banging my head on the
> table.>> I think if I just had a couple real-world examples I'd pick it up faster.>> How's that book coming along? :D>> Thanks!>> -
> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share your> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV> ___
> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>> -> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> 
https://lists.sourceforge.net/lists/listinfo/wicket-user>>>-Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing listWicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user
package ptabs.webapp.support;

import java.util.ArrayList;
import java.util.List;

import ptabs.util.AssertUtils;

public class QueryParam {

	int first;

	int count;

	List sort = new ArrayList(1);

	public QueryParam(int first, int count) {
		this.first = first;
		this.count = count;
	}

	public QueryParam(int first, int count, SortState sortState) {
		this(first, count);
		AssertUtils.argNotNull(sortState);
		addSortState(sortState);
	}

	/**
	 * Returns first
	 * 
	 * @return the first
	 */
	public int getFirst() {
		return first;
	}

	/**
	 * Sets first
	 * 
	 * @param first the first to set
	 */
	public void setFirst(int first) {
		this.first = first;
	}

	/**
	 * Returns count
	 * 
	 * @return the count
	 */
	public int getCount() {
		return count;
	}

	/**
	 * Sets count
	 * 
	 * @param count the count to set
	 */
	public void setCount(int last) {
		this.count = last;
	}

	/**
	 * Returns list of sort states
	 * 
	 * @return list of sort states
	 */
	public List getSort() {
		return sort;
	}

	public void addSo

Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Vincent Jenks
Currently I don't have anything like the ContactsDatabase class in
'examples' - I'm just pulling a list of data and displaying in a
ListViewbut it appears now that I'm browsing through I'm going to
have to create one and implement some of the methods like you have in
order to get paging/sorting.

I'll play w/ it...it was just a little more than I expected once I
started digging into it.

On 7/18/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> what could be simpler then the dataview? its just like a listview only
> instead of being fed off the list it is fed from the idataprovider.
>
> class mydataprovider implements idataprovider() {
>iterator iterator(int first, int count) {
>   return mydao.findcontacts(first, count).iterator();
>}
>
> int size() {
>return mydao.countcontacts();
>  }
>
> model model(object o) {
>   Contact contact=(Contact)o;
> return new ContactDetachableModel(contact);
>   //or return new Model(contact);
> }
> }
>
> and that gets you paging, sorting is like this
>
> mydataprovider extends sortabledataprovider {
>  // ditto from above
>
>iterator iterator(int first, int last) {
>  return mydao.findcontacts(first, last, getsort().getproperty(),
> getsort().getcount();
>}
>
> }
>
>
> if you have more specific questions i will be happy to help you
>
> -Igor
>
>
>
>
>
> On 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
> >
>  Is there something smaller & simpler out there I could refer to for
> sorting?  I've glanced at the DataView example a few times and once I
> start digging in it just seems unwieldly to me.  I'm simply trying to
>  sort a List of entities and the getContactsDB() stuff in the examples
> is a bit complicated to try and pick through.
>
> I gave paging a shot yesterday but quickly figured out it wouldn't be
> a snap to throw together like most wicket stuff I've done so
> farI'm in a crunch or I'd spend more time banging my head on the
> table.
>
> I think if I just had a couple real-world examples I'd pick it up faster.
>
> How's that book coming along? :D
>
> Thanks!
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
> ___
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


Re: [Wicket-user] More examples of sorting?

2006-07-18 Thread Igor Vaynberg
what could be simpler then the dataview? its just like a listview only instead of being fed off the list it is fed from the idataprovider.class mydataprovider implements idataprovider() {   iterator iterator(int first, int count) {
  return mydao.findcontacts(first, count).iterator();   }    int size() {   return mydao.countcontacts(); }    model model(object o) {  Contact contact=(Contact)o;
   return new ContactDetachableModel(contact);  //or return new Model(contact);    }}and that gets you paging, sorting is like thismydataprovider extends sortabledataprovider {
    // ditto from above   iterator iterator(int first, int last) { return mydao.findcontacts(first, last, getsort().getproperty(), getsort().getcount();   }}if you have more specific questions i will be happy to help you
-IgorOn 7/18/06, Vincent Jenks <[EMAIL PROTECTED]> wrote:
Is there something smaller & simpler out there I could refer to forsorting?  I've glanced at the DataView example a few times and once Istart digging in it just seems unwieldly to me.  I'm simply trying to
sort a List of entities and the getContactsDB() stuff in the examplesis a bit complicated to try and pick through.I gave paging a shot yesterday but quickly figured out it wouldn't bea snap to throw together like most wicket stuff I've done so
farI'm in a crunch or I'd spend more time banging my head on thetable.I think if I just had a couple real-world examples I'd pick it up faster.How's that book coming along? :DThanks!
-Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Wicket-user mailing listWicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


[Wicket-user] More examples of sorting?

2006-07-18 Thread Vincent Jenks
Is there something smaller & simpler out there I could refer to for
sorting?  I've glanced at the DataView example a few times and once I
start digging in it just seems unwieldly to me.  I'm simply trying to
sort a List of entities and the getContactsDB() stuff in the examples
is a bit complicated to try and pick through.

I gave paging a shot yesterday but quickly figured out it wouldn't be
a snap to throw together like most wicket stuff I've done so
farI'm in a crunch or I'd spend more time banging my head on the
table.

I think if I just had a couple real-world examples I'd pick it up faster.

How's that book coming along? :D

Thanks!

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user