java.lang.Object
org.apache.wicket.markup.parser.AbstractMarkupFilter
- All Implemented Interfaces:
IMarkupFilter
- Direct Known Subclasses:
AutoLabelTagHandler
,EnclosureHandler
,HeadForceTagIdHandler
,HtmlHandler
,HtmlHeaderSectionHandler
,HtmlProblemFinder
,InlineEnclosureHandler
,OpenCloseTagExpander
,RelativePathPrefixHandler
,RootMarkupFilter
,StyleAndScriptIdentifier
,WicketContainerTagHandler
,WicketLinkTagHandler
,WicketMessageTagHandler
,WicketNamespaceHandler
,WicketRemoveTagHandler
,WicketTagIdentifier
Base class for markup filters
- Author:
- Jonathan Locke, Juergen Donnerstag
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final MetaDataKey<Map<String,
AtomicInteger>> A key for a request-relative map of counters. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected MarkupResourceStream
IMarkupFilters are usually chained with the last filter retrieving the elements from the XML parser.protected int
Returns an id using the request-relative counter associated with the underlyingMarkupResourceStream
's owner container (seeMarkupResourceStream.getContainerInfo()
).protected String
Extracts the markup namespace from the MarkupResourceStream passed at creation time.protected String
getWicketNamespace
(MarkupStream markupStream) Extracts the markup namespace from the passed MarkupStream if available, or from the MarkupResourceStream passed at creation time.Get the next xml element from the markup.protected abstract MarkupElement
Invoked when a ComponentTag was found.protected MarkupElement
Invoked when a tags (e.g.void
postProcess
(Markup markup) Called after all filters have been processed.void
setNextFilter
(IMarkupFilter parent) Set new parent.
-
Field Details
-
REQUEST_COUNTER_KEY
A key for a request-relative map of counters. As map keys we use the class name of theMarkupResourceStream
's owner container (seeMarkupResourceStream.getContainerInfo()
), meaning that each container has its own counter. The counters are used bygetRequestUniqueId()
to get unique ids for markup tags.
-
-
Constructor Details
-
AbstractMarkupFilter
public AbstractMarkupFilter()Construct. -
AbstractMarkupFilter
-
-
Method Details
-
getNextFilter
Description copied from interface:IMarkupFilter
IMarkupFilters are usually chained with the last filter retrieving the elements from the XML parser.- Specified by:
getNextFilter
in interfaceIMarkupFilter
- Returns:
- The next MarkupFilter in the chain
-
setNextFilter
Set new parent.- Specified by:
setNextFilter
in interfaceIMarkupFilter
- Parameters:
parent
- The parent of this component The next element in the chain
-
nextElement
Get the next xml element from the markup. If eof, than return null. Ignore raw markup. Invoke nextTag(tag) if a tag was found.- Specified by:
nextElement
in interfaceIMarkupFilter
- Returns:
- Return the next eligible MarkupElement. Null, if no more found.
- Throws:
ParseException
-
onComponentTag
Invoked when a ComponentTag was found.By default this method is also called for WicketTags.
- Parameters:
tag
-- Returns:
- Usually the same as the tag attribute
- Throws:
ParseException
-
onSpecialTag
Invoked when a tags (e.g. DOCTYPE, PROCESSING_INSTRUCTION, etc. which have been identified as special tags by the xml parser.- Parameters:
tag
-- Returns:
- Usually the same as the tag attribute
- Throws:
ParseException
-
postProcess
Description copied from interface:IMarkupFilter
Called after all filters have been processed.- Specified by:
postProcess
in interfaceIMarkupFilter
-
getMarkupResourceStream
-
getWicketNamespace
Extracts the markup namespace from the MarkupResourceStream passed at creation time.There are two versions of this method because most IMarkupFilter's have dual personality -
IMarkupFilter
(one instance per MarkupParser) andIComponentResolver
(one instance per application).- Returns:
- the namespace of the loaded markup
-
getWicketNamespace
Extracts the markup namespace from the passed MarkupStream if available, or from the MarkupResourceStream passed at creation time.There are two versions of this method because most IMarkupFilter's have dual personality -
IMarkupFilter
(one instance per MarkupParser) andIComponentResolver
(one instance per application).- Parameters:
markupStream
- the markup stream- Returns:
- namespace extracted from the markup
-
getRequestUniqueId
Returns an id using the request-relative counter associated with the underlyingMarkupResourceStream
's owner container (seeMarkupResourceStream.getContainerInfo()
). This can be useful for auto component tags that need to get a tag id.- Returns:
- the request-relative id
-