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 <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to