Package com.microstrategy.web.tags
Class TagImpl
- java.lang.Object
-
- com.microstrategy.web.tags.TagImpl
-
- All Implemented Interfaces:
EnumHTMLTags,Tag,java.io.Serializable
- Direct Known Subclasses:
AnchorTagImpl,BaseTagImpl,DisplayTagImpl,IFrameOutputTag,IncludeTagImpl,JUILLayoutsTagImpl,JUILLayoutsTagImpl,ReplaceTagImpl,RootBlockTagImpl,ScriptTagImpl,SlotTagImpl,WebBlockContextTagImpl,WebBlockDeletePropertyTagImpl,WebBlockEditTagImpl,WebBlockListTagImpl,WebBlockSetPropertyTagImpl,WebBlockTagImpl
public class TagImpl extends java.lang.Object implements Tag, java.io.Serializable
- Since:
- MicroStrategy Web 8.0.0
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface com.microstrategy.web.tags.EnumHTMLTags
ATT_ACTION, ATT_ALIGN, ATT_ALT, ATT_AUTOCOMPLETE, ATT_BORDER, ATT_CELLPADDING, ATT_CELLSPACING, ATT_CHECKED, ATT_CLASS, ATT_CMD_FORMAT_TYPE, ATT_CMDID, ATT_CMDLVL, ATT_COLS, ATT_COLSPAN, ATT_DG, ATT_DIALOG, ATT_DISABLED, ATT_FOR, ATT_HEIGHT, ATT_HREF, ATT_HSPACE, ATT_ID, ATT_IFRAME, ATT_LANGUAGE, ATT_MAXLENGTH, ATT_METHOD, ATT_MODAL, ATT_NAME, ATT_NOWRAP, ATT_ONCHANGE, ATT_ONCLICK, ATT_ONFOCUS, ATT_ONKEYDOWN, ATT_ONKEYUP, ATT_ONMOUSEOUT, ATT_ONMOUSEOVER, ATT_ONSUBMIT, ATT_PARAM, ATT_PLACEHOLDER, ATT_READONLY, ATT_REL, ATT_ROWS, ATT_ROWSPAN, ATT_SCRIPT_CLASS, ATT_SELECTED, ATT_SIZE, ATT_SRC, ATT_STYLE, ATT_SUMMARY, ATT_TARGET, ATT_TITLE, ATT_TY, ATT_TYPE, ATT_VALIGN, ATT_VALUE, ATT_VALUE_ABSBOTTOM, ATT_VALUE_ABSMIDDLE, ATT_VALUE_BOTTOM, ATT_VALUE_BUTTON, ATT_VALUE_CHECKBOX, ATT_VALUE_DEFAULT, ATT_VALUE_EMBED, ATT_VALUE_FALSE, ATT_VALUE_HIDDEN, ATT_VALUE_IMAGE, ATT_VALUE_JAVASCRIPT, ATT_VALUE_LEFT, ATT_VALUE_MAX, ATT_VALUE_MIDDLE, ATT_VALUE_MIN, ATT_VALUE_NUMBER, ATT_VALUE_POST, ATT_VALUE_RADIO, ATT_VALUE_SUBMIT, ATT_VALUE_TEXT, ATT_VALUE_TOP, ATT_VALUE_TRUE, ATT_VSPACE, ATT_WIDTH, TAG_NAME_ANCHOR, TAG_NAME_CELL, TAG_NAME_DIV, TAG_NAME_HEADER, TAG_NAME_IFRAME, TAG_NAME_IMAGE, TAG_NAME_INPUT, TAG_NAME_LABEL, TAG_NAME_MAP, TAG_NAME_OPTION, TAG_NAME_ROW, TAG_NAME_SCRIPT, TAG_NAME_SELECT, TAG_NAME_SPAN, TAG_NAME_STYLE, TAG_NAME_TABLE, TAG_NAME_TBODY, TAG_NAME_TEXTAREA, TAG_NAME_THEAD
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MarkupOutputaddChild(MarkupOutput markup)Adds aMarkupOutputinstance as a child of the current tag.TagaddChild(Tag tag)Adds a child tag.TagaddChild(java.lang.String tagName)Adds a child tag with the speicified tag name.java.lang.StringaddTextChild(java.lang.String text)Adds a text as a child of the current tag.java.lang.StringaddTextChild(java.lang.String text, boolean encode)Adds a text as a child of the current tag.protected voidcheckEmptyString(java.lang.String s, java.lang.String msg)protected voidcheckModifiable()protected voidcheckNullObject(java.lang.Object o, java.lang.String msg)voiddoEndTag(LayoutContext context)This method is called after the rendering methodTag.renderCloseTag(MarkupOutput)is called to render the closing part of a tag, such as "".voiddoStartTag(LayoutContext context)This method is called before the rendering methodTag.renderOpenTag(MarkupOutput, LayoutContext)is called to render the opening part of a tag, such as "".java.lang.StringgenerateErrorMessage(Tag origin, java.lang.String msg)java.lang.StringgetAttribute(java.lang.String attrName)Returns the attribute value with the specified attribute name.java.util.EnumerationgetAttributeNames()Returns aEnumerationof attributes of the current tag.protected java.util.MapgetAttributeNamesCollection()protected java.util.MapgetAttributesCollection()java.util.EnumerationgetChildren()Returns aEnumerationof children of the current tag.protected java.util.ListgetChildrenCollection()MarkupOutputgetContent()Returns a newMarkupOutputinstance and Adds it as a child of the current tag.java.lang.StringgetCssClass()Returns theCascading Style Sheetsclass name associated with the current tag.TaggetDeepCopy()Returns a deep copy of this tagprotected java.util.ListgetDynamicAttributesCollection()java.lang.StringgetId()Returns the ID attribute value of the current tag.intgetLineNumber()Returns the line number of the current tag in the layout source.booleangetPreserveCase()Gets the character cases when rendering the tag name and attribute name.TaggetRootTag()Returns the root tag in the tag hierarchical tree.booleangetSealed()Returns a boolean value indicating whether the current tag is read-only.java.lang.StringgetStyle()Returns the value of the style attribute.java.lang.StringgetTagName()Returns the name of the current tag.booleanisClosedRequired()Returns a boolean value indicating whether a closing tag, which looks like</foo>, is required when rendering the current tag.booleanisContentInline()Returns a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.booleanisDynamic()Returns a boolean value indicating whether the current tag is dynamic.protected voidremoveAttribute(java.lang.String name)voidremoveChildren()Remove any existing child tag from this tag.voidrender(MarkupOutput markup)Renders the current tag including all its children tags and stores the rendering result in the specifiedMarkupOutputinstance.voidrender(MarkupOutput markup, LayoutContext context)(1) context == null, print out layout-related tags (2) context !protected voidrenderAllAttributes(MarkupOutput markup, LayoutContext context)protected voidrenderChildTags(MarkupOutput markup, LayoutContext context)voidrenderCloseTag(MarkupOutput markup)Renders the closing tag of the current tag and stores the rendering result in the specifiedMarkupOutputobject.voidrenderCloseTag(MarkupOutput markup, LayoutContext context)voidrenderOpenTag(MarkupOutput markup)Renders the openning tag of the current tag ans store the rendering result in the specifiedMarkupOutputobject.voidrenderOpenTag(MarkupOutput markup, LayoutContext context)Renders the openning tag of the current tag and stores the rendering result in the specifiedMarkupOutputobject.voidreplaceContent(Tag srcTag)copyContent Replace the current tag's content with the srcTag's contentvoidsetAttribute(java.lang.String attrName, java.lang.String attrValue)Sets a new value to the attribute with the specified attribute name.voidsetAttributes(java.util.Map attributes)Sets aMapof attributes to the current tag.voidsetCssClass(java.lang.String css)Sets a class name for the Cascading Style Sheets attribute on the current tag.voidsetDynamic(boolean dyn)Sets a boolean value indicating whether the current tag is dynamic.protected voidsetDynamicInternal(boolean dyn)voidsetId(java.lang.String id)Sets a value to the ID attribute on the current tag.voidsetIsClosedRequired(boolean closeReq)Sets a boolean value indicating whether a closing tag, which looks like</foo>, is required when rendering the current tag.voidsetIsContentInline(boolean inline)Sets a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.voidsetLineNumber(int lineNumber)Sets the line number of the current tag in the layout source.voidsetPreserveCase(boolean preserveCase)Sets the character cases when rendering the tag name and attribute name.voidsetRootTag(Tag root)Sets a root tag of the tag tree to which the current tag belongs.voidsetSealed()Marks the current tag as read-only.voidsetStyle(java.lang.String style)Set a value to the style attribute.voidsetTagName(java.lang.String name)Sets the current tag name.protected booleanshouldCloseTag()
-
-
-
Method Detail
-
addChild
public MarkupOutput addChild(MarkupOutput markup) throws UnmodifiableException
Description copied from interface:TagAdds aMarkupOutputinstance as a child of the current tag.- Specified by:
addChildin interfaceTag- Parameters:
markup- aMarkupOutputinstance to be added.- Returns:
- the
MarkupOutputinstance just being added. - Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
addChild
public Tag addChild(java.lang.String tagName) throws UnmodifiableException
Description copied from interface:TagAdds a child tag with the speicified tag name.- Specified by:
addChildin interfaceTag- Parameters:
tagName- the child tag name.- Returns:
- the child tag just being added.
- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
addChild
public Tag addChild(Tag tag) throws UnmodifiableException
Description copied from interface:TagAdds a child tag.- Specified by:
addChildin interfaceTag- Parameters:
tag- the child tag to be added.- Returns:
- the child tag just being added.
- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
addTextChild
public java.lang.String addTextChild(java.lang.String text) throws UnmodifiableExceptionDescription copied from interface:TagAdds a text as a child of the current tag.- Specified by:
addTextChildin interfaceTag- Parameters:
text- a text string to be added.- Returns:
- the text just being added.
- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
addTextChild
public java.lang.String addTextChild(java.lang.String text, boolean encode) throws UnmodifiableExceptionDescription copied from interface:TagAdds a text as a child of the current tag.- Specified by:
addTextChildin interfaceTag- Parameters:
text- a text string to be added.encode- true if the text should be encoded- Returns:
- the text just being added.
- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
getAttribute
public java.lang.String getAttribute(java.lang.String attrName)
Description copied from interface:TagReturns the attribute value with the specified attribute name.Nullis returned if there is no such an attribute.- Specified by:
getAttributein interfaceTag- Parameters:
attrName- the attribute name.- Returns:
- the attribute value with the specified name.
-
getContent
public MarkupOutput getContent() throws UnmodifiableException
Description copied from interface:TagReturns a newMarkupOutputinstance and Adds it as a child of the current tag. If the last child is aMarkupOutputobject, just returns that one for the sake of memory consumption and performance.- Specified by:
getContentin interfaceTag- Returns:
- a child
MarkupOutputinstance. - Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
getCssClass
public java.lang.String getCssClass()
Description copied from interface:TagReturns theCascading Style Sheetsclass name associated with the current tag. It is equivalent to call the methodgetAttribute(.EnumHTMLTags.ATT_CLASS)- Specified by:
getCssClassin interfaceTag- Returns:
- the Cascading Style Sheets class name.
-
getId
public java.lang.String getId()
Description copied from interface:TagReturns the ID attribute value of the current tag. It is equivalent to call the methodgetAttribute(.EnumHTMLTags.ATT_ID)
-
getStyle
public java.lang.String getStyle()
Description copied from interface:TagReturns the value of the style attribute. It is equivalent to call the methodgetAttribute(.EnumHTMLTags.ATT_STYLE)
-
getTagName
public java.lang.String getTagName()
Description copied from interface:TagReturns the name of the current tag.- Specified by:
getTagNamein interfaceTag- Returns:
- the current tag name.
-
isClosedRequired
public boolean isClosedRequired()
Description copied from interface:TagReturns a boolean value indicating whether a closing tag, which looks like</foo>, is required when rendering the current tag.- Specified by:
isClosedRequiredin interfaceTag- Returns:
trueto indicate that a closing tag is required.
-
isContentInline
public boolean isContentInline()
Description copied from interface:TagReturns a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.- Specified by:
isContentInlinein interfaceTag- Returns:
trueto indicate that a single line of the rendering result is preferred.
-
render
public void render(MarkupOutput markup)
Description copied from interface:TagRenders the current tag including all its children tags and stores the rendering result in the specifiedMarkupOutputinstance.- Specified by:
renderin interfaceTag- Parameters:
markup- theMarkupOutputobject to store the rendering result.
-
render
public void render(MarkupOutput markup, LayoutContext context) throws MalformedMethodException
(1) context == null, print out layout-related tags (2) context != null, render dynamic content from layout-related tags- Specified by:
renderin interfaceTag- Parameters:
markup- MarkupOutputcontext- LayoutContext- Throws:
RenderUnsuccessfulExceptionMalformedMethodException- thrown if error occurs at rendering.
-
renderChildTags
protected void renderChildTags(MarkupOutput markup, LayoutContext context) throws MalformedMethodException
- Throws:
MalformedMethodException- Since:
- MicroStrategy Web 9.0.0
-
shouldCloseTag
protected boolean shouldCloseTag()
- Since:
- MicroStrategy Web 9.0.0
-
doEndTag
public void doEndTag(LayoutContext context)
Description copied from interface:TagThis method is called after the rendering methodTag.renderCloseTag(MarkupOutput)is called to render the closing part of a tag, such as "". It is recommended to put all the cleaning work in this method that does not require rendering to theMarkupOutputobject.- Specified by:
doEndTagin interfaceTag- Parameters:
context- theLayoutContextobject within which the rendering occurs.- Since:
- MicroStrategy Web 9.0.0
-
doStartTag
public void doStartTag(LayoutContext context)
Description copied from interface:TagThis method is called before the rendering methodTag.renderOpenTag(MarkupOutput, LayoutContext)is called to render the opening part of a tag, such as "". It is recommended to put all the preparations in this method that does not require rendering to the
MarkupOutputobject.- Specified by:
doStartTagin interfaceTag- Parameters:
context- theLayoutContextobject within which the rendering occurs.- Since:
- MicroStrategy Web 9.0.0
-
renderOpenTag
public void renderOpenTag(MarkupOutput markup)
Description copied from interface:TagRenders the openning tag of the current tag ans store the rendering result in the specifiedMarkupOutputobject.- Specified by:
renderOpenTagin interfaceTag- Parameters:
markup- theMarkupOutputobject to store the rendering result.
-
renderCloseTag
public void renderCloseTag(MarkupOutput markup)
Description copied from interface:TagRenders the closing tag of the current tag and stores the rendering result in the specifiedMarkupOutputobject.- Specified by:
renderCloseTagin interfaceTag- Parameters:
markup- theMarkupOutputobject to store the rendering result.
-
renderCloseTag
public void renderCloseTag(MarkupOutput markup, LayoutContext context)
- Since:
- MicroStrategy Web 9.0.0
-
setAttribute
public void setAttribute(java.lang.String attrName, java.lang.String attrValue) throws UnmodifiableExceptionDescription copied from interface:TagSets a new value to the attribute with the specified attribute name. If the specified attribute does not exist in the current tag, adds it. If the specified attribute value is null, removes the attribute from the current tag.- Specified by:
setAttributein interfaceTag- Parameters:
attrName- the name of the attributeattrValue- the value of the attribute- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setAttributes
public void setAttributes(java.util.Map attributes)
Description copied from interface:TagSets aMapof attributes to the current tag. TheMapcontains pairs of attribute name and value.- Specified by:
setAttributesin interfaceTag- Parameters:
attributes- aMapof attributes- See Also:
Tag.setAttribute(String, String)
-
setCssClass
public void setCssClass(java.lang.String css) throws UnmodifiableExceptionDescription copied from interface:TagSets a class name for the Cascading Style Sheets attribute on the current tag. It is equivalent to call the methodsetAttribute(EnumHTMLTags.ATT_CLASS, css)- Specified by:
setCssClassin interfaceTag- Parameters:
css- the class name of the Cascading Style Sheets attribute- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setId
public void setId(java.lang.String id) throws UnmodifiableExceptionDescription copied from interface:TagSets a value to the ID attribute on the current tag. It is equivalent to call the methodsetAttribute(.EnumHTMLTags.ATT_ID, id)- Specified by:
setIdin interfaceTag- Parameters:
id- the valud of the ID attribute.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setIsClosedRequired
public void setIsClosedRequired(boolean closeReq) throws UnmodifiableExceptionDescription copied from interface:TagSets a boolean value indicating whether a closing tag, which looks like</foo>, is required when rendering the current tag.- Specified by:
setIsClosedRequiredin interfaceTag- Parameters:
closeReq-trueto indicate that a closing tag is required.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setIsContentInline
public void setIsContentInline(boolean inline) throws UnmodifiableExceptionDescription copied from interface:TagSets a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.- Specified by:
setIsContentInlinein interfaceTag- Parameters:
inline-trueto indicate that a single line of the rendering result is preferred.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setStyle
public void setStyle(java.lang.String style) throws UnmodifiableExceptionDescription copied from interface:TagSet a value to the style attribute. It is equivalent to call the methodsetAttribute(.EnumHTMLTags.ATT_STYLE, style)- Specified by:
setStylein interfaceTag- Parameters:
style- the style attribute value.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setTagName
public void setTagName(java.lang.String name) throws UnmodifiableExceptionDescription copied from interface:TagSets the current tag name.- Specified by:
setTagNamein interfaceTag- Parameters:
name- the tag name.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
setSealed
public void setSealed()
Description copied from interface:TagMarks the current tag as read-only.
-
getSealed
public boolean getSealed()
Description copied from interface:TagReturns a boolean value indicating whether the current tag is read-only.
-
getRootTag
public Tag getRootTag()
Description copied from interface:TagReturns the root tag in the tag hierarchical tree.- Specified by:
getRootTagin interfaceTag- Returns:
- the root tag of the tree to which the current tag belongs.
-
setRootTag
public void setRootTag(Tag root) throws UnmodifiableException
Description copied from interface:TagSets a root tag of the tag tree to which the current tag belongs.- Specified by:
setRootTagin interfaceTag- Parameters:
root- the root tag of the tag tree.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
getLineNumber
public int getLineNumber()
Description copied from interface:TagReturns the line number of the current tag in the layout source.- Specified by:
getLineNumberin interfaceTag- Returns:
- the line number of the current tag in the layout source.
-
setLineNumber
public void setLineNumber(int lineNumber) throws UnmodifiableExceptionDescription copied from interface:TagSets the line number of the current tag in the layout source.- Specified by:
setLineNumberin interfaceTag- Parameters:
lineNumber- the line number of the current tag in the layout source.- Throws:
UnmodifiableException- thrown if the current tag is read-only.
-
isDynamic
public boolean isDynamic()
Description copied from interface:TagReturns a boolean value indicating whether the current tag is dynamic. A dynamic tag might not get its opening tag rendered when theLayoutContextobject is not null.- Specified by:
isDynamicin interfaceTag- Returns:
trueto indicate that the current tag is dynamic.- See Also:
Tag.render(MarkupOutput, LayoutContext)
-
setDynamic
public void setDynamic(boolean dyn) throws UnmodifiableExceptionDescription copied from interface:TagSets a boolean value indicating whether the current tag is dynamic. A dynamic tag might not get its opening tag rendered when theLayoutContextobject is not null.- Specified by:
setDynamicin interfaceTag- Parameters:
dyn-trueto indicate that the current tag is dynamic.- Throws:
UnmodifiableException- thrown if the current tag is read-only.- See Also:
Tag.render(MarkupOutput, LayoutContext)
-
getChildren
public java.util.Enumeration getChildren()
Description copied from interface:TagReturns aEnumerationof children of the current tag.- Specified by:
getChildrenin interfaceTag- Returns:
- a
Enumerationof children of the current tag.
-
getAttributeNames
public java.util.Enumeration getAttributeNames()
Description copied from interface:TagReturns aEnumerationof attributes of the current tag.- Specified by:
getAttributeNamesin interfaceTag- Returns:
- a
Enumerationof attributes of the current tag.
-
generateErrorMessage
public java.lang.String generateErrorMessage(Tag origin, java.lang.String msg)
-
replaceContent
public void replaceContent(Tag srcTag)
copyContent Replace the current tag's content with the srcTag's content- Specified by:
replaceContentin interfaceTag- Parameters:
srcTag- Tag - The source tag which provides the content to replace with- Since:
- MicroStrategy Web 8.0.2
-
getDeepCopy
public Tag getDeepCopy()
Returns a deep copy of this tag- Specified by:
getDeepCopyin interfaceTag- Returns:
- Tag - This tag is a full copy of the current tag
- Since:
- MicroStrategy Web 8.0.2
-
setPreserveCase
public void setPreserveCase(boolean preserveCase)
Description copied from interface:TagSets the character cases when rendering the tag name and attribute name. Default isfalse.- Specified by:
setPreserveCasein interfaceTag- Parameters:
preserveCase-trueto indicate case will be preserved when rendering of the tag name and attribute name.falseto indicate the rendering of the tag name and attribute name will be in lower case.- Since:
- MicroStrategy Web 9.0.0
-
getPreserveCase
public boolean getPreserveCase()
Description copied from interface:TagGets the character cases when rendering the tag name and attribute name.- Specified by:
getPreserveCasein interfaceTag- Since:
- MicroStrategy Web 9.0.0
-
getChildrenCollection
protected java.util.List getChildrenCollection()
-
getAttributesCollection
protected java.util.Map getAttributesCollection()
-
getAttributeNamesCollection
protected java.util.Map getAttributeNamesCollection()
- Since:
- MicroStrategy Web 9.0.0
-
getDynamicAttributesCollection
protected java.util.List getDynamicAttributesCollection()
-
renderOpenTag
public void renderOpenTag(MarkupOutput markup, LayoutContext context) throws MalformedMethodException
Description copied from interface:TagRenders the openning tag of the current tag and stores the rendering result in the specifiedMarkupOutputobject.- Specified by:
renderOpenTagin interfaceTag- Parameters:
markup- theMarkupOutputobject to store the rendering result.context- theLayoutContextobject within which the rendering occurs.- Throws:
MalformedMethodException- thrown if error occurs at rendering.
-
checkNullObject
protected void checkNullObject(java.lang.Object o, java.lang.String msg) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
checkEmptyString
protected void checkEmptyString(java.lang.String s, java.lang.String msg) throws java.lang.IllegalArgumentException- Throws:
java.lang.IllegalArgumentException
-
checkModifiable
protected void checkModifiable() throws UnmodifiableException- Throws:
UnmodifiableException
-
removeAttribute
protected void removeAttribute(java.lang.String name)
-
setDynamicInternal
protected void setDynamicInternal(boolean dyn)
-
renderAllAttributes
protected void renderAllAttributes(MarkupOutput markup, LayoutContext context) throws MalformedMethodException
- Throws:
MalformedMethodException
-
removeChildren
public void removeChildren()
Description copied from interface:TagRemove any existing child tag from this tag.- Specified by:
removeChildrenin interfaceTag- Since:
- MicroStrategy Web 9.0.0
-
-