Class WBootstrap2Theme
This theme implements support for building a JWt web application that uses Twitter Bootstrap as a theme for its (layout and) styling. The theme comes with CSS from Bootstrap version 2.2.2. Only the CSS components of twitter bootstrap are used, but not the JavaScript (i.e. the functional parts), since the functionality is already built-in to the widgets from the library.
Using this theme, various widgets provided by the library are rendered using markup that is compatible with Twitter Bootstrap. 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 resources that are shipped together with the JWt
distribution, but since the Twitter Bootstrap CSS API is a popular API for custom themes, you can
easily replace the CSS with custom-built CSS (by reimplementing getStyleSheets()).
Although this theme facilitates the use of Twitter Bootstrap with JWt, it is still important to understand how Bootstrap expects markup to be, especially related to layout using its grid system, for which we refer to the official bootstrap documentation, see http://getbootstrap.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(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, EnumSet<ValidationStyleFlag> styles) Applies a style that indicates the result of validation.booleancanBorderBoxElement(DomElement element) Returns a generic CSS class name for an active element.Returns a generic CSS class name for a disabled element.getName()Returns a theme name.Returns the URL where theme-related resources are stored.Returns a vector with stylesheets for the theme.voidinit(WApplication app) Called when the theme is assigned to aWApplication.booleanReturns whether the theme allows for an anchor to be styled as a button.booleanReturns whether responsive features are enabled.voidLoad the required content for validation.voidsetResponsive(boolean enabled) Enables responsive features.utilityCssClass(int utilityCssClassRole) Returns a generic CSS class name for the chosen role.Methods inherited from class eu.webtoolkit.jwt.WTheme
apply, applyValidationStyle, getPanelCollapseIconSide, serveCssMethods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
Constructor Details
-
WBootstrap2Theme
public WBootstrap2Theme()Constructor.
-
-
Method Details
-
setResponsive
public void setResponsive(boolean enabled) Enables responsive features.Responsive features can be enabled only at application startup.
Responsive features are disabled by default.
-
isResponsive
public boolean isResponsive()Returns whether responsive features are enabled.- See Also:
-
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
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
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
-
init
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.
-
apply
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
Description copied from class:WThemeReturns a generic CSS class name for a disabled element.- Specified by:
getDisabledClassin classWTheme
-
getActiveClass
Description copied from class:WThemeReturns a generic CSS class name for an active element.- Specified by:
getActiveClassin classWTheme
-
utilityCssClass
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
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, EnumSet<ValidationStyleFlag> styles) Description copied from class:WThemeApplies a style that indicates the result of validation.- Specified by:
applyValidationStylein classWTheme
-
canBorderBoxElement
- Specified by:
canBorderBoxElementin classWTheme
-
applyFunctionalStyling
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.
- Specified by:
applyFunctionalStylingin classWTheme- See Also:
-
applyOptionalStyling
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.
- Specified by:
applyOptionalStylingin classWTheme- See Also:
-