com.vaadin.copilot.plugins.themeeditor.
Class ThemeModifier
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
createEmptyStyleRule
(String selector) Creates empty rule with given selector
protected com.helger.css.decl.CSSStyleRule
createStyleRule
(String selector, String property, String value) protected com.helger.css.decl.CSSStyleRule
findRuleBySelector
(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSSelector selector) protected com.helger.css.decl.CSSStyleRule
findRuleBySelector
(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSStyleRule rule) protected com.helger.css.decl.CascadingStyleSheet
getCss()
Returns the content of the theme editor CSS file.
protected String
getCssRules
(List<String> selectors) Retrieves list of
CssRule
for given selectors.Returns selectors in the theme editors
protected String
int
getRuleLocationLine
(String selectorString) Gets location line of rule with given selector
protected File
protected void
protected boolean
protected com.helger.css.decl.CSSSelector
parseSelector
(String selector) protected void
removeCssProperty
(com.helger.css.decl.CascadingStyleSheet styleSheet, String selector, String property) protected void
removeProperty
(com.helger.css.decl.CSSStyleRule existingRule, com.helger.css.decl.CSSStyleRule newRule) protected void
replaceClassName
(com.helger.css.decl.CascadingStyleSheet styleSheet, String tagName, String oldClassName, String newClassName) void
replaceClassName
(String tagName, String oldClassName, String newClassName) Replaces classname with new classname in all matching rules.
protected void
setCssProperty
(com.helger.css.decl.CascadingStyleSheet styleSheet, String selector, String property, String value) void
Adds an import rule for the specified font to the theme editor CSS file and updates the Lumo font family theme property.
void
setThemeProperties
(List<CssRule> rules) Performs update of CSS file setting (adding or updating) given
CssRule
.protected void
sortStyleSheet
(com.helger.css.decl.CascadingStyleSheet styleSheet) protected CssRule
toCssRule
(com.helger.css.decl.CSSStyleRule rule) protected void
writeStyleSheet
(com.helger.css.decl.CascadingStyleSheet styleSheet)
-
Field Details
-
THEME_EDITOR_CSS
See Also:
-
-
Constructor Details
-
ThemeModifier
Constructor
Parameters:
projectManager
- project managerThrows:
ThemeEditorException
- in not present
-
-
Method Details
-
setThemeProperties
Performs update of CSS file setting (adding or updating) given
CssRule
.Parameters:
rules
- list ofCssRule
to be added or updated -
setFont
Adds an import rule for the specified font to the theme editor CSS file and updates the Lumo font family theme property. Removes all previous import rules.
Parameters:
fontName
- the font to use -
getCss
Returns the content of the theme editor CSS file.
Returns:
CSS string
-
getCssRules
Retrieves list of
CssRule
for given selectors.Parameters:
selectors
- list of selectorsReturns:
list of
CssRule
-
replaceClassName
Replaces classname with new classname in all matching rules.
Parameters:
oldClassName
- classname to be replacednewClassName
- new classname -
getRuleLocationLine
Gets location line of rule with given selector
Parameters:
selectorString
-Returns:
line number when located, -1 otherwise
-
createEmptyStyleRule
Creates empty rule with given selector
Parameters:
selector
- Selector to add rule to stylesheet. Null means create the file if not exists -
getExistingClassNames
Returns selectors in the theme editors
Returns:
list of class names
-
noStyleSheet
protected boolean noStyleSheet() -
getCssFileName
-
getHeaderText
-
getThemeFolder
-
getStyleSheetFile
-
getCascadingStyleSheet
protected com.helger.css.decl.CascadingStyleSheet getCascadingStyleSheet() -
setCssProperty
-
removeCssProperty
-
writeStyleSheet
protected void writeStyleSheet(com.helger.css.decl.CascadingStyleSheet styleSheet) -
sortStyleSheet
protected void sortStyleSheet(com.helger.css.decl.CascadingStyleSheet styleSheet) -
createStyleRule
-
removeProperty
protected void removeProperty(com.helger.css.decl.CSSStyleRule existingRule, com.helger.css.decl.CSSStyleRule newRule) -
findRuleBySelector
protected com.helger.css.decl.CSSStyleRule findRuleBySelector(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSStyleRule rule) -
findRuleBySelector
protected com.helger.css.decl.CSSStyleRule findRuleBySelector(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSSelector selector) -
replaceClassName
-
insertImportIfNotExists
protected void insertImportIfNotExists() -
toCssRule
-
parseSelector
-