Class ThemeModifier
java.lang.Object
com.vaadin.copilot.plugins.themeeditor.ThemeModifier
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateEmptyStyleRule(String selector) Creates empty rule with given selectorprotected com.helger.css.decl.CSSStyleRulecreateStyleRule(String selector, String property, String value) protected com.helger.css.decl.CSSStyleRulefindRuleBySelector(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSSelector selector) protected com.helger.css.decl.CSSStyleRulefindRuleBySelector(com.helger.css.decl.CascadingStyleSheet styleSheet, com.helger.css.decl.CSSStyleRule rule) protected com.helger.css.decl.CascadingStyleSheetgetCss()Returns the content of the theme editor CSS file.protected StringgetCssRules(List<String> selectors) Retrieves list ofCssRulefor given selectors.Returns selectors in the theme editorsprotected StringintgetRuleLocationLine(String selectorString) Gets location line of rule with given selectorprotected Fileprotected voidprotected booleanprotected com.helger.css.decl.CSSSelectorparseSelector(String selector) protected voidremoveCssProperty(com.helger.css.decl.CascadingStyleSheet styleSheet, String selector, String property) protected voidremoveProperty(com.helger.css.decl.CSSStyleRule existingRule, com.helger.css.decl.CSSStyleRule newRule) protected voidreplaceClassName(com.helger.css.decl.CascadingStyleSheet styleSheet, String tagName, String oldClassName, String newClassName) voidreplaceClassName(String tagName, String oldClassName, String newClassName) Replaces classname with new classname in all matching rules.protected voidsetCssProperty(com.helger.css.decl.CascadingStyleSheet styleSheet, String selector, String property, String value) voidAdds an import rule for the specified font to the theme editor CSS file and updates the Lumo font family theme property.voidsetThemeProperties(List<CssRule> rules) Performs update of CSS file setting (adding or updating) givenCssRule.protected voidsortStyleSheet(com.helger.css.decl.CascadingStyleSheet styleSheet) protected CssRuletoCssRule(com.helger.css.decl.CSSStyleRule rule) protected voidwriteStyleSheet(com.helger.css.decl.CascadingStyleSheet styleSheet)
-
Field Details
-
THEME_EDITOR_CSS
- See Also:
-
-
Constructor Details
-
ThemeModifier
Constructor- Throws:
ThemeEditorException- in not present
-
-
Method Details
-
setThemeProperties
Performs update of CSS file setting (adding or updating) givenCssRule.- Parameters:
rules- list ofCssRuleto 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 ofCssRulefor given selectors.- Parameters:
selectors- list of selectors- Returns:
- 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
-