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.
 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.
 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 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 toString(boolean stripWicketAttributes)
          Converts this object to a string representation.
 java.lang.String toUserDebugString()
          Converts this object to a string representation including useful information for debugging
 
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 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 ValueMap getAttributes()
Returns:
The tag#s attributes
See Also:
XmlTag.getAttributes()

getId

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

Returns:
The component id attribute of this tag

getLength

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

Returns:
The tag's length

getName

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

getNameChanged

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

getNamespace

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

getOpenTag

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

Returns:
The corresponding open tag

getPos

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

getString

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

getType

public 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 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 boolean isClose()
Returns:
True if this tag is a close tag
See Also:
XmlTag.isClose()

isOpen

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

isOpen

public 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 boolean isOpenClose()
Returns:
True if this tag is an open and a close tag
See Also:
XmlTag.isOpenClose()

isOpenClose

public 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()

makeImmutable

public 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 void put(java.lang.String key,
                boolean value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, boolean)

put

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

put

public 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 void put(java.lang.String key,
                StringValue value)
Parameters:
key - The key
value - The value
See Also:
XmlTag.put(String, StringValue)

putAll

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

remove

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

requiresCloseTag

public 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 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="componentName".

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

setName

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

setOpenTag

public 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 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 java.lang.String syntheticCloseTagString()
Returns:
A synthetic close tag for this tag

toString

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

Returns:
String version of this object

toString

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

Parameters:
stripWicketAttributes - If true, tag attributes with namespace 'wicket# will not be printed.
Returns:
String version of this object

toUserDebugString

public 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


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