wicket.markup
Class ComponentTag

java.lang.Object
  extended bywicket.markup.MarkupElement
      extended bywicket.markup.ComponentTag
Direct Known Subclasses:
WicketTag

public class ComponentTag
extends MarkupElement

A subclass of MarkupElement which represents a "significant" markup tag, such as a component open tag. Insignificant markup tags (those which are merely concerned with markup formatting operations and do not denote components or component nesting) are coalesced into instances of RawMarkup (also a subclass of MarkupElement).

Author:
Jonathan Locke

Field Summary
protected  ComponentTag closes
          Assuming this is a open (or open-close) tag, 'closes' refers to the ComponentTag which closes it.
static java.lang.String DEFAULT_WICKET_NAMESPACE
          Standard component id attribute always available for components regardless of user ApplicationSettings for id attribute; value == 'wicket'.
protected  XmlTag xmlTag
          The underlying xml tag
 
Constructor Summary
ComponentTag(XmlTag tag)
          Construct.
 
Method Summary
 boolean closes(MarkupElement open)
          Gets whether this tag closes the provided open tag.
 void enableAutolink(boolean autolink)
          If autolink is set to true, href attributes will automatically be converted into Wicket bookmarkable URLs.
 AttributeMap getAdditionalAttributes()
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 ValueMap getAttributes()
           
 java.lang.String getId()
          Get the tag's component id
 int getLength()
          Gets the length of the tag in characters.
 java.lang.String getName()
           
 boolean getNameChanged()
           
 java.lang.String getNamespace()
           
 ComponentTag getOpenTag()
          If set, return the corresponding open tag (ComponentTag).
 int getPos()
           
 java.lang.String getString(java.lang.String key)
           
 XmlTag.Type getType()
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
(package private)  XmlTag getXmlTag()
           
 boolean hasEqualTagName(ComponentTag tag)
          Compare tag name including namespace
 boolean isAutolinkEnabled()
          True if autolink is enabled and the tag contains a href attribute.
 boolean isClose()
           
 boolean isOpen()
           
 boolean isOpen(java.lang.String id)
           
 boolean isOpenClose()
           
 boolean isOpenClose(java.lang.String id)
           
 void makeImmutable()
          Makes this tag object immutable by making the attribute map unmodifiable.
 ComponentTag mutable()
          Gets this tag if it is already mutable, or a mutable copy of this tag if it is immutable.
 void put(java.lang.String key, boolean value)
           
 void put(java.lang.String key, int value)
           
 void put(java.lang.String key, java.lang.String value)
           
 void put(java.lang.String key, StringValue value)
           
 void putAll(java.util.Map map)
           
 void remove(java.lang.String key)
           
 boolean requiresCloseTag()
          Gets whether this tag does not require a closing tag.
 void setId(java.lang.String id)
          Set the component's id.
 void setName(java.lang.String name)
           
 void setNamespace(java.lang.String namespace)
           
 void setOpenTag(ComponentTag tag)
          Assuming this is a close tag, assign it's corresponding open tag.
 void setType(XmlTag.Type type)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 java.lang.String syntheticCloseTagString()
           
 java.lang.String toString()
          Converts this object to a string representation.
 java.lang.String toUserDebugString()
          Converts this object to a string representation including useful information for debugging
 void writeOutput(Response response, boolean stripWicketAttributes, java.lang.String namespace)
          Write the tag to the response
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_WICKET_NAMESPACE

public static final java.lang.String DEFAULT_WICKET_NAMESPACE
Standard component id attribute always available for components regardless of user ApplicationSettings for id attribute; value == 'wicket'.

See Also:
Constant Field Values

closes

protected ComponentTag closes
Assuming this is a open (or open-close) tag, 'closes' refers to the ComponentTag which closes it.


xmlTag

protected final XmlTag xmlTag
The underlying xml tag

Constructor Detail

ComponentTag

public ComponentTag(XmlTag tag)
Construct.

Parameters:
tag - The underlying xml tag
Method Detail

closes

public final boolean closes(MarkupElement open)
Gets whether this tag closes the provided open tag.

Overrides:
closes in class MarkupElement
Parameters:
open - The open tag
Returns:
True if this tag closes the given open tag

enableAutolink

public final void enableAutolink(boolean autolink)
If autolink is set to true, href attributes will automatically be converted into Wicket bookmarkable URLs.

Parameters:
autolink - enable/disable automatic href conversion

getAttributes

public final ValueMap getAttributes()
Returns:
The tag#s attributes
See Also:
XmlTag.getAttributes()

getId

public final java.lang.String getId()
Get the tag's component id

Returns:
The component id attribute of this tag

getLength

public final int getLength()
Gets the length of the tag in characters.

Returns:
The tag's length

getName

public final java.lang.String getName()
Returns:
The tag's name
See Also:
XmlTag.getName()

getNameChanged

