I want to add several "collapsable" ListViews: a listview paired with a button to toggle showing either the full list or the fist N elements.

But each listview's populateItem and corresponding markup will be different.

If I write a Wicket Panel, I'm not only "locked-in" to one set of markup.

I must also new up the ListView in the Panel's constructor, which means I can't vary the code in ListView's overridden anonymous-class populateItem, as I could if I passed in ListView instance.

MyPanel() {
  add( new ListView("someid") {
    void populateItem( ListItem i ) {
      i.add( new Label("foo") ...



If I instead pass in the ListView, then any user of my Panel class can pass in any instance or anonymous instance of ListView -- but my Panel can't call listView.setId() on the already constructed ListView to make its id match the id in the Panel's markup.

This seems like a simple thing, make two components collaborators and make that reusable, but the only way to do it seems to be to write a WebMarkupContainer-derived class, and pass in the ids, rather than writing a Panel.

is there a simpler way I'm not seeing?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to