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

-- 
im Auftrag der eFonds Solutions AG, +49-89-579494-3417


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

Reply via email to