You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "Eric J. Van der Velden" <er...@gmail.com> on 2017/05/03 11:07:00 UTC

Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

Hello,

I don't understand why a cell item gets a model, because I have not seen
where it is used. Only the model in the row item is used, together with the
property of the column.

Also why is the populator of the column in that model?


public abstract class AbstractDataGridView<T> extends DataViewBase<T>
@Override
protected final void populateItem(final Item<T> item)
{

                RepeatingView cells = new RepeatingView(CELL_REPEATER_ID);
item.add(cells);

                int populatorsNumber = populators.size();
for (int i = 0; i < populatorsNumber; i++)
{
ICellPopulator<T> populator = populators.get(i);
IModel<ICellPopulator<T>> populatorModel = new Model<>(populator);
Item<ICellPopulator<T>> cellItem = newCellItem(cells.newChildId(), i,
populatorModel);
cells.add(cellItem);
...

For example here we see that the row model + property of the column is
used, and not the model of the cell item:

public class PropertyPopulator<T> implements ICellPopulator<T>
@Override
public void populateItem(final Item<ICellPopulator<T>> cellItem, final
String componentId,
final IModel<T> rowModel)
{
cellItem.add(new Label(componentId, new PropertyModel<>(rowModel,
property)));
}

Thanks.

Re: Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

Posted by Sven Meier <sv...@meiers.net>.
Hi,

just to correct myself: each cell holds in its model the populator for 
the *corresponding* column .

Never seen it being used, but no problem.

Have fun
Sven


On 04.05.2017 09:00, Eric J. Van der Velden wrote:
> Hi Sven,
>
> Thank you!
>
> No, I was just wondering. I have not seen this model used.
>
>
>
> On Wed, May 3, 2017 at 1:44 PM, Sven Meier <sv...@meiers.net> wrote:
>
>> Hi,
>>
>> a cell item is an org.apache.wicket.markup.repeater.Item, and each item
>> has
>> a model - so AbstractDataGridView just uses a model containing the
>> ICellPopulator for that.
>>
>> It seems strange, that all cells of a row share the same model object, but
>> it does no harm.
>>
>> Do you see a problem?
>>
>> Have fun
>> Sven
>>
>> --
>> View this message in context: http://apache-wicket.1842946.
>> n4.nabble.com/Why-has-a-cell-item-a-model-and-why-is-it-a-
>> model-with-the-populator-with-the-property-of-the-column-
>> tp4677772p4677773.html
>> Sent from the Users forum mailing list archive at Nabble.com.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

Posted by "Eric J. Van der Velden" <er...@gmail.com>.
Hi Sven,

Thank you!

No, I was just wondering. I have not seen this model used.



On Wed, May 3, 2017 at 1:44 PM, Sven Meier <sv...@meiers.net> wrote:

> Hi,
>
> a cell item is an org.apache.wicket.markup.repeater.Item, and each item
> has
> a model - so AbstractDataGridView just uses a model containing the
> ICellPopulator for that.
>
> It seems strange, that all cells of a row share the same model object, but
> it does no harm.
>
> Do you see a problem?
>
> Have fun
> Sven
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Why-has-a-cell-item-a-model-and-why-is-it-a-
> model-with-the-populator-with-the-property-of-the-column-
> tp4677772p4677773.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Why has a cell item a model (and why is it a model with the populator (with the property) of the column)?

Posted by Sven Meier <sv...@meiers.net>.
Hi,

a cell item is an org.apache.wicket.markup.repeater.Item, and each item has
a model - so AbstractDataGridView just uses a model containing the
ICellPopulator for that.

It seems strange, that all cells of a row share the same model object, but
it does no harm.

Do you see a problem?

Have fun
Sven

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Why-has-a-cell-item-a-model-and-why-is-it-a-model-with-the-populator-with-the-property-of-the-column-tp4677772p4677773.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org