public class ComponentTag extends MarkupElement
Modifier and Type | Class and Description |
---|---|
static interface |
ComponentTag.IAutoComponentFactory
Factory that creates component during markup root container's initialization.
|
Modifier and Type | Field and Description |
---|---|
static int |
CONTAINS_WICKET_ID
If true, the current tag contains a child or a descendant with the "wicket:id" attribute
|
static int |
RENDER_RAW
Render the tag as RawMarkup even if no Component can be found
|
protected XmlTag |
xmlTag
The underlying xml tag
|
Constructor and Description |
---|
ComponentTag(ComponentTag tag)
Constructor
|
ComponentTag(String name,
XmlTag.TagType type)
Automatically create a XmlTag, assign the name and the type, and construct a ComponentTag
based on this XmlTag.
|
ComponentTag(XmlTag tag)
Construct.
|
Modifier and Type | Method and Description |
---|---|
void |
addBehavior(Behavior behavior)
Adds a behavior to this component tag.
|
void |
append(String key,
CharSequence value,
String separator)
Appends specified
value to the attribute |
boolean |
closes(MarkupElement open)
Gets whether this tag closes the provided open tag.
|
boolean |
containsWicketId()
Says if the current tag contains a child or a descendant with the "wicket:id" attribute.
|
void |
enableAutolink(boolean autolink)
If autolink is set to true, href attributes will automatically be converted into Wicket
bookmarkable URLs.
|
boolean |
equalTo(MarkupElement element)
This is not an implementation of equals because we don't care about hashCodes for
MarkupElements yet.
|
String |
getAttribute(String name)
A convenient method.
|
IValueMap |
getAttributes() |
ComponentTag.IAutoComponentFactory |
getAutoComponentFactory() |
Iterator<? extends Behavior> |
getBehaviors() |
boolean |
getFlag(int flag)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
String |
getId()
Get the tag's component id
|
int |
getLength()
Gets the length of the tag in characters.
|
Class<? extends Component> |
getMarkupClass()
In case of inherited markup, the base and the extended markups are merged and the information
about the tags origin is lost.
|
String |
getName() |
String |
getNamespace() |
ComponentTag |
getOpenTag()
If set, return the corresponding open tag (ComponentTag).
|
int |
getPos() |
XmlTag.TagType |
getType() |
Object |
getUserData(String key)
Gets userData.
|
XmlTag |
getXmlTag() |
boolean |
hasBehaviors() |
boolean |
hasNoCloseTag() |
boolean |
isAutoComponentTag() |
boolean |
isAutolinkEnabled()
True if autolink is enabled and the tag contains a href attribute.
|
boolean |
isClose() |
boolean |
isIgnore()
Gets ignore.
|
boolean |
isOpen() |
boolean |
isOpen(String id) |
boolean |
isOpenClose() |
boolean |
isOpenClose(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 |
onBeforeRender(Component component,
MarkupStream markupStream)
For subclasses to override.
|
void |
put(String key,
boolean value) |
void |
put(String key,
CharSequence value) |
void |
put(String key,
int value) |
void |
put(String key,
StringValue value) |
void |
putAll(Map<String,Object> map) |
void |
putInternal(String key,
CharSequence value)
THIS METHOD IS NOT PART OF THE PUBLIC API, DO NOT CALL IT
|
void |
remove(String key) |
boolean |
requiresCloseTag()
Gets whether this tag does not require a closing tag.
|
void |
setAutoComponentFactory(ComponentTag.IAutoComponentFactory autoComponentFactory) |
void |
setAutoComponentTag(boolean auto) |
void |
setContainsWicketId(boolean containsWicketId)
Sets the flag to indicate if the current tag contains a child
or a descendant with the "wicket:id" attribute.
|
void |
setFlag(int flag,
boolean set)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
void |
setHasNoCloseTag(boolean hasNoCloseTag)
True if the HTML tag (e.g.
|
void |
setId(String id)
Set the component's id.
|
void |
setIgnore(boolean ignore)
Sets ignore.
|
<C extends Component> |
setMarkupClass(Class<C> wicketHeaderClass)
Set the class of wicket component which contains the wicket:head tag.
|
void |
setModified(boolean modified)
Manually mark the ComponentTag being modified.
|
void |
setName(String name) |
void |
setNamespace(String namespace) |
void |
setOpenTag(ComponentTag tag)
Assuming this is a close tag, assign it's corresponding open tag.
|
void |
setType(XmlTag.TagType type)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
void |
setUserData(String key,
Object value)
Sets userData.
|
CharSequence |
syntheticCloseTagString() |
CharSequence |
toCharSequence() |
String |
toString()
Converts this object to a string representation.
|
String |
toUserDebugString()
Converts this object to a string representation including useful information for debugging
|
void |
writeOutput(Response response,
boolean stripWicketAttributes,
String namespace)
Write the tag to the response
|
public static final int RENDER_RAW
public static final int CONTAINS_WICKET_ID
protected final XmlTag xmlTag
public ComponentTag(String name, XmlTag.TagType type)
name
- The name of html tagtype
- The type of tagpublic ComponentTag(XmlTag tag)
tag
- The underlying xml tagpublic ComponentTag(ComponentTag tag)
tag
- The ComponentTag tag which this wicket tag is based upon.public final void setFlag(int flag, boolean set)
flag
- The flag to setset
- True to turn the flag on, false to turn it offpublic final boolean getFlag(int flag)
flag
- The flag to testpublic final void addBehavior(Behavior behavior)
behavior
- public final boolean hasBehaviors()
public final Iterator<? extends Behavior> getBehaviors()
public final boolean closes(MarkupElement open)
closes
in class MarkupElement
open
- The open tagpublic final void enableAutolink(boolean autolink)
autolink
- enable/disable automatic href conversionpublic final IValueMap getAttributes()
XmlTag.getAttributes()
public final String getAttribute(String name)
name
- public final String getId()
public final int getLength()
public final String getName()
public final String getNamespace()
public final ComponentTag getOpenTag()
public final int getPos()
XmlTag.getPos()
public final XmlTag.TagType getType()
public final boolean isAutolinkEnabled()
public final boolean isClose()
XmlTag.isClose()
public final boolean isOpen()
XmlTag.isOpen()
public final boolean isOpen(String id)
id
- Required component idXmlTag.isOpen()
public final boolean isOpenClose()
XmlTag.isOpenClose()
public final boolean isOpenClose(String id)
id
- Required component idXmlTag.isOpenClose()
public final void makeImmutable()
public ComponentTag mutable()
public final void put(String key, boolean value)
key
- The keyvalue
- The valueXmlTag.put(String, boolean)
public final void put(String key, int value)
key
- The keyvalue
- The valueXmlTag.put(String, int)
public final void put(String key, CharSequence value)
key
- The keyvalue
- The valueXmlTag.put(String, CharSequence)
public final void putInternal(String key, CharSequence value)
key
- The keyvalue
- The valueXmlTag.put(String, CharSequence)
public final void append(String key, CharSequence value, String separator)
value
to the attributekey
- The keyvalue
- The valueseparator
- The separator used to append the valuepublic final void put(String key, StringValue value)
key
- The keyvalue
- The valueXmlTag.put(String, StringValue)
public final void putAll(Map<String,Object> map)
map
- a key/value mapXmlTag.putAll(Map)
public final void remove(String key)
key
- The key to removeXmlTag.remove(String)
public final boolean requiresCloseTag()
public final void setId(String id)
id
- The component's id assigned to the tag.public final void setName(String name)
name
- New tag nameXmlTag.setName(String)
public final void setNamespace(String namespace)
namespace
- New tag name namespaceXmlTag.setNamespace(String)
public final void setOpenTag(ComponentTag tag)
tag
- the open-tagRuntimeException
- if 'this' is not a close tagpublic final void setType(XmlTag.TagType type)
type
- The new typepublic final CharSequence syntheticCloseTagString()
public CharSequence toCharSequence()
toCharSequence
in class MarkupElement
MarkupElement.toCharSequence()
public final String toString()
public final void writeOutput(Response response, boolean stripWicketAttributes, String namespace)
response
- The response to write tostripWicketAttributes
- if true, wicket:id are removed from outputnamespace
- Wicket's namespace to usepublic final String toUserDebugString()
toUserDebugString
in class MarkupElement
public final XmlTag getXmlTag()
public final void setModified(boolean modified)
modified
- public boolean hasNoCloseTag()
public void setHasNoCloseTag(boolean hasNoCloseTag)
hasNoCloseTag
- public void setContainsWicketId(boolean containsWicketId)
containsWicketId
- public boolean containsWicketId()
public Class<? extends Component> getMarkupClass()
public <C extends Component> void setMarkupClass(Class<C> wicketHeaderClass)
C
- wicketHeaderClass
- wicketHeaderClasspublic boolean equalTo(MarkupElement element)
MarkupElement
equalTo
in class MarkupElement
element
- The markup element to compare withMarkupElement.equalTo(org.apache.wicket.markup.MarkupElement)
public boolean isIgnore()
public void setIgnore(boolean ignore)
ignore
- If true than MarkupParser will remove it from the markuppublic boolean isAutoComponentTag()
public void setAutoComponentTag(boolean auto)
auto
- True, if wicket:id has been automatically created (internal component)public Object getUserData(String key)
key
- The key to store and retrieve the valuepublic void setUserData(String key, Object value)
key
- The key to store and retrieve the valuevalue
- The user specific value to storepublic void onBeforeRender(Component component, MarkupStream markupStream)
component
- The component that is about to be renderedmarkupStream
- The current markup streampublic ComponentTag.IAutoComponentFactory getAutoComponentFactory()
public void setAutoComponentFactory(ComponentTag.IAutoComponentFactory autoComponentFactory)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.