org.apache.wicket.markup.head
Class MetaDataHeaderItem

java.lang.Object
  extended by org.apache.wicket.markup.head.HeaderItem
      extended by org.apache.wicket.markup.head.MetaDataHeaderItem
All Implemented Interfaces:
Serializable, IClusterable
Direct Known Subclasses:
HtmlImportHeaderItem

public class MetaDataHeaderItem
extends HeaderItem

HeaderItem for meta informations such as <meta> tags or canonical <link>

Since:
6.17.0
Author:
andrea del bene
See Also:
Serialized Form

Field Summary
static String LINK_TAG
           
static String META_TAG
           
 
Constructor Summary
MetaDataHeaderItem(String tagName)
          Build a new MetaDataHeaderItem having tagName as tag.
 
Method Summary
 MetaDataHeaderItem addTagAttribute(String attributeName)
          Add a minimized tag attribute to the item.
 MetaDataHeaderItem addTagAttribute(String attributeName, Object attributeValue)
          Add a tag attribute to the item.
 boolean equals(Object obj)
           
static MetaDataHeaderItem forLinkTag(IModel<String> rel, IModel<String> href)
          Factory method to create <link> tag.
static MetaDataHeaderItem forLinkTag(String rel, String href)
          Factory method to create <link> tag.
static MetaDataHeaderItem forMetaTag(IModel<String> name, IModel<String> content)
          Factory method to create <meta> tag.
static MetaDataHeaderItem forMetaTag(String name, String content)
          Factory method to create <meta> tag.
 String generateString()
          Generate the string representation for the current item.
 Iterable<?> getRenderTokens()
           
 void render(Response response)
          Renders the HeaderItem to the response.
 
Methods inherited from class org.apache.wicket.markup.head.HeaderItem
getDependencies, getProvidedResources
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_TAG

public static final String META_TAG
See Also:
Constant Field Values

LINK_TAG

public static final String LINK_TAG
See Also:
Constant Field Values
Constructor Detail

MetaDataHeaderItem

public MetaDataHeaderItem(String tagName)
Build a new MetaDataHeaderItem having tagName as tag.

Parameters:
tagName - the name of the tag
Method Detail

addTagAttribute

public MetaDataHeaderItem addTagAttribute(String attributeName,
                                          Object attributeValue)
Add a tag attribute to the item. If the attribute value is a IModel, the object wrapped inside the model is used as actual value.

Parameters:
attributeName - the attribute name
attributeValue - the attribute value
Returns:
The current item.

addTagAttribute

public MetaDataHeaderItem addTagAttribute(String attributeName)
Add a minimized tag attribute to the item. The attribute has no value and only its name is rendered (for example 'async')

Parameters:
attributeName - the attribute name
Returns:
The current item.

generateString

public String generateString()
Generate the string representation for the current item.

Returns:
The string representation for the current item.

getRenderTokens

public Iterable<?> getRenderTokens()
Specified by:
getRenderTokens in class HeaderItem
Returns:
The tokens this HeaderItem can be identified by. If any of the tokens has already been rendered, this HeaderItem will not be rendered.

render

public void render(Response response)
Description copied from class: HeaderItem
Renders the HeaderItem to the response.

Specified by:
render in class HeaderItem

forMetaTag

public static MetaDataHeaderItem forMetaTag(String name,
                                            String content)
Factory method to create <meta> tag.

Parameters:
name - the 'name' attribute of the tag
content - the 'content' attribute of the tag
Returns:
A new MetaDataHeaderItem

forMetaTag

public static MetaDataHeaderItem forMetaTag(IModel<String> name,
                                            IModel<String> content)
Factory method to create <meta> tag.

Parameters:
name - the 'name' attribute of the tag as String model
content - the 'content' attribute of the tag as String model
Returns:
A new MetaDataHeaderItem

forLinkTag

public static MetaDataHeaderItem forLinkTag(String rel,
                                            String href)
Factory method to create <link> tag.

Parameters:
rel - the 'rel' attribute of the tag
href - the 'href' attribute of the tag
Returns:
A new MetaDataHeaderItem

forLinkTag

public static MetaDataHeaderItem forLinkTag(IModel<String> rel,
                                            IModel<String> href)
Factory method to create <link> tag.

Parameters:
rel - the 'rel' attribute of the tag as String model
href - the 'href' attribute of the tag as String model
Returns:
A new MetaDataHeaderItem

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


Copyright © 2006–2016 Apache Software Foundation. All rights reserved.