Module org.apache.wicket.core
Class WicketLinkTagHandler
java.lang.Object
org.apache.wicket.markup.parser.AbstractMarkupFilter
org.apache.wicket.markup.parser.filter.WicketLinkTagHandler
- All Implemented Interfaces:
Serializable
,IMarkupFilter
,IComponentResolver
,IClusterable
This is a markup inline filter. It identifies xml tags which include a href attribute and which
are not Wicket specific components and flags these tags (ComponentTag) as autolink enabled. A
component resolver will later resolve the href and assign a BookmarkablePageLink to it
(automatically).
An application setting is used as default value, which might be modified for specific regions. These regions are identified by <wicket:link> tags with an optional 'autolink' attribute. The default value for the attribute is true, thus enabling autolinking. An open-close <wicket:link/> tag will change the autolink status until the end of the markup document or the next <wicket:link> tag respectively. <wicket:link> regions may be nested.
- Author:
- Juergen Donnerstag
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The id of autolink componentsstatic final String
Fields inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
REQUEST_COUNTER_KEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
Analyze the tag.protected final MarkupElement
Invoked when a ComponentTag was found.resolve
(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) Try to resolve a component.void
setAutomaticLinking
(boolean enable) Set the default value for autolinkingMethods inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
getMarkupResourceStream, getNextFilter, getRequestUniqueId, getWicketNamespace, getWicketNamespace, nextElement, onSpecialTag, postProcess, setNextFilter
-
Field Details
-
LINK
- See Also:
-
AUTOLINK_ID
The id of autolink components- See Also:
-
-
Constructor Details
-
WicketLinkTagHandler
public WicketLinkTagHandler()Construct. -
WicketLinkTagHandler
-
-
Method Details
-
setAutomaticLinking
Set the default value for autolinking- Parameters:
enable
- if true, autolinks are enabled
-
onComponentTag
Description copied from class:AbstractMarkupFilter
Invoked when a ComponentTag was found.By default this method is also called for WicketTags.
- Specified by:
onComponentTag
in classAbstractMarkupFilter
- Returns:
- Usually the same as the tag attribute
- Throws:
ParseException
-
analyzeAutolinkCondition
Analyze the tag. If return value == true, a autolink component will be created.Subclass analyzeAutolinkCondition() to implement you own implementation and register the new tag handler with the markup parser through Application.newMarkupParser().
- Parameters:
tag
- The current tag being parsed- Returns:
- If true, tag will become auto component
-
resolve
Description copied from interface:IComponentResolver
Try to resolve a component.- Specified by:
resolve
in interfaceIComponentResolver
- Parameters:
container
- The container parsing its markupmarkupStream
- The current markupStreamtag
- The current component tag while parsing the markup- Returns:
- component or
null
if not found
-