Class ComponentBlock


  • public class ComponentBlock
    extends java.lang.Object
    This class represents a component block generated for partial update request. A ComponentBlock consists of a set of name/value pairs, HTML content (if the component needs to update itself) and a list of child ComponentBlocks (if the component has sub components to update) ComponentBlock renders itself into JSON stream. If child ComponentsBlocks are present it will just render the children array as the value of the COMPONENTS property; if it's child-less it will render the HTML content as the value of the CONTENT property.
    • Constructor Detail

      • ComponentBlock

        public ComponentBlock​(java.lang.String id,
                              MarkupOutput out)
        Creates a new ComponentBlock object.
    • Method Detail

      • setOrCreateProperty

        public BlockProperty setOrCreateProperty​(java.lang.String propName,
                                                 java.lang.String propType,
                                                 java.lang.Object propValue)
        Sets a property (creating it, if necessary) to a specific value.
        Parameters:
        propName - The name of the property to set.
        propType - The type of the property.
        propValue - The value of the property.
        Returns:
        The BlockProperty object that was set (or created).
      • getChildBlocks

        public java.util.List<ComponentBlock> getChildBlocks()
        Returns the list of child ComponentBlocks.
        Returns:
        The List containing child ComponentBlock.
      • hasChildBlocks

        public boolean hasChildBlocks()
        Return a flag indicating whether this instance has children ComponentBlock(s) or not
        Returns:
        boolean true if has children false if child-less
      • serializeInto

        public void serializeInto​(MarkupOutput out,
                                  BlockContext bContext)
        This method is called when a ComponentBlock needs to serialize itself. If child ComponentsBlocks are present it will render the children array as the value of the COMPONENTS property; if it's child-less it will render the HTML content as the value of the CONTENT property.
        Parameters:
        out - the MarkupOutput instance that will hold the serialization result
        bContext - the BlockContext object that will be used for the Block instance to render itself
      • setErrorInfo

        public void setErrorInfo​(java.lang.StringBuffer error)
        Set error information on the ComponentBlock instance.
        Parameters:
        error - the StringBuffer with error information that needs to be set
      • addErrorInfo

        public void addErrorInfo​(java.lang.String error)
        Append more error information to the ComponentBlock instance.
        Parameters:
        error - the error information that needs to be added