Package com.vaadin.copilot.javarewriter
Class JavaStyleRewriter
java.lang.Object
com.vaadin.copilot.javarewriter.JavaStyleRewriter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic List<JavaStyleRewriter.StyleInfo> getStyles(ComponentInfo componentInfo) Gets the (active) styles of a component.static Map<JavaStyleRewriter.StyleInfo, com.github.javaparser.ast.expr.MethodCallExpr> getStylesWithMethodCalls(ComponentInfo componentInfo) static voidsetSizing(ComponentInfo componentInfo, Map<String, String> changes) Handles calls of the given component and adjust them based on the given properties.static voidsetStyle(ComponentInfo componentInfo, String dashSeparatedProperty, String value) /** Sets the given inline style on the given component, replacing an existing style property if present.setStyle(ComponentInfo componentInfo, String dashSeparatedProperty, String value, boolean allowNullValue) Sets the given inline style on the given component, replacing an existing style property if present.
-
Constructor Details
-
JavaStyleRewriter
public JavaStyleRewriter()
-
-
Method Details
-
getStyles
Gets the (active) styles of a component.- Parameters:
componentInfo- the component to get the styles of- Returns:
- the styles, as a list of style names and values
-
getStylesWithMethodCalls
public static Map<JavaStyleRewriter.StyleInfo,com.github.javaparser.ast.expr.MethodCallExpr> getStylesWithMethodCalls(ComponentInfo componentInfo) -
setStyle
public static void setStyle(ComponentInfo componentInfo, String dashSeparatedProperty, String value) /** Sets the given inline style on the given component, replacing an existing style property if present. An exception will be thrown when value is null.- Parameters:
componentInfo- the component to set the style ondashSeparatedProperty- the style property to setvalue- the style value to set or null to remove the style
-
setStyle
public static JavaStyleRewriter.StylingResult setStyle(ComponentInfo componentInfo, String dashSeparatedProperty, String value, boolean allowNullValue) Sets the given inline style on the given component, replacing an existing style property if present.- Parameters:
componentInfo- the component to set the style ondashSeparatedProperty- the style property to setvalue- the style value to set or null to remove the styleallowNullValue- allowing value of a style to be null. Throws exception when disallowed.
-
setSizing
Handles calls of the given component and adjust them based on the given properties.- Parameters:
componentInfo- Component to updatechanges- Changed properties for the sizing. Keys are camelCased, values might be string or null. e.g.flexGrow -> "1",maxHeight -> null
-