Class AbstractAttribute

    • Field Detail

      • LOGGER

        public static final java.util.logging.Logger LOGGER
    • Constructor Detail

      • AbstractAttribute

        public AbstractAttribute​()
    • Method Detail

      • 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)
      • getWffPrintStructure

        protected java.lang.String getWffPrintStructure​()
        gets the attribute name and value in the format of name=value.
        Eg: style=color:green;background:blue
        This reduces 2 bytes taken for ".
        Returns:
        the attribute name and value in the format of name=value. Eg: style=color:green;background:blue
        Since:
        2.0.0
      • toWffString

        public java.lang.String toWffString​()
        gets the attribute name and value in the format of name=value.
        Eg: style=color:green;background:blue
        This reduces 2 bytes taken for ".
        Returns:
        the attribute name and value in the format of name=value. Eg: style=color:green;background:blue;
        Since:
        2.0.0
      • beforeWffPrintStructure

        protected void beforeWffPrintStructure​()
      • getBinaryStructureCompressedByIndex

        protected byte[] getBinaryStructureCompressedByIndex​(boolean rebuild)
                                                      throws java.io.IOException
        gives compressed by index bytes for the attribute and value. The first byte represents the attribute name index bytes length, the next bytes represent the attribute name index bytes and the remaining bytes represent attribute value without = and ".
        Parameters:
        rebuild -
        Returns:
        the compressed by index bytes.
        Throws:
        java.io.IOException
        Since:
        1.1.3
      • getAttributeName

        public java.lang.String getAttributeName​()
        Returns:
        the attributeName set by AbstractAttribute#setAttributeName(String)
        Since:
        1.0.0
      • setAttributeName

        protected void setAttributeName​(java.lang.String attributeName)
        Set attribute name, eg: width, height, name, type etc..
        Parameters:
        attributeName - the attributeName to set
        Since:
        1.0.0
      • 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.
      • toCompressedBytesByIndex

        public byte[] toCompressedBytesByIndex​(boolean rebuild)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • toCompressedBytesByIndex

        public byte[] toCompressedBytesByIndex​(boolean rebuild,
                                               java.nio.charset.Charset charset)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • 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.
      • 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.
      • getAttributeValueMap

        protected java.util.Map<java.lang.String,java.lang.String> getAttributeValueMap​()
        Returns:
        the attributeValueMap
        Since:
        1.0.0
      • setAttributeValueMap

        protected void setAttributeValueMap​(java.util.Map<java.lang.String,java.lang.String> attributeValueMap)
        Parameters:
        attributeValueMap - the attributeValueMap to set
        Since:
        1.0.0
      • addToAttributeValueMap

        protected boolean addToAttributeValueMap​(java.lang.String key,
                                                 java.lang.String value)
        adds the given key value.
        Parameters:
        key -
        value -
        Returns:
        true if it is modified
        Since:
        1.0.0
      • addAllToAttributeValueMap

        protected boolean addAllToAttributeValueMap​(java.util.Map<java.lang.String,java.lang.String> map)
        adds all to the attribute value map.
        Parameters:
        map -
        Returns:
        true if it is modified
        Since:
        1.0.0
      • removeFromAttributeValueMap

        protected boolean removeFromAttributeValueMap​(java.lang.String key)
        removes the key value for the input key.
        Parameters:
        key -
        Returns:
        true if the given key (as well as value contained corresponding to it) has been removed.
        Since:
        1.0.0
      • removeFromAttributeValueMap

        protected boolean removeFromAttributeValueMap​(java.lang.String key,
                                                      java.lang.String value)
        removes only if the key and value matches in the map for any particular entry.
        Parameters:
        key -
        value -
        Returns:
        true if it is modified
        Since:
        1.0.0
      • removeAllFromAttributeValueMap

        protected void removeAllFromAttributeValueMap​()
      • getAttributeValue

        public java.lang.String getAttributeValue​()
        Returns:
        the attributeValue
        Since:
        1.0.0
      • setAttributeValue

        protected void setAttributeValue​(java.lang.String attributeValue)
        Parameters:
        attributeValue - the attributeValue to set
        Since:
        1.0.0
      • getOwnerTag

        @Deprecated
        public AbstractHtml getOwnerTag​()
        Deprecated. this method may be removed later as there could be multiple owner tags.
        Since:
        1.0.0
      • getOwnerTags

        public AbstractHtml[] getOwnerTags​()
        Returns:
        the tags which are consuming this attribute as an array. If there is no owner tag then it will return an empty array instead of null.
        Since:
        2.0.0
      • setOwnerTag

        public void setOwnerTag​(AbstractHtml ownerTag)
        NB:- this method is used for internal purpose, so it should not be consumed.
        Parameters:
        ownerTag - the ownerTag to set
        Since:
        1.0.0
      • unsetOwnerTag

        public boolean unsetOwnerTag​(AbstractHtml ownerTag)
        NB:- this method is used for internal purpose, so it should not be consumed.
        Parameters:
        ownerTag - the ownerTag to unset
        Returns:
        true if the given ownerTag is an owner of the attribute.
        Since:
        2.0.0
      • setModified

        public void setModified​(boolean modified)
        Description copied from class: AbstractTagBase
        set true whenever this object's state is modified.
        Overrides:
        setModified in class AbstractTagBase
        Parameters:
        modified - the modified to set
      • getAttributeValueSet

        protected java.util.Set<java.lang.String> getAttributeValueSet​()
        NB:- this is only for getting values. Use addToAttributeValueSet method for adding
        Returns:
        the attributeValueSet
        Since:
        1.0.0
      • setAttributeValueSet

        protected void setAttributeValueSet​(java.util.Set<java.lang.String> attributeValueSet)
        Parameters:
        attributeValueSet - the attributeValueSet to set
        Since:
        1.0.0
      • addToAttributeValueSet

        protected boolean addToAttributeValueSet​(java.lang.String value)
        adds to the attribute value set.
        Parameters:
        value -
        Returns:
        Since:
        1.0.0
      • addAllToAttributeValueSet

        protected void addAllToAttributeValueSet​(java.util.Collection<java.lang.String> values)
        adds all to the attribute value set.
        Parameters:
        value -
        Since:
        1.0.0
      • removeFromAttributeValueSet

        protected void removeFromAttributeValueSet​(java.lang.String value)
        removes the value from the the attribute set.
        Parameters:
        value -
        Since:
        1.0.0
      • removeAllFromAttributeValueSet

        protected void removeAllFromAttributeValueSet​(java.util.Collection<java.lang.String> values)
        removes the value from the the attribute set.
        Parameters:
        values -
        Since:
        1.0.0
      • removeAllFromAttributeValueSet

        protected void removeAllFromAttributeValueSet​()
        clears all values from the value set.
        Since:
        1.0.0
      • 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
      • beforePrintStructureCompressedByIndex

        protected void beforePrintStructureCompressedByIndex​()
        invokes just before getPrintStructureCompressedByIndex(final boolean method and only if the getPrintStructureCompressedByIndex(final boolean} rebuilds the structure.
        Since:
        1.0.0
      • 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
      • addValueChangeListener

        public void addValueChangeListener​(AttributeValueChangeListener valueChangeListener)
        adds value change lister which will be invoked when the value changed
        Parameters:
        valueChangeListener -
        Since:
        2.0.0
      • removeValueChangeListener

        public void removeValueChangeListener​(AttributeValueChangeListener valueChangeListener)
        removes the corresponding value change listener
        Parameters:
        valueChangeListener -
        Since:
        2.0.0
      • getValueChangeListeners

        public java.util.Set<AttributeValueChangeListener> getValueChangeListeners​()
        Returns:
        the set of value change listeners
        Since:
        2.0.0