public final boolean getNameChanged()
Returns:
Returns true if the name of this component tag was changed
See Also:
XmlTag.getNameChanged()

getNamespace

public final java.lang.String getNamespace()
Returns:
The tag's namespace
See Also:
XmlTag.getNamespace()

getOpenTag

public final ComponentTag getOpenTag()
If set, return the corresponding open tag (ComponentTag).

Returns:
The corresponding open tag

getPos

public final int getPos()
Returns:
Tag location (index in input string)
See Also:
XmlTag.getPos()

getString

public final java.lang.String getString(java.lang.String key)
Parameters:
key - The key
Returns:
The string value
See Also:
XmlTag.getString(String)

getType

public final XmlTag.Type getType()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Returns:
the tag type (OPEN, CLOSE or OPEN_CLOSE).
See Also:
XmlTag.getType()

isAutolinkEnabled

public final boolean isAutolinkEnabled()
True if autolink is enabled and the tag contains a href attribute.

Returns:
True, if the href contained should automatically be converted

isClose

public final boolean isClose()
Returns:
True if this tag is a close tag
See Also:
XmlTag.isClose()

isOpen

public final boolean isOpen()
Returns:
True if this tag is an open tag
See Also:
XmlTag.isOpen()

isOpen

public final boolean isOpen(java.lang.String id)
Parameters:
id - Required component id
Returns:
True if this tag is an open tag with the given component name
See Also:
XmlTag.isOpen()

isOpenClose

public final boolean isOpenClose()
Returns:
True if this tag is an open and a close tag
See Also:
XmlTag.isOpenClose()

isOpenClose

public final boolean isOpenClose(java.lang.String id)
Parameters:
id - Required component id
Returns:
True if this tag is an openclose tag with the given component id
See Also:
XmlTag.isOpenClose()

hasEqualTagName

public boolean hasEqualTagName(ComponentTag tag)
Compare tag name including namespace

Parameters:
tag -
Returns:
true if name and namespace are equal

makeImmutable

public final void makeImmutable()
Makes this tag object immutable by making the attribute map unmodifiable. Immutable tags cannot be made mutable again. They can only be copied into new mutable tag objects.


mutable

public ComponentTag mutable()
Gets this tag if it is already mutable, or a mutable copy of this tag if it is immutable.

Returns:
This tag if it is already mutable, or a mutable copy of this tag if it is immutable.

put

public final void put(java.lang.String key,
                      boolean value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, boolean)

put

public final void put(java.lang.String key,
                      int value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, int)

put

public final void put(java.lang.String key,
                      java.lang.String value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, String)

put

public final void put(java.lang.String key,
                      StringValue value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, StringValue)

putAll

public final void putAll(java.util.Map map)
Parameters:
map - a key/value map
See Also:
XmlTag.putAll(Map)

remove

public final void remove(java.lang.String key)
Parameters:
key - The key to remove
See Also:
XmlTag.remove(String)

requiresCloseTag

public final boolean requiresCloseTag()
Gets whether this tag does not require a closing tag.

Returns:
True if this tag does not require a closing tag

setId

public final void setId(java.lang.String id)
Set the component's id. The value is usually taken from the tag's id attribute, e.g. wicket:id="componentId".

Parameters:
id - The component's id assigned to the tag.

setName

public final void setName(java.lang.String name)
Parameters:
name - New tag name
See Also:
XmlTag.setName(String)

setNamespace

public final void setNamespace(java.lang.String namespace)
Parameters:
namespace - New tag name namespace
See Also:
XmlTag.setNamespace(String)

setOpenTag

public final void setOpenTag(ComponentTag tag)
Assuming this is a close tag, assign it's corresponding open tag.

Parameters:
tag - the open-tag
Throws:
java.lang.RuntimeException - if 'this' is not a close tag

setType

public final void setType(XmlTag.Type type)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Parameters:
type - The new type

syntheticCloseTagString

public final java.lang.String syntheticCloseTagString()
Returns:
A synthetic close tag for this tag

toString

public final java.lang.String toString()
Converts this object to a string representation.

Returns:
String version of this object

writeOutput

public final void writeOutput(Response response,
                              boolean stripWicketAttributes,
                              java.lang.String namespace)
Write the tag to the response

Parameters:
response - The response to write to
stripWicketAttributes - if true, wicket:id are removed from output
namespace - Wicket's namespace to use

toUserDebugString

public final java.lang.String toUserDebugString()
Converts this object to a string representation including useful information for debugging

Specified by:
toUserDebugString in class MarkupElement
Returns:
String version of this object

getXmlTag

final XmlTag getXmlTag()
Returns:
Returns the underlying xml tag.

getAdditionalAttributes

public final AttributeMap getAdditionalAttributes()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.

Get additional attributes contributed by <wicket:param>

Returns:
additional attributes


Copyright © 2004-2006 Wicket developers. All Rights Reserved.