org.apache.wicket.markup.parser.filter
Class WicketMessageTagHandler

java.lang.Object
  extended by org.apache.wicket.markup.parser.AbstractMarkupFilter
      extended by org.apache.wicket.markup.parser.filter.WicketMessageTagHandler
All Implemented Interfaces:
java.io.Serializable, IClusterable, IMarkupFilter, IComponentResolver

public final class WicketMessageTagHandler
extends AbstractMarkupFilter
implements IComponentResolver

This is a markup inline filter and a component resolver. It identifies wicket:message attributes and adds an attribute modifier to the component tag that can localize wicket:message="attr-name:i18n-key,attr-name-2:i18n-key-2,..." expressions, replacing values of attributes specified by attr-name with a localizer lookup with key i18n-key. If an attribute being localized has a set value that value will be used as the default value for the localization lookup. This handler also resolves and localizes raw markup with wicket:message attribute.

Author:
Juergen Donnerstag, Igor Vaynberg
See Also:
Serialized Form

Nested Class Summary
static class WicketMessageTagHandler.AttributeLocalizer
          Attribute localizing behavior.
 
Field Summary
static Behavior ATTRIBUTE_LOCALIZER
          singleton instance of WicketMessageTagHandler.AttributeLocalizer
static java.lang.String WICKET_MESSAGE_CONTAINER_ID
          The id automatically assigned to tags with wicket:message attribute but without id
 
Constructor Summary
WicketMessageTagHandler()
          Construct.
 
Method Summary
protected  MarkupElement onComponentTag(ComponentTag tag)
          Invoked when a ComponentTag was found.
 Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
          Try to resolve a component.
 
Methods inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
getNextFilter, nextElement, onSpecialTag, postProcess, setNextFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WICKET_MESSAGE_CONTAINER_ID

public static final java.lang.String WICKET_MESSAGE_CONTAINER_ID
The id automatically assigned to tags with wicket:message attribute but without id

See Also:
Constant Field Values

ATTRIBUTE_LOCALIZER

public static final Behavior ATTRIBUTE_LOCALIZER
singleton instance of WicketMessageTagHandler.AttributeLocalizer

Constructor Detail

WicketMessageTagHandler

public WicketMessageTagHandler()
Construct.

Method Detail

onComponentTag

protected final MarkupElement onComponentTag(ComponentTag tag)
                                      throws java.text.ParseException
Description copied from class: AbstractMarkupFilter
Invoked when a ComponentTag was found.

By default this method is also called for WicketTags.

Specified by:
onComponentTag in class AbstractMarkupFilter
Returns:
Usually the same as the tag attribute
Throws:
java.text.ParseException

resolve

public Component resolve(MarkupContainer container,
                         MarkupStream markupStream,
                         ComponentTag tag)
Description copied from interface: IComponentResolver
Try to resolve a component.

Specified by:
resolve in interface IComponentResolver
Parameters:
container - The container parsing its markup
markupStream - The current markupStream
tag - The current component tag while parsing the markup
Returns:
component or null if not found


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.