Class WBootstrap5Theme
- java.lang.Object
-
- eu.webtoolkit.jwt.WObject
-
- eu.webtoolkit.jwt.WTheme
-
- eu.webtoolkit.jwt.WBootstrap5Theme
-
public class WBootstrap5Theme extends WTheme
Theme based on the Bootstrap 5 CSS framework.This theme implements support for building a JWt web application that uses Bootstrap 5 as a theme for its (layout and) styling.
Using this theme, various widgets provided by the library are rendered using markup that is compatible with Bootstrap 5. The bootstrap theme is also extended with a proper (compatible) styling of widgets for which bootstrap does not provide styling (table views, tree views, sliders, etc...).
By default, the theme will use CSS and JavaScript resources that are shipped together with the JWt distribution, but you can replace the CSS with custom-built CSS by reimplementing
getStyleSheets().Although this theme styles individual widgets correctly, for your web application's layout you are recommended to use
WTemplatein conjunction with Bootstrap's CSS classes. For this we refer to Bootstrap's documentation at https://getbootstrap.com.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
-
Constructor Summary
Constructors Constructor Description WBootstrap5Theme()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidapply(WWidget widget, DomElement element, int elementRole)Applies the theme to a DOM element that renders a widget.protected voidapplyFunctionalStyling(WWidget widget, WWidget child, int widgetRole)Applies the functional part of the theme to a widget's child.protected voidapplyOptionalStyling(WWidget widget, WWidget child, int widgetRole)Applies the optional part of the theme to a widget's child.voidapplyValidationStyle(WWidget widget, WValidator.Result validation, java.util.EnumSet<ValidationStyleFlag> styles)Applies a style that indicates the result of validation.booleancanBorderBoxElement(DomElement element)java.lang.StringgetActiveClass()Returns a generic CSS class name for an active element.java.lang.StringgetDisabledClass()Returns a generic CSS class name for a disabled element.java.lang.StringgetName()Returns a theme name.SidegetPanelCollapseIconSide()Returns which side theWPanelcollapse icon should be added on.java.lang.StringgetResourcesUrl()Returns the URL where theme-related resources are stored.java.util.List<WLinkedCssStyleSheet>getStyleSheets()Returns a vector with stylesheets for the theme.voidinit(WApplication app)Called when the theme is assigned to aWApplication.booleanisCanStyleAnchorAsButton()Returns whether the theme allows for an anchor to be styled as a button.voidloadValidationStyling(WApplication app)Load the required content for validation.java.lang.StringutilityCssClass(int utilityCssClassRole)Returns a generic CSS class name for the chosen role.-
Methods inherited from class eu.webtoolkit.jwt.WTheme
apply, applyValidationStyle, serveCss
-
Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
-
-
-
Method Detail
-
init
public void init(WApplication app)
Description copied from class:WThemeCalled 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.
-
getName
public java.lang.String getName()
Description copied from class:WThemeReturns 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
public java.lang.String getResourcesUrl()
Description copied from class:WThemeReturns the URL where theme-related resources are stored.The default implementation considers a folder within JWt's resource directory, based on the theme
getName().- Overrides:
getResourcesUrlin classWTheme
-
getStyleSheets
public java.util.List<WLinkedCssStyleSheet> getStyleSheets()
Description copied from class:WThemeReturns 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.
- Specified by:
getStyleSheetsin classWTheme
-
apply
public void apply(WWidget widget, DomElement element, int elementRole)
Description copied from class:WThemeApplies 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
public java.lang.String getDisabledClass()
Description copied from class:WThemeReturns a generic CSS class name for a disabled element.- Specified by:
getDisabledClassin classWTheme
-
getActiveClass
public java.lang.String getActiveClass()
Description copied from class:WThemeReturns a generic CSS class name for an active element.- Specified by:
getActiveClassin classWTheme
-
utilityCssClass
public java.lang.String utilityCssClass(int utilityCssClassRole)
Description copied from class:WThemeReturns a generic CSS class name for the chosen role.- Specified by:
utilityCssClassin classWTheme
-
isCanStyleAnchorAsButton
public boolean isCanStyleAnchorAsButton()
Description copied from class:WThemeReturns whether the theme allows for an anchor to be styled as a button.- Specified by:
isCanStyleAnchorAsButtonin classWTheme
-
loadValidationStyling
public void loadValidationStyling(WApplication app)
Description copied from class:WThemeLoad the required content for validation.The styling, and scripts used for validation are separated. Loading these is not done on theme initialization.
- Overrides:
loadValidationStylingin classWTheme
-
applyValidationStyle
public void applyValidationStyle(WWidget widget, WValidator.Result validation, java.util.EnumSet<ValidationStyleFlag> styles)
Description copied from class:WThemeApplies a style that indicates the result of validation.- Specified by:
applyValidationStylein classWTheme
-
canBorderBoxElement
public boolean canBorderBoxElement(DomElement element)
- Specified by:
canBorderBoxElementin classWTheme
-
getPanelCollapseIconSide
public Side getPanelCollapseIconSide()
Description copied from class:WThemeReturns which side theWPanelcollapse icon should be added on.Side is assumed to be
Side.LeftorSide.Right, other sides are not supported.- Overrides:
getPanelCollapseIconSidein classWTheme
-
applyFunctionalStyling
protected void applyFunctionalStyling(WWidget widget, WWidget child, int widgetRole)
Description copied from class:WThemeApplies 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
protected void applyOptionalStyling(WWidget widget, WWidget child, int widgetRole)
Description copied from class:WThemeApplies 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.
-
-