You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Kaspar Fischer <fi...@inf.ethz.ch> on 2008/08/06 10:08:28 UTC
Add markup to ListView's markup
I try to code a subclass of ListView that adds some markup after
(i.e., at the
bottom of) the list. Markup like a "buy all cheeses in this list"-
link, for
example.
public abstract class NodeListView extends ListView<Node>
{
public NodeListView(String id, IModel<List<SessionNode>> model,
boolean showFooter)
{
// ...
}
// ...
}
Ideally, I'd like users of this class to provide the markup, for
instance:
<ul>
<li wicket:id="list"><wicket:container wicket:id="node"/></li>
</ul>
with code
add(new NodeListView("list", listModel, true)
{
@Override
protected void populateItem(ListItem<SessionNode> item)
{
item.add(new Label("node, /* ... */));
}
});
With this approach, is it possible to add markup from within
NodeListView?
Could a behaviour help (or overriding onRender() if it were not final)?
Another option would be to make NodeListView a Panel with associated
markup
and have clients of NodeListView pass in a fragment, which is a bit
unreadable:
<wicket:container wicket:id="list" />
<wicket:fragment wicket:id="list-item">
<wicket:container wicket:id="node"/>
</wicket:fragment>
with
add(new NodeListView("list", listModel, true,
new Fragment(NodeListView.ITEM_ID, "list-item", this)));
Any ideas?
Thanks, Kaspar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Add markup to ListView's markup
Posted by Kaspar Fischer <fi...@inf.ethz.ch>.
On 06.08.2008, at 14:26, Kaspar Fischer wrote:
> On 06.08.2008, at 13:15, James Carman wrote:
>
>> Why not make a new panel component that has a ListView and a label at
>> the bottom?
I ended up doing exactly this ...
> I need this component in many places, every time with different
> markup for
> between <li> and </li>. Therefore I am interested in solutions that
> allow
> the user of the component to provide the markup (as users of
> ListView can
> do right now).
... and my panel provides an overridable method to allow subclasses
to replace the markup between <li> and </li> (by passing in a Fragment
or so) in case they need it.
Thanks for your help and clarifications, James.
Kaspar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Add markup to ListView's markup
Posted by Kaspar Fischer <fi...@inf.ethz.ch>.
On 06.08.2008, at 13:15, James Carman wrote:
> Why not make a new panel component that has a ListView and a label at
> the bottom?
I need this component in many places, every time with different markup
for
between <li> and </li>. Therefore I am interested in solutions that
allow
the user of the component to provide the markup (as users of ListView
can
do right now).
> On Wed, Aug 6, 2008 at 4:08 AM, Kaspar Fischer
> <fi...@inf.ethz.ch> wrote:
>> I try to code a subclass of ListView that adds some markup after
>> (i.e., at
>> the
>> bottom of) the list. Markup like a "buy all cheeses in this list"-
>> link, for
>> example.
>>
>> public abstract class NodeListView extends ListView<Node>
>> {
>> public NodeListView(String id, IModel<List<SessionNode>> model,
>> boolean
>> showFooter)
>> {
>> // ...
>> }
>> // ...
>> }
>>
>> Ideally, I'd like users of this class to provide the markup, for
>> instance:
>>
>> <ul>
>> <li wicket:id="list"><wicket:container wicket:id="node"/></li>
>> </ul>
>>
>> with code
>>
>> add(new NodeListView("list", listModel, true)
>> {
>> @Override
>> protected void populateItem(ListItem<SessionNode> item)
>> {
>> item.add(new Label("node, /* ... */));
>> }
>> });
>>
>> With this approach, is it possible to add markup from within
>> NodeListView?
>> Could a behaviour help (or overriding onRender() if it were not
>> final)?
>>
>> Another option would be to make NodeListView a Panel with
>> associated markup
>> and have clients of NodeListView pass in a fragment, which is a bit
>> unreadable:
>>
>> <wicket:container wicket:id="list" />
>> <wicket:fragment wicket:id="list-item">
>> <wicket:container wicket:id="node"/>
>> </wicket:fragment>
>>
>> with
>>
>> add(new NodeListView("list", listModel, true,
>> new Fragment(NodeListView.ITEM_ID, "list-item", this)));
>>
>> Any ideas?
>>
>> Thanks, Kaspar
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Add markup to ListView's markup
Posted by James Carman <ja...@carmanconsulting.com>.
Why not make a new panel component that has a ListView and a label at
the bottom?
On Wed, Aug 6, 2008 at 4:08 AM, Kaspar Fischer <fi...@inf.ethz.ch> wrote:
> I try to code a subclass of ListView that adds some markup after (i.e., at
> the
> bottom of) the list. Markup like a "buy all cheeses in this list"-link, for
> example.
>
> public abstract class NodeListView extends ListView<Node>
> {
> public NodeListView(String id, IModel<List<SessionNode>> model, boolean
> showFooter)
> {
> // ...
> }
> // ...
> }
>
> Ideally, I'd like users of this class to provide the markup, for instance:
>
> <ul>
> <li wicket:id="list"><wicket:container wicket:id="node"/></li>
> </ul>
>
> with code
>
> add(new NodeListView("list", listModel, true)
> {
> @Override
> protected void populateItem(ListItem<SessionNode> item)
> {
> item.add(new Label("node, /* ... */));
> }
> });
>
> With this approach, is it possible to add markup from within NodeListView?
> Could a behaviour help (or overriding onRender() if it were not final)?
>
> Another option would be to make NodeListView a Panel with associated markup
> and have clients of NodeListView pass in a fragment, which is a bit
> unreadable:
>
> <wicket:container wicket:id="list" />
> <wicket:fragment wicket:id="list-item">
> <wicket:container wicket:id="node"/>
> </wicket:fragment>
>
> with
>
> add(new NodeListView("list", listModel, true,
> new Fragment(NodeListView.ITEM_ID, "list-item", this)));
>
> Any ideas?
>
> Thanks, Kaspar
>
> ---------------------------------------------------------------------
> 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