com.vaadin.flow.internal.nodefeature.

Class ComponentMapping

All Implemented Interfaces:

Serializable

public class ComponentMapping extends ServerSideFeature

A server side only node feature for mapping a node to a component.

For internal use only. May be renamed or removed in a future release.

Since:

1.0

Author:

Vaadin Ltd

See Also:

  • Constructor Details

    • ComponentMapping

      protected ComponentMapping(StateNode node)

      Creates an instance of this node feature.

      Parameters:

      node - the node that the feature belongs to

  • Method Details

    • setComponent

      public void setComponent(Component component)

      Assigns the given component to this node.

      When assigning a component to the node, there must be no previously assigned component.

      Parameters:

      component - the component to assign to this node, not null

    • getComponent

      public Optional<Component> getComponent()

      Gets the component this node has been mapped to, if any.

      Returns:

      an optional component, or an empty optional if no component has been mapped to this node

    • getComponent

      public static Optional<Component> getComponent(StateNode node)

      Gets the component mapped to the given state node.

      Parameters:

      node - the state node for which to find a component, not null

      Returns:

      the mapped component, or an empty optional if no component is mapped

    • onAttach

      public void onAttach(boolean initialAttach)

      Description copied from class: NodeFeature

      Called when the state node has been attached to the state tree.

      Overrides:

      onAttach in class NodeFeature

      Parameters:

      initialAttach - true if this is the first time the node is attached to a StateTree, false otherwise

    • onDetach

      public void onDetach()

      Description copied from class: NodeFeature

      Called when the state node has been detached from the state tree.

      Overrides:

      onDetach in class NodeFeature