Yes, this works. Why is bind() not necessary? If I don't call bind() who does?
   public StaticResourceReference(String name)
   {
       super(name);
       bind(Session.get().getApplication());
   }

    So now my code is down to:

    WebMarkupContainer pageCSS = new WebMarkupContainer("pageCSS");
    add(pageCSS);
StaticResourceReference pageResource = new StaticResourceReference(getClass(), "page.css"); pageCSS.add(new AttributeModifier("href", false, new Model(urlFor(pageResource.getPath()))));
make:

class CssAttributeModifier extends AttributeModifier
{
         public CssAttributeModifier(Page page, String cssName)
         {
super("href" , false , new Model(page.urlFor(new StaticResourceReference(page.getClass(), cssName).getPath())))
         }
}

then:

add(new WebMarkupContainer("pageCSS").add(new CssAttributeModifier (this, "page.css")));

one line!!! :)

johan



per CSS file. While this works I am disappointed it takes so much code to do this. My old code making use of Panels was about 1/4 the amount of code. I wish there was a way for us to refactor this somehow so it's a bit cleaner. Any ideas?

Gili

Johan Compagner wrote:
is this not possible:

StaticResourceReference pageResource = new StaticResourceReference(getClass(), "page.css"); pageCSS.add(new AttributeModifier("href", false, new Model(page.urlFor(pageResource.getPath()))));

that bind call that you do is not needed.

johan



-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to