Class AbstractNodeStateProvider

    • Constructor Detail

      • AbstractNodeStateProvider

        public AbstractNodeStateProvider()
    • Method Detail

      • supports

        public boolean supports​(StateNode node)
        Description copied from interface: ElementStateProvider
        Checks if the element state provider supports the given state node.
        Specified by:
        supports in interface ElementStateProvider
        Parameters:
        node - the state node to check
        Returns:
        true if the element state provider is compatible with the given state node, false otherwise
      • getProviderFeatures

        protected abstract Class<? extends NodeFeature>[] getProviderFeatures()
        Returns the features supported by the provider.
        Returns:
        features supported by the provider
      • getParent

        public Node getParent​(StateNode node)
        Description copied from interface: ElementStateProvider
        Gets the parent element.
        Specified by:
        getParent in interface ElementStateProvider
        Parameters:
        node - the node containing the data
        Returns:
        the parent element or null if the element has no parent
      • getChild

        public Element getChild​(StateNode node,
                                int index)
        Description copied from interface: ElementStateProvider
        Returns the child element at the given position.
        Specified by:
        getChild in interface ElementStateProvider
        Parameters:
        node - the node containing the data
        index - the index of the child element to return
        Returns:
        the child element
      • insertChild

        public void insertChild​(StateNode node,
                                int index,
                                Element child)
        Description copied from interface: ElementStateProvider
        Inserts the given child at the given position.
        Specified by:
        insertChild in interface ElementStateProvider
        Parameters:
        node - the node containing the data
        index - the position at which to insert the new child
        child - the child element to insert
      • removeChild

        public void removeChild​(StateNode node,
                                int index)
        Description copied from interface: ElementStateProvider
        Removes the child at the given position.
        Specified by:
        removeChild in interface ElementStateProvider
        Parameters:
        node - the node containing the data
        index - the position of the child element to remove
      • attachExistingElement

        public void attachExistingElement​(StateNode node,
                                          String tagName,
                                          Element previousSibling,
                                          ChildElementConsumer callback)
        Description copied from interface: ElementStateProvider
        Attaches a child element with the given tagName which is the next sibling for the previousSibling.

        The previousSibling parameter value can be null which means that the very first child with the given tagName will be used to attach (if any).

        Specified by:
        attachExistingElement in interface ElementStateProvider
        Parameters:
        node - the parent node
        tagName - the tag name of the element to attach, not null
        previousSibling - previous sibling, may be null
        callback - the callback which will be invoked with a server side element instance or an error will be reported, not null
      • appendVirtualChild

        public void appendVirtualChild​(StateNode node,
                                       Element child,
                                       String type,
                                       String payload)
        Description copied from interface: ElementStateProvider
        Append the given element as a virtual child.
        Specified by:
        appendVirtualChild in interface ElementStateProvider
        Parameters:
        node - the node containing the data
        child - the child element to add
        type - the type of additional payload data
        payload - the additional payload data
      • visitDescendants

        protected void visitDescendants​(Node<?> node,
                                        NodeVisitor visitor)
        Apply the visitor for the descendants of the node.
        Parameters:
        node - the node whose descendants are targets to apply the visitor
        visitor - the visitor to apply
      • getNode

        protected abstract Node<?> getNode​(StateNode node)
        Gets the flyweight instance for the node supported by the provider.
        Parameters:
        node - the node to wrap into flyweight
        Returns:
        the flyweight instance for the node
        See Also:
        supports(StateNode)