com.vaadin.flow.internal.nodefeature.
Class ComponentMapping
- java.lang.Object
-
- com.vaadin.flow.internal.nodefeature.NodeFeature
-
- com.vaadin.flow.internal.nodefeature.ServerSideFeature
-
- com.vaadin.flow.internal.nodefeature.ComponentMapping
-
All Implemented Interfaces:
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 Summary
Constructors Modifier Constructor Description protected
ComponentMapping(StateNode node)
Creates an instance of this node feature.
-
Method Summary
All Methods Modifier and Type Method Description Optional<Component>
getComponent()
Gets the component this node has been mapped to, if any.
static Optional<Component>
getComponent(StateNode node)
Gets the component mapped to the given state node.
void
onAttach(boolean initialAttach)
Called when the state node has been attached to the state tree.
void
onDetach()
Called when the state node has been detached from the state tree.
void
setComponent(Component component)
Assigns the given component to this node.
-
Methods inherited from class com.vaadin.flow.internal.nodefeature.ServerSideFeature
collectChanges, forEachChild, generateChangesFromEmpty
-
Methods inherited from class com.vaadin.flow.internal.nodefeature.NodeFeature
allowsChanges, attachPotentialChild, detatchPotentialChild, getNode
-
-
-
-
Constructor Detail
-
ComponentMapping
protected ComponentMapping(StateNode node)
Creates an instance of this node feature.
Parameters:
node
- the node that the feature belongs to
-
-
Method Detail
-
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, notnull
-
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, notnull
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 classNodeFeature
Parameters:
initialAttach
-true
if this is the first time the node is attached to aStateTree
,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 classNodeFeature
-
-