Class WicketLinkTagHandler
- java.lang.Object
-
- org.apache.wicket.markup.parser.AbstractMarkupFilter
-
- org.apache.wicket.markup.parser.filter.WicketLinkTagHandler
-
- All Implemented Interfaces:
java.io.Serializable,IMarkupFilter,IComponentResolver,org.apache.wicket.util.io.IClusterable
public class WicketLinkTagHandler extends AbstractMarkupFilter implements IComponentResolver
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAUTOLINK_IDThe id of autolink componentsstatic java.lang.StringLINK-
Fields inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
REQUEST_COUNTER_KEY
-
-
Constructor Summary
Constructors Constructor Description WicketLinkTagHandler()Construct.WicketLinkTagHandler(MarkupResourceStream resourceStream)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleananalyzeAutolinkCondition(ComponentTag tag)Analyze the tag.protected MarkupElementonComponentTag(ComponentTag tag)Invoked when a ComponentTag was found.Componentresolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)Try to resolve a component.voidsetAutomaticLinking(boolean enable)Set the default value for autolinking-
Methods inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
getMarkupResourceStream, getNextFilter, getRequestUniqueId, getWicketNamespace, getWicketNamespace, nextElement, onSpecialTag, postProcess, setNextFilter
-
-
-
-
Field Detail
-
LINK
public static final java.lang.String LINK
- See Also:
- Constant Field Values
-
AUTOLINK_ID
public static final java.lang.String AUTOLINK_ID
The id of autolink components- See Also:
- Constant Field Values
-
-
Constructor Detail
-
WicketLinkTagHandler
public WicketLinkTagHandler()
Construct.
-
WicketLinkTagHandler
public WicketLinkTagHandler(MarkupResourceStream resourceStream)
-
-
Method Detail
-
setAutomaticLinking
public void setAutomaticLinking(boolean enable)
Set the default value for autolinking- Parameters:
enable- if true, autolinks are enabled
-
onComponentTag
protected final MarkupElement onComponentTag(ComponentTag tag) throws java.text.ParseException
Description copied from class:AbstractMarkupFilterInvoked when a ComponentTag was found.By default this method is also called for WicketTags.
- Specified by:
onComponentTagin classAbstractMarkupFilter- Returns:
- Usually the same as the tag attribute
- Throws:
java.text.ParseException
-
analyzeAutolinkCondition
protected boolean analyzeAutolinkCondition(ComponentTag tag)
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
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
Description copied from interface:IComponentResolverTry to resolve a component.- Specified by:
resolvein interfaceIComponentResolver- Parameters:
container- The container parsing its markupmarkupStream- The current markupStreamtag- The current component tag while parsing the markup- Returns:
- component or
nullif not found
-
-