Component#onInitialize() is called *once* for any instance, so it won't be
added/removed in Ajax request.

class AutoCssBehavior extends Behavior {

  @Override
  public void renderHead(Component component, IHeaderResponse response) {
    super.renderHead(component, response);

    if (component instanceof MyAutoCssComponent) {
       Class clz = component.getClass();
       response.render(CssHeaderItem.forReference(new
CssResourceReference(clz, clz.getSimpleName() + ".css")));
    }
  }
}

About the bundleing - there is no support for any automated way. But I'd
prefer a build time solution then a runtime one.


On Tue, Jul 2, 2013 at 4:28 PM, Koen <koen.verrec...@gmail.com> wrote:

> Adding / removing CSS on every ajax seems inefficient though though, or is
> the performance impact negligible?
>
> On the other hand, scanning and combining all the CSS beforehand (like
> Spring scans config files) and then injecting it into Page components seems
> like a good solution.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Feature-question-CSS-per-component-tp4659972p4659974.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to