You're viewing an older version of Vaadin JavaDoc. Please see version 24.7.0 for the latest.
com.vaadin.copilot.javarewriter.

Class LumoRewriterUtil

java.lang.Object
com.vaadin.copilot.javarewriter.LumoRewriterUtil
public class LumoRewriterUtil extends Object
  • Constructor Details

    • LumoRewriterUtil

      public LumoRewriterUtil()
  • Method Details

    • addClassNameWithArgs

      public static void addClassNameWithArgs(JavaRewriter.ComponentInfo component, List<com.github.javaparser.ast.expr.Expression> arguments)

      Creates addClassNames(...) statement with given arguments if there is none. Adds arguments to existing one.

      Parameters:

      component - the component to add class name

      arguments - class name arguments. Most likely StringLiteral or FieldAccessExpr generated for LumoUtility.

    • removeClassNameArgs

      public static void removeClassNameArgs(JavaRewriter.ComponentInfo component, String... lumoUtilityClassNames) throws IllegalAccessException

      Searches addClassName, addClassNames, setClassName methods for given component and then remove given lumo utility class names. e.g. if self-start is given for removal, LumoUtility.AlignSelf.START and "self-start" are removed from args.

      Parameters:

      component - the component to remove class names

      lumoUtilityClassNames - Utility class names such as "align-items", "gap-m"

      Throws:

      IllegalAccessException

    • addLumoUtilityImport

      public static void addLumoUtilityImport(com.github.javaparser.ast.CompilationUnit compilationUnit)
    • getLumoMethodArgExpressions

      public static List<com.github.javaparser.ast.expr.Expression> getLumoMethodArgExpressions(String lumoInnerClassName, List<String> classNames) throws IllegalAccessException

      Converts given class names to LumoUtility field access expressions. e.g. items-center becomes AlignItems.CENTER

      Parameters:

      lumoInnerClassName - Inner class name of LumoUtility class. e.g. AlignSelf, AlignItems etc...

      classNames - html class names

      Returns:

      list of expressions.

      Throws:

      IllegalAccessException