Class AbstractHtml

    • Field Detail

      • tagNameIndex

        protected static int tagNameIndex
    • Constructor Detail

      • AbstractHtml

        public AbstractHtml​(AbstractHtml base,
                            java.util.Collection<? extends AbstractHtml> children)
        Parameters:
        base - the parent tag of this object
        children - the tags which will be added as a children tag of this object.
      • AbstractHtml

        public AbstractHtml​(AbstractHtml base,
                            java.lang.String childContent)
        Parameters:
        base -
        childContent - any text, it can also be html text.
      • AbstractHtml

        public AbstractHtml​(java.lang.String tagName,
                            AbstractHtml base,
                            AbstractAttribute[] attributes)
        should be invoked to generate opening and closing tag base class containing the functionalities to generate html string.
        Parameters:
        tagName - TODO
        base - TODO
      • AbstractHtml

        protected AbstractHtml​(AbstractHtml.TagType tagType,
                               java.lang.String tagName,
                               AbstractHtml base,
                               AbstractAttribute[] attributes)
        should be invoked to generate opening and closing tag base class containing the functionalities to generate html string.
        Parameters:
        tagType -
        tagName - TODO
        base - TODO
    • Method Detail

      • appendChild

        public boolean appendChild​(AbstractHtml child)
        Appends the given child tag to its children.
        Parameters:
        child - the tag to append to its children.
        Returns:
        true if the given child tag is appended as child of this tag.
      • removeAllChildren

        public void removeAllChildren​()
        Removes all children from this tag.
      • addInnerHtml

        public void addInnerHtml​(AbstractHtml innerHtml)
        removes all children and adds the given tag
        Parameters:
        innerHtml - the inner html tag to add
      • addInnerHtmls

        public void addInnerHtmls​(AbstractHtml... innerHtmls)
        Removes all children and adds the given tags as children.
        Parameters:
        innerHtmls - the inner html tags to add
        Since:
        2.1.3
      • removeChildren

        public boolean removeChildren​(java.util.Collection<AbstractHtml> children)
        Removes the given tags from its children tags.
        Parameters:
        children - the tags to remove from its children.
        Returns:
        true given given children tags have been removed.
      • removeChild

        public boolean removeChild​(AbstractHtml child)
        Removes the given tag from its children only if the given tag is a child of this tag.
        Parameters:
        child - the tag to remove from its children
        Returns:
        true if removed
      • addChild

        public boolean addChild​(java.lang.Object accessObject,
                                AbstractHtml child,
                                boolean invokeListener)
        NB: This method is for internal use
        Parameters:
        accessObject -
        child -
        invokeListener -
        Returns:
        Since:
        2.0.0
      • appendChildren

        public void appendChildren​(java.util.Collection<AbstractHtml> children)
        adds the given children to the last position of the current children of this object.
        Parameters:
        children - children to append in this object's existing children.
      • appendChildren

        public void appendChildren​(AbstractHtml... children)
        adds the given children to the last position of the current children of this object.
        Parameters:
        children - children to append in this object's existing children.
        Since:
        2.1.6
      • addAttributes

        public void addAttributes​(AbstractAttribute... attributes)
        adds the given attributes to this tag.
        Parameters:
        attributes - attributes to add
        Since:
        2.0.0
      • getAttributes

        public java.util.Collection<AbstractAttribute> getAttributes​()
        Returns:
        the collection of attributes
        Since:
        2.0.0
      • getAttributeByName

        public AbstractAttribute getAttributeByName​(java.lang.String attributeName)
        gets the attribute by attribute name
        Returns:
        the attribute object for the given attribute name if exists otherwise returns null.
        Since:
        2.0.0
      • removeAttributes

        public boolean removeAttributes​(AbstractAttribute... attributes)
        removes the given attributes from this tag.
        Parameters:
        attributes - attributes to remove
        Returns:
        true if any of the attributes are removed.
        Since:
        2.0.0
      • removeAttributes

        public boolean removeAttributes​(java.lang.Object accessObject,
                                        boolean invokeListener,
                                        AbstractAttribute... attributes)
        removes the given attributes from this tag.
        Parameters:
        invokeListener - true to invoke listener
        attributes - attributes to remove
        Returns:
        true if any of the attributes are removed.
        Since:
        2.0.0
      • removeAttributes

        public boolean removeAttributes​(java.lang.String... attributeNames)
        removes the given attributes from this tag.
        Parameters:
        attributeNames - to remove the attributes having in the given names.
        Returns:
        true if any of the attributes are removed.
        Since:
        2.0.0
      • removeAttributes

        public boolean removeAttributes​(java.lang.Object accessObject,
                                        boolean invokeListener,
                                        java.lang.String... attributeNames)
        removes the given attributes from this tag.
        Parameters:
        invokeListener - true to invoke listener
        attributeNames - to remove the attributes having in the given names.
        Returns:
        true if any of the attributes are removed.
        Since:
        2.0.0
      • setParent

        @Deprecated
        public void setParent​(AbstractHtml parent)
        Deprecated. This method is not allowed to use. It's not implemented.
        Parameters:
        parent -
        Since:
        2.0.0
      • getChildren

        public java.util.List<AbstractHtml> getChildren​()
        Returns:
        the unmodifiable list of children
        Since:
        2.0.0
      • getChildren

        public java.util.Set<AbstractHtml> getChildren​(java.lang.Object accessObject)
        NB: this method is for internal use. The returned object should not be modified.
        Returns:
        the internal children object.
        Since:
        2.0.0
      • setChildren

        public void setChildren​(java.util.Set<AbstractHtml> children)
        Removes all current children and adds the given children under this tag. Unlike setter methods, it will not reuse the given set object but it will copy all children from the given set object.
        Parameters:
        children - which will be set as the children tag after removing all current children. Empty set or null will remove all current children from this tag.
        Since:
        2.1.12 proper implementation is available since 2.1.12
      • getOpeningTag

        public final java.lang.String getOpeningTag​()
        For internal purpose. Not recommended for external purpose.
        Returns:
        the opening tag of this object
      • getClosingTag

        public java.lang.String getClosingTag​()
        For internal purpose.
        Returns:
        the closing tag of this object
      • getPrintStructure

        protected java.lang.String getPrintStructure​()
        Returns:
        String equalent to the html string of the tag including the child tags.
        Since:
        1.0.0
      • getPrintStructure

        protected java.lang.String getPrintStructure​(boolean rebuild)
        Parameters:
        rebuild -
        Returns:
        Since:
        1.0.0
      • writePrintStructureToOutputStream

        protected int writePrintStructureToOutputStream​(java.nio.charset.Charset charset,
                                                        java.io.OutputStream os,
                                                        boolean rebuild)
                                                 throws java.io.IOException
        Parameters:
        rebuild -
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        1.0.0
      • writePrintStructureToWffBinaryMessageOutputStream

        protected void writePrintStructureToWffBinaryMessageOutputStream​(boolean rebuild)
                                                                  throws java.io.IOException
        Parameters:
        rebuild -
        Throws:
        java.io.IOException
        Since:
        2.0.0
      • toBigHtmlString

        public java.lang.String toBigHtmlString​()
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toHtmlString method which is faster than this method. The advantage of toBigHtmlString over toHtmlString is it will never throw StackOverflowError.
        NB:- this method has not been undergone all testing process.
        Returns:
        the HTML string similar to toHtmlString method.
        Since:
        2.1.12
      • toBigHtmlString

        public java.lang.String toBigHtmlString​(boolean rebuild)
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toHtmlString method which is faster than this method. The advantage of toBigHtmlString over toHtmlString is it will never throw StackOverflowError.
        NB:- this method has not been undergone all testing process.
        Parameters:
        rebuild - true to rebuild the tag hierarchy or false to return from cache if available.
        Returns:
        the HTML string similar to toHtmlString method.
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os,
                                     java.nio.charset.Charset charset)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        charset - the charset
        Returns:
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os,
                                     java.lang.String charset)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os,
                                     boolean rebuild)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os,
                                     boolean rebuild,
                                     java.nio.charset.Charset charset)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toBigOutputStream

        public int toBigOutputStream​(java.io.OutputStream os,
                                     boolean rebuild,
                                     java.lang.String charset)
                              throws java.io.IOException
        Use this method to produce HTML from very heavy and complicated tag hierarchy. For normal and simple HTML hierarchy use toOutputStream method which is faster than this method. The advantage of toBigOutputStream over toOutputStream is it will never throw StackOverflowError and the memory consumed at the time of writing could be available for GC (depends on JVM GC rules).
        NB:- this method has not been undergone all testing process.
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
        Since:
        2.1.12
      • toHtmlString

        public java.lang.String toHtmlString​()
        Description copied from interface: TagBase
        gets the html string of the tag including the child tags/values. rebuilds the html string if the child tags/values or attributes have been modified.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toHtmlString

        public java.lang.String toHtmlString​(java.nio.charset.Charset charset)
        Description copied from interface: TagBase
        gets the html string of the tag including the child tags/values using the given charset. rebuilds the html string if the child tags/values or attributes have been modified.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toHtmlString

        public java.lang.String toHtmlString​(java.lang.String charset)
        Description copied from interface: TagBase
        gets the html string of the tag including the child tags/values using the given charset. rebuilds the html string if the child tags/values or attributes have been modified.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toHtmlString

        public java.lang.String toHtmlString​(boolean rebuild)
        Description copied from interface: TagBase
        rebuilds the html string of the tag including the child tags/values if parameter is true, otherwise returns the html string prebuilt and kept in the cache.
        Parameters:
        rebuild - true to rebuild & false to return previously built string.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toHtmlString

        public java.lang.String toHtmlString​(boolean rebuild,
                                             java.nio.charset.Charset charset)
        Description copied from interface: TagBase
        rebuilds the html string of the tag including the child tags/values if parameter is true, otherwise returns the html string prebuilt and kept in the cache.
        Parameters:
        rebuild - true to rebuild & false to return previously built string.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toHtmlString

        public java.lang.String toHtmlString​(boolean rebuild,
                                             java.lang.String charset)
        Description copied from interface: TagBase
        rebuilds the html string of the tag including the child tags/values if parameter is true, otherwise returns the html string prebuilt and kept in the cache.
        Parameters:
        rebuild - true to rebuild & false to return previously built string.
        Returns:
        String equalent to the html string of the tag including the child tags.
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os,
                                  java.nio.charset.Charset charset)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        charset - the charset
        Returns:
        Throws:
        java.io.IOException
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os,
                                  java.lang.String charset)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os,
                                  boolean rebuild)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os,
                                  boolean rebuild,
                                  java.nio.charset.Charset charset)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
      • toOutputStream

        public int toOutputStream​(java.io.OutputStream os,
                                  boolean rebuild,
                                  java.lang.String charset)
                           throws java.io.IOException
        Parameters:
        os - the object of OutputStream to write to.
        rebuild - true to rebuild & false to write previously built bytes.
        charset - the charset
        Returns:
        the total number of bytes written
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString​()
        Description copied from interface: TagBase
        gets the html string of the tag including the child tags/values. rebuilds the html string if the child tags/values or attributes have been modified.
        Specified by:
        toString in interface TagBase
        Overrides:
        toString in class java.lang.Object
        Returns:
        String equalent to the html string of the tag including the child tags.
      • getTagName

        public java.lang.String getTagName​()
        Eg tag names :- html, body, div table, input, button etc...
        Returns:
        the tagName set by AbstractHtml5#setTagName(String) method.
        Since:
        1.0.0
      • getAttributeHtmlBytesCompressedByIndex

        public byte[][] getAttributeHtmlBytesCompressedByIndex​(boolean rebuild,
                                                               java.nio.charset.Charset charset)
                                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • getHtmlMiddleSB

        protected java.lang.StringBuilder getHtmlMiddleSB​()
        Returns:
        the htmlMiddleSB
        Since:
        1.0.0
      • isHtmlStartSBAsFirst

        public boolean isHtmlStartSBAsFirst​()
        Returns:
        the htmlStartSBAsFirst
        Since:
        1.0.0
      • deepClone

        protected AbstractHtml deepClone​(AbstractHtml objectToBeClonned)
                                  throws java.lang.CloneNotSupportedException
        Throws:
        java.lang.CloneNotSupportedException
      • beforePrintStructure

        protected void beforePrintStructure​()
        invokes just before getPrintStructure(final boolean method and only if the getPrintStructure(final boolean} rebuilds the structure.
        Since:
        1.0.0
      • beforeWritePrintStructureToOutputStream

        protected void beforeWritePrintStructureToOutputStream​()
        invokes just before writePrintStructureToOutputStream(final OutputStream method.
        Since:
        1.0.0
      • beforeWritePrintStructureToWffBinaryMessageOutputStream

        protected void beforeWritePrintStructureToWffBinaryMessageOutputStream​()
        invokes just before writePrintStructureToWffBinaryMessageOutputStream(final OutputStream method.
        Since:
        2.0.0
      • clone

        public AbstractHtml clone​()
                           throws java.lang.CloneNotSupportedException
        Creates and returns a deeply cloned copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:
         x.clone() != x
         
        will be true, and that the expression:
         x.clone().getClass() == x.getClass()
         
        will be true, but these are not absolute requirements. While it is typically the case that:
         x.clone().equals(x)
         
        will be true, this is not an absolute requirement.

        By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

        By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

        The method clone for class AbstractHtml performs a specific cloning operation. First, if the class of this object does not implement the interfaces Cloneable and Serializable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable and that the return type of the clone method of an array type T[] is T[] where T is any reference or primitive type. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.

        Overrides:
        clone in class java.lang.Object
        Returns:
        a deep clone of this instance.
        Throws:
        java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable and Serializable interfaces. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
        See Also:
        Cloneable, Serializable
      • clone

        public AbstractHtml clone​(java.lang.String... excludeAttributes)
                           throws java.lang.CloneNotSupportedException
        Creates and returns a deeply cloned copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:
         x.clone() != x
         
        will be true, and that the expression:
         x.clone().getClass() == x.getClass()
         
        will be true, but these are not absolute requirements. While it is typically the case that:
         x.clone().equals(x)
         
        will be true, this is not an absolute requirement.

        By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

        By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

        The method clone for class AbstractHtml performs a specific cloning operation. First, if the class of this object does not implement the interfaces Cloneable and Serializable, then a CloneNotSupportedException is thrown. Note that all arrays are considered to implement the interface Cloneable and that the return type of the clone method of an array type T[] is T[] where T is any reference or primitive type. Otherwise, this method creates a new instance of the class of this object and initializes all its fields with exactly the contents of the corresponding fields of this object, as if by assignment; the contents of the fields are not themselves cloned. Thus, this method performs a "shallow copy" of this object, not a "deep copy" operation.

        Parameters:
        excludeAttributes - pass the attributes names which need to be excluded from all tags including their child tags.
        Returns:
        a deep clone of this instance without the given attributes.
        Throws:
        java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable and Serializable interfaces. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.
        Since:
        2.0.0
        See Also:
        Cloneable, Serializable
      • getCharset

        public java.nio.charset.Charset getCharset​()
        Returns:
        the charset
      • setCharset

        public void setCharset​(java.nio.charset.Charset charset)
        Parameters:
        charset - the charset to set
      • toWffBMBytes

        public byte[] toWffBMBytes​()
        Returns:
        the Wff Binary Message bytes of this tag. It uses default charset for encoding values.
        Since:
        2.0.0
      • toWffBMBytes

        public byte[] toWffBMBytes​(java.lang.String charset)
        Parameters:
        charset -
        Returns:
        the Wff Binary Message bytes of this tag
        Throws:
        InvalidTagException
        Since:
        2.0.0
      • getTagFromWffBMBytes

        public static AbstractHtml getTagFromWffBMBytes​(byte[] bmMessageBytes)
        Parameters:
        bmMessageBytes -
        Returns:
        the AbstractHtml instance from the given Wff BM bytes. It uses system default charset.
        Throws:
        java.io.UnsupportedEncodingException
        Since:
        2.0.0
      • getTagFromWffBMBytes

        public static AbstractHtml getTagFromWffBMBytes​(byte[] bmMessageBytes,
                                                        java.lang.String charset)
        Parameters:
        bmMessageBytes -
        charset - of value bytes
        Returns:
        the AbstractHtml instance from the given Wff BM bytes
        Throws:
        java.io.UnsupportedEncodingException
        Since:
        2.0.0
      • getDataWffId

        public DataWffId getDataWffId​()
        Returns:
        the dataWffId
      • setDataWffId

        public void setDataWffId​(DataWffId dataWffId)
        adds data-wff-id for the tag if doesn't already exist. NB:- this method is ony for internal use.
        Parameters:
        dataWffId - the dataWffId to set
      • insertBefore

        public boolean insertBefore​(AbstractHtml... abstractHtmls)
        Inserts the given tags before this tag. There must be a parent for this method tag.
        Parameters:
        abstractHtmls - to insert before this tag
        Returns:
        true if inserted otherwise false.
        Since:
        2.1.1
      • insertAfter

        public boolean insertAfter​(AbstractHtml... abstractHtmls)
        Inserts the given tags after this tag. There must be a parent for this method tag.
        Note : This insertAfter method might be bit slower (in terms of nano optimization) than insertBefore method as it internally uses insertBefore method. This will be improved in the future version.
        Parameters:
        abstractHtmls - to insert after this tag
        Returns:
        true if inserted otherwise false.
        Since:
        2.1.6
      • loopThroughAllNestedChildren

        protected static void loopThroughAllNestedChildren​(NestedChild nestedChild,
                                                           boolean includeParents,
                                                           AbstractHtml... parents)
        Loops through all nested children tags (excluding the given tag) of the given tag. The looping is in a random order to gain maximum performance and minimum memory footprint.
        Parameters:
        nestedChild - the object of NestedChild from which the eachChild(AbstractHtml) to be invoked.
        includeParents - true to include the given parent tags in the loop
        parents - the tags from which to loop through.
        Since:
        2.1.8
      • addWffData

        protected WffBMData addWffData​(java.lang.String key,
                                       WffBMData wffBMData)
        Parameters:
        key -
        wffBMData -
        Returns:
        Since:
        2.1.8
      • removeWffData

        protected WffBMData removeWffData​(java.lang.String key)
        Parameters:
        key -
        Returns:
        Since:
        2.1.8
      • getRootTag

        public AbstractHtml getRootTag​()
        Gets the root level tag of this tag.
        Returns:
        the root parent tag or the current tag if there is no parent for the given tag
        Since:
        2.1.11
      • getSharedData

        public java.lang.Object getSharedData​()
        Gets the object which is accessible in all of this tag hierarchy.


        Eg:-
         
         Html html = new Html(null) {{
              new Head(this) {{
                  new TitleTag(this){{
                      new NoTag(this, "some title");
                  }};
              }};
              new Body(this, new Id("one")) {{
                  new Div(this);
              }};
          }};
        
          Div div = TagRepository.findOneTagAssignableToTag(Div.class, html);
          Head head = TagRepository.findOneTagAssignableToTag(Head.class, html);
        
          Object sharedData = "some object";
        
          div.setSharedData(sharedData);
        
          System.out.println(sharedData == head.getSharedData());
        
          System.out.println(div.getSharedData() == head.getSharedData());
        
          System.out.println(div.getSharedData().equals(head.getSharedData()));
        
          //prints
        
          true
          true
          true
        
         
         
        Returns:
        the sharedData object set by setSharedData method. This object is same across all of this tag hierarchy.
        Since:
        2.1.11
      • setSharedData

        public void setSharedData​(java.lang.Object sharedData)
        Sets the object which will be accessible by getSharedData method in all of this tag hierarchy. setData sets an object for the specific tag but setSharedData sets an object for all of the tag hierarchy.


        Eg:-
         
         Html html = new Html(null) {{
              new Head(this) {{
                  new TitleTag(this){{
                      new NoTag(this, "some title");
                  }};
              }};
              new Body(this, new Id("one")) {{
                  new Div(this);
              }};
          }};
        
          Div div = TagRepository.findOneTagAssignableToTag(Div.class, html);
          Head head = TagRepository.findOneTagAssignableToTag(Head.class, html);
        
          Object sharedData = "some object";
        
          div.setSharedData(sharedData);
        
          System.out.println(sharedData == head.getSharedData());
        
          System.out.println(div.getSharedData() == head.getSharedData());
        
          System.out.println(div.getSharedData().equals(head.getSharedData()));
        
          //prints
        
          true
          true
          true
        
         
         
        Parameters:
        sharedData - the object to access through all of this tag hierarchy.
        Since:
        2.1.11
      • resetHierarchy

        public final void resetHierarchy​()
                                  throws InvalidTagException
        Resets the hierarchy of this tag so that it can be used in another instance of BrowserPage. If a tag is used under a BrowserPage instance and the same instance of tag needs to be used in another instance of BrowserPage then the tag needs to be reset before use otherwise there could be some strange behaviour in the UI. To avoid compromising performance such usage never throws any exception.
        NB:- Child tag cannot be reset, i.e. this tag should not be a child of another tag.
        Throws:
        InvalidTagException - if the tag is already used by another tag, i.e. if this tag has a parent tag.
        Since:
        2.1.13