001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.wicket.settings;
018:
019: import org.apache.wicket.markup.IMarkupCache;
020: import org.apache.wicket.markup.IMarkupParserFactory;
021: import org.apache.wicket.markup.MarkupParserFactory;
022:
023: /**
024: * Interface for markup related settings.
025: * <p>
026: * <i>compressWhitespace </i> (defaults to false) - Causes pages to render with
027: * redundant whitespace removed. Whitespace stripping is not HTML or JavaScript
028: * savvy and can conceivably break pages, but should provide significant
029: * performance improvements.
030: * <p>
031: * <i>stripComments </i> (defaults to false) - Set to true to strip HTML
032: * comments during markup loading
033: *
034: * @author Igor Vaynberg (ivaynberg)
035: */
036: public interface IMarkupSettings {
037: /**
038: * If true, automatic link resolution is enabled. Disabled by default.
039: *
040: * @see org.apache.wicket.markup.resolver.AutoLinkResolver
041: * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler
042: * @return Returns the automaticLinking.
043: */
044: boolean getAutomaticLinking();
045:
046: /**
047: * @return Returns the compressWhitespace.
048: * @see IMarkupSettings#setCompressWhitespace(boolean)
049: */
050: boolean getCompressWhitespace();
051:
052: /**
053: * @return Returns the defaultAfterDisabledLink.
054: */
055: String getDefaultAfterDisabledLink();
056:
057: /**
058: * @return Returns the defaultBeforeDisabledLink.
059: */
060: String getDefaultBeforeDisabledLink();
061:
062: /**
063: * @since 1.1
064: * @return Returns default encoding of markup files. If null, the operating
065: * system provided encoding will be used.
066: */
067: String getDefaultMarkupEncoding();
068:
069: /**
070: * @return markup parser factory
071: */
072: IMarkupParserFactory getMarkupParserFactory();
073:
074: /**
075: * The markup cache also loads the markup if not yet avaiable in the cache.
076: *
077: * @return markup cache
078: */
079: IMarkupCache getMarkupCache();
080:
081: /**
082: * @return Returns the stripComments.
083: * @see IMarkupSettings#setStripComments(boolean)
084: */
085: boolean getStripComments();
086:
087: /**
088: * Gets whether to remove wicket tags from the output.
089: *
090: * @return whether to remove wicket tags from the output
091: */
092: boolean getStripWicketTags();
093:
094: /**
095: *
096: * @since 1.1
097: * @return if true, xml declaration will be removed.
098: */
099: boolean getStripXmlDeclarationFromOutput();
100:
101: /**
102: * Application default for automatic link resolution. Please
103: *
104: * @see org.apache.wicket.markup.resolver.AutoLinkResolver and
105: * @see org.apache.wicket.markup.parser.filter.WicketLinkTagHandler for more
106: * details.
107: *
108: * @param automaticLinking
109: * The automaticLinking to set.
110: */
111: void setAutomaticLinking(boolean automaticLinking);
112:
113: /**
114: * Turns on whitespace compression. Multiple occurrences of space/tab
115: * characters will be compressed to a single space. Multiple line breaks
116: * newline/carriage-return will also be compressed to a single newline.
117: * <p>
118: * Compression is currently not HTML aware and so it may be possible for
119: * whitespace compression to break pages. For this reason, whitespace
120: * compression is off by default and you should test your application
121: * throroughly after turning whitespace compression on.
122: * <p>
123: * Spaces are removed from markup at markup load time and there should be no
124: * effect on page rendering speed. In fact, your pages should render faster
125: * with whitespace compression enabled.
126: *
127: * @param compressWhitespace
128: * The compressWhitespace to set.
129: */
130: void setCompressWhitespace(final boolean compressWhitespace);
131:
132: /**
133: * @param defaultAfterDisabledLink
134: * The defaultAfterDisabledLink to set.
135: */
136: void setDefaultAfterDisabledLink(String defaultAfterDisabledLink);
137:
138: /**
139: * @param defaultBeforeDisabledLink
140: * The defaultBeforeDisabledLink to set.
141: */
142: void setDefaultBeforeDisabledLink(String defaultBeforeDisabledLink);
143:
144: /**
145: * Set default encoding for markup files. If null, the encoding provided by
146: * the operating system will be used.
147: *
148: * @since 1.1
149: * @param encoding
150: */
151: void setDefaultMarkupEncoding(final String encoding);
152:
153: /**
154: * Sets the markup parser factory that will be used to generate parsers for
155: * markup. By default {@link MarkupParserFactory} will be used.
156: *
157: * @param factory
158: * new factory
159: */
160: void setMarkupParserFactory(IMarkupParserFactory factory);
161:
162: /**
163: * Sets a new markup cache which will also be used to load markup if not yet
164: * available in the cache.
165: *
166: * @param markupCache
167: * new markup cache
168: */
169: void setMarkupCache(IMarkupCache markupCache);
170:
171: /**
172: * Enables stripping of markup comments denoted in markup by HTML comment
173: * tagging.
174: *
175: * @param stripComments
176: * True to strip markup comments from rendered pages
177: */
178: void setStripComments(boolean stripComments);
179:
180: /**
181: * Sets whether to remove wicket tags from the output.
182: *
183: * @param stripWicketTags
184: * whether to remove wicket tags from the output
185: */
186: void setStripWicketTags(boolean stripWicketTags);
187:
188: /**
189: *
190: * @since 1.1
191: * @param strip
192: * if true, xml declaration will be stripped from output
193: */
194: void setStripXmlDeclarationFromOutput(final boolean strip);
195: }
|