Thank you Igor!
I forgot that. It works ok!

Tito

2011/10/25 Igor Vaynberg <igor.vaynb...@gmail.com>

> you never say item.add(contentRow, detailsRow);
>
> and you dont need to override newItem() at all
>
> -igor
>
> On Tue, Oct 25, 2011 at 8:30 AM, Tito <njyt...@gmail.com> wrote:
> > I thought that I had to create Items on newItem method.
> > Anyway, I tried this but it doesn't work. Perhaps I'm doing something
> wrong,
> > this is my test:
> >
> > @Override
> >  protected void populateItem(Item<Dedication> item) {
> > DateFormat formatter = new SimpleDateFormat("hh:mm");
> >  final Dedication dedication = item.getModelObject();
> > Item<Dedication> contentRow = new OddEvenItem<Dedication>("content",
> > item.getIndex(), item.getModel());
> >  Item<Dedication> detailsRow = new OddEvenItem<Dedication>("details",
> > item.getIndex(), item.getModel());
> > contentRow.add(new Label("timeFrom",
> >  formatter.format(dedication.getTimeFrom())));
> >  contentRow.add(new Label("timeTo",
> >  formatter.format(dedication.getTimeTo())));
> > contentRow.add(new Label("hours", dedication.getHours().toString()));
> >  contentRow.add(new Label("task", dedication.getTask().getName()));
> > contentRow.add(new Label("accounts", getAccounts(dedication)));
> >  detailsRow.add(new TextArea<String>("serviceStatus", new
> > PropertyModel<String>(item.getModel(), "serviceStatus")));
> >  }
> >
> > @Override
> > protected Item<Dedication> newItem(String id, int index,
> IModel<Dedication>
> > model) {
> >  return new Item<Dedication>(id, index, model);
> > }
> >
> > And html:
> >
> > <wicket:container wicket:id="dedications">
> > <tr wicket:id="content">
> >  <td><span wicket:id="hours">[horas]</span></td>
> > <td><span wicket:id="timeFrom">[hora desde]</span>]</td>
> >  <td><span wicket:id="timeTo">[hora hasta]</span>]</td>
> > <td><span wicket:id="task">[tarea]</span></td>
> >  <td><span wicket:id="accounts">[cuentas]</span></td>
> > </tr>
> >  <tr wicket:id="details">
> > <td colspan="5">
> >  <input wicket:id="serviceStatus" />
> > </td>
> > </tr>
> >  </wicket:container>
> >
> >
> > 2011/10/25 Igor Vaynberg <igor.vaynb...@gmail.com>
> >
> >> populateitem(item) {
> >>  OddEvenItem tr1=new OddEvenItem("tr1", item.getindex(),
> item.getmodel());
> >>  OddEvenItem tr2=new OddEvenItem("tr1", item.getindex(),
> item.getmodel());
> >>  item.add(tr1, tr2);
> >>
> >>  tr1.add(...);
> >>  tr2.add(...);
> >> }
> >>
> >> -igor
> >>
> >>
> >> On Tue, Oct 25, 2011 at 7:37 AM, Tito <njyt...@gmail.com> wrote:
> >> > Yes I tried but the problem is I can't get MarkupContainer to add the
> >> > AttributeModifierBehavior.
> >> > I don't know how to get a container that represents <tr> tag.
> >> >
> >> > 2011/10/25 Josh Kamau <joshnet2...@gmail.com>
> >> >
> >> >> Have you tried using attributeModifiers or attributeAppenders to add
> or
> >> >> modify a css class?
> >> >>
> >> >> Josh
> >> >>
> >> >>
> >> >> On Tue, Oct 25, 2011 at 4:21 PM, Tito <njyt...@gmail.com> wrote:
> >> >>
> >> >> > Yes, but I think this is not the problem.
> >> >> > I have not problems with wicket:container, my problem is that I
> can't
> >> >> > modify
> >> >> > class attribute of <tr> to add Odd or Even.
> >> >> >
> >> >> > Tito
> >> >> >
> >> >> > 2011/10/25 Josh Kamau <joshnet2...@gmail.com>
> >> >> >
> >> >> > > You can always use component#renderBodyOnly(true) method to
> ensure
> >> that
> >> >> > the
> >> >> > > containers markup is not rendered.
> >> >> > >
> >> >> > > Josh.
> >> >> > >
> >> >> > > On Tue, Oct 25, 2011 at 2:33 PM, Tito <njyt...@gmail.com> wrote:
> >> >> > >
> >> >> > > > Hi,
> >> >> > > >
> >> >> > > > Wicket container works ok!
> >> >> > > > But making trs webmarkupcontainers doesn't allow me to populate
> >> items
> >> >> > of
> >> >> > > > the
> >> >> > > > table because it change hierarchy of components, and I can't
> get
> >> >> > > > WebMarkupContainers from Item.
> >> >> > > >
> >> >> > > > I mean, before I had:
> >> >> > > >
> >> >> > > > <wicket:container wicket:id="dedications">
> >> >> > > > <tr>
> >> >> > > >  <td><span wicket:id="hours">[horas]</span></td>
> >> >> > > > <td><span wicket:id="timeFrom">[hora desde]</span>]</td>
> >> >> > > >  <td><span wicket:id="timeTo">[hora hasta]</span>]</td>
> >> >> > > > <td><span wicket:id="task">[tarea]</span></td>
> >> >> > > >  <td><span wicket:id="accounts">[cuentas]</span></td>
> >> >> > > > </tr>
> >> >> > > >  <tr>
> >> >> > > > <td colspan="5">
> >> >> > > > <input wicket:id="serviceStatus" />
> >> >> > > >  </td>
> >> >> > > > </tr>
> >> >> > > > </wicket:container>
> >> >> > > >
> >> >> > > > And I populated items in this way:
> >> >> > > >
> >> >> > > > @Override
> >> >> > > > protected void populateItem(Item<Dedication> item) {
> >> >> > > >  DateFormat formatter = new SimpleDateFormat("hh:mm");
> >> >> > > > final Dedication dedication = item.getModelObject();
> >> >> > > >  item.add(new Label("timeFrom",
> >> >> > > >  formatter.format(dedication.getTimeFrom())));
> >> >> > > > item.add(new Label("timeTo",
> >> >> >  formatter.format(dedication.getTimeTo())));
> >> >> > > >  item.add(new Label("hours",
> dedication.getHours().toString()));
> >> >> > > > item.add(new Label("task", dedication.getTask().getName()));
> >> >> > > >  item.add(new Label("accounts", getAccounts(dedication)));
> >> >> > > > item.add(new TextArea<String>("serviceStatus", new
> >> >> > > > PropertyModel<String>(item.getModel(), "serviceStatus")));
> >> >> > > >  }
> >> >> > > >
> >> >> > > >
> >> >> > > > But now if I do this in order to add Odd, Even classes:
> >> >> > > >
> >> >> > > > <wicket:container wicket:id="dedications">
> >> >> > > >  <tr wicket:id="content">
> >> >> > > > <td><span wicket:id="hours">[horas]</span></td>
> >> >> > > >  <td><span wicket:id="timeFrom">[hora desde]</span>]</td>
> >> >> > > > <td><span wicket:id="timeTo">[hora hasta]</span>]</td>
> >> >> > > >  <td><span wicket:id="task">[tarea]</span></td>
> >> >> > > > <td><span wicket:id="accounts">[cuentas]</span></td>
> >> >> > > >  </tr>
> >> >> > > > <tr wicket:id="details">
> >> >> > > > <td colspan="5">
> >> >> > > >  <input wicket:id="serviceStatus" />
> >> >> > > > </td>
> >> >> > > > </tr>
> >> >> > > >  </wicket:container>
> >> >> > > >
> >> >> > > > I don't know how to populate items.
> >> >> > > >
> >> >> > > > Thanks for helping!
> >> >> > > >
> >> >> > > > Tito
> >> >> > > >
> >> >> > > > 2011/10/24 Igor Vaynberg <igor.vaynb...@gmail.com>
> >> >> > > >
> >> >> > > > > On Mon, Oct 24, 2011 at 9:31 AM, Tito <njyt...@gmail.com>
> >> wrote:
> >> >> > > > > > I'm sorry, you are right!
> >> >> > > > > > I said columns but I meant Rows!
> >> >> > > > > >
> >> >> > > > > > What is the java component for wicket container?
> >> >> > > > >
> >> >> > > > > no need for a java component, wicket:container is an auto tag
> >> like
> >> >> > > > > wicket:message
> >> >> > > > >
> >> >> > > > > > How do you suggest to add Odd, Even classes?
> >> >> > > > >
> >> >> > > > > you can make trs webmarkupcontainers that add the correct
> class
> >> >> > > > >
> >> >> > > > > -igor
> >> >> > > > >
> >> >> > > > > >
> >> >> > > > > > Thank you!
> >> >> > > > > >
> >> >> > > > > > 2011/10/24 Igor Vaynberg <igor.vaynb...@gmail.com>
> >> >> > > > > >
> >> >> > > > > >> ahhh.....
> >> >> > > > > >>
> >> >> > > > > >> so you want two *rows* not two *columns* per item, attach
> the
> >> >> > > repeater
> >> >> > > > > >> to a wicket:container tag like so:
> >> >> > > > > >>
> >> >> > > > > >> <wicket:container wicket:id="repeater">
> >> >> > > > > >> <tr><td>...</tr>
> >> >> > > > > >> <tr><td>....</tr>
> >> >> > > > > >> </wicket:container>
> >> >> > > > > >>
> >> >> > > > > >> you will have to rig up odd/even yourself....
> >> >> > > > > >>
> >> >> > > > > >> -igor
> >> >> > > > > >>
> >> >> > > > > >> On Mon, Oct 24, 2011 at 9:10 AM, Tito <njyt...@gmail.com>
> >> >> wrote:
> >> >> > > > > >> > Hi Igor this is what i'm doing:
> >> >> > > > > >> >
> >> >> > > > > >> > .java
> >> >> > > > > >> >
> >> >> > > > > >> > public DedicationsReportPanel(String id, IModel<Users>
> >> user,
> >> >> > final
> >> >> > > > > >> > IModel<Date> dayOfReport) {
> >> >> > > > > >> > super(id);
> >> >> > > > > >> >
> >> >> > > > > >> > add(new DataView<Dedication>("dedications", new
> >> >> > > > > >> > DedicationDataProvider(dedicationService,
> >> >> > > > > >> user.getObject().getUserName())) {
> >> >> > > > > >> >
> >> >> > > > > >> > @Override
> >> >> > > > > >> > protected void populateItem(Item<Dedication> item) {
> >> >> > > > > >> >  DateFormat formatter = new SimpleDateFormat("hh:mm");
> >> >> > > > > >> > final Dedication dedication = item.getModelObject();
> >> >> > > > > >> >  item.add(new Label("timeFrom",
> >> >> > > > > >> >  formatter.format(dedication.getTimeFrom())));
> >> >> > > > > >> > item.add(new Label("timeTo",
> >> >> > > > >  formatter.format(dedication.getTimeTo())));
> >> >> > > > > >> >  item.add(new Label("hours",
> >> >> dedication.getHours().toString()));
> >> >> > > > > >> > item.add(new Label("task",
> >> dedication.getTask().getName()));
> >> >> > > > > >> >  item.add(new Label("accounts",
> getAccounts(dedication)));
> >> >> > > > > >> > item.add(new TextArea<String>("serviceStatus", new
> >> >> > > > > >> > PropertyModel<String>(item.getModel(),
> "serviceStatus")));
> >> >> > > > > >> >  }
> >> >> > > > > >> >
> >> >> > > > > >> > @Override
> >> >> > > > > >> > protected Item<Dedication> newItem(String id, int index,
> >> >> > > > > >> IModel<Dedication>
> >> >> > > > > >> > model) {
> >> >> > > > > >> >  OddEvenItem<Dedication> item = new
> >> >> OddEvenItem<Dedication>(id,
> >> >> > > > index,
> >> >> > > > > >> > model);
> >> >> > > > > >> > return item;
> >> >> > > > > >> >  }
> >> >> > > > > >> > });
> >> >> > > > > >> > }
> >> >> > > > > >> >
> >> >> > > > > >> > .html
> >> >> > > > > >> >
> >> >> > > > > >> > <html
> >> >> > > > > >> > xmlns:wicket="
> >> >> > > > > >>
> >> http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd
> >> >> > > > > >> > ">
> >> >> > > > > >> > <head></head>
> >> >> > > > > >> > <body>
> >> >> > > > > >> > <wicket:panel>
> >> >> > > > > >> > <table cellspacing="0" class="listado">
> >> >> > > > > >> >  <tr>
> >> >> > > > > >> > <th>Fecha</th>
> >> >> > > > > >> > <th>Horas</th>
> >> >> > > > > >> >  <th>Tarea</th>
> >> >> > > > > >> > <th>Servicios</th>
> >> >> > > > > >> > <th>Acciones</th>
> >> >> > > > > >> >  </tr>
> >> >> > > > > >> > <div wicket:id="dedications">
> >> >> > > > > >> > <tr>
> >> >> > > > > >> >  <td><span wicket:id="hours">[horas]</span></td>
> >> >> > > > > >> > <td><span wicket:id="timeFrom">[hora desde]</span>]</td>
> >> >> > > > > >> >  <td><span wicket:id="timeTo">[hora hasta]</span>]</td>
> >> >> > > > > >> > <td><span wicket:id="task">[tarea]</span></td>
> >> >> > > > > >> >  <td><span wicket:id="accounts">[cuentas]</span></td>
> >> >> > > > > >> > </tr>
> >> >> > > > > >> >  <tr>
> >> >> > > > > >> > <td colspan="5">
> >> >> > > > > >> > <input wicket:id="serviceStatus" />
> >> >> > > > > >> >  </td>
> >> >> > > > > >> > </tr>
> >> >> > > > > >> > </div>
> >> >> > > > > >> >  </table>
> >> >> > > > > >> > </wicket:panel>
> >> >> > > > > >> > </body>
> >> >> > > > > >> > </html>
> >> >> > > > > >> >
> >> >> > > > > >> > I'm using a div to group two columns. The problem is
> that
> >> this
> >> >> > not
> >> >> > > a
> >> >> > > > > >> valid
> >> >> > > > > >> > html, and I can't get Odd, Even class in rows. I think
> it
> >> is
> >> >> > > because
> >> >> > > > > div
> >> >> > > > > >> is
> >> >> > > > > >> > repeated instead of tr.
> >> >> > > > > >> >
> >> >> > > > > >> > What i'm expecting in the final html is something like
> >> this:
> >> >> > > > > >> >
> >> >> > > > > >> > <table cellspacing="0" class="listado">
> >> >> > > > > >> >  <tr>
> >> >> > > > > >> > <th>Fecha</th>
> >> >> > > > > >> > <th>Horas</th>
> >> >> > > > > >> >  <th>Tarea</th>
> >> >> > > > > >> > <th>Servicios</th>
> >> >> > > > > >> > <th>Acciones</th>
> >> >> > > > > >> >  </tr>
> >> >> > > > > >> > <tr class="Even">
> >> >> > > > > >> > <td><span>hours 1</span></td>
> >> >> > > > > >> >  <td><span>time from 1</span>]</td>
> >> >> > > > > >> > <td><span>time to 1</span>]</td>
> >> >> > > > > >> >  <td><span>task 1</span></td>
> >> >> > > > > >> > <td><span>accounts 1</span></td>
> >> >> > > > > >> >  </tr>
> >> >> > > > > >> > <tr class="Even">
> >> >> > > > > >> > <td colspan="5">
> >> >> > > > > >> >  <input wicket:id="serviceStatus" />
> >> >> > > > > >> > </td>
> >> >> > > > > >> > </tr>
> >> >> > > > > >> >  <tr class="Odd">
> >> >> > > > > >> > <td><span>hours 2</span></td>
> >> >> > > > > >> >  <td><span>time from 2</span>]</td>
> >> >> > > > > >> > <td><span>time to 2</span>]</td>
> >> >> > > > > >> >  <td><span>task 2</span></td>
> >> >> > > > > >> > <td><span>accounts 2</span></td>
> >> >> > > > > >> >  </tr>
> >> >> > > > > >> > <tr class="Odd">
> >> >> > > > > >> > <td colspan="5">
> >> >> > > > > >> >  <input wicket:id="serviceStatus" />
> >> >> > > > > >> > </td>
> >> >> > > > > >> > </tr>
> >> >> > > > > >> >  </table>
> >> >> > > > > >> >
> >> >> > > > > >> >
> >> >> > > > > >> > Thanks!
> >> >> > > > > >> >
> >> >> > > > > >> >
> >> >> > > > > >> > 2011/10/24 Igor Vaynberg <igor.vaynb...@gmail.com>
> >> >> > > > > >> >
> >> >> > > > > >> >> dataview/listview/datatable should all work just fine,
> >> post
> >> >> > your
> >> >> > > > > code.
> >> >> > > > > >> >>
> >> >> > > > > >> >> -igor
> >> >> > > > > >> >>
> >> >> > > > > >> >> On Mon, Oct 24, 2011 at 5:06 AM, Tito <
> njyt...@gmail.com>
> >> >> > wrote:
> >> >> > > > > >> >> > Hi,
> >> >> > > > > >> >> >
> >> >> > > > > >> >> > I'm trying to make a table with two columns by item.
> I
> >> >> mean,
> >> >> > my
> >> >> > > > > item
> >> >> > > > > >> have
> >> >> > > > > >> >> to
> >> >> > > > > >> >> > generate two columns.
> >> >> > > > > >> >> > The first have attributes of the object, the second
> have
> >> >> > > another
> >> >> > > > > >> >> attribute
> >> >> > > > > >> >> > with details.
> >> >> > > > > >> >> >
> >> >> > > > > >> >> > I can't do this. I made tests with DataView and
> >> GridView. I
> >> >> > > don't
> >> >> > > > > know
> >> >> > > > > >> >> what
> >> >> > > > > >> >> > is the best component. Could you give me an idea of
> how
> >> to
> >> >> do
> >> >> > > > > >> something
> >> >> > > > > >> >> like
> >> >> > > > > >> >> > this?
> >> >> > > > > >> >> >
> >> >> > > > > >> >> > Thanks in advance.
> >> >> > > > > >> >> >
> >> >> > > > > >> >> > Tito
> >> >> > > > > >> >> >
> >> >> > > > > >> >>
> >> >> > > > > >> >>
> >> >> > > >
> >> ---------------------------------------------------------------------
> >> >> > > > > >> >> To unsubscribe, e-mail:
> >> users-unsubscr...@wicket.apache.org
> >> >> > > > > >> >> For additional commands, e-mail:
> >> >> users-h...@wicket.apache.org
> >> >> > > > > >> >>
> >> >> > > > > >> >>
> >> >> > > > > >> >
> >> >> > > > > >>
> >> >> > > > > >>
> >> >> > >
> >> ---------------------------------------------------------------------
> >> >> > > > > >> To unsubscribe, e-mail:
> users-unsubscr...@wicket.apache.org
> >> >> > > > > >> For additional commands, e-mail:
> >> users-h...@wicket.apache.org
> >> >> > > > > >>
> >> >> > > > > >>
> >> >> > > > > >
> >> >> > > > >
> >> >> > > > >
> >> >> ---------------------------------------------------------------------
> >> >> > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> >> > > > > For additional commands, e-mail:
> users-h...@wicket.apache.org
> >> >> > > > >
> >> >> > > > >
> >> >> > > >
> >> >> > >
> >> >> >
> >> >>
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to