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:
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 IBehavior ATTRIBUTE_LOCALIZER
          singleton instance of WicketMessageTagHandler.AttributeLocalizer
static String WICKET_MESSAGE_CONTAINER_ID
          The id automatically assigned to tags with wicket:message attribute but without id
 
Constructor Summary
WicketMessageTagHandler()
          Construct.
 
Method Summary
 MarkupElement nextTag()
          Get the next MarkupElement from the parent MarkupFilter and handle it if the specific filter criteria are met.
 boolean resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag)
          Try to resolve the tag, then create a component, add it to the container and render it.
 
Methods inherited from class org.apache.wicket.markup.parser.AbstractMarkupFilter
getParent, nextComponentTag, setParent
 
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 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 IBehavior ATTRIBUTE_LOCALIZER
singleton instance of WicketMessageTagHandler.AttributeLocalizer

Constructor Detail

WicketMessageTagHandler

public WicketMessageTagHandler()
Construct.

Method Detail

nextTag

public final MarkupElement nextTag()
                            throws ParseException
Description copied from interface: IMarkupFilter
Get the next MarkupElement from the parent MarkupFilter and handle it if the specific filter criteria are met. Depending on the filter, it may return the MarkupElement unchanged, modified or remove it by asking the parent handler for the next tag.

Specified by:
nextTag in interface IMarkupFilter
Returns:
The next tag to be processed. Null, if not more tags are available
Throws:
ParseException
See Also:
IMarkupFilter.nextTag()

resolve

public boolean resolve(MarkupContainer container,
                       MarkupStream markupStream,
                       ComponentTag tag)
Description copied from interface: IComponentResolver
Try to resolve the tag, then create a component, add it to the container and render it.

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:
True if component-id was handled by the resolver, false otherwise.
See Also:
IComponentResolver.resolve(org.apache.wicket.MarkupContainer, org.apache.wicket.markup.MarkupStream, org.apache.wicket.markup.ComponentTag)


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