On 6/23/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
I am creating an application that utilizes alternate stylesheets. A
javascript library also needs each stylesheet to have a title. The
output format should be something like this:
<link rel="alternate stylesheet" type="text/css" href="large.css"
title="large" />
Using HeaderContributor, I can get this output:
<link href="/db/app/resources/mypackage.MyPanel/large.css"
type="text/css" rel="stylesheet">
Note that I need to add "alternate" to the "rel" attribute and add a
"title" attribute to the HeaderContributor output.
I was hoping to alter this <link> tag using an AttributeModifier, but
there doesn't seem to be a way to do this since HeaderContributor is
not a Component.
Here is code:
private static final CompressedResourceReference CSS_LARGE =
new CompressedResourceReference(MyPanel.class, "large.css");
public MyPanel(String id) {
super(id);
HeaderContributor large = HeaderContributor.forCss(SS_CSS_LARGE);
}
I thought I could create my own version of
HeaderContributor.CSSReferenceHeaderContributor, but I can't override
forCss(ResourceReference) because it is final.
Is there some other way to alter a tag? Otherwise, how would I accomplish
this?
Thanks,
Tauren
tbh, these reqs sound a little too exotic to be supported by the core
framework. that said, it is trivial to create your own css contributor.
class mycontributor extends abstractbehavior implements iheadercontributor {
private ResourceReference ref;
private String title;
public mycontributor(ref,title) {...}
renderHead(final IHeaderResponse response) {
response.renderString("<style all your attributes
href=\""+requestcycle.get().urlfor(ref)+"\"/>");
}
}
done
-------------------------------------------------------------------------
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