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
>
>

Reply via email to