no, if you work with an iterator and dont have access to the list it is not
as obvious, but still very doable. i leave the exercise to you - that is the
fun in programming no? doing something that is not very obvious. :)
-igor
On 2/20/07, Alexei Sokolov <[EMAIL PROTECTED]> wrote:
Igor,
You are cheating :) groupsiterator should take another iterator, not list
for the constructor. In this case implementation of findnext is not obvious
since you cannot rewind the original iterator.
Alex
On 2/19/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>
> thats easy. you have a list of rows that is primarily sorted on the
> group. so just do something like this (rough pseudocode)
>
> class groupsiterator implements iterator {
> private final list rows;
> private string group;
> private int idx;
>
> public groupsiterator(list rows) {
> this.rows=rows;
> findnext();
> }
>
> public boolean hasnext() { return group!=null; }
>
> public void next() {
> string curr=group;
> findnext();
> return curr;
> }
>
> private void findnext() {
> String nextgroup=null;
> for (int idx;idx<rows.size();idx++) {
> if (!rows.get(i).getgroup().equals(group)) {
> nextgroup=rows.geT(i).getgroup();
> break;
> }
> }
> return nextgroup;
> }
> }
>
> think of it as a filtered iterator :)
>
> -igor
>
>
> On 2/19/07, Alexei Sokolov <[EMAIL PROTECTED]> wrote:
> >
> > Igor,
> >
> > In this case outer repeater will have to iterate over groups, and I
> > don't know how to iterate over groups. I can iterate over every record and I
> > can detect when there is a group boundary.
> >
> > Alex
> >
> > On 2/19/07, Igor Vaynberg <[EMAIL PROTECTED] > wrote:
> > >
> > > you would use two repeaters, one inside the other
> > >
> > > one for outputting group header and footer
> > > and the other one inside that one to output the rows in between.
> > >
> > > -igor
> > >
> > >
> > > On 2/19/07, Alexei Sokolov <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hello,
> > > >
> > > > I'm sorry if this subject was discussed before... if so please
> > > > point me in the right direction. Here is my problem:
> > > >
> > > > I'm using IDataProvider interface from wicket extensions package
> > > > to load set of data from database. The data has the following format:
> > > >
> > > > group1, field11, field12, field13, field14
> > > > group1, field21, field22, field23, field24
> > > > group1, field31, field32, field33, field34
> > > > ...
> > > > groupN, fieldN1, fieldN2, fieldN3, fieldN4
> > > >
> > > > Now, what I want to show is this:
> > > >
> > > > group1 header
> > > > group1 row1
> > > > group1 row2
> > > > ...
> > > > group1 rowM
> > > > group1 footer
> > > > ...
> > > > groupN header
> > > > groupN row1
> > > > ...
> > > > groupN rowK
> > > > groupN footer
> > > >
> > > > How do I do this if markup for group header and group footer is
> > > > different from each row's markup?
> > > >
> > > > Thank you,
> > > > Alex
> > > >
> > > >
> > > >
-------------------------------------------------------------------------
> > > > 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
> > > > [email protected]
> > > > 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
> > > [email protected]
> > > 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
> > [email protected]
> > 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
> [email protected]
> 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
[email protected]
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user