Class TagImpl

    • Constructor Detail

      • TagImpl

        public TagImpl()
      • TagImpl

        public TagImpl​(java.lang.String tagName)
    • Method Detail

      • addChild

        public Tag addChild​(java.lang.String tagName)
                     throws UnmodifiableException
        Description copied from interface: Tag
        Adds a child tag with the speicified tag name.
        Specified by:
        addChild in interface Tag
        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: Tag
        Adds a child tag.
        Specified by:
        addChild in interface Tag
        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 UnmodifiableException
        Description copied from interface: Tag
        Adds a text as a child of the current tag.
        Specified by:
        addTextChild in interface Tag
        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 UnmodifiableException
        Description copied from interface: Tag
        Adds a text as a child of the current tag.
        Specified by:
        addTextChild in interface Tag
        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: Tag
        Returns the attribute value with the specified attribute name. Null is returned if there is no such an attribute.
        Specified by:
        getAttribute in interface Tag
        Parameters:
        attrName - the attribute name.
        Returns:
        the attribute value with the specified name.
      • getCssClass

        public java.lang.String getCssClass()
        Description copied from interface: Tag
        Returns the Cascading Style Sheets class name associated with the current tag. It is equivalent to call the method getAttribute(EnumHTMLTags.ATT_CLASS).
        Specified by:
        getCssClass in interface Tag
        Returns:
        the Cascading Style Sheets class name.
      • getId

        public java.lang.String getId()
        Description copied from interface: Tag
        Returns the ID attribute value of the current tag. It is equivalent to call the method getAttribute(EnumHTMLTags.ATT_ID).
        Specified by:
        getId in interface Tag
        Returns:
        the value of the ID attribute.
      • getStyle

        public java.lang.String getStyle()
        Description copied from interface: Tag
        Returns the value of the style attribute. It is equivalent to call the method getAttribute(EnumHTMLTags.ATT_STYLE).
        Specified by:
        getStyle in interface Tag
        Returns:
        the style attribute value.
      • getTagName

        public java.lang.String getTagName()
        Description copied from interface: Tag
        Returns the name of the current tag.
        Specified by:
        getTagName in interface Tag
        Returns:
        the current tag name.
      • isClosedRequired

        public boolean isClosedRequired()
        Description copied from interface: Tag
        Returns a boolean value indicating whether a closing tag, which looks like </foo>, is required when rendering the current tag.
        Specified by:
        isClosedRequired in interface Tag
        Returns:
        true to indicate that a closing tag is required.
      • isContentInline

        public boolean isContentInline()
        Description copied from interface: Tag
        Returns a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.
        Specified by:
        isContentInline in interface Tag
        Returns:
        true to indicate that a single line of the rendering result is preferred.
      • render

        public void render​(MarkupOutput markup)
        Description copied from interface: Tag
        Renders the current tag including all its children tags and stores the rendering result in the specified MarkupOutput instance.
        Specified by:
        render in interface Tag
        Parameters:
        markup - the MarkupOutput object 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:
        render in interface Tag
        Parameters:
        markup - MarkupOutput
        context - LayoutContext
        Throws:
        RenderUnsuccessfulException
        MalformedMethodException - thrown if error occurs at rendering.
      • shouldCloseTag

        protected boolean shouldCloseTag()
        Since:
        MicroStrategy Web 9.0.0
      • doEndTag

        public void doEndTag​(LayoutContext context)
        Description copied from interface: Tag
        This method is called after the rendering method Tag.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 the MarkupOutput object.
        Specified by:
        doEndTag in interface Tag
        Parameters:
        context - the LayoutContext object within which the rendering occurs.
        Since:
        MicroStrategy Web 9.0.0
      • doStartTag

        public void doStartTag​(LayoutContext context)
        Description copied from interface: Tag
        This method is called before the rendering method Tag.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 MarkupOutput object.
        Specified by:
        doStartTag in interface Tag
        Parameters:
        context - the LayoutContext object within which the rendering occurs.
        Since:
        MicroStrategy Web 9.0.0
        • renderOpenTag

          public void renderOpenTag​(MarkupOutput markup)
          Description copied from interface: Tag
          Renders the openning tag of the current tag ans store the rendering result in the specified MarkupOutput object.
          Specified by:
          renderOpenTag in interface Tag
          Parameters:
          markup - the MarkupOutput object to store the rendering result.
        • renderCloseTag

          public void renderCloseTag​(MarkupOutput markup)
          Description copied from interface: Tag
          Renders the closing tag of the current tag and stores the rendering result in the specified MarkupOutput object.
          Specified by:
          renderCloseTag in interface Tag
          Parameters:
          markup - the MarkupOutput object 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 UnmodifiableException
          Description copied from interface: Tag
          Sets 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:
          setAttribute in interface Tag
          Parameters:
          attrName - the name of the attribute
          attrValue - 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: Tag
          Sets a Map of attributes to the current tag. The Map contains pairs of attribute name and value.
          Specified by:
          setAttributes in interface Tag
          Parameters:
          attributes - a Map of attributes
          See Also:
          Tag.setAttribute(String, String)
        • setCssClass

          public void setCssClass​(java.lang.String css)
                           throws UnmodifiableException
          Description copied from interface: Tag
          Sets a class name for the Cascading Style Sheets attribute on the current tag. It is equivalent to call the method setAttribute(EnumHTMLTags.ATT_CLASS, css)
          Specified by:
          setCssClass in interface Tag
          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 UnmodifiableException
          Description copied from interface: Tag
          Sets a value to the ID attribute on the current tag. It is equivalent to call the method setAttribute(EnumHTMLTags.ATT_ID, id).
          Specified by:
          setId in interface Tag
          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 UnmodifiableException
          Description copied from interface: Tag
          Sets a boolean value indicating whether a closing tag, which looks like </foo>, is required when rendering the current tag.
          Specified by:
          setIsClosedRequired in interface Tag
          Parameters:
          closeReq - true to indicate that a closing tag is required.
          Throws:
          UnmodifiableException - thrown if the current tag is read-only.
        • setIsContentInline

          public void setIsContentInline​(boolean inline)
                                  throws UnmodifiableException
          Description copied from interface: Tag
          Sets a boolean value indicating whether the rendering result of the current tag needs to be written in a single line.
          Specified by:
          setIsContentInline in interface Tag
          Parameters:
          inline - true to 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 UnmodifiableException
          Description copied from interface: Tag
          Set a value to the style attribute. It is equivalent to call the method setAttribute(EnumHTMLTags.ATT_STYLE, style).
          Specified by:
          setStyle in interface Tag
          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 UnmodifiableException
          Description copied from interface: Tag
          Sets the current tag name.
          Specified by:
          setTagName in interface Tag
          Parameters:
          name - the tag name.
          Throws:
          UnmodifiableException - thrown if the current tag is read-only.
        • setSealed

          public void setSealed()
          Description copied from interface: Tag
          Marks the current tag as read-only.
          Specified by:
          setSealed in interface Tag
        • getSealed

          public boolean getSealed()
          Description copied from interface: Tag
          Returns a boolean value indicating whether the current tag is read-only.
          Specified by:
          getSealed in interface Tag
          Returns:
          true to indicate that the current tag is read-only.
        • getRootTag

          public Tag getRootTag()
          Description copied from interface: Tag
          Returns the root tag in the tag hierarchical tree.
          Specified by:
          getRootTag in interface Tag
          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: Tag
          Sets a root tag of the tag tree to which the current tag belongs.
          Specified by:
          setRootTag in interface Tag
          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: Tag
          Returns the line number of the current tag in the layout source.
          Specified by:
          getLineNumber in interface Tag
          Returns:
          the line number of the current tag in the layout source.
        • setLineNumber

          public void setLineNumber​(int lineNumber)
                             throws UnmodifiableException
          Description copied from interface: Tag
          Sets the line number of the current tag in the layout source.
          Specified by:
          setLineNumber in interface Tag
          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: Tag
          Returns a boolean value indicating whether the current tag is dynamic. A dynamic tag might not get its opening tag rendered when the LayoutContext object is not null.
          Specified by:
          isDynamic in interface Tag
          Returns:
          true to indicate that the current tag is dynamic.
          See Also:
          Tag.render(MarkupOutput, LayoutContext)
        • getChildren

          public java.util.Enumeration getChildren()
          Description copied from interface: Tag
          Returns a Enumeration of children of the current tag.
          Specified by:
          getChildren in interface Tag
          Returns:
          a Enumeration of children of the current tag.
        • getAttributeNames

          public java.util.Enumeration getAttributeNames()
          Description copied from interface: Tag
          Returns a Enumeration of attributes of the current tag.
          Specified by:
          getAttributeNames in interface Tag
          Returns:
          a Enumeration of 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:
          replaceContent in interface Tag
          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:
          getDeepCopy in interface Tag
          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: Tag
          Sets the character cases when rendering the tag name and attribute name. Default is false.
          Specified by:
          setPreserveCase in interface Tag
          Parameters:
          preserveCase - true to indicate case will be preserved when rendering of the tag name and attribute name. false to 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: Tag
          Gets the character cases when rendering the tag name and attribute name.
          Specified by:
          getPreserveCase in interface Tag
          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()
        • 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
        • removeAttribute

          protected void removeAttribute​(java.lang.String name)
        • setDynamicInternal

          protected void setDynamicInternal​(boolean dyn)
        • removeChildren

          public void removeChildren()
          Description copied from interface: Tag
          Remove any existing child tag from this tag.
          Specified by:
          removeChildren in interface Tag
          Since:
          MicroStrategy Web 9.0.0