Class JavaSourceModifier

java.lang.Object
com.vaadin.base.devserver.editor.Editor
com.vaadin.base.devserver.themeeditor.JavaSourceModifier

public class JavaSourceModifier extends Editor
  • Field Details

    • LOCAL_CLASSNAME_COMMENT

      public static final com.github.javaparser.ast.comments.LineComment LOCAL_CLASSNAME_COMMENT
  • Constructor Details

    • JavaSourceModifier

      public JavaSourceModifier(VaadinContext context)
  • Method Details

    • setLocalClassName

      public void setLocalClassName(Integer uiId, Integer nodeId, String className)
      Adds local component class name if not already present, updates value otherwise.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
      className - className to be set
    • setLocalClassName

      protected void setLocalClassName(Component component, String className, boolean overlay)
    • getTag

      public String getTag(Integer uiId, Integer nodeId)
      Gets tag name of given component.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
      Returns:
    • getLocalClassName

      public String getLocalClassName(Integer uiId, Integer nodeId)
      Gets component local classname if exists.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
      Returns:
      component local classname
    • removeLocalClassName

      public void removeLocalClassName(Integer uiId, Integer nodeId)
      Removes local class name of given component.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
    • removeLocalClassName

      public void removeLocalClassName(Component component, boolean overlay)
    • isAccessible

      public boolean isAccessible(Integer uiId, Integer nodeId)
      Checks if component can be accessed within source code.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
      Returns:
      true if component is accessible, false otherwise
    • getSuggestedClassName

      public String getSuggestedClassName(Integer uiId, Integer nodeId)
      Creates suggested local classname based on component tag.
      Parameters:
      uiId - uiId of target component's UI
      nodeId - nodeIf of target component
      Returns:
      suggested local classname
    • getCreateLocation

      protected ComponentTracker.Location getCreateLocation(Component c)
    • getSession

      protected VaadinSession getSession()
    • getSourceFolder

      protected File getSourceFolder(ComponentTracker.Location location)
    • createAddClassNameStatement

      protected com.github.javaparser.ast.stmt.Statement createAddClassNameStatement(com.github.javaparser.ast.expr.SimpleName scope, String className, boolean overlay)
    • getSourceFile

      protected File getSourceFile(ComponentTracker.Location createLocation)
    • getComponent

      protected Component getComponent(VaadinSession session, int uiId, int nodeId)
    • getCompilationUnit

      protected com.github.javaparser.ast.CompilationUnit getCompilationUnit(Component component)
    • findLocalClassNameStmt

      protected com.github.javaparser.ast.stmt.ExpressionStmt findLocalClassNameStmt(com.github.javaparser.ast.CompilationUnit cu, Component component, boolean overlay)
    • findModificationWhere

      protected Where findModificationWhere(com.github.javaparser.ast.CompilationUnit cu, Component component)
    • findNode

      protected com.github.javaparser.ast.Node findNode(com.github.javaparser.ast.CompilationUnit cu, Component component)
    • hasOverlay

      protected boolean hasOverlay(Component component)