You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by sahar rostami <sa...@gmail.com> on 2010/04/07 17:15:46 UTC

resource (css) loading

Hi all,
I want to know how wicket loads css files from location specified in
HeaderContributer or using "href" in  header?

Thanks in advanced!

Re: resource (css) loading

Posted by Apple Grew <ap...@gmail.com>.
u r welcome.

Regards,
Apple Grew
my blog @ http://blog.applegrew.com/


On Sun, Apr 11, 2010 at 11:48 AM, sahar rostami <sa...@gmail.com>wrote:

> Thanks so much dear apple grew!
>
> Regards
>
>
> On Sun, Apr 11, 2010 at 9:49 AM, Apple Grew <ap...@gmail.com> wrote:
>
> > Maybe it was stripped by Wicket Mailing list. Anyway I will paste the
> code
> > in the mail itself.
> >
> > Regards,
> > Apple Grew
> > my blog @ http://blog.applegrew.com/
> >
> > --Code Starts--
> >
> > /**
> >  * Web based application for e-shopping.
> >  * Copyright (C) 2010  Nirupam Biswas (AppleGrew)
> >  *
> >  * This program is free software: you can redistribute it and/or modify
> >  * it under the terms of the GNU General Public License as published by
> >  * the Free Software Foundation, either version 3 of the License, or
> >  * (at your option) any later version.
> >  *
> >  * This program is distributed in the hope that it will be useful,
> >  * but WITHOUT ANY WARRANTY; without even the implied warranty of
> >  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> >  * GNU General Public License for more details.
> >  *
> >  * You should have received a copy of the GNU General Public License
> >  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> >  */
> > package com.sym.core;
> >
> > import java.util.Arrays;
> > import java.util.List;
> >
> > import org.apache.wicket.util.resource.IResourceStream;
> > import org.apache.wicket.util.resource.locator.ResourceStreamLocator;
> >
> > import com.sym.core.utils.MiscUtils;
> > import com.sym.html.pages.BaseLayoutPage;
> >
> > public class AppStreamLocator extends ResourceStreamLocator {
> >    private static final String HTML_EXT = ".html";
> >    private static final String CSS_EXT = ".css";
> >    private static final String JS_PATH = "/js/";
> >    private static final String CSS_PATH = "/css/";
> >    private static final String IMG_PATH = "/img/";
> >    private static final List<String> IMG_EXTS = Arrays.asList(new
> String[]{
> > ".png", ".jpg", ".gif", ".svg" });
> >
> >    private static final String PAGES_PACKAGE =
> > BaseLayoutPage.class.getPackage().getName();
> >    private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length();
> >    private static final int GLOBAL_PACKAGE_NAME_LEN =
> > ApplicationCore.class.getPackage().getName().length();
> >
> >    @Override
> >    public IResourceStream locate(final Class<?> clazz, String path) {
> >        //Only pages' (not components or panel etc.s') HTMLs and CSS will
> be
> > fetched from 'res' directory.
> >        if(clazz.getName().startsWith(PAGES_PACKAGE)){
> >            IResourceStream located = null;
> >
> >            if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) {
> >                located = super.locate(clazz, "html/" +
> > ApplicationCore.getThemeName() + trimFolders(path, false));
> >            }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) {
> >                located = super.locate(clazz, "/img" + trimFolders(path,
> > false));
> >            }
> >
> >            if (located != null) {
> >                return located;
> >            }
> >        }else if(clazz.equals(ApplicationCore.class)){
> >            //Global shared resources have been requested.
> >            IResourceStream located = null;
> >            path = trimFolders(path, true);
> >
> >            if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) ||
> > path.startsWith(IMG_PATH)) {
> >                located = super.locateByResourceFinder(clazz, path);
> >                if(located == null && path.startsWith(CSS_PATH)) {
> >                    located = super.locateByResourceFinder(clazz,
> >                            CSS_PATH + ApplicationCore.getThemeName()
> >                            + path.substring(path.indexOf(CSS_PATH) +
> > CSS_PATH.length() - 1));
> >                }
> >            }
> >            return located;
> >        }
> >        return super.locate(clazz, path);
> >    }
> >
> >    private String trimFolders(final String path, final boolean
> > isGlobalPath) {
> >        return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN)
> >                : path.substring(PG_PACKAGE_NAME_LEN);
> >    }
> >
> > }
> >
> >
> > --Code Ends--
> >
> > On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami <sahar.rostami@gmail.com
> > >wrote:
> >
> > > thank you Apple Grew
> > > I can't receive your attachments. Are you sure they have been attached
> ?
> > >
> > > On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew <ap...@gmail.com>
> wrote:
> > >
> > > > Maybe u can try writing a stream locator as I did. I am attaching my
> > > stream
> > > > locator with this mail.
> > > >
> > > > The necessary plumbing required with this is:-
> > > >
> > > > resourceSettings.addResourceFolder("WEB-INF/res");
> > > > resourceSettings.setResourceStreamLocator(new AppStreamLocator());
> > > > getSharedResources().putClassAlias(ApplicationCore.class, "global");
> > > >
> > > > The above needs to be put in your Application class.
> > > >
> > > > Regards,
> > > > Apple Grew
> > > > my blog @ http://blog.applegrew.com/
> > > >
> > > >
> > > >
> > > > On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <lindner@visionet.de
> > > >wrote:
> > > >
> > > >> You could e.g. write your own page class
> > > >>
> > > >>        class MyCustomersPage extens Page {
> > > >>                @Override
> > > >>                public void renderHead(HtmlHeaderContainer container)
> {
> > > >>                        super.renderHead(container);
> > > >>                        cssResourceReference =
> > > >> Session.get().getCssResourceReferenceForcustomer()
> > > >>
> > > >>
> >  container.getHeaderResponse().renderCSSReference(cssResourceReference);
> > > >>                }
> > > >>        }
> > > >>
> > > >> And then let each of your pages be a child of MyCustomersPage
> > > >>
> > > >> Stefan
> > > >> -----Ursprüngliche Nachricht-----
> > > >> Von: sahar rostami [mailto:sahar.rostami@gmail.com]
> > > >> Gesendet: Mittwoch, 7. April 2010 18:42
> > > >> An: users@wicket.apache.org
> > > >> Betreff: Re: resource (css) loading
> > > >>
> > > >> thank you moèz
> > > >> but i want to set the location for whole application not a specific
> > > file.
> > > >>
> > > >> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <
> > > benrhouma.moez@gmail.com
> > > >> >wrote:
> > > >>
> > > >> > In java
> > > >> >
> > > >> > add(new StyleSheetReference("stylesheet", BasePage.class,
> > > >> *"style.css"*));
> > > >> >
> > > >> > style.css is the path of the file style.css (i.e you can write
> > > >> > "/stylesheets/style.css  ...)
> > > >> >
> > > >> > 2010/4/7 sahar rostami <sa...@gmail.com>
> > > >> >
> > > >> > > No , i want to know how wicket knows where is style.css?
> > > >> > >
> > > >> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> > > >> > benrhouma.moez@gmail.com
> > > >> > > >wrote:
> > > >> > >
> > > >> > > > If I understand , you can use in constructor of class java the
> > > >> > following
> > > >> > > > code:
> > > >> > > > add(new StyleSheetReference("stylesheet", BasePage.class,
> > > >> > "style.css"));
> > > >> > > >
> > > >> > > > and in the html page you add:
> > > >> > > > <link wicket:id="stylesheet" >
> > > >> > > >
> > > >> > > > 2010/4/7 sahar rostami <sa...@gmail.com>
> > > >> > > >
> > > >> > > > > Thanks MZemeck
> > > >> > > > > But my question in another form is "Where wicket load css
> > (which
> > > >> > > class)?"
> > > >> > > > > how wicket knows where look up a css file?
> > > >> > > > >
> > > >> > > > > i'm trying to override default location of css file and read
> > > them
> > > >> > from
> > > >> > > > > path(s) specified in application start up ,but i can't
> because
> > i
> > > >> > don't
> > > >> > > > know
> > > >> > > > > how wicket loads them.
> > > >> > > > >
> > > >> > > > > any idea would help me!
> > > >> > > > > thanks
> > > >> > > > >
> > > >> > > > >
> > > >> > > > >
> > > >> > > > >
> > > >> > > > >
> > > >> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us>
> > > wrote:
> > > >> > > > >
> > > >> > > > > > One difference I am aware of (and community correct me if
> I
> > am
> > > >> > > wrong),
> > > >> > > > > > Wicket GZIPs resources.  So if you directly link to the
> css
> > > >> using
> > > >> > an
> > > >> > > > > > "href" you will not have that feature.
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > sahar rostami <sa...@gmail.com>
> > > >> > > > > > 04/07/2010 11:16 AM
> > > >> > > > > > Please respond to
> > > >> > > > > > users@wicket.apache.org
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > To
> > > >> > > > > > Wicket User Mailing List <us...@wicket.apache.org>
> > > >> > > > > > cc
> > > >> > > > > >
> > > >> > > > > > Subject
> > > >> > > > > > resource (css) loading
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > Hi all,
> > > >> > > > > > I want to know how wicket loads css files from location
> > > >> specified
> > > >> > in
> > > >> > > > > > HeaderContributer or using "href" in  header?
> > > >> > > > > >
> > > >> > > > > > Thanks in advanced!
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > >
> > > >> > > > > > Notice: This communication, including any attachments, is
> > > >> intended
> > > >> > > > solely
> > > >> > > > > > for the use of the individual or entity to which it is
> > > >> addressed.
> > > >> > > This
> > > >> > > > > > communication may contain information that is protected
> from
> > > >> > > disclosure
> > > >> > > > > > under State and/or Federal law. Please notify the sender
> > > >> > immediately
> > > >> > > if
> > > >> > > > > > you have received this communication in error and delete
> > this
> > > >> email
> > > >> > > > from
> > > >> > > > > > your system. If you are not the intended recipient, you
> are
> > > >> > requested
> > > >> > > > not
> > > >> > > > > > to disclose, copy, distribute or take any action in
> reliance
> > > on
> > > >> the
> > > >> > > > > > contents of this information.
> > > >> > > > >
> > > >> > > >
> > > >> > >
> > > >> >
> > > >>
> > > >>
> ---------------------------------------------------------------------
> > > >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > >> For additional commands, e-mail: users-help@wicket.apache.org
> > > >>
> > > >>
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > > For additional commands, e-mail: users-help@wicket.apache.org
> > > >
> > >
> >
>

Re: resource (css) loading

Posted by sahar rostami <sa...@gmail.com>.
Thanks so much dear apple grew!

Regards


On Sun, Apr 11, 2010 at 9:49 AM, Apple Grew <ap...@gmail.com> wrote:

> Maybe it was stripped by Wicket Mailing list. Anyway I will paste the code
> in the mail itself.
>
> Regards,
> Apple Grew
> my blog @ http://blog.applegrew.com/
>
> --Code Starts--
>
> /**
>  * Web based application for e-shopping.
>  * Copyright (C) 2010  Nirupam Biswas (AppleGrew)
>  *
>  * This program is free software: you can redistribute it and/or modify
>  * it under the terms of the GNU General Public License as published by
>  * the Free Software Foundation, either version 3 of the License, or
>  * (at your option) any later version.
>  *
>  * This program is distributed in the hope that it will be useful,
>  * but WITHOUT ANY WARRANTY; without even the implied warranty of
>  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>  * GNU General Public License for more details.
>  *
>  * You should have received a copy of the GNU General Public License
>  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  */
> package com.sym.core;
>
> import java.util.Arrays;
> import java.util.List;
>
> import org.apache.wicket.util.resource.IResourceStream;
> import org.apache.wicket.util.resource.locator.ResourceStreamLocator;
>
> import com.sym.core.utils.MiscUtils;
> import com.sym.html.pages.BaseLayoutPage;
>
> public class AppStreamLocator extends ResourceStreamLocator {
>    private static final String HTML_EXT = ".html";
>    private static final String CSS_EXT = ".css";
>    private static final String JS_PATH = "/js/";
>    private static final String CSS_PATH = "/css/";
>    private static final String IMG_PATH = "/img/";
>    private static final List<String> IMG_EXTS = Arrays.asList(new String[]{
> ".png", ".jpg", ".gif", ".svg" });
>
>    private static final String PAGES_PACKAGE =
> BaseLayoutPage.class.getPackage().getName();
>    private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length();
>    private static final int GLOBAL_PACKAGE_NAME_LEN =
> ApplicationCore.class.getPackage().getName().length();
>
>    @Override
>    public IResourceStream locate(final Class<?> clazz, String path) {
>        //Only pages' (not components or panel etc.s') HTMLs and CSS will be
> fetched from 'res' directory.
>        if(clazz.getName().startsWith(PAGES_PACKAGE)){
>            IResourceStream located = null;
>
>            if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) {
>                located = super.locate(clazz, "html/" +
> ApplicationCore.getThemeName() + trimFolders(path, false));
>            }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) {
>                located = super.locate(clazz, "/img" + trimFolders(path,
> false));
>            }
>
>            if (located != null) {
>                return located;
>            }
>        }else if(clazz.equals(ApplicationCore.class)){
>            //Global shared resources have been requested.
>            IResourceStream located = null;
>            path = trimFolders(path, true);
>
>            if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) ||
> path.startsWith(IMG_PATH)) {
>                located = super.locateByResourceFinder(clazz, path);
>                if(located == null && path.startsWith(CSS_PATH)) {
>                    located = super.locateByResourceFinder(clazz,
>                            CSS_PATH + ApplicationCore.getThemeName()
>                            + path.substring(path.indexOf(CSS_PATH) +
> CSS_PATH.length() - 1));
>                }
>            }
>            return located;
>        }
>        return super.locate(clazz, path);
>    }
>
>    private String trimFolders(final String path, final boolean
> isGlobalPath) {
>        return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN)
>                : path.substring(PG_PACKAGE_NAME_LEN);
>    }
>
> }
>
>
> --Code Ends--
>
> On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami <sahar.rostami@gmail.com
> >wrote:
>
> > thank you Apple Grew
> > I can't receive your attachments. Are you sure they have been attached ?
> >
> > On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew <ap...@gmail.com> wrote:
> >
> > > Maybe u can try writing a stream locator as I did. I am attaching my
> > stream
> > > locator with this mail.
> > >
> > > The necessary plumbing required with this is:-
> > >
> > > resourceSettings.addResourceFolder("WEB-INF/res");
> > > resourceSettings.setResourceStreamLocator(new AppStreamLocator());
> > > getSharedResources().putClassAlias(ApplicationCore.class, "global");
> > >
> > > The above needs to be put in your Application class.
> > >
> > > Regards,
> > > Apple Grew
> > > my blog @ http://blog.applegrew.com/
> > >
> > >
> > >
> > > On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <lindner@visionet.de
> > >wrote:
> > >
> > >> You could e.g. write your own page class
> > >>
> > >>        class MyCustomersPage extens Page {
> > >>                @Override
> > >>                public void renderHead(HtmlHeaderContainer container) {
> > >>                        super.renderHead(container);
> > >>                        cssResourceReference =
> > >> Session.get().getCssResourceReferenceForcustomer()
> > >>
> > >>
>  container.getHeaderResponse().renderCSSReference(cssResourceReference);
> > >>                }
> > >>        }
> > >>
> > >> And then let each of your pages be a child of MyCustomersPage
> > >>
> > >> Stefan
> > >> -----Ursprüngliche Nachricht-----
> > >> Von: sahar rostami [mailto:sahar.rostami@gmail.com]
> > >> Gesendet: Mittwoch, 7. April 2010 18:42
> > >> An: users@wicket.apache.org
> > >> Betreff: Re: resource (css) loading
> > >>
> > >> thank you moèz
> > >> but i want to set the location for whole application not a specific
> > file.
> > >>
> > >> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <
> > benrhouma.moez@gmail.com
> > >> >wrote:
> > >>
> > >> > In java
> > >> >
> > >> > add(new StyleSheetReference("stylesheet", BasePage.class,
> > >> *"style.css"*));
> > >> >
> > >> > style.css is the path of the file style.css (i.e you can write
> > >> > "/stylesheets/style.css  ...)
> > >> >
> > >> > 2010/4/7 sahar rostami <sa...@gmail.com>
> > >> >
> > >> > > No , i want to know how wicket knows where is style.css?
> > >> > >
> > >> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> > >> > benrhouma.moez@gmail.com
> > >> > > >wrote:
> > >> > >
> > >> > > > If I understand , you can use in constructor of class java the
> > >> > following
> > >> > > > code:
> > >> > > > add(new StyleSheetReference("stylesheet", BasePage.class,
> > >> > "style.css"));
> > >> > > >
> > >> > > > and in the html page you add:
> > >> > > > <link wicket:id="stylesheet" >
> > >> > > >
> > >> > > > 2010/4/7 sahar rostami <sa...@gmail.com>
> > >> > > >
> > >> > > > > Thanks MZemeck
> > >> > > > > But my question in another form is "Where wicket load css
> (which
> > >> > > class)?"
> > >> > > > > how wicket knows where look up a css file?
> > >> > > > >
> > >> > > > > i'm trying to override default location of css file and read
> > them
> > >> > from
> > >> > > > > path(s) specified in application start up ,but i can't because
> i
> > >> > don't
> > >> > > > know
> > >> > > > > how wicket loads them.
> > >> > > > >
> > >> > > > > any idea would help me!
> > >> > > > > thanks
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > >
> > >> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us>
> > wrote:
> > >> > > > >
> > >> > > > > > One difference I am aware of (and community correct me if I
> am
> > >> > > wrong),
> > >> > > > > > Wicket GZIPs resources.  So if you directly link to the css
> > >> using
> > >> > an
> > >> > > > > > "href" you will not have that feature.
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > sahar rostami <sa...@gmail.com>
> > >> > > > > > 04/07/2010 11:16 AM
> > >> > > > > > Please respond to
> > >> > > > > > users@wicket.apache.org
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > To
> > >> > > > > > Wicket User Mailing List <us...@wicket.apache.org>
> > >> > > > > > cc
> > >> > > > > >
> > >> > > > > > Subject
> > >> > > > > > resource (css) loading
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > Hi all,
> > >> > > > > > I want to know how wicket loads css files from location
> > >> specified
> > >> > in
> > >> > > > > > HeaderContributer or using "href" in  header?
> > >> > > > > >
> > >> > > > > > Thanks in advanced!
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > >
> > >> > > > > > Notice: This communication, including any attachments, is
> > >> intended
> > >> > > > solely
> > >> > > > > > for the use of the individual or entity to which it is
> > >> addressed.
> > >> > > This
> > >> > > > > > communication may contain information that is protected from
> > >> > > disclosure
> > >> > > > > > under State and/or Federal law. Please notify the sender
> > >> > immediately
> > >> > > if
> > >> > > > > > you have received this communication in error and delete
> this
> > >> email
> > >> > > > from
> > >> > > > > > your system. If you are not the intended recipient, you are
> > >> > requested
> > >> > > > not
> > >> > > > > > to disclose, copy, distribute or take any action in reliance
> > on
> > >> the
> > >> > > > > > contents of this information.
> > >> > > > >
> > >> > > >
> > >> > >
> > >> >
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > >> For additional commands, e-mail: users-help@wicket.apache.org
> > >>
> > >>
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> >
>

Re: resource (css) loading

Posted by Apple Grew <ap...@gmail.com>.
Maybe it was stripped by Wicket Mailing list. Anyway I will paste the code
in the mail itself.

Regards,
Apple Grew
my blog @ http://blog.applegrew.com/

--Code Starts--

/**
 * Web based application for e-shopping.
 * Copyright (C) 2010  Nirupam Biswas (AppleGrew)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package com.sym.core;

import java.util.Arrays;
import java.util.List;

import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.locator.ResourceStreamLocator;

import com.sym.core.utils.MiscUtils;
import com.sym.html.pages.BaseLayoutPage;

public class AppStreamLocator extends ResourceStreamLocator {
    private static final String HTML_EXT = ".html";
    private static final String CSS_EXT = ".css";
    private static final String JS_PATH = "/js/";
    private static final String CSS_PATH = "/css/";
    private static final String IMG_PATH = "/img/";
    private static final List<String> IMG_EXTS = Arrays.asList(new String[]{
".png", ".jpg", ".gif", ".svg" });

    private static final String PAGES_PACKAGE =
BaseLayoutPage.class.getPackage().getName();
    private static final int PG_PACKAGE_NAME_LEN = PAGES_PACKAGE.length();
    private static final int GLOBAL_PACKAGE_NAME_LEN =
ApplicationCore.class.getPackage().getName().length();

    @Override
    public IResourceStream locate(final Class<?> clazz, String path) {
        //Only pages' (not components or panel etc.s') HTMLs and CSS will be
fetched from 'res' directory.
        if(clazz.getName().startsWith(PAGES_PACKAGE)){
            IResourceStream located = null;

            if (path.endsWith(HTML_EXT) || path.endsWith(CSS_EXT)) {
                located = super.locate(clazz, "html/" +
ApplicationCore.getThemeName() + trimFolders(path, false));
            }else if (IMG_EXTS.contains(MiscUtils.getExt(path))) {
                located = super.locate(clazz, "/img" + trimFolders(path,
false));
            }

            if (located != null) {
                return located;
            }
        }else if(clazz.equals(ApplicationCore.class)){
            //Global shared resources have been requested.
            IResourceStream located = null;
            path = trimFolders(path, true);

            if (path.startsWith(CSS_PATH) || path.startsWith(JS_PATH) ||
path.startsWith(IMG_PATH)) {
                located = super.locateByResourceFinder(clazz, path);
                if(located == null && path.startsWith(CSS_PATH)) {
                    located = super.locateByResourceFinder(clazz,
                            CSS_PATH + ApplicationCore.getThemeName()
                            + path.substring(path.indexOf(CSS_PATH) +
CSS_PATH.length() - 1));
                }
            }
            return located;
        }
        return super.locate(clazz, path);
    }

    private String trimFolders(final String path, final boolean
isGlobalPath) {
        return isGlobalPath? path.substring(GLOBAL_PACKAGE_NAME_LEN)
                : path.substring(PG_PACKAGE_NAME_LEN);
    }

}


--Code Ends--

On Sun, Apr 11, 2010 at 9:18 AM, sahar rostami <sa...@gmail.com>wrote:

> thank you Apple Grew
> I can't receive your attachments. Are you sure they have been attached ?
>
> On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew <ap...@gmail.com> wrote:
>
> > Maybe u can try writing a stream locator as I did. I am attaching my
> stream
> > locator with this mail.
> >
> > The necessary plumbing required with this is:-
> >
> > resourceSettings.addResourceFolder("WEB-INF/res");
> > resourceSettings.setResourceStreamLocator(new AppStreamLocator());
> > getSharedResources().putClassAlias(ApplicationCore.class, "global");
> >
> > The above needs to be put in your Application class.
> >
> > Regards,
> > Apple Grew
> > my blog @ http://blog.applegrew.com/
> >
> >
> >
> > On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <lindner@visionet.de
> >wrote:
> >
> >> You could e.g. write your own page class
> >>
> >>        class MyCustomersPage extens Page {
> >>                @Override
> >>                public void renderHead(HtmlHeaderContainer container) {
> >>                        super.renderHead(container);
> >>                        cssResourceReference =
> >> Session.get().getCssResourceReferenceForcustomer()
> >>
> >>  container.getHeaderResponse().renderCSSReference(cssResourceReference);
> >>                }
> >>        }
> >>
> >> And then let each of your pages be a child of MyCustomersPage
> >>
> >> Stefan
> >> -----Ursprüngliche Nachricht-----
> >> Von: sahar rostami [mailto:sahar.rostami@gmail.com]
> >> Gesendet: Mittwoch, 7. April 2010 18:42
> >> An: users@wicket.apache.org
> >> Betreff: Re: resource (css) loading
> >>
> >> thank you moèz
> >> but i want to set the location for whole application not a specific
> file.
> >>
> >> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <
> benrhouma.moez@gmail.com
> >> >wrote:
> >>
> >> > In java
> >> >
> >> > add(new StyleSheetReference("stylesheet", BasePage.class,
> >> *"style.css"*));
> >> >
> >> > style.css is the path of the file style.css (i.e you can write
> >> > "/stylesheets/style.css  ...)
> >> >
> >> > 2010/4/7 sahar rostami <sa...@gmail.com>
> >> >
> >> > > No , i want to know how wicket knows where is style.css?
> >> > >
> >> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> >> > benrhouma.moez@gmail.com
> >> > > >wrote:
> >> > >
> >> > > > If I understand , you can use in constructor of class java the
> >> > following
> >> > > > code:
> >> > > > add(new StyleSheetReference("stylesheet", BasePage.class,
> >> > "style.css"));
> >> > > >
> >> > > > and in the html page you add:
> >> > > > <link wicket:id="stylesheet" >
> >> > > >
> >> > > > 2010/4/7 sahar rostami <sa...@gmail.com>
> >> > > >
> >> > > > > Thanks MZemeck
> >> > > > > But my question in another form is "Where wicket load css (which
> >> > > class)?"
> >> > > > > how wicket knows where look up a css file?
> >> > > > >
> >> > > > > i'm trying to override default location of css file and read
> them
> >> > from
> >> > > > > path(s) specified in application start up ,but i can't because i
> >> > don't
> >> > > > know
> >> > > > > how wicket loads them.
> >> > > > >
> >> > > > > any idea would help me!
> >> > > > > thanks
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > >
> >> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us>
> wrote:
> >> > > > >
> >> > > > > > One difference I am aware of (and community correct me if I am
> >> > > wrong),
> >> > > > > > Wicket GZIPs resources.  So if you directly link to the css
> >> using
> >> > an
> >> > > > > > "href" you will not have that feature.
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > sahar rostami <sa...@gmail.com>
> >> > > > > > 04/07/2010 11:16 AM
> >> > > > > > Please respond to
> >> > > > > > users@wicket.apache.org
> >> > > > > >
> >> > > > > >
> >> > > > > > To
> >> > > > > > Wicket User Mailing List <us...@wicket.apache.org>
> >> > > > > > cc
> >> > > > > >
> >> > > > > > Subject
> >> > > > > > resource (css) loading
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > Hi all,
> >> > > > > > I want to know how wicket loads css files from location
> >> specified
> >> > in
> >> > > > > > HeaderContributer or using "href" in  header?
> >> > > > > >
> >> > > > > > Thanks in advanced!
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > >
> >> > > > > > Notice: This communication, including any attachments, is
> >> intended
> >> > > > solely
> >> > > > > > for the use of the individual or entity to which it is
> >> addressed.
> >> > > This
> >> > > > > > communication may contain information that is protected from
> >> > > disclosure
> >> > > > > > under State and/or Federal law. Please notify the sender
> >> > immediately
> >> > > if
> >> > > > > > you have received this communication in error and delete this
> >> email
> >> > > > from
> >> > > > > > your system. If you are not the intended recipient, you are
> >> > requested
> >> > > > not
> >> > > > > > to disclose, copy, distribute or take any action in reliance
> on
> >> the
> >> > > > > > contents of this information.
> >> > > > >
> >> > > >
> >> > >
> >> >
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
>

Re: resource (css) loading

Posted by sahar rostami <sa...@gmail.com>.
thank you Apple Grew
I can't receive your attachments. Are you sure they have been attached ?

On Thu, Apr 8, 2010 at 6:34 AM, Apple Grew <ap...@gmail.com> wrote:

> Maybe u can try writing a stream locator as I did. I am attaching my stream
> locator with this mail.
>
> The necessary plumbing required with this is:-
>
> resourceSettings.addResourceFolder("WEB-INF/res");
> resourceSettings.setResourceStreamLocator(new AppStreamLocator());
> getSharedResources().putClassAlias(ApplicationCore.class, "global");
>
> The above needs to be put in your Application class.
>
> Regards,
> Apple Grew
> my blog @ http://blog.applegrew.com/
>
>
>
> On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <li...@visionet.de>wrote:
>
>> You could e.g. write your own page class
>>
>>        class MyCustomersPage extens Page {
>>                @Override
>>                public void renderHead(HtmlHeaderContainer container) {
>>                        super.renderHead(container);
>>                        cssResourceReference =
>> Session.get().getCssResourceReferenceForcustomer()
>>
>>  container.getHeaderResponse().renderCSSReference(cssResourceReference);
>>                }
>>        }
>>
>> And then let each of your pages be a child of MyCustomersPage
>>
>> Stefan
>> -----Ursprüngliche Nachricht-----
>> Von: sahar rostami [mailto:sahar.rostami@gmail.com]
>> Gesendet: Mittwoch, 7. April 2010 18:42
>> An: users@wicket.apache.org
>> Betreff: Re: resource (css) loading
>>
>> thank you moèz
>> but i want to set the location for whole application not a specific file.
>>
>> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <benrhouma.moez@gmail.com
>> >wrote:
>>
>> > In java
>> >
>> > add(new StyleSheetReference("stylesheet", BasePage.class,
>> *"style.css"*));
>> >
>> > style.css is the path of the file style.css (i.e you can write
>> > "/stylesheets/style.css  ...)
>> >
>> > 2010/4/7 sahar rostami <sa...@gmail.com>
>> >
>> > > No , i want to know how wicket knows where is style.css?
>> > >
>> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
>> > benrhouma.moez@gmail.com
>> > > >wrote:
>> > >
>> > > > If I understand , you can use in constructor of class java the
>> > following
>> > > > code:
>> > > > add(new StyleSheetReference("stylesheet", BasePage.class,
>> > "style.css"));
>> > > >
>> > > > and in the html page you add:
>> > > > <link wicket:id="stylesheet" >
>> > > >
>> > > > 2010/4/7 sahar rostami <sa...@gmail.com>
>> > > >
>> > > > > Thanks MZemeck
>> > > > > But my question in another form is "Where wicket load css (which
>> > > class)?"
>> > > > > how wicket knows where look up a css file?
>> > > > >
>> > > > > i'm trying to override default location of css file and read them
>> > from
>> > > > > path(s) specified in application start up ,but i can't because i
>> > don't
>> > > > know
>> > > > > how wicket loads them.
>> > > > >
>> > > > > any idea would help me!
>> > > > > thanks
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
>> > > > >
>> > > > > > One difference I am aware of (and community correct me if I am
>> > > wrong),
>> > > > > > Wicket GZIPs resources.  So if you directly link to the css
>> using
>> > an
>> > > > > > "href" you will not have that feature.
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > sahar rostami <sa...@gmail.com>
>> > > > > > 04/07/2010 11:16 AM
>> > > > > > Please respond to
>> > > > > > users@wicket.apache.org
>> > > > > >
>> > > > > >
>> > > > > > To
>> > > > > > Wicket User Mailing List <us...@wicket.apache.org>
>> > > > > > cc
>> > > > > >
>> > > > > > Subject
>> > > > > > resource (css) loading
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Hi all,
>> > > > > > I want to know how wicket loads css files from location
>> specified
>> > in
>> > > > > > HeaderContributer or using "href" in  header?
>> > > > > >
>> > > > > > Thanks in advanced!
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > >
>> > > > > > Notice: This communication, including any attachments, is
>> intended
>> > > > solely
>> > > > > > for the use of the individual or entity to which it is
>> addressed.
>> > > This
>> > > > > > communication may contain information that is protected from
>> > > disclosure
>> > > > > > under State and/or Federal law. Please notify the sender
>> > immediately
>> > > if
>> > > > > > you have received this communication in error and delete this
>> email
>> > > > from
>> > > > > > your system. If you are not the intended recipient, you are
>> > requested
>> > > > not
>> > > > > > to disclose, copy, distribute or take any action in reliance on
>> the
>> > > > > > contents of this information.
>> > > > >
>> > > >
>> > >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

Re: resource (css) loading

Posted by Apple Grew <ap...@gmail.com>.
Maybe u can try writing a stream locator as I did. I am attaching my stream
locator with this mail.

The necessary plumbing required with this is:-

resourceSettings.addResourceFolder("WEB-INF/res");
resourceSettings.setResourceStreamLocator(new AppStreamLocator());
getSharedResources().putClassAlias(ApplicationCore.class, "global");

The above needs to be put in your Application class.

Regards,
Apple Grew
my blog @ http://blog.applegrew.com/


On Wed, Apr 7, 2010 at 10:19 PM, Stefan Lindner <li...@visionet.de> wrote:

> You could e.g. write your own page class
>
>        class MyCustomersPage extens Page {
>                @Override
>                public void renderHead(HtmlHeaderContainer container) {
>                        super.renderHead(container);
>                        cssResourceReference =
> Session.get().getCssResourceReferenceForcustomer()
>
>  container.getHeaderResponse().renderCSSReference(cssResourceReference);
>                }
>        }
>
> And then let each of your pages be a child of MyCustomersPage
>
> Stefan
> -----Ursprüngliche Nachricht-----
> Von: sahar rostami [mailto:sahar.rostami@gmail.com]
> Gesendet: Mittwoch, 7. April 2010 18:42
> An: users@wicket.apache.org
> Betreff: Re: resource (css) loading
>
> thank you moèz
> but i want to set the location for whole application not a specific file.
>
> On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <benrhouma.moez@gmail.com
> >wrote:
>
> > In java
> >
> > add(new StyleSheetReference("stylesheet", BasePage.class,
> *"style.css"*));
> >
> > style.css is the path of the file style.css (i.e you can write
> > "/stylesheets/style.css  ...)
> >
> > 2010/4/7 sahar rostami <sa...@gmail.com>
> >
> > > No , i want to know how wicket knows where is style.css?
> > >
> > > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> > benrhouma.moez@gmail.com
> > > >wrote:
> > >
> > > > If I understand , you can use in constructor of class java the
> > following
> > > > code:
> > > > add(new StyleSheetReference("stylesheet", BasePage.class,
> > "style.css"));
> > > >
> > > > and in the html page you add:
> > > > <link wicket:id="stylesheet" >
> > > >
> > > > 2010/4/7 sahar rostami <sa...@gmail.com>
> > > >
> > > > > Thanks MZemeck
> > > > > But my question in another form is "Where wicket load css (which
> > > class)?"
> > > > > how wicket knows where look up a css file?
> > > > >
> > > > > i'm trying to override default location of css file and read them
> > from
> > > > > path(s) specified in application start up ,but i can't because i
> > don't
> > > > know
> > > > > how wicket loads them.
> > > > >
> > > > > any idea would help me!
> > > > > thanks
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
> > > > >
> > > > > > One difference I am aware of (and community correct me if I am
> > > wrong),
> > > > > > Wicket GZIPs resources.  So if you directly link to the css using
> > an
> > > > > > "href" you will not have that feature.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > sahar rostami <sa...@gmail.com>
> > > > > > 04/07/2010 11:16 AM
> > > > > > Please respond to
> > > > > > users@wicket.apache.org
> > > > > >
> > > > > >
> > > > > > To
> > > > > > Wicket User Mailing List <us...@wicket.apache.org>
> > > > > > cc
> > > > > >
> > > > > > Subject
> > > > > > resource (css) loading
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Hi all,
> > > > > > I want to know how wicket loads css files from location specified
> > in
> > > > > > HeaderContributer or using "href" in  header?
> > > > > >
> > > > > > Thanks in advanced!
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > Notice: This communication, including any attachments, is
> intended
> > > > solely
> > > > > > for the use of the individual or entity to which it is addressed.
> > > This
> > > > > > communication may contain information that is protected from
> > > disclosure
> > > > > > under State and/or Federal law. Please notify the sender
> > immediately
> > > if
> > > > > > you have received this communication in error and delete this
> email
> > > > from
> > > > > > your system. If you are not the intended recipient, you are
> > requested
> > > > not
> > > > > > to disclose, copy, distribute or take any action in reliance on
> the
> > > > > > contents of this information.
> > > > >
> > > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

AW: resource (css) loading

Posted by Stefan Lindner <li...@visionet.de>.
You could e.g. write your own page class

	class MyCustomersPage extens Page {
		@Override
		public void renderHead(HtmlHeaderContainer container) {
			super.renderHead(container);
			cssResourceReference = Session.get().getCssResourceReferenceForcustomer()
			container.getHeaderResponse().renderCSSReference(cssResourceReference);
		}
	}

And then let each of your pages be a child of MyCustomersPage

Stefan
-----Ursprüngliche Nachricht-----
Von: sahar rostami [mailto:sahar.rostami@gmail.com] 
Gesendet: Mittwoch, 7. April 2010 18:42
An: users@wicket.apache.org
Betreff: Re: resource (css) loading

thank you moèz
but i want to set the location for whole application not a specific file.

On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <be...@gmail.com>wrote:

> In java
>
> add(new StyleSheetReference("stylesheet", BasePage.class, *"style.css"*));
>
> style.css is the path of the file style.css (i.e you can write
> "/stylesheets/style.css  ...)
>
> 2010/4/7 sahar rostami <sa...@gmail.com>
>
> > No , i want to know how wicket knows where is style.css?
> >
> > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> benrhouma.moez@gmail.com
> > >wrote:
> >
> > > If I understand , you can use in constructor of class java the
> following
> > > code:
> > > add(new StyleSheetReference("stylesheet", BasePage.class,
> "style.css"));
> > >
> > > and in the html page you add:
> > > <link wicket:id="stylesheet" >
> > >
> > > 2010/4/7 sahar rostami <sa...@gmail.com>
> > >
> > > > Thanks MZemeck
> > > > But my question in another form is "Where wicket load css (which
> > class)?"
> > > > how wicket knows where look up a css file?
> > > >
> > > > i'm trying to override default location of css file and read them
> from
> > > > path(s) specified in application start up ,but i can't because i
> don't
> > > know
> > > > how wicket loads them.
> > > >
> > > > any idea would help me!
> > > > thanks
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
> > > >
> > > > > One difference I am aware of (and community correct me if I am
> > wrong),
> > > > > Wicket GZIPs resources.  So if you directly link to the css using
> an
> > > > > "href" you will not have that feature.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > sahar rostami <sa...@gmail.com>
> > > > > 04/07/2010 11:16 AM
> > > > > Please respond to
> > > > > users@wicket.apache.org
> > > > >
> > > > >
> > > > > To
> > > > > Wicket User Mailing List <us...@wicket.apache.org>
> > > > > cc
> > > > >
> > > > > Subject
> > > > > resource (css) loading
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi all,
> > > > > I want to know how wicket loads css files from location specified
> in
> > > > > HeaderContributer or using "href" in  header?
> > > > >
> > > > > Thanks in advanced!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Notice: This communication, including any attachments, is intended
> > > solely
> > > > > for the use of the individual or entity to which it is addressed.
> > This
> > > > > communication may contain information that is protected from
> > disclosure
> > > > > under State and/or Federal law. Please notify the sender
> immediately
> > if
> > > > > you have received this communication in error and delete this email
> > > from
> > > > > your system. If you are not the intended recipient, you are
> requested
> > > not
> > > > > to disclose, copy, distribute or take any action in reliance on the
> > > > > contents of this information.
> > > >
> > >
> >
>

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


Re: resource (css) loading

Posted by sahar rostami <sa...@gmail.com>.
thank you moèz
but i want to set the location for whole application not a specific file.

On Wed, Apr 7, 2010 at 8:53 PM, moèz ben rhouma <be...@gmail.com>wrote:

> In java
>
> add(new StyleSheetReference("stylesheet", BasePage.class, *"style.css"*));
>
> style.css is the path of the file style.css (i.e you can write
> "/stylesheets/style.css  ...)
>
> 2010/4/7 sahar rostami <sa...@gmail.com>
>
> > No , i want to know how wicket knows where is style.css?
> >
> > On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <
> benrhouma.moez@gmail.com
> > >wrote:
> >
> > > If I understand , you can use in constructor of class java the
> following
> > > code:
> > > add(new StyleSheetReference("stylesheet", BasePage.class,
> "style.css"));
> > >
> > > and in the html page you add:
> > > <link wicket:id="stylesheet" >
> > >
> > > 2010/4/7 sahar rostami <sa...@gmail.com>
> > >
> > > > Thanks MZemeck
> > > > But my question in another form is "Where wicket load css (which
> > class)?"
> > > > how wicket knows where look up a css file?
> > > >
> > > > i'm trying to override default location of css file and read them
> from
> > > > path(s) specified in application start up ,but i can't because i
> don't
> > > know
> > > > how wicket loads them.
> > > >
> > > > any idea would help me!
> > > > thanks
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
> > > >
> > > > > One difference I am aware of (and community correct me if I am
> > wrong),
> > > > > Wicket GZIPs resources.  So if you directly link to the css using
> an
> > > > > "href" you will not have that feature.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > sahar rostami <sa...@gmail.com>
> > > > > 04/07/2010 11:16 AM
> > > > > Please respond to
> > > > > users@wicket.apache.org
> > > > >
> > > > >
> > > > > To
> > > > > Wicket User Mailing List <us...@wicket.apache.org>
> > > > > cc
> > > > >
> > > > > Subject
> > > > > resource (css) loading
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Hi all,
> > > > > I want to know how wicket loads css files from location specified
> in
> > > > > HeaderContributer or using "href" in  header?
> > > > >
> > > > > Thanks in advanced!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Notice: This communication, including any attachments, is intended
> > > solely
> > > > > for the use of the individual or entity to which it is addressed.
> > This
> > > > > communication may contain information that is protected from
> > disclosure
> > > > > under State and/or Federal law. Please notify the sender
> immediately
> > if
> > > > > you have received this communication in error and delete this email
> > > from
> > > > > your system. If you are not the intended recipient, you are
> requested
> > > not
> > > > > to disclose, copy, distribute or take any action in reliance on the
> > > > > contents of this information.
> > > >
> > >
> >
>

Re: resource (css) loading

Posted by moèz ben rhouma <be...@gmail.com>.
In java

add(new StyleSheetReference("stylesheet", BasePage.class, *"style.css"*));

style.css is the path of the file style.css (i.e you can write
"/stylesheets/style.css  ...)

2010/4/7 sahar rostami <sa...@gmail.com>

> No , i want to know how wicket knows where is style.css?
>
> On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <benrhouma.moez@gmail.com
> >wrote:
>
> > If I understand , you can use in constructor of class java the following
> > code:
> > add(new StyleSheetReference("stylesheet", BasePage.class, "style.css"));
> >
> > and in the html page you add:
> > <link wicket:id="stylesheet" >
> >
> > 2010/4/7 sahar rostami <sa...@gmail.com>
> >
> > > Thanks MZemeck
> > > But my question in another form is "Where wicket load css (which
> class)?"
> > > how wicket knows where look up a css file?
> > >
> > > i'm trying to override default location of css file and read them from
> > > path(s) specified in application start up ,but i can't because i don't
> > know
> > > how wicket loads them.
> > >
> > > any idea would help me!
> > > thanks
> > >
> > >
> > >
> > >
> > >
> > > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
> > >
> > > > One difference I am aware of (and community correct me if I am
> wrong),
> > > > Wicket GZIPs resources.  So if you directly link to the css using an
> > > > "href" you will not have that feature.
> > > >
> > > >
> > > >
> > > >
> > > > sahar rostami <sa...@gmail.com>
> > > > 04/07/2010 11:16 AM
> > > > Please respond to
> > > > users@wicket.apache.org
> > > >
> > > >
> > > > To
> > > > Wicket User Mailing List <us...@wicket.apache.org>
> > > > cc
> > > >
> > > > Subject
> > > > resource (css) loading
> > > >
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Hi all,
> > > > I want to know how wicket loads css files from location specified in
> > > > HeaderContributer or using "href" in  header?
> > > >
> > > > Thanks in advanced!
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Notice: This communication, including any attachments, is intended
> > solely
> > > > for the use of the individual or entity to which it is addressed.
> This
> > > > communication may contain information that is protected from
> disclosure
> > > > under State and/or Federal law. Please notify the sender immediately
> if
> > > > you have received this communication in error and delete this email
> > from
> > > > your system. If you are not the intended recipient, you are requested
> > not
> > > > to disclose, copy, distribute or take any action in reliance on the
> > > > contents of this information.
> > >
> >
>

Re: resource (css) loading

Posted by sahar rostami <sa...@gmail.com>.
No , i want to know how wicket knows where is style.css?

On Wed, Apr 7, 2010 at 8:24 PM, moèz ben rhouma <be...@gmail.com>wrote:

> If I understand , you can use in constructor of class java the following
> code:
> add(new StyleSheetReference("stylesheet", BasePage.class, "style.css"));
>
> and in the html page you add:
> <link wicket:id="stylesheet" >
>
> 2010/4/7 sahar rostami <sa...@gmail.com>
>
> > Thanks MZemeck
> > But my question in another form is "Where wicket load css (which class)?"
> > how wicket knows where look up a css file?
> >
> > i'm trying to override default location of css file and read them from
> > path(s) specified in application start up ,but i can't because i don't
> know
> > how wicket loads them.
> >
> > any idea would help me!
> > thanks
> >
> >
> >
> >
> >
> > On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
> >
> > > One difference I am aware of (and community correct me if I am wrong),
> > > Wicket GZIPs resources.  So if you directly link to the css using an
> > > "href" you will not have that feature.
> > >
> > >
> > >
> > >
> > > sahar rostami <sa...@gmail.com>
> > > 04/07/2010 11:16 AM
> > > Please respond to
> > > users@wicket.apache.org
> > >
> > >
> > > To
> > > Wicket User Mailing List <us...@wicket.apache.org>
> > > cc
> > >
> > > Subject
> > > resource (css) loading
> > >
> > >
> > >
> > >
> > >
> > >
> > > Hi all,
> > > I want to know how wicket loads css files from location specified in
> > > HeaderContributer or using "href" in  header?
> > >
> > > Thanks in advanced!
> > >
> > >
> > >
> > >
> > >
> > > Notice: This communication, including any attachments, is intended
> solely
> > > for the use of the individual or entity to which it is addressed. This
> > > communication may contain information that is protected from disclosure
> > > under State and/or Federal law. Please notify the sender immediately if
> > > you have received this communication in error and delete this email
> from
> > > your system. If you are not the intended recipient, you are requested
> not
> > > to disclose, copy, distribute or take any action in reliance on the
> > > contents of this information.
> >
>

Re: resource (css) loading

Posted by moèz ben rhouma <be...@gmail.com>.
If I understand , you can use in constructor of class java the following
code:
add(new StyleSheetReference("stylesheet", BasePage.class, "style.css"));

and in the html page you add:
<link wicket:id="stylesheet" >

2010/4/7 sahar rostami <sa...@gmail.com>

> Thanks MZemeck
> But my question in another form is "Where wicket load css (which class)?"
> how wicket knows where look up a css file?
>
> i'm trying to override default location of css file and read them from
> path(s) specified in application start up ,but i can't because i don't know
> how wicket loads them.
>
> any idea would help me!
> thanks
>
>
>
>
>
> On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:
>
> > One difference I am aware of (and community correct me if I am wrong),
> > Wicket GZIPs resources.  So if you directly link to the css using an
> > "href" you will not have that feature.
> >
> >
> >
> >
> > sahar rostami <sa...@gmail.com>
> > 04/07/2010 11:16 AM
> > Please respond to
> > users@wicket.apache.org
> >
> >
> > To
> > Wicket User Mailing List <us...@wicket.apache.org>
> > cc
> >
> > Subject
> > resource (css) loading
> >
> >
> >
> >
> >
> >
> > Hi all,
> > I want to know how wicket loads css files from location specified in
> > HeaderContributer or using "href" in  header?
> >
> > Thanks in advanced!
> >
> >
> >
> >
> >
> > Notice: This communication, including any attachments, is intended solely
> > for the use of the individual or entity to which it is addressed. This
> > communication may contain information that is protected from disclosure
> > under State and/or Federal law. Please notify the sender immediately if
> > you have received this communication in error and delete this email from
> > your system. If you are not the intended recipient, you are requested not
> > to disclose, copy, distribute or take any action in reliance on the
> > contents of this information.
>

Re: resource (css) loading

Posted by sahar rostami <sa...@gmail.com>.
Thanks MZemeck
But my question in another form is "Where wicket load css (which class)?"
how wicket knows where look up a css file?

i'm trying to override default location of css file and read them from
path(s) specified in application start up ,but i can't because i don't know
how wicket loads them.

any idea would help me!
thanks





On Wed, Apr 7, 2010 at 7:50 PM, <MZ...@osc.state.ny.us> wrote:

> One difference I am aware of (and community correct me if I am wrong),
> Wicket GZIPs resources.  So if you directly link to the css using an
> "href" you will not have that feature.
>
>
>
>
> sahar rostami <sa...@gmail.com>
> 04/07/2010 11:16 AM
> Please respond to
> users@wicket.apache.org
>
>
> To
> Wicket User Mailing List <us...@wicket.apache.org>
> cc
>
> Subject
> resource (css) loading
>
>
>
>
>
>
> Hi all,
> I want to know how wicket loads css files from location specified in
> HeaderContributer or using "href" in  header?
>
> Thanks in advanced!
>
>
>
>
>
> Notice: This communication, including any attachments, is intended solely
> for the use of the individual or entity to which it is addressed. This
> communication may contain information that is protected from disclosure
> under State and/or Federal law. Please notify the sender immediately if
> you have received this communication in error and delete this email from
> your system. If you are not the intended recipient, you are requested not
> to disclose, copy, distribute or take any action in reliance on the
> contents of this information.

Re: resource (css) loading

Posted by MZ...@osc.state.ny.us.
One difference I am aware of (and community correct me if I am wrong), 
Wicket GZIPs resources.  So if you directly link to the css using an 
"href" you will not have that feature.




sahar rostami <sa...@gmail.com> 
04/07/2010 11:16 AM
Please respond to
users@wicket.apache.org


To
Wicket User Mailing List <us...@wicket.apache.org>
cc

Subject
resource (css) loading






Hi all,
I want to know how wicket loads css files from location specified in
HeaderContributer or using "href" in  header?

Thanks in advanced!





Notice: This communication, including any attachments, is intended solely 
for the use of the individual or entity to which it is addressed. This 
communication may contain information that is protected from disclosure 
under State and/or Federal law. Please notify the sender immediately if 
you have received this communication in error and delete this email from 
your system. If you are not the intended recipient, you are requested not 
to disclose, copy, distribute or take any action in reliance on the 
contents of this information.