Updated Branches: refs/heads/master 88191edb1 -> 755539e84
WICKET-5410 Remove setting interfaces Remove IJavaScriptLibrarySettings interface Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/755539e8 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/755539e8 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/755539e8 Branch: refs/heads/master Commit: 755539e84f927ed37f0cab3022e8f850e74ff23e Parents: 88191ed Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Tue Nov 12 11:45:18 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Tue Nov 12 11:45:18 2013 +0200 ---------------------------------------------------------------------- .../java/org/apache/wicket/Application.java | 7 +- .../markup/head/OnDomReadyHeaderItem.java | 4 +- .../wicket/markup/head/OnEventHeaderItem.java | 6 +- .../wicket/markup/head/OnLoadHeaderItem.java | 6 +- .../resource/CoreLibrariesContributor.java | 6 +- .../resource/JQueryResourceReference.java | 7 +- .../settings/IJavaScriptLibrarySettings.java | 85 -------------------- .../settings/def/JavaScriptLibrarySettings.java | 52 +++++++++--- 8 files changed, 60 insertions(+), 113 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/Application.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/Application.java b/wicket-core/src/main/java/org/apache/wicket/Application.java index 8ddaaed..b7cb8d8 100644 --- a/wicket-core/src/main/java/org/apache/wicket/Application.java +++ b/wicket-core/src/main/java/org/apache/wicket/Application.java @@ -84,7 +84,6 @@ import org.apache.wicket.response.filter.EmptySrcAttributeCheckFilter; import org.apache.wicket.session.DefaultPageFactory; import org.apache.wicket.session.ISessionStore; import org.apache.wicket.session.ISessionStore.UnboundListener; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; import org.apache.wicket.settings.IMarkupSettings; import org.apache.wicket.settings.IPageSettings; import org.apache.wicket.settings.IRequestCycleSettings; @@ -1021,7 +1020,7 @@ public abstract class Application implements UnboundListener, IEventSink private ApplicationSettings applicationSettings; /** JavaScriptLibrary settings */ - private IJavaScriptLibrarySettings javaScriptLibrarySettings; + private JavaScriptLibrarySettings javaScriptLibrarySettings; /** Debug Settings */ private DebugSettings debugSettings; @@ -1083,7 +1082,7 @@ public abstract class Application implements UnboundListener, IEventSink * @return Application's JavaScriptLibrary settings * @since 6.0 */ - public final IJavaScriptLibrarySettings getJavaScriptLibrarySettings() + public final JavaScriptLibrarySettings getJavaScriptLibrarySettings() { checkSettingsAvailable(); if (javaScriptLibrarySettings == null) @@ -1098,7 +1097,7 @@ public abstract class Application implements UnboundListener, IEventSink * @param javaScriptLibrarySettings */ public final void setJavaScriptLibrarySettings( - final IJavaScriptLibrarySettings javaScriptLibrarySettings) + final JavaScriptLibrarySettings javaScriptLibrarySettings) { this.javaScriptLibrarySettings = javaScriptLibrarySettings; } http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java index a4c1dbc..df12e1b 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnDomReadyHeaderItem.java @@ -22,7 +22,7 @@ import java.util.List; import org.apache.wicket.Application; import org.apache.wicket.request.Response; import org.apache.wicket.request.resource.ResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; +import org.apache.wicket.settings.def.JavaScriptLibrarySettings; import org.apache.wicket.util.lang.Args; import org.apache.wicket.core.util.string.JavaScriptUtils; @@ -103,7 +103,7 @@ public class OnDomReadyHeaderItem extends HeaderItem @Override public List<HeaderItem> getDependencies() { - IJavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); + JavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); ResourceReference wicketEventReference = ajaxSettings.getWicketEventReference(); List<HeaderItem> dependencies = super.getDependencies(); dependencies.add(JavaScriptHeaderItem.forReference(wicketEventReference)); http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java index 4949dcd..a3e072c 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnEventHeaderItem.java @@ -21,11 +21,11 @@ import java.util.List; import java.util.Locale; import org.apache.wicket.Application; +import org.apache.wicket.core.util.string.JavaScriptUtils; import org.apache.wicket.request.Response; import org.apache.wicket.request.resource.ResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; +import org.apache.wicket.settings.def.JavaScriptLibrarySettings; import org.apache.wicket.util.lang.Args; -import org.apache.wicket.core.util.string.JavaScriptUtils; /** * {@link HeaderItem} for event triggered scripts. @@ -157,7 +157,7 @@ public class OnEventHeaderItem extends HeaderItem @Override public List<HeaderItem> getDependencies() { - IJavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); + JavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); ResourceReference wicketEventReference = ajaxSettings.getWicketEventReference(); List<HeaderItem> dependencies = super.getDependencies(); dependencies.add(JavaScriptHeaderItem.forReference(wicketEventReference)); http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java index 45e91e7..7b099b9 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/OnLoadHeaderItem.java @@ -20,11 +20,11 @@ import java.util.Collections; import java.util.List; import org.apache.wicket.Application; +import org.apache.wicket.core.util.string.JavaScriptUtils; import org.apache.wicket.request.Response; import org.apache.wicket.request.resource.ResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; +import org.apache.wicket.settings.def.JavaScriptLibrarySettings; import org.apache.wicket.util.lang.Args; -import org.apache.wicket.core.util.string.JavaScriptUtils; /** * {@link HeaderItem} for scripts that need to be executed after the entire page is loaded. @@ -103,7 +103,7 @@ public class OnLoadHeaderItem extends HeaderItem @Override public List<HeaderItem> getDependencies() { - IJavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); + JavaScriptLibrarySettings ajaxSettings = Application.get().getJavaScriptLibrarySettings(); ResourceReference wicketEventReference = ajaxSettings.getWicketEventReference(); List<HeaderItem> dependencies = super.getDependencies(); dependencies.add(JavaScriptHeaderItem.forReference(wicketEventReference)); http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/resource/CoreLibrariesContributor.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/CoreLibrariesContributor.java b/wicket-core/src/main/java/org/apache/wicket/resource/CoreLibrariesContributor.java index 666bb3d..f4722af 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/CoreLibrariesContributor.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/CoreLibrariesContributor.java @@ -20,8 +20,8 @@ import org.apache.wicket.Application; import org.apache.wicket.markup.head.IHeaderResponse; import org.apache.wicket.markup.head.JavaScriptHeaderItem; import org.apache.wicket.request.resource.ResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; import org.apache.wicket.settings.def.DebugSettings; +import org.apache.wicket.settings.def.JavaScriptLibrarySettings; /** * A helper class that contributes all required JavaScript resources needed for Wicket Ajax @@ -41,7 +41,7 @@ public class CoreLibrariesContributor */ public static void contribute(final Application application, final IHeaderResponse response) { - IJavaScriptLibrarySettings jsLibrarySettings = application.getJavaScriptLibrarySettings(); + JavaScriptLibrarySettings jsLibrarySettings = application.getJavaScriptLibrarySettings(); ResourceReference wicketEventReference = jsLibrarySettings.getWicketEventReference(); response.render(JavaScriptHeaderItem.forReference(wicketEventReference)); } @@ -57,7 +57,7 @@ public class CoreLibrariesContributor */ public static void contributeAjax(final Application application, final IHeaderResponse response) { - IJavaScriptLibrarySettings jsLibrarySettings = application.getJavaScriptLibrarySettings(); + JavaScriptLibrarySettings jsLibrarySettings = application.getJavaScriptLibrarySettings(); final DebugSettings debugSettings = application.getDebugSettings(); if (debugSettings.isAjaxDebugModeEnabled()) http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java b/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java index 931eb4a..cb6b4fb 100644 --- a/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java +++ b/wicket-core/src/main/java/org/apache/wicket/resource/JQueryResourceReference.java @@ -17,13 +17,13 @@ package org.apache.wicket.resource; import org.apache.wicket.request.resource.JavaScriptResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; /** * 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. + * {@link org.apache.wicket.settings.def.JavaScriptLibrarySettings#getJQueryReference()} + * to prevent version conflicts. * * @author papegaaij */ @@ -40,7 +40,8 @@ public class JQueryResourceReference extends JavaScriptResourceReference /** * Normally you should not use this method, but use - * {@link IJavaScriptLibrarySettings#getJQueryReference()} to prevent version conflicts. + * {@link org.apache.wicket.settings.def.JavaScriptLibrarySettings#getJQueryReference()} + * to prevent version conflicts. * * @return the single instance of the resource reference */ http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/settings/IJavaScriptLibrarySettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IJavaScriptLibrarySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IJavaScriptLibrarySettings.java deleted file mode 100644 index 12b561c..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/settings/IJavaScriptLibrarySettings.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.wicket.settings; - -import org.apache.wicket.request.resource.ResourceReference; -import org.apache.wicket.resource.JQueryResourceReference; - - -/** - * Interface for settings related to the JavaScript libraries that come with and are used by Wicket. - * <p> - * With these settings the user application can replace the JavaScript libraries used for Wicket's - * event and Ajax functionality. By default Wicket uses {@linkplain JQueryResourceReference JQuery} - * as a backing library but via this interface the application can replace the implementations of - * wicket-event.js, wicket-ajax.js and wicket-ajax-debug.js to use implementations on other - * libraries, such as YUI or DOJO. The resource reference implementations need to specify the - * {@linkplain ResourceReference#getDependencies() dependency} on the backing library, if needed. - * - * @since 6.0 - */ -public interface IJavaScriptLibrarySettings -{ - - /** - * @return the reference to the JQuery JavaScript library used as backing library for - * wicket-event and wicket-ajax - */ - ResourceReference getJQueryReference(); - - /** - * @param reference - * a reference to the JQuery JavaScript library used as backing library for - * wicket-event and wicket-ajax - */ - void setJQueryReference(ResourceReference reference); - - /** - * @return the reference to the implementation of wicket-event.js - */ - ResourceReference getWicketEventReference(); - - /** - * @param reference - * a reference to the implementation of wicket-event.js - */ - void setWicketEventReference(ResourceReference reference); - - /** - * @return the reference to the implementation of wicket-ajax.js - */ - ResourceReference getWicketAjaxReference(); - - /** - * @param reference - * a reference to the implementation of wicket-ajax.js - */ - void setWicketAjaxReference(ResourceReference reference); - - /** - * The Wicket Ajax Debug Window. - * - * @return the reference to the implementation of wicket-ajax-debug.js - */ - ResourceReference getWicketAjaxDebugReference(); - - /** - * @param reference - * a reference to the implementation of wicket-ajax-debug.js - */ - void setWicketAjaxDebugReference(ResourceReference reference); -} http://git-wip-us.apache.org/repos/asf/wicket/blob/755539e8/wicket-core/src/main/java/org/apache/wicket/settings/def/JavaScriptLibrarySettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/JavaScriptLibrarySettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/JavaScriptLibrarySettings.java index 8835a8b..e0bf694 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/def/JavaScriptLibrarySettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/JavaScriptLibrarySettings.java @@ -21,13 +21,21 @@ import org.apache.wicket.ajax.WicketAjaxJQueryResourceReference; import org.apache.wicket.ajax.WicketEventJQueryResourceReference; import org.apache.wicket.request.resource.ResourceReference; import org.apache.wicket.resource.JQueryResourceReference; -import org.apache.wicket.settings.IJavaScriptLibrarySettings; import org.apache.wicket.util.lang.Args; /** + * Interface for settings related to the JavaScript libraries that come with and are used by Wicket. + * <p> + * With these settings the user application can replace the JavaScript libraries used for Wicket's + * event and Ajax functionality. By default Wicket uses {@linkplain JQueryResourceReference JQuery} + * as a backing library but via this interface the application can replace the implementations of + * wicket-event.js, wicket-ajax.js and wicket-ajax-debug.js to use implementations on other + * libraries, such as YUI or DOJO. The resource reference implementations need to specify the + * {@linkplain ResourceReference#getDependencies() dependency} on the backing library, if needed. + * * @since 6.0 */ -public class JavaScriptLibrarySettings implements IJavaScriptLibrarySettings +public class JavaScriptLibrarySettings { private ResourceReference jQueryReference = JQueryResourceReference.get(); @@ -37,49 +45,73 @@ public class JavaScriptLibrarySettings implements IJavaScriptLibrarySettings private ResourceReference wicketAjaxDebugReference = WicketAjaxDebugJQueryResourceReference.get(); - @Override + /** + * @return the reference to the JQuery JavaScript library used as backing library for + * wicket-event and wicket-ajax + */ public ResourceReference getJQueryReference() { return jQueryReference; } - @Override + /** + * @param jQueryReference + * a reference to the JQuery JavaScript library used as backing library for + * wicket-event and wicket-ajax + */ public void setJQueryReference(ResourceReference jQueryReference) { this.jQueryReference = Args.notNull(jQueryReference, "jQueryReference"); } - @Override + /** + * @return the reference to the implementation of wicket-event.js + */ public ResourceReference getWicketEventReference() { return wicketEventReference; } - @Override + /** + * @param wicketEventReference + * a reference to the implementation of wicket-event.js + */ public void setWicketEventReference(ResourceReference wicketEventReference) { this.wicketEventReference = Args.notNull(wicketEventReference, "wicketEventReference"); } - @Override + /** + * @return the reference to the implementation of wicket-ajax.js + */ public ResourceReference getWicketAjaxReference() { return wicketAjaxReference; } - @Override + /** + * @param wicketAjaxReference + * a reference to the implementation of wicket-ajax.js + */ public void setWicketAjaxReference(ResourceReference wicketAjaxReference) { this.wicketAjaxReference = Args.notNull(wicketAjaxReference, "wicketAjaxReference"); } - @Override + /** + * The Wicket Ajax Debug Window. + * + * @return the reference to the implementation of wicket-ajax-debug.js + */ public ResourceReference getWicketAjaxDebugReference() { return wicketAjaxDebugReference; } - @Override + /** + * @param wicketAjaxDebugReference + * a reference to the implementation of wicket-ajax-debug.js + */ public void setWicketAjaxDebugReference(ResourceReference wicketAjaxDebugReference) { this.wicketAjaxDebugReference = Args.notNull(wicketAjaxDebugReference,
