You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stefan Renz <s....@efonds.com> on 2013/01/22 16:15:02 UTC
Additional CSS HeaderItems in Wicket/WiQuery 6?
Hi,
how would I specify to load an additional stylesheet when Wicket loads
the WiQueryCoreThemeResourceReference?
Background: I'd like to tweak some of the jquery-ui styles by providing
a custom CSS. I want to make sure that whenever wiquery's core resource
loads, the additional CSS loads as well.
I tried Application#addResourceReplacement(), but this replaces the core
resource entirely, and even though I specify it in #getDependency of my
custom resource reference.
I also tried ResourceBundles, but that didn't work, either -- only one
of each loads. Maybe I just don't get the API...
In WiQuery 1.5, I used IThemableApplication for that.
Thanks for your help,
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Additional CSS HeaderItems in Wicket/WiQuery 6?
Posted by Ernesto Reinaldo Barreiro <re...@gmail.com>.
IMHO it would be simpler for users to restore IThemableApplication and plug
it at CoreUIJavaScriptResourceReference#getDependencies()
On Tue, Jan 22, 2013 at 4:23 PM, Martin Grigorov <mg...@apache.org>wrote:
> Hi,
>
> With the bundle - register a bundle that contains
> WiQueryCoreThemeResourceReference and your Css reference for the custom Css
> resource.
>
> With the replacement -
> create
> class MyCssResRef extends CssResourceReference {
> public MyCssResRef() { super(MyCssResRef.class, "my.css") }
>
> @Override public Iterable getDependencies() { return aListThatContains
> WiQueryCoreThemeCssHeaderItem;}
> }
>
> and register it as replacement.
>
> I'd use the bundle approach.
>
>
> On Tue, Jan 22, 2013 at 5:15 PM, Stefan Renz <s....@efonds.com> wrote:
>
> > Hi,
> >
> > how would I specify to load an additional stylesheet when Wicket loads
> > the WiQueryCoreThemeResourceReference?
> >
> > Background: I'd like to tweak some of the jquery-ui styles by providing
> > a custom CSS. I want to make sure that whenever wiquery's core resource
> > loads, the additional CSS loads as well.
> >
> > I tried Application#addResourceReplacement(), but this replaces the core
> > resource entirely, and even though I specify it in #getDependency of my
> > custom resource reference.
> >
> > I also tried ResourceBundles, but that didn't work, either -- only one
> > of each loads. Maybe I just don't get the API...
> >
> > In WiQuery 1.5, I used IThemableApplication for that.
> >
> > Thanks for your help,
> > Stefan
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com <http://jweekend.com/>
>
--
Regards - Ernesto Reinaldo Barreiro
Antilia Soft
http://antiliasoft.com/ <http://antiliasoft.com/antilia>
Re: Additional CSS HeaderItems in Wicket/WiQuery 6?
Posted by Stefan Renz <s....@efonds.com>.
Hi,
so after double checking and a bit of trial and error, I got it to work.
Somewhere in the documentation I read "if in doubt, try the easy path".
Keep it simple, stupid :-)
Here it goes:
CustomResourceReference extends TextTemplateResourceReference, which is
interpolates ${}-variables in the CSS template resource against a
variable map. That way, I can customize a few CSS classes if JQuery-UI
without rolling out an entire theme.
CustomResourceReference#getDependencies returns
WiQueryCoreThemeResourceReference.
Now, in order to make Wicket render both HeaderItems for the core jquery
ui theme CSS, and the customization, simply simply add a ResourceBundle
in the application initializer:
app.getResourceBundles().addBundle( CssHeaderItem.forReference(
CustomResourceReference.get() ) );
No more than that. I previously explicitly called
#addProvidedResources() on the bundle with all the dependencies. As I
suspected, I just did not grasp the Wicket API; the bundle adds the
dependencies itself.
Quite elegant, just like the rest of Wicket and WiQuery :-)
Thanks for the help.
Bye
Stefan
Stefan Renz wrote:
> Hi Martin,
>
> thanks for the quick response.
>
> Martin Grigorov wrote:
>> Hi,
>>
>> With the bundle - register a bundle that contains
>> WiQueryCoreThemeResourceReference and your Css reference for the custom Css
>> resource.
>
> Tried that, only one of the CSS loads, but I'll double check.
>
>> With the replacement -
>> create
>> class MyCssResRef extends CssResourceReference {
>> public MyCssResRef() { super(MyCssResRef.class, "my.css") }
>>
>> @Override public Iterable getDependencies() { return aListThatContains
>> WiQueryCoreThemeCssHeaderItem;}
>> }
>>
>> and register it as replacement.
>
> Tried that, getDependencies() never isn't called. Once again, I will
> double check.
>
> Thanks, bye
> Stefan
>
>> I'd use the bundle approach.
>>
>>
>> On Tue, Jan 22, 2013 at 5:15 PM, Stefan Renz <s....@efonds.com> wrote:
>>
>>> Hi,
>>>
>>> how would I specify to load an additional stylesheet when Wicket loads
>>> the WiQueryCoreThemeResourceReference?
>>>
>>> Background: I'd like to tweak some of the jquery-ui styles by providing
>>> a custom CSS. I want to make sure that whenever wiquery's core resource
>>> loads, the additional CSS loads as well.
>>>
>>> I tried Application#addResourceReplacement(), but this replaces the core
>>> resource entirely, and even though I specify it in #getDependency of my
>>> custom resource reference.
>>>
>>> I also tried ResourceBundles, but that didn't work, either -- only one
>>> of each loads. Maybe I just don't get the API...
>>>
>>> In WiQuery 1.5, I used IThemableApplication for that.
>>>
>>> Thanks for your help,
>>> Stefan
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>
--
im Auftrag der eFonds Solutions AG, +49-89-579494-3417
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Additional CSS HeaderItems in Wicket/WiQuery 6?
Posted by Stefan Renz <s....@efonds.com>.
Hi Martin,
thanks for the quick response.
Martin Grigorov wrote:
> Hi,
>
> With the bundle - register a bundle that contains
> WiQueryCoreThemeResourceReference and your Css reference for the custom Css
> resource.
Tried that, only one of the CSS loads, but I'll double check.
>
> With the replacement -
> create
> class MyCssResRef extends CssResourceReference {
> public MyCssResRef() { super(MyCssResRef.class, "my.css") }
>
> @Override public Iterable getDependencies() { return aListThatContains
> WiQueryCoreThemeCssHeaderItem;}
> }
>
> and register it as replacement.
Tried that, getDependencies() never isn't called. Once again, I will
double check.
Thanks, bye
Stefan
>
> I'd use the bundle approach.
>
>
> On Tue, Jan 22, 2013 at 5:15 PM, Stefan Renz <s....@efonds.com> wrote:
>
>> Hi,
>>
>> how would I specify to load an additional stylesheet when Wicket loads
>> the WiQueryCoreThemeResourceReference?
>>
>> Background: I'd like to tweak some of the jquery-ui styles by providing
>> a custom CSS. I want to make sure that whenever wiquery's core resource
>> loads, the additional CSS loads as well.
>>
>> I tried Application#addResourceReplacement(), but this replaces the core
>> resource entirely, and even though I specify it in #getDependency of my
>> custom resource reference.
>>
>> I also tried ResourceBundles, but that didn't work, either -- only one
>> of each loads. Maybe I just don't get the API...
>>
>> In WiQuery 1.5, I used IThemableApplication for that.
>>
>> Thanks for your help,
>> Stefan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
--
im Auftrag der eFonds Solutions AG, +49-89-579494-3417
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Additional CSS HeaderItems in Wicket/WiQuery 6?
Posted by Martin Grigorov <mg...@apache.org>.
Hi,
With the bundle - register a bundle that contains
WiQueryCoreThemeResourceReference and your Css reference for the custom Css
resource.
With the replacement -
create
class MyCssResRef extends CssResourceReference {
public MyCssResRef() { super(MyCssResRef.class, "my.css") }
@Override public Iterable getDependencies() { return aListThatContains
WiQueryCoreThemeCssHeaderItem;}
}
and register it as replacement.
I'd use the bundle approach.
On Tue, Jan 22, 2013 at 5:15 PM, Stefan Renz <s....@efonds.com> wrote:
> Hi,
>
> how would I specify to load an additional stylesheet when Wicket loads
> the WiQueryCoreThemeResourceReference?
>
> Background: I'd like to tweak some of the jquery-ui styles by providing
> a custom CSS. I want to make sure that whenever wiquery's core resource
> loads, the additional CSS loads as well.
>
> I tried Application#addResourceReplacement(), but this replaces the core
> resource entirely, and even though I specify it in #getDependency of my
> custom resource reference.
>
> I also tried ResourceBundles, but that didn't work, either -- only one
> of each loads. Maybe I just don't get the API...
>
> In WiQuery 1.5, I used IThemableApplication for that.
>
> Thanks for your help,
> Stefan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>