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 <
[email protected]> 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 <[email protected]>:
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: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to