On 7/4/07, Erik Dreyer <[EMAIL PROTECTED]> wrote:
Hi,
I'm trying to update the provided TabbedPanel to be able to provide a new
CSS style to each tab so I can control the color of each tab.
I tried subclassing TabbedPanel and adding this method:
@Override
protected void onBeforeRender() {
super.onBeforeRender();
// get each tab and add a style
for (int i = 0; i < getTabs().size(); i++) {
Component tab = get("tabs-container:tabs:" + i);
tab.add(new AttributeAppender("class", true, new
Model("tab"+i), " "));
}
}
This doesn't work (Null Pointer) because this method gets called before
the actual tabs are added. I tried using onAfterRender(). This time the
tabs exist, but I can't modify the hierarchy during rendering.
Is there a way I can accomplish what I want without forking the
TabbedPanel class?
Thanks for your help,
Erik
No response. Let me rephrase the question more generally.
How can a component manipulate the component hierarchy of its children if
those children don't expose their inner structure? It seems the components
render from the top down. That is, a parent is rendered before its
children. Is that correct? What if a parent wants to modify its children
in onBeforeRender(), but can't because performing a get("path:to:child")
results in a NPE? Is there a way to do so? See my original post for an
example of why I might want to do this.
Thanks,
Erik
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user