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
FieldsModifier and TypeFieldDescriptionstatic final com.github.javaparser.ast.comments.LineCommentFields inherited from class com.vaadin.copilot.plugins.themeeditor.CopilotEditor
projectManager -
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, com.vaadin.flow.component.Component component, boolean overlay) protected WherefindModificationWhere(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) protected com.github.javaparser.ast.NodefindNode(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) protected com.github.javaparser.ast.NodefindParentBlockNode(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) protected com.github.javaparser.ast.CompilationUnitgetCompilationUnit(com.vaadin.flow.component.Component component) 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.protected com.vaadin.flow.server.VaadinSessionprotected FilegetSourceFile(com.vaadin.flow.component.internal.ComponentTracker.Location createLocation) protected FilegetSourceFolder(com.vaadin.flow.component.internal.ComponentTracker.Location location) getSuggestedClassName(Integer uiId, Integer nodeId) Creates suggested local classname based on component tag.Gets tag name of given component.protected booleanhasOverlay(com.vaadin.flow.component.Component component) booleanisAccessible(Integer uiId, Integer nodeId) Checks if component can be accessed within source code.voidremoveLocalClassName(com.vaadin.flow.component.Component component, boolean overlay) voidremoveLocalClassName(Integer uiId, Integer nodeId) Removes local class name of given component.protected voidsetLocalClassName(com.vaadin.flow.component.Component component, 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
-
Field Details
-
LOCAL_CLASSNAME_COMMENT
public static final com.github.javaparser.ast.comments.LineComment LOCAL_CLASSNAME_COMMENT
-
-
Constructor Details
-
JavaSourceModifier
-
-
Method Details
-
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(com.vaadin.flow.component.Component component, 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
public void removeLocalClassName(com.vaadin.flow.component.Component component, boolean overlay) -
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) -
getSession
protected com.vaadin.flow.server.VaadinSession getSession() -
getSourceFolder
protected File getSourceFolder(com.vaadin.flow.component.internal.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(com.vaadin.flow.component.internal.ComponentTracker.Location createLocation) -
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(com.vaadin.flow.component.Component component) -
findLocalClassNameStmt
protected com.github.javaparser.ast.stmt.ExpressionStmt findLocalClassNameStmt(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component, 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, com.vaadin.flow.component.Component component) -
findNode
protected com.github.javaparser.ast.Node findNode(com.github.javaparser.ast.CompilationUnit cu, com.vaadin.flow.component.Component component) -
hasOverlay
protected boolean hasOverlay(com.vaadin.flow.component.Component component)
-