Hi,

you have to add the header contributor only once.

See here for a live example of a theme chooser:

   http://wicket-tree.appspot.com

Sven

Pierre Goupil wrote:
I did it, but there problem is still the same: all CSS files keep being in
the header as soon as I add one of them.

What I'd like to do is to have only one CSS at a given moment in the page.

Any ideas?

Regards,

Zala


On Sun, Sep 13, 2009 at 4:59 PM, Sven Meier <s...@meiers.net> wrote:

      component.add(new HeaderContributor(new IHeaderContributor()
      {
          private static final long serialVersionUID = 1L;

          public void renderHead(IHeaderResponse response)
          {
              response.renderCSSReference(getCurrentResource());
          }
      }));

Just let getCurrentResource() return the current theme's resource.

Sven



Pierre Goupil wrote:

Thanks for your reply! Let me explain.

I have three CSS files (1, 2, 3) and only one page (Page). On this Page,
there's a Component which contains three links which purpose are to swith
the graphical theme of the page, based on the CSS files.

When the user clicks on one of these links, the onClick() method performs
a
add(CSSPackageResource .getHeaderContribution("[1,2,3].css")) in order to
swith theme. Then the user goes back to the Page.

BUT, I want one and only one of the CSS files at any given moment. If I
click on sequence on each of these 3 links, the theme switches normally,
but
then it can't switch anymore as all three files are already loaded in my
page, as Firebug confirms.

Hence, my question is: how to remove one of these HeaderContributor?
Since,
when my user clicks on one of the links, I want to add a
HeaderContributor,
but also to remove the old one(s).

Regards,

Zala




On Sun, Sep 13, 2009 at 9:06 AM, nino martinez wael <
nino.martinez.w...@gmail.com> wrote:



What about just not adding it instead? So in the first cycle you add
it and in the next rendering you do not?

2009/9/13 Pierre Goupil <goupilpie...@gmail.com>:


Good morning,

I use CSSPackageResource .getHeaderContribution("style.css") in order to
load CSS files into my page. But is there any way to remove the
HeaderContributor ?

If I just add another one in a subsequent request, the old CSS is still
there, which I don't want.

Regards,

Zala


--
Sans amis était le grand maître des mondes,
Eprouvait manque, ce pour quoi il créa les esprits,
Miroirs bienveillants de sa béatitude.
Mais au vrai, il ne trouva aucun égal,
Du calice du royaume total des âmes
Ecume jusqu'à lui l'infinité.

(Schiller, "l'amitié")



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to