Class WTheme
- Direct Known Subclasses:
WBootstrap2Theme,WBootstrap3Theme,WBootstrap5Theme,WBootstrapTheme,WCssTheme
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidapply(WWidget widget, DomElement element, int elementRole) Applies the theme to a DOM element that renders a widget.voidApplies the theme to a child of a composite widget.protected abstract voidapplyFunctionalStyling(WWidget widget, WWidget child, int widgetRole) Applies the functional part of the theme to a widget's child.protected abstract voidapplyOptionalStyling(WWidget widget, WWidget child, int widgetRole) Applies the optional part of the theme to a widget's child.final voidapplyValidationStyle(WWidget widget, WValidator.Result validation, ValidationStyleFlag flag, ValidationStyleFlag... flags) Applies a style that indicates the result of validation.abstract voidapplyValidationStyle(WWidget widget, WValidator.Result validation, EnumSet<ValidationStyleFlag> flags) Applies a style that indicates the result of validation.abstract booleancanBorderBoxElement(DomElement element) abstract StringReturns a generic CSS class name for an active element.abstract StringReturns a generic CSS class name for a disabled element.abstract StringgetName()Returns a theme name.Returns which side theWPanelcollapse icon should be added on.Returns the URL where theme-related resources are stored.abstract List<WLinkedCssStyleSheet>Returns a vector with stylesheets for the theme.voidinit(WApplication app) Called when the theme is assigned to aWApplication.abstract booleanReturns whether the theme allows for an anchor to be styled as a button.voidLoad the required content for validation.voidserveCss(StringBuilder out) Serves the CSS for the theme.abstract StringutilityCssClass(int utilityCssClassRole) Returns a generic CSS class name for the chosen role.Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
Constructor Details
-
WTheme
public WTheme()Constructor.
-
-
Method Details
-
getName
Returns a theme name.Returns a unique name for the theme. This name is used by the default implementation of
getResourcesUrl()to compute a location for the theme's resources. -
getResourcesUrl
Returns the URL where theme-related resources are stored.The default implementation considers a folder within JWt's resource directory, based on the theme
getName(). -
serveCss
Serves the CSS for the theme.This must serve CSS declarations for the theme.
The default implementation serves all the
getStyleSheets(). -
getStyleSheets
Returns a vector with stylesheets for the theme.This should return a vector with stylesheets that implement the theme. This list may be tailored to the current user agent, which is read from the application environment.
-
init
Called when the theme is assigned to aWApplication.This allows the theme to do things like load resource bundles when it is added to an application using
WApplication#setTheme().The default implementation does nothing.
-
apply
Applies the theme to a child of a composite widget.The
widgetRoleindicates the role thatchildhas within the implementation of thewidget. -
apply
Applies the theme to a DOM element that renders a widget.The
elementis a rendered representation of thewidget, and may be further customized to reflect the theme. -
getDisabledClass
Returns a generic CSS class name for a disabled element. -
getActiveClass
Returns a generic CSS class name for an active element. -
utilityCssClass
Returns a generic CSS class name for the chosen role. -
isCanStyleAnchorAsButton
public abstract boolean isCanStyleAnchorAsButton()Returns whether the theme allows for an anchor to be styled as a button. -
loadValidationStyling
Load the required content for validation.The styling, and scripts used for validation are separated. Loading these is not done on theme initialization.
-
applyValidationStyle
public abstract void applyValidationStyle(WWidget widget, WValidator.Result validation, EnumSet<ValidationStyleFlag> flags) Applies a style that indicates the result of validation. -
applyValidationStyle
public final void applyValidationStyle(WWidget widget, WValidator.Result validation, ValidationStyleFlag flag, ValidationStyleFlag... flags) Applies a style that indicates the result of validation.Calls
applyValidationStyle(widget, validation, EnumSet.of(flag, flags)) -
canBorderBoxElement
-
getPanelCollapseIconSide
Returns which side theWPanelcollapse icon should be added on.Side is assumed to be
Side.LeftorSide.Right, other sides are not supported. -
applyFunctionalStyling
Applies the functional part of the theme to a widget's child.Only applies the functional part of the theme. This means that only things that are mandatory for the widget to function properly but depend on the theme are applied.
-
applyOptionalStyling
Applies the optional part of the theme to a widget's child.Only applies the optional part of the theme. This means that only things that are purely cosmetic and do not affect the functionality of the widget are applied.
This should only be called for widgets that have theme styling enabled.
-