On 6/24/07, Tauren Mills <[EMAIL PROTECTED]> wrote:
Igor,
Thanks for the solution! I'll go that route for now.
However, I'm not convinced that supporting alternate stylesheets is
outside the scope of wicket core. Mozilla browsers support switching
to alternate stylesheets from a menu option:
http://www.w3.org/Style/Examples/007/alternatives.html
That alone is probably not a good enough incentive to include it in
core. But my use case is to improve accessibility. The site I'm
making is for senior citizens, so I'm providing them with a way to
easily scale the size of the font displayed on the site by clicking
font size icons on the page. This technique is explained here:
http://alistapart.com/stories/alternate/
This solution uses javascript to activate and deactivate the alternate
stylesheets. I prefer to utilize javascript for quick stylesheet
changes rather than a round-trip to the server. I realize I could
accomplish the same thing with server round-trips and not need any
custom HeaderContributor.
Lastly, it is possible to group stylesheets together and activate or
deactivate them all at once if they have the same title. Adding that
attribute would make it more robust.
Regardless, as you have shown, it isn't hard to implement my own
IHeaderContributor. I just wasn't sure how to go about it, and now I
am. So perhaps you are right in that it is best left out of core.
Thanks again!
Tauren
in fact, take it a bit further:
StylesheetSwitcher switcher=new StylesheetSwitcher();
switcher.addStylesheet("small", new ResourceReference...
switcher.addStylesheet("medium", new ResourceReference...
switcher.addStylesheet("large", new ResourceReference...
add(switcher);
add(new SwitchStylesheetLink("link", switcher, "small"));
add(new IncreateStylesheetLink("plus", switcher);
you can encapsulate all this stuff including javascript, etc, in an
encapsulated header contributor and make it totally transparent and reusable
across projects. then after you get it working feel free to contribute it to
wicketstuff-minis :)
-igor
-------------------------------------------------------------------------
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