java.lang.Object
org.apache.wicket.markup.MarkupElement
org.apache.wicket.markup.ComponentTag
- Direct Known Subclasses:
WicketTag
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
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Factory that creates component during markup root container's initialization. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
If true, the current tag contains a child or a descendant with the "wicket:id" attributestatic final int
Render the tag as RawMarkup even if no Component can be foundprotected final XmlTag
The underlying xml tag -
Constructor Summary
ConstructorDescriptionComponentTag
(String name, XmlTag.TagType type) Automatically create a XmlTag, assign the name and the type, and construct a ComponentTag based on this XmlTag.ComponentTag
(ComponentTag tag) ConstructorComponentTag
(XmlTag tag) Construct. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addBehavior
(Behavior behavior) Adds a behavior to this component tag.final void
append
(String key, CharSequence value, String separator) Appends specifiedvalue
to the attributefinal boolean
closes
(MarkupElement open) Gets whether this tag closes the provided open tag.boolean
Says if the current tag contains a child or a descendant with the "wicket:id" attribute.final 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.final String
getAttribute
(String name) A convenient method.final IValueMap
final boolean
getFlag
(int flag) THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.final String
getId()
Get the tag's component idfinal int
Gets the length of the tag in characters.In case of inherited markup, the base and the extended markups are merged and the information about the tags origin is lost.final String
getName()
final String
final ComponentTag
If set, return the corresponding open tag (ComponentTag).final int
getPos()
final XmlTag.TagType
getType()
getUserData
(String key) Gets userData.final XmlTag
final boolean
boolean
boolean
final boolean
True if autolink is enabled and the tag contains a href attribute.final boolean
isClose()
boolean
isIgnore()
Gets ignore.final boolean
isOpen()
final boolean
final boolean
final boolean
isOpenClose
(String id) final void
Makes this tag object immutable by making the attribute map unmodifiable.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.final void
final void
final void
put
(String key, CharSequence value) final void
put
(String key, StringValue value) final void
final void
putInternal
(String key, CharSequence value) THIS METHOD IS NOT PART OF THE PUBLIC API, DO NOT CALL ITfinal void
final boolean
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.final 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. br) has no close tagfinal void
Set the component's id.void
setIgnore
(boolean ignore) Sets ignore.<C extends Component>
voidsetMarkupClass
(Class<C> wicketHeaderClass) Set the class of wicket component which contains the wicket:head tag.final void
setModified
(boolean modified) Manually mark the ComponentTag being modified.final void
final void
setNamespace
(String namespace) final void
setOpenTag
(ComponentTag tag) Assuming this is a close tag, assign it's corresponding open tag.final void
setType
(XmlTag.TagType type) THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.void
setUserData
(String key, Object value) Sets userData.final String
toString()
Converts this object to a string representation.final String
Converts this object to a string representation including useful information for debuggingfinal void
writeOutput
(Response response, boolean stripWicketAttributes, String namespace) Write the tag to the responsefinal void
writeSyntheticCloseTag
(Response response) Writes the synthetic close tag for this tag to the response
-
Field Details
-
RENDER_RAW
Render the tag as RawMarkup even if no Component can be found- See Also:
-
CONTAINS_WICKET_ID
If true, the current tag contains a child or a descendant with the "wicket:id" attribute- See Also:
-
xmlTag
The underlying xml tag
-
-
Constructor Details
-
ComponentTag
Automatically create a XmlTag, assign the name and the type, and construct a ComponentTag based on this XmlTag.- Parameters:
name
- The name of html tagtype
- The type of tag
-
ComponentTag
Construct.- Parameters:
tag
- The underlying xml tag
-
ComponentTag
Constructor- Parameters:
tag
- The ComponentTag tag which this wicket tag is based upon.
-
-
Method Details
-
setFlag
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!- Parameters:
flag
- The flag to setset
- True to turn the flag on, false to turn it off
-
getFlag
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT!- Parameters:
flag
- The flag to test- Returns:
- True if the flag is set
-
addBehavior
Adds a behavior to this component tag.- Parameters:
behavior
-
-
hasBehaviors
- Returns:
- true if this tag has any behaviors added, false otherwise
-
getBehaviors
- Returns:
- read only iterator over added behaviors
-
closes
Gets whether this tag closes the provided open tag.- Overrides:
closes
in classMarkupElement
- Parameters:
open
- The open tag- Returns:
- True if this tag closes the given open tag
-
enableAutolink
If autolink is set to true, href attributes will automatically be converted into Wicket bookmarkable URLs.- Parameters:
autolink
- enable/disable automatic href conversion
-
getAttributes
- Returns:
- The tag#s attributes
- See Also:
-
getAttribute
A convenient method. The same as getAttributes().getString(name)- Parameters:
name
-- Returns:
- The attributes value
-
getId
Get the tag's component id- Returns:
- The component id attribute of this tag
-
getLength
Gets the length of the tag in characters.- Returns:
- The tag's length
-
getName
- Returns:
- The tag's name
-
getNamespace
- Returns:
- The tag's namespace
-
getOpenTag
If set, return the corresponding open tag (ComponentTag).- Returns:
- The corresponding open tag
-
getPos
- Returns:
- Tag location (index in input string)
- See Also:
-
getType
- Returns:
- the tag type (OPEN, CLOSE or OPEN_CLOSE).
-
isAutolinkEnabled
True if autolink is enabled and the tag contains a href attribute.- Returns:
- True, if the href contained should automatically be converted
-
isClose
- Returns:
- True if this tag is a close tag
- See Also:
-
isOpen
- Returns:
- True if this tag is an open tag
- See Also:
-
isOpen
- Parameters:
id
- Required component id- Returns:
- True if this tag is an open tag with the given component name
- See Also:
-
isOpenClose
- Returns:
- True if this tag is an open and a close tag
- See Also:
-
isOpenClose
- Parameters:
id
- Required component id- Returns:
- True if this tag is an openclose tag with the given component id
- See Also:
-
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
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
- Parameters:
key
- The keyvalue
- The value- See Also:
-
put
- Parameters:
key
- The keyvalue
- The value- See Also:
-
put
- Parameters:
key
- The keyvalue
- The value- See Also:
-
putInternal
THIS METHOD IS NOT PART OF THE PUBLIC API, DO NOT CALL IT- Parameters:
key
- The keyvalue
- The value- See Also:
-
append
Appends specifiedvalue
to the attribute- Parameters:
key
- The keyvalue
- The valueseparator
- The separator used to append the value
-
put
- Parameters:
key
- The keyvalue
- The value- See Also:
-
putAll
- Parameters:
map
- a key/value map- See Also:
-
remove
- Parameters:
key
- The key to remove- See Also:
-
requiresCloseTag
Gets whether this tag does not require a closing tag.- Returns:
- True if this tag does not require a closing tag
-
setId
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
- Parameters:
name
- New tag name- See Also:
-
setNamespace
- Parameters:
namespace
- New tag name namespace- See Also:
-
setOpenTag
Assuming this is a close tag, assign it's corresponding open tag.- Parameters:
tag
- the open-tag- Throws:
RuntimeException
- if 'this' is not a close tag
-
setType
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT CALL IT.- Parameters:
type
- The new type
-
writeSyntheticCloseTag
Writes the synthetic close tag for this tag to the response- Parameters:
response
- The response to write to
-
toCharSequence
- Specified by:
toCharSequence
in classMarkupElement
- Returns:
- Gets the charsequence representation of this element
- See Also:
-
toString
Converts this object to a string representation. -
writeOutput
Write the tag to the response- Parameters:
response
- The response to write tostripWicketAttributes
- if true, wicket:id are removed from outputnamespace
- Wicket's namespace to use
-
toUserDebugString
Converts this object to a string representation including useful information for debugging- Specified by:
toUserDebugString
in classMarkupElement
- Returns:
- String version of this object
-
getXmlTag
- Returns:
- Returns the underlying xml tag.
-
setModified
Manually mark the ComponentTag being modified. Flagging the tag being modified does not happen automatically.- Parameters:
modified
-
-
hasNoCloseTag
- Returns:
- True if the HTML tag (e.g. br) has no close tag
-
setHasNoCloseTag
True if the HTML tag (e.g. br) has no close tag- Parameters:
hasNoCloseTag
-
-
setContainsWicketId
Sets the flag to indicate if the current tag contains a child or a descendant with the "wicket:id" attribute.- Parameters:
containsWicketId
-
-
containsWicketId
Says if the current tag contains a child or a descendant with the "wicket:id" attribute.- Returns:
- true if the current tag contains a child or a descendant with the "wicket:id" attribute.
-
getMarkupClass
In case of inherited markup, the base and the extended markups are merged and the information about the tags origin is lost. In some cases like wicket:head and wicket:link this information however is required.- Returns:
- wicketHeaderClass
-
setMarkupClass
Set the class of wicket component which contains the wicket:head tag.- Type Parameters:
C
-- Parameters:
wicketHeaderClass
- wicketHeaderClass
-
equalTo
Description copied from class:MarkupElement
This is not an implementation of equals because we don't care about hashCodes for MarkupElements yet. Also, this method only compares the namespace, name and attributes of the given MarkupElements.- Specified by:
equalTo
in classMarkupElement
- Parameters:
element
- The markup element to compare with- Returns:
- True if the other element equals this one
- See Also:
-
isIgnore
Gets ignore.- Returns:
- If true than MarkupParser will remove it from the markup
-
setIgnore
Sets ignore.- Parameters:
ignore
- If true than MarkupParser will remove it from the markup
-
isAutoComponentTag
- Returns:
- True, if wicket:id has been automatically created (internal component)
-
setAutoComponentTag
- Parameters:
auto
- True, if wicket:id has been automatically created (internal component)
-
getUserData
Gets userData.- Parameters:
key
- The key to store and retrieve the value- Returns:
- userData
-
setUserData
Sets userData.- Parameters:
key
- The key to store and retrieve the valuevalue
- The user specific value to store
-
onBeforeRender
For subclasses to override. Gets called just before a Component gets rendered. It is guaranteed that the markupStream is set on the Component and determineVisibility is not yet called.- Parameters:
component
- The component that is about to be renderedmarkupStream
- The current markup stream
-
getAutoComponentFactory
-
setAutoComponentFactory
-