com.vaadin.flow.internal.nodefeature.
Class ComponentMapping
All Implemented Interfaces:
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
ConstructorsModifierConstructorDescriptionprotected
ComponentMapping
(StateNode node) Creates an instance of this node feature.
-
Method Summary
Modifier and TypeMethodDescriptionGets the component this node has been mapped to, if any.
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 Details
-
ComponentMapping
Creates an instance of this node feature.
Parameters:
node
- the node that the feature belongs to
-
-
Method Details
-
setComponent
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
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
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
-