Updated Branches: refs/heads/master b2d13b276 -> b4a864b09
WICKET-5410 Remove setting interfaces Remove IMarkupSettings interface Project: http://git-wip-us.apache.org/repos/asf/wicket/repo Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/b4a864b0 Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/b4a864b0 Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/b4a864b0 Branch: refs/heads/master Commit: b4a864b0963303d7338a716355ae4401f8f4d122 Parents: b2d13b2 Author: Martin Tzvetanov Grigorov <[email protected]> Authored: Wed Nov 13 10:17:12 2013 +0200 Committer: Martin Tzvetanov Grigorov <[email protected]> Committed: Wed Nov 13 10:17:12 2013 +0200 ---------------------------------------------------------------------- .../java/org/apache/wicket/Application.java | 7 +- .../wicket/markup/AbstractMarkupParser.java | 6 +- .../org/apache/wicket/markup/IMarkupCache.java | 8 +- .../org/apache/wicket/markup/MarkupCache.java | 7 +- .../apache/wicket/settings/IMarkupSettings.java | 150 ------------------- .../wicket/settings/def/MarkupSettings.java | 98 ++++++++---- .../apache/wicket/markup/MarkupParserTest.java | 10 +- .../apache/wicket/jmx/MarkupSettingsMBean.java | 6 +- 8 files changed, 87 insertions(+), 205 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/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 90d445c..1a81c58 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.IMarkupSettings; import org.apache.wicket.settings.def.ApplicationSettings; import org.apache.wicket.settings.def.DebugSettings; import org.apache.wicket.settings.def.ExceptionSettings; @@ -1026,7 +1025,7 @@ public abstract class Application implements UnboundListener, IEventSink private FrameworkSettings frameworkSettings; /** The Markup Settings */ - private IMarkupSettings markupSettings; + private MarkupSettings markupSettings; /** The Page Settings */ private PageSettings pageSettings; @@ -1209,7 +1208,7 @@ public abstract class Application implements UnboundListener, IEventSink /** * @return Application's markup related settings */ - public IMarkupSettings getMarkupSettings() + public MarkupSettings getMarkupSettings() { checkSettingsAvailable(); if (markupSettings == null) @@ -1223,7 +1222,7 @@ public abstract class Application implements UnboundListener, IEventSink * * @param markupSettings */ - public final void setMarkupSettings(final IMarkupSettings markupSettings) + public final void setMarkupSettings(final MarkupSettings markupSettings) { this.markupSettings = markupSettings; } http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/main/java/org/apache/wicket/markup/AbstractMarkupParser.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/AbstractMarkupParser.java b/wicket-core/src/main/java/org/apache/wicket/markup/AbstractMarkupParser.java index 70e5e11..762ac57 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/AbstractMarkupParser.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/AbstractMarkupParser.java @@ -27,7 +27,7 @@ import org.apache.wicket.markup.parser.IMarkupFilter; import org.apache.wicket.markup.parser.IXmlPullParser; import org.apache.wicket.markup.parser.XmlPullParser; import org.apache.wicket.markup.parser.filter.RootMarkupFilter; -import org.apache.wicket.settings.IMarkupSettings; +import org.apache.wicket.settings.def.MarkupSettings; import org.apache.wicket.util.resource.ResourceStreamNotFoundException; import org.apache.wicket.util.resource.StringResourceStream; import org.slf4j.Logger; @@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory; * * @see IMarkupFilter * @see MarkupFactory - * @see IMarkupSettings + * @see MarkupSettings * * @author Jonathan Locke * @author Juergen Donnerstag @@ -68,7 +68,7 @@ public abstract class AbstractMarkupParser private final Markup markup; /** Temporary variable: Application.get().getMarkupSettings() */ - private final IMarkupSettings markupSettings; + private final MarkupSettings markupSettings; private final List<IMarkupFilter> filters; http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java b/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java index b4e6824..7b6393f 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/IMarkupCache.java @@ -17,11 +17,11 @@ package org.apache.wicket.markup; import org.apache.wicket.MarkupContainer; -import org.apache.wicket.settings.IMarkupSettings; /** - * Each Wicket application has a single IMarkupCache associated with it (see {@link IMarkupSettings} - * ). Via {@link MarkupFactory} the markup cache is used by every Component to get its associated + * Each Wicket application has a single IMarkupCache associated with it (see + * {@link org.apache.wicket.settings.def.MarkupSettings}). Via {@link MarkupFactory} + * the markup cache is used by every Component to get its associated * markup stream. * * @author Juergen Donnerstag @@ -71,4 +71,4 @@ public interface IMarkupCache * if necessary. */ void shutdown(); -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java index d89e213..9445975 100644 --- a/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java +++ b/wicket-core/src/main/java/org/apache/wicket/markup/MarkupCache.java @@ -23,7 +23,6 @@ import java.util.concurrent.ConcurrentHashMap; import org.apache.wicket.Application; import org.apache.wicket.MarkupContainer; import org.apache.wicket.WicketRuntimeException; -import org.apache.wicket.settings.IMarkupSettings; import org.apache.wicket.util.lang.Args; import org.apache.wicket.util.listener.IChangeListener; import org.apache.wicket.util.watch.IModifiable; @@ -40,9 +39,9 @@ import org.slf4j.LoggerFactory; * removed from the cache and reloaded when needed. * <p> * MarkupCache is registered with {@link MarkupFactory} which in turn is registered with - * {@link IMarkupSettings} and thus can be replaced with a subclassed version. + * {@link org.apache.wicket.settings.def.MarkupSettings} and thus can be replaced with a sub-classed version. * - * @see IMarkupSettings + * @see org.apache.wicket.settings.def.MarkupSettings * @see MarkupFactory * * @author Jonathan Locke @@ -331,7 +330,7 @@ public class MarkupCache implements IMarkupCache * @param markup * Markup.NO_MARKUP * @return Same as parameter "markup" - * @see org.apache.wicket.settings.IResourceSettings#setResourceStreamLocator(org.apache.wicket.core.util.resource.locator.IResourceStreamLocator) + * @see org.apache.wicket.settings.def.ResourceSettings#setResourceStreamLocator(org.apache.wicket.core.util.resource.locator.IResourceStreamLocator) */ protected Markup onMarkupNotFound(final String cacheKey, final MarkupContainer container, final Markup markup) http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/main/java/org/apache/wicket/settings/IMarkupSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/IMarkupSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/IMarkupSettings.java deleted file mode 100644 index 4dbbb24..0000000 --- a/wicket-core/src/main/java/org/apache/wicket/settings/IMarkupSettings.java +++ /dev/null @@ -1,150 +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.markup.MarkupFactory; - -/** - * Interface for markup related settings. - * <p> - * <i>compressWhitespace </i> (defaults to false) - Causes pages to render with redundant whitespace - * removed. Whitespace stripping is not HTML or JavaScript savvy and can conceivably break pages, - * but should provide significant performance improvements. - * <p> - * <i>stripComments</i> (defaults to false) - Set to true to strip HTML comments during markup - * loading - * - * @author Igor Vaynberg (ivaynberg) - */ -public interface IMarkupSettings -{ - /** - * If true, automatic link resolution is enabled. Disabled by default. - * - * @see org.apache.wicket.markup.resolver.AutoLinkResolver - * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler - * @return Returns the automaticLinking. - */ - boolean getAutomaticLinking(); - - /** - * @return Returns the compressWhitespace. - * @see IMarkupSettings#setCompressWhitespace(boolean) - */ - boolean getCompressWhitespace(); - - /** - * @since 1.1 - * @return Returns default encoding of markup files. If null, the operating system provided - * encoding will be used. - */ - String getDefaultMarkupEncoding(); - - /** - * @return Returns the stripComments. - * @see IMarkupSettings#setStripComments(boolean) - */ - boolean getStripComments(); - - /** - * Gets whether to remove wicket tags from the output. - * - * @return whether to remove wicket tags from the output - */ - boolean getStripWicketTags(); - - /** - * @since 1.3 - * @return if true, an exception is thrown if the markup file does not contain a xml declaration - */ - boolean getThrowExceptionOnMissingXmlDeclaration(); - - /** - * Application default for automatic link resolution. - * - * @param automaticLinking - * The automaticLinking to set. - * @see org.apache.wicket.markup.resolver.AutoLinkResolver - * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler - */ - void setAutomaticLinking(boolean automaticLinking); - - /** - * Turns on whitespace compression. Multiple occurrences of space/tab characters will be - * compressed to a single space. Multiple line breaks newline/carriage-return will also be - * compressed to a single newline. - * <p> - * Compression is currently not HTML aware and so it may be possible for whitespace compression - * to break pages. For this reason, whitespace compression is off by default and you should test - * your application thoroughly after turning whitespace compression on. - * <p> - * Spaces are removed from markup at markup load time and there should be no effect on page - * rendering speed. In fact, your pages should render faster with whitespace compression - * enabled. - * - * @param compressWhitespace - * The compressWhitespace to set. - */ - void setCompressWhitespace(final boolean compressWhitespace); - - /** - * Set default encoding for markup files. If null, the encoding provided by the operating system - * will be used. - * - * @since 1.1 - * @param encoding - */ - void setDefaultMarkupEncoding(final String encoding); - - /** - * Enables stripping of markup comments denoted in markup by HTML comment tagging. - * - * @param stripComments - * True to strip markup comments from rendered pages - */ - void setStripComments(boolean stripComments); - - /** - * Sets whether to remove wicket tags from the output. - * - * @param stripWicketTags - * whether to remove wicket tags from the output - */ - void setStripWicketTags(boolean stripWicketTags); - - /** - * If true, an exception is thrown if the markup file does not contain a xml declaration - * - * @since 1.3 - * @param throwException - */ - void setThrowExceptionOnMissingXmlDeclaration(final boolean throwException); - - /** - * Get the markup factory - * - * @return A new instance of MarkupFactory. - */ - MarkupFactory getMarkupFactory(); - - /** - * Set a new markup factory - * - * @param factory - */ - void setMarkupFactory(MarkupFactory factory); -} http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/main/java/org/apache/wicket/settings/def/MarkupSettings.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/main/java/org/apache/wicket/settings/def/MarkupSettings.java b/wicket-core/src/main/java/org/apache/wicket/settings/def/MarkupSettings.java index 2ca7ec0..ddb3a6a 100644 --- a/wicket-core/src/main/java/org/apache/wicket/settings/def/MarkupSettings.java +++ b/wicket-core/src/main/java/org/apache/wicket/settings/def/MarkupSettings.java @@ -17,10 +17,18 @@ package org.apache.wicket.settings.def; import org.apache.wicket.markup.MarkupFactory; -import org.apache.wicket.settings.IMarkupSettings; import org.apache.wicket.util.lang.Args; /** + * Interface for markup related settings. + * <p> + * <i>compressWhitespace </i> (defaults to false) - Causes pages to render with redundant whitespace + * removed. Whitespace stripping is not HTML or JavaScript savvy and can conceivably break pages, + * but should provide significant performance improvements. + * <p> + * <i>stripComments</i> (defaults to false) - Set to true to strip HTML comments during markup + * loading + * * @author Jonathan Locke * @author Chris Turner * @author Eelco Hillenius @@ -30,7 +38,7 @@ import org.apache.wicket.util.lang.Args; * @author Martijn Dashorst * @author James Carman */ -public class MarkupSettings implements IMarkupSettings +public class MarkupSettings { /** Application default for automatically resolving hrefs */ private boolean automaticLinking = false; @@ -63,36 +71,40 @@ public class MarkupSettings implements IMarkupSettings } /** - * @see org.apache.wicket.settings.IMarkupSettings#getAutomaticLinking() + * If true, automatic link resolution is enabled. Disabled by default. + * + * @see org.apache.wicket.markup.resolver.AutoLinkResolver + * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler + * @return Returns the automaticLinking. */ - @Override public boolean getAutomaticLinking() { return automaticLinking; } /** - * @see org.apache.wicket.settings.IMarkupSettings#getCompressWhitespace() + * @return Returns the compressWhitespace. */ - @Override public boolean getCompressWhitespace() { return compressWhitespace; } /** - * @see org.apache.wicket.settings.IMarkupSettings#getDefaultMarkupEncoding() + * @since 1.1 + * @return Returns default encoding of markup files. If null, the operating system provided + * encoding will be used. */ - @Override public String getDefaultMarkupEncoding() { return defaultMarkupEncoding; } /** - * @see org.apache.wicket.settings.IMarkupSettings#getMarkupFactory() + * Get the markup factory + * + * @return A new instance of MarkupFactory. */ - @Override public MarkupFactory getMarkupFactory() { if (markupFactory == null) @@ -103,63 +115,83 @@ public class MarkupSettings implements IMarkupSettings } /** - * @see org.apache.wicket.settings.IMarkupSettings#getStripComments() + * @return Returns the stripComments. */ - @Override public boolean getStripComments() { return stripComments; } /** - * @see org.apache.wicket.settings.IMarkupSettings#getStripWicketTags() + * Gets whether to remove wicket tags from the output. + * + * @return whether to remove wicket tags from the output */ - @Override public boolean getStripWicketTags() { return stripWicketTags; } /** - * @see org.apache.wicket.settings.IMarkupSettings#getThrowExceptionOnMissingXmlDeclaration() + * @since 1.3 + * @return if true, an exception is thrown if the markup file does not contain a xml declaration */ - @Override public boolean getThrowExceptionOnMissingXmlDeclaration() { return throwExceptionOnMissingXmlDeclaration; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setAutomaticLinking(boolean) + * Application default for automatic link resolution. + * + * @param automaticLinking + * The automaticLinking to set. + * @see org.apache.wicket.markup.resolver.AutoLinkResolver + * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler */ - @Override public void setAutomaticLinking(boolean automaticLinking) { this.automaticLinking = automaticLinking; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setCompressWhitespace(boolean) + * Turns on whitespace compression. Multiple occurrences of space/tab characters will be + * compressed to a single space. Multiple line breaks newline/carriage-return will also be + * compressed to a single newline. + * <p> + * Compression is currently not HTML aware and so it may be possible for whitespace compression + * to break pages. For this reason, whitespace compression is off by default and you should test + * your application thoroughly after turning whitespace compression on. + * <p> + * Spaces are removed from markup at markup load time and there should be no effect on page + * rendering speed. In fact, your pages should render faster with whitespace compression + * enabled. + * + * @param compressWhitespace + * The compressWhitespace to set. */ - @Override public void setCompressWhitespace(final boolean compressWhitespace) { this.compressWhitespace = compressWhitespace; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setDefaultMarkupEncoding(java.lang.String) + * Set default encoding for markup files. If null, the encoding provided by the operating system + * will be used. + * + * @since 1.1 + * @param encoding */ - @Override public void setDefaultMarkupEncoding(final String encoding) { defaultMarkupEncoding = encoding; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setMarkupFactory(org.apache.wicket.markup.MarkupFactory) + * Set a new markup factory + * + * @param factory */ - @Override public void setMarkupFactory(final MarkupFactory factory) { Args.notNull(factory, "markup factory"); @@ -167,27 +199,33 @@ public class MarkupSettings implements IMarkupSettings } /** - * @see org.apache.wicket.settings.IMarkupSettings#setStripComments(boolean) + * Enables stripping of markup comments denoted in markup by HTML comment tagging. + * + * @param stripComments + * True to strip markup comments from rendered pages */ - @Override public void setStripComments(boolean stripComments) { this.stripComments = stripComments; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setStripWicketTags(boolean) + * Sets whether to remove wicket tags from the output. + * + * @param stripWicketTags + * whether to remove wicket tags from the output */ - @Override public void setStripWicketTags(boolean stripWicketTags) { this.stripWicketTags = stripWicketTags; } /** - * @see org.apache.wicket.settings.IMarkupSettings#setThrowExceptionOnMissingXmlDeclaration(boolean) + * If true, an exception is thrown if the markup file does not contain a xml declaration + * + * @since 1.3 + * @param throwException */ - @Override public void setThrowExceptionOnMissingXmlDeclaration(boolean throwException) { throwExceptionOnMissingXmlDeclaration = throwException; http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java ---------------------------------------------------------------------- diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java index 4ca7a9c..cb2a060 100644 --- a/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java +++ b/wicket-core/src/test/java/org/apache/wicket/markup/MarkupParserTest.java @@ -21,19 +21,17 @@ import java.text.ParseException; import java.util.Locale; import java.util.regex.Matcher; -import org.junit.Assert; - import org.apache.wicket.WicketTestCase; +import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator; +import org.apache.wicket.core.util.resource.locator.ResourceStreamLocator; import org.apache.wicket.markup.html.border.Border; import org.apache.wicket.markup.html.pages.PageExpiredErrorPage; import org.apache.wicket.markup.parser.XmlTag.TagType; import org.apache.wicket.markup.parser.filter.WicketTagIdentifier; -import org.apache.wicket.settings.IMarkupSettings; import org.apache.wicket.util.resource.IResourceStream; import org.apache.wicket.util.resource.ResourceStreamNotFoundException; -import org.apache.wicket.core.util.resource.locator.IResourceStreamLocator; -import org.apache.wicket.core.util.resource.locator.ResourceStreamLocator; import org.apache.wicket.util.string.StringValueConversionException; +import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -626,7 +624,7 @@ public final class MarkupParserTest extends WicketTestCase /** * Tests that IE conditional comments are properly preserved when - * {@link IMarkupSettings#setStripComments(boolean)} is set to true + * {@link org.apache.wicket.settings.def.MarkupSettings#setStripComments(boolean)} is set to true * * @see <a href="https://issues.apache.org/jira/browse/WICKET-3648">WICKET-3648</a> * http://git-wip-us.apache.org/repos/asf/wicket/blob/b4a864b0/wicket-jmx/src/main/java/org/apache/wicket/jmx/MarkupSettingsMBean.java ---------------------------------------------------------------------- diff --git a/wicket-jmx/src/main/java/org/apache/wicket/jmx/MarkupSettingsMBean.java b/wicket-jmx/src/main/java/org/apache/wicket/jmx/MarkupSettingsMBean.java index 44646ed..91f2b23 100644 --- a/wicket-jmx/src/main/java/org/apache/wicket/jmx/MarkupSettingsMBean.java +++ b/wicket-jmx/src/main/java/org/apache/wicket/jmx/MarkupSettingsMBean.java @@ -16,8 +16,6 @@ */ package org.apache.wicket.jmx; -import org.apache.wicket.settings.IMarkupSettings; - /** * Markup settings. * @@ -36,7 +34,7 @@ public interface MarkupSettingsMBean /** * @return Returns the compressWhitespace. - * @see IMarkupSettings#setCompressWhitespace(boolean) + * @see MarkupSettings#setCompressWhitespace(boolean) */ boolean getCompressWhitespace(); @@ -49,7 +47,7 @@ public interface MarkupSettingsMBean /** * @return Returns the stripComments. - * @see IMarkupSettings#setStripComments(boolean) + * @see MarkupSettings#setStripComments(boolean) */ boolean getStripComments();
