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?
the short answer is: you cannot.
the point of tabbedpanel is to encapsulate a lot of these details so you do
not have to worry about it. the ease of use comes at a price - not
everything is customizable to everyone's content.
so there are two options to solve this
a) you can roll your own tabbed panel (which in wicket is not very hard, the
original has about 30-40 lines of code that make it tick?
b) we can add this functionality to the tabbed pael in core, making it a bit
more bloated.
i dont mind (b) if its just adding "tab1", "tab2" class attributes.
-igor
Thanks for your help,
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
-------------------------------------------------------------------------
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