Class JavaSourceModifier
java.lang.Object
com.vaadin.copilot.plugins.themeeditor.Editor
com.vaadin.copilot.plugins.themeeditor.CopilotEditor
com.vaadin.copilot.plugins.themeeditor.JavaSourceModifier
-
Nested Class Summary
Nested classes/interfaces inherited from class com.vaadin.copilot.plugins.themeeditor.Editor
Editor.Modification -
Field Summary
Fields inherited from class com.vaadin.copilot.plugins.themeeditor.CopilotEditor
sourceFinder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.github.javaparser.ast.stmt.StatementcreateAddClassNameStatement(com.github.javaparser.ast.expr.SimpleName scope, String className) protected com.github.javaparser.ast.stmt.ExpressionStmtfindLocalClassNameStmt(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource) protected WherefindModificationWhere(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource) protected com.github.javaparser.ast.NodefindNode(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource) protected com.github.javaparser.ast.NodefindParentBlockNode(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) protected com.github.javaparser.ast.CompilationUnitgetCompilationUnit(ComponentTypeAndSourceLocation componentSource) protected com.vaadin.flow.component.ComponentgetComponent(com.vaadin.flow.server.VaadinSession session, int uiId, int nodeId) getLocalClassName(Integer uiId, Integer nodeId) Gets component local classname if exists.getSuggestedClassName(Integer uiId, Integer nodeId) Creates suggested local classname based on component tag.Gets tag name of given component.static booleanhasLocalClassnameComment(com.github.javaparser.ast.Node n) booleanisAccessible(Integer uiId, Integer nodeId) Checks if component can be accessed within source code.voidremoveLocalClassName(ComponentTypeAndSourceLocation componentSource) voidremoveLocalClassName(Integer uiId, Integer nodeId) Removes local class name of given component.protected voidsetLocalClassName(ComponentTypeAndSourceLocation componentSource, String className) voidsetLocalClassName(Integer uiId, Integer nodeId, String className) Adds local component class name if not already present, updates value otherwise.Methods inherited from class com.vaadin.copilot.plugins.themeeditor.CopilotEditor
getVaadinSession, modifyClassMethods inherited from class com.vaadin.copilot.plugins.themeeditor.Editor
addComponent, addComponentAttribute, addListener, findLocalVariableOrField, findMethodCall, findMethodCalls, findStatement, getSourceFile, getSourceFile, parseSource, readFile, removeComponentAttribute, setComponentAttribute, setComponentAttribute
-
Constructor Details
-
JavaSourceModifier
public JavaSourceModifier(com.vaadin.flow.server.VaadinSession session)
-
-
Method Details
-
hasLocalClassnameComment
public static boolean hasLocalClassnameComment(com.github.javaparser.ast.Node n) -
setLocalClassName
Adds local component class name if not already present, updates value otherwise.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target componentclassName- className to be set
-
setLocalClassName
-
getTag
Gets tag name of given component.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target component- Returns:
- tag name of given element
-
getLocalClassName
Gets component local classname if exists.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target component- Returns:
- component local classname
-
removeLocalClassName
Removes local class name of given component.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target component
-
removeLocalClassName
-
isAccessible
Checks if component can be accessed within source code.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target component- Returns:
- true if component is accessible, false otherwise
-
getSuggestedClassName
Creates suggested local classname based on component tag.- Parameters:
uiId- uiId of target component's UInodeId- nodeIf of target component- Returns:
- suggested local classname
-
createAddClassNameStatement
protected com.github.javaparser.ast.stmt.Statement createAddClassNameStatement(com.github.javaparser.ast.expr.SimpleName scope, String className) -
getComponent
protected com.vaadin.flow.component.Component getComponent(com.vaadin.flow.server.VaadinSession session, int uiId, int nodeId) -
getCompilationUnit
protected com.github.javaparser.ast.CompilationUnit getCompilationUnit(ComponentTypeAndSourceLocation componentSource) throws IOException - Throws:
IOException
-
findLocalClassNameStmt
protected com.github.javaparser.ast.stmt.ExpressionStmt findLocalClassNameStmt(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource) -
findParentBlockNode
protected com.github.javaparser.ast.Node findParentBlockNode(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) -
findModificationWhere
protected Where findModificationWhere(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource) -
findNode
protected com.github.javaparser.ast.Node findNode(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource)
-