Class MarkupSettings
- java.lang.Object
-
- org.apache.wicket.settings.MarkupSettings
-
public class MarkupSettings extends Object
Class for markup related settings.compressWhitespace (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.
stripComments (defaults to false) - Set to true to strip HTML comments during markup loading
- Author:
- Jonathan Locke, Chris Turner, Eelco Hillenius, Juergen Donnerstag, Johan Compagner, Igor Vaynberg (ivaynberg), Martijn Dashorst, James Carman
-
-
Constructor Summary
Constructors Constructor Description MarkupSettings()
Construct
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getAutomaticLinking()
If true, automatic link resolution is enabled.boolean
getCompressWhitespace()
String
getDefaultMarkupEncoding()
MarkupFactory
getMarkupFactory()
Get the markup factoryIMarkupIdGenerator
getMarkupIdGenerator()
boolean
getStripComments()
boolean
getStripWicketTags()
Gets whether to remove wicket tags from the output.boolean
getThrowExceptionOnMissingXmlDeclaration()
boolean
isUpdateAutoLabelsTogetherWithFormComponent()
MarkupSettings
setAutomaticLinking(boolean automaticLinking)
Application default for automatic link resolution.MarkupSettings
setCompressWhitespace(boolean compressWhitespace)
Turns on whitespace compression.MarkupSettings
setDefaultMarkupEncoding(String encoding)
Set default encoding for markup files.MarkupSettings
setMarkupFactory(MarkupFactory factory)
Set a new markup factoryMarkupSettings
setMarkupIdGenerator(IMarkupIdGenerator markupIdGenerator)
Sets a new IMarkupIdGeneratorMarkupSettings
setStripComments(boolean stripComments)
Enables stripping of markup comments denoted in markup by HTML comment tagging.MarkupSettings
setStripWicketTags(boolean stripWicketTags)
Sets whether to remove wicket tags from the output.MarkupSettings
setThrowExceptionOnMissingXmlDeclaration(boolean throwException)
If true, an exception is thrown if the markup file does not contain a xml declarationMarkupSettings
setUpdateAutoLabelsTogetherWithFormComponent(boolean updateAutoLabelsTogetherWithFormComponent)
-
-
-
Constructor Detail
-
MarkupSettings
public MarkupSettings()
Construct
-
-
Method Detail
-
getAutomaticLinking
public boolean getAutomaticLinking()
If true, automatic link resolution is enabled. Disabled by default.- Returns:
- Returns the automaticLinking.
- See Also:
AutoLinkResolver
,WicketLinkTagHandler
-
getCompressWhitespace
public boolean getCompressWhitespace()
- Returns:
- Returns the compressWhitespace.
-
getDefaultMarkupEncoding
public String getDefaultMarkupEncoding()
- Returns:
- Returns default encoding of markup files. If null, the operating system provided encoding will be used.
- Since:
- 1.1
-
getMarkupFactory
public MarkupFactory getMarkupFactory()
Get the markup factory- Returns:
- A new instance of MarkupFactory.
-
getStripComments
public boolean getStripComments()
- Returns:
- Returns the stripComments.
-
getStripWicketTags
public boolean getStripWicketTags()
Gets whether to remove wicket tags from the output.- Returns:
- whether to remove wicket tags from the output
-
getThrowExceptionOnMissingXmlDeclaration
public boolean getThrowExceptionOnMissingXmlDeclaration()
- Returns:
- if true, an exception is thrown if the markup file does not contain a xml declaration
- Since:
- 1.3
-
setAutomaticLinking
public MarkupSettings setAutomaticLinking(boolean automaticLinking)
Application default for automatic link resolution.- Parameters:
automaticLinking
- The automaticLinking to set.- Returns:
this
object for chaining- See Also:
AutoLinkResolver
,WicketLinkTagHandler
-
setCompressWhitespace
public MarkupSettings setCompressWhitespace(boolean compressWhitespace)
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.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.
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.
- Parameters:
compressWhitespace
- The compressWhitespace to set.- Returns:
this
object for chaining
-
setDefaultMarkupEncoding
public MarkupSettings setDefaultMarkupEncoding(String encoding)
Set default encoding for markup files. If null, the encoding provided by the operating system will be used.- Parameters:
encoding
-- Returns:
this
object for chaining- Since:
- 1.1
-
setMarkupFactory
public MarkupSettings setMarkupFactory(MarkupFactory factory)
Set a new markup factory- Parameters:
factory
-- Returns:
this
object for chaining
-
setStripComments
public MarkupSettings setStripComments(boolean stripComments)
Enables stripping of markup comments denoted in markup by HTML comment tagging.- Parameters:
stripComments
- True to strip markup comments from rendered pages- Returns:
this
object for chaining
-
setStripWicketTags
public MarkupSettings setStripWicketTags(boolean stripWicketTags)
Sets whether to remove wicket tags from the output.- Parameters:
stripWicketTags
- whether to remove wicket tags from the output- Returns:
this
object for chaining
-
setThrowExceptionOnMissingXmlDeclaration
public MarkupSettings setThrowExceptionOnMissingXmlDeclaration(boolean throwException)
If true, an exception is thrown if the markup file does not contain a xml declaration- Parameters:
throwException
-- Returns:
this
object for chaining- Since:
- 1.3
-
getMarkupIdGenerator
public IMarkupIdGenerator getMarkupIdGenerator()
- Returns:
- The configured generator for component markup ids
-
setMarkupIdGenerator
public MarkupSettings setMarkupIdGenerator(IMarkupIdGenerator markupIdGenerator)
Sets a new IMarkupIdGenerator- Parameters:
markupIdGenerator
- The generator of markup ids for the components- Returns:
this
object for chaining
-
isUpdateAutoLabelsTogetherWithFormComponent
public boolean isUpdateAutoLabelsTogetherWithFormComponent()
- Returns:
- If true, wicket auto-labels will always be updated (via AJAX) whenever the associated form component is. The default is false (for backward compatibility).
-
setUpdateAutoLabelsTogetherWithFormComponent
public MarkupSettings setUpdateAutoLabelsTogetherWithFormComponent(boolean updateAutoLabelsTogetherWithFormComponent)
- Parameters:
updateAutoLabelsTogetherWithFormComponent
- If true, wicket auto-labels will always be updated (via AJAX) whenever the associated form component is.- Returns:
this
object for chaining
-
-