as a sidenote, i think a few tag-interfaces are in order:

INotRenderable, INotAjaxifiable, names up for grabs.

what this can do is give the user some nice runtime errors that explain
whats wrong. listview, for example, would implement both.

INotRenderable - throw exception when a behavior is added, figure out a way
to lock out oncomponenttag overrides

INotAjaxifiable - throw error when added to ajax target for repainting

just some brain farts

-igor


On 1/10/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:

Someone (nick eugs) had a question on the IRC channel today. I gave
the wrong answer unfortunately, and I'm afraid this is quite a common
mistake to make anyway.

Q: I want to change an attribute of the list view. So say, the list
view is attached to tag <tr wicket:id="rows">...</tr>, I want it to
render as <tr myattrib="foo" wicket:id="rows">...</tr>. I tried adding
an attribute modifier to the list view: myListView.add(new
SimpleAttributeModifier("myattrib", "foo")), but it doesn't show up. I
also tried overriding onComponentTag of the list view, but this never
gets called.

A: ListView is a weird bastard. The actual component itself is never
rendered, but for every row, the child components it creates (the
ListItem components you get passed in the populateItem method) get
rendered instead. This is something to get used to, but once you get
the solutions like this question are easy: attach the attribute
modifier to the list item instead of to the list view:

add(new myListView("someid", list) {
  protected void populateItem(ListItem listItem) {
    listItem.add(new SimpleAttributeModifier("myattrib", "foo"));
    ...
  }
});

If I didn't make any grave mistakes and all, could someone be so kind
to put this (maybe with more list view examples?) in the WIKI
somewhere?

Eelco

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share
your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to