Class ComponentUtils
java.lang.Object
com.vaadin.flow.ai.formfiller.utils.ComponentUtils
Util class to deal with a component and its children
(get children, map hierarchy, map types,...)
- Author:
- Vaadin Ltd.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord with information of a component to be filled.static final recordRecord with information of the hierarchy of the components to be filled and the value types of each one of them. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMapping(com.vaadin.flow.component.Component component) Creates the mapped structures with the information required to generate the prompt and fill the components after the response.static voidfillComponents(List<ComponentUtils.ComponentInfo> components, Map<String, Object> mapComponentValues) Fills the component(s) of the target component using the map with components and values.static Stream<com.vaadin.flow.component.Component>getAllChildren(com.vaadin.flow.component.Component component) Get all children from a parent componentstatic List<ComponentUtils.ComponentInfo>getComponentInfo(com.vaadin.flow.component.Component component) Get all the components detailed information from a parent component.static booleanisSupportedComponent(com.vaadin.flow.component.Component component)
-
Constructor Details
-
ComponentUtils
public ComponentUtils()
-
-
Method Details
-
createMapping
public static ComponentUtils.ComponentsMapping createMapping(com.vaadin.flow.component.Component component) Creates the mapped structures with the information required to generate the prompt and fill the components after the response. This includes the hierarchy of components and the value types of each component.- Parameters:
component- the component target (can be a component or a container of components)- Returns:
- the mapped structures with the information
-
getComponentInfo
public static List<ComponentUtils.ComponentInfo> getComponentInfo(com.vaadin.flow.component.Component component) Get all the components detailed information from a parent component.ComponentUtils.ComponentInfoincludes the component id, type and the component itself.- Parameters:
component- target- Returns:
- List of all component children information
-
getAllChildren
public static Stream<com.vaadin.flow.component.Component> getAllChildren(com.vaadin.flow.component.Component component) Get all children from a parent component- Parameters:
component- target- Returns:
- Stream of all component children
-
fillComponents
public static void fillComponents(List<ComponentUtils.ComponentInfo> components, Map<String, Object> mapComponentValues) Fills the component(s) of the target component using the map with components and values.- Parameters:
mapComponentValues- Transformed AI module response to a map with components and values.
-
isSupportedComponent
public static boolean isSupportedComponent(com.vaadin.flow.component.Component component)
-