On Wed, Jul 25, 2012 at 5:47 PM, Bertrand Guay-Paquet
<[email protected]> wrote:
>
>>> -There are references to
>>> IJavaScriptLibrarySettings#setBackingLibraryReference which does not
>>> exist
>>> anymore. Is it still possible to change the backing library? I personally
>>> don't want to, but the disparity between the doc and the code confused
>>> me.
>>
>> Fixed!
>> org.apache.wicket.settings.IJavaScriptLibrarySettings#setJQueryReference
>>
>
> Maybe I don't understand it properly, but the possibility of changing the
> Wicket's backing library does not seem consistent. The names of the classes
> and methods for this functionality are one source of confusion. In the first
> versions of this code, the term "BackingLibrary" was used all over the place
> but it is now replaced by "JQuery".
Blame Emond for that. He changed it and he didn't change the docs in the Wiki...
> For me, it is confusing that
> Application.get().getJavaScriptLibrarySettings().getJQueryReference() could
> return a reference to something which is not jQuery at all (e.g. DOJO).
It wont. It will return jQuery - one version or another.
If you use Dojo then you will need WicketDojoAjaxReference which will
depend on DojoAjaxReference (DAR), but DAR should not be registered in
IJSLibrarySettings at all.
>
> Consider a subclass of JQueryPluginResourceReference whose javadoc states :
> * Base class for JavaScript resources that are JQuery plugins. This class
> already defines a
> * dependency on JQuery.
> In its getDependencies() method, it looks up
> Application.get().getJavaScriptLibrarySettings().getJQueryReference() which
> can actually be something other than jQuery.
>
> To get around this and protect my ResourceReference from a backing library
> change, I thought I would add the jQuery dependency myself with
> JQueryResourceReference, but its javadoc states:
> * The resource reference for the jquery javascript library as released with
> Wicket. To add a JQuery
> * resource reference to a component, do not use this reference, but use
> * {@link IJavaScriptLibrarySettings#getJQueryReference()} to prevent
> version conflicts.
> So I'm back to square one.
>
> Of course, personally I don't plan on using another backing library, but if
> this is something which Wicket wants to allow, I think it would be essential
> to address these issues. I wish I could offer a solution, but I don't
> currently have one so I decided to share this before 6.0 is released.
To re-iterate - #setJQueryReference() should be used only to change
the version of jquery.js if you need.
I'll update the Wiki page.
>
> Regards,
> Bertrand
--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com