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
projectManager, sourceFinder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.github.javaparser.ast.stmt.StatementcreateAddClassNameStatement(com.github.javaparser.ast.expr.SimpleName scope, String className, boolean overlay) protected com.github.javaparser.ast.stmt.ExpressionStmtfindLocalClassNameStmt(com.github.javaparser.ast.CompilationUnit cu, ComponentTypeAndSourceLocation componentSource, boolean overlay) 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) protected com.vaadin.flow.component.internal.ComponentTracker.LocationgetCreateLocation(com.vaadin.flow.component.Component c) 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) protected booleanhasOverlay(ComponentTypeAndSourceLocation componentSource) booleanisAccessible(Integer uiId, Integer nodeId) Checks if component can be accessed within source code.voidremoveLocalClassName(ComponentTypeAndSourceLocation componentSource, boolean overlay) voidremoveLocalClassName(Integer uiId, Integer nodeId) Removes local class name of given component.protected voidsetLocalClassName(ComponentTypeAndSourceLocation componentSource, String className, boolean overlay) 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
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
-
-
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
protected void setLocalClassName(ComponentTypeAndSourceLocation componentSource, String className, boolean overlay) -
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
-
getCreateLocation
protected com.vaadin.flow.component.internal.ComponentTracker.Location getCreateLocation(com.vaadin.flow.component.Component c) -
createAddClassNameStatement
protected com.github.javaparser.ast.stmt.Statement createAddClassNameStatement(com.github.javaparser.ast.expr.SimpleName scope, String className, boolean overlay) -
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, boolean overlay) -
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) -
hasOverlay
-