Class WBadge
A badge is a short text, often shown against a contrasting background, which is used to convey important information at a glance.
For instance, in a shopping application, a badge with the word "new" can be added to an article to show that this article was recently added.
Another example is to add a badge next to the channel in a chat application to show the number of unread messages in that channel.
A WBadge is an inline WText with a specific look. This look is defined in any
of JWt's themes. Either they are "Wt-badge" for the polished and default theme, or
"badge" for any of the bootstrap themes. For more information on the latter visit Bootstrap's documentation
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData -
Field Summary
Fields inherited from class eu.webtoolkit.jwt.WInteractWidget
dragTouchEndSlot_, dragTouchSlot_, noDefaultFields inherited from class eu.webtoolkit.jwt.WWidget
WT_GETEXTRAMS_JS -
Constructor Summary
ConstructorsConstructorDescriptionWBadge()Creates an empty badge.WBadge(WContainerWidget parentContainer) Creates an empty badge.WBadge(CharSequence text) Creates a badge with the given text.WBadge(CharSequence text, TextFormat textFormat) Creates a badge with the given text and format.WBadge(CharSequence text, TextFormat textFormat, WContainerWidget parentContainer) Creates a badge with the given text and format.WBadge(CharSequence text, WContainerWidget parentContainer) Creates a badge with the given text. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisInline()Returns whether the widget is displayed inline or as block.booleanReturns whether the badge uses the default style.voidsetUseDefaultStyle(boolean use) Sets whether the badge should use the default theme style.Methods inherited from class eu.webtoolkit.jwt.WText
getPadding, getText, getTextAlignment, getTextFormat, hasInternalPathEncoding, isWordWrap, refresh, remove, render, setInternalPathEncoding, setPadding, setPadding, setPadding, setText, setTextAlignment, setTextFormat, setWordWrapMethods inherited from class eu.webtoolkit.jwt.WInteractWidget
clicked, doubleClicked, enterPressed, escapePressed, gestureChanged, gestureEnded, gestureStarted, getMouseOverDelay, isEnabled, keyPressed, keyWentDown, keyWentUp, load, mouseDragged, mouseMoved, mouseWentDown, mouseWentOut, mouseWentOver, mouseWentUp, mouseWheel, propagateSetEnabled, setDraggable, setDraggable, setDraggable, setDraggable, setMouseOverDelay, setPopup, touchEnded, touchMoved, touchStarted, unsetDraggableMethods inherited from class eu.webtoolkit.jwt.WWebWidget
addStyleClass, beingDeleted, blurred, callJavaScriptMember, childrenChanged, createDomElement, doJavaScript, enableAjax, escapeText, escapeText, escapeText, escapeText, find, findById, focussed, formDataChanged, getAttributeValue, getBaseZIndex, getChildren, getClearSides, getDecorationStyle, getDomChanges, getFloatSide, getHeight, getHtmlTagName, getId, getJavaScriptMember, getLineHeight, getMargin, getMaximumHeight, getMaximumWidth, getMinimumHeight, getMinimumWidth, getOffset, getPositionScheme, getScrollVisibilityMargin, getStyleClass, getTabIndex, getToolTip, getVerticalAlignment, getVerticalAlignmentLength, getWidth, hasFocus, hasStyleClass, hideToolTip, isCanReceiveFocus, isDisabled, isHidden, isHiddenKeepsGeometry, isLoaded, isPopup, isRendered, isScrollVisibilityEnabled, isScrollVisible, isSetFirstFocus, isThemeStyleEnabled, isVisible, iterateChildren, jsStringLiteral, jsStringLiteral, manageWidget, parentResized, parentResized, propagateSetVisible, removeScript, removeStyleClass, resendFormData, resize, scrollVisibilityChanged, setAttributeValue, setBaseZIndex, setCanReceiveFocus, setClearSides, setDecorationStyle, setDeferredToolTip, setDisabled, setFlexBox, setFloatSide, setFocus, setHidden, setHiddenKeepsGeometry, setHtmlTagName, setId, setInline, setJavaScriptMember, setLineHeight, setLoadLaterWhenInvisible, setMargin, setMaximumSize, setMinimumSize, setObjectName, setOffsets, setParentWidget, setPositionScheme, setScrollVisibilityEnabled, setScrollVisibilityMargin, setSelectable, setStyleClass, setTabIndex, setThemeStyleEnabled, setToolTip, setVerticalAlignment, showToolTip, showToolTipOnHover, unescapeText, updateSignalConnection, voidEventSignal, widgetAdded, widgetRemovedMethods inherited from class eu.webtoolkit.jwt.WWidget
acceptDrops, acceptDrops, addCssRule, addCssRule, addJSignal, addStyleClass, animateHide, animateShow, applyThemeStyles, boxBorder, boxPadding, createJavaScript, disable, dropEvent, enable, getDropTouch, getJsRef, getParent, hide, htmlText, htmlText, isExposed, isGlobalWidget, isLayoutSizeAware, layoutSizeChanged, needsRerender, positionAt, positionAt, positionAt, positionAt, removeFromParent, removeStyleClass, removeWidget, render, resize, scheduleRender, scheduleRender, scheduleRender, scheduleThemeStyleApply, setClearSides, setDeferredToolTip, setFocus, setHeight, setHidden, setLayoutSizeAware, setMargin, setMargin, setMargin, setMargin, setMargin, setOffsets, setOffsets, setOffsets, setOffsets, setOffsets, setToolTip, setVerticalAlignment, setWidth, show, stopAcceptDrops, toggleStyleClass, toggleStyleClass, trMethods inherited from class eu.webtoolkit.jwt.WObject
getObjectName, setFormData
-
Constructor Details
-
WBadge
Creates an empty badge.- See Also:
-
WBadge
public WBadge()Creates an empty badge. -
WBadge
Creates a badge with the given text.- See Also:
-
WBadge
Creates a badge with the given text. -
WBadge
Creates a badge with the given text and format.- See Also:
-
WBadge
Creates a badge with the given text and format.
-
-
Method Details
-
isInline
public boolean isInline()Description copied from class:WWidgetReturns whether the widget is displayed inline or as block.- Overrides:
isInlinein classWWebWidget- See Also:
-
setUseDefaultStyle
public void setUseDefaultStyle(boolean use) Sets whether the badge should use the default theme style.If set to true, the badge will use the default theme style defined in the current theme.
We recommend setting this to false if you want to customize the badge's style using
WWebWidget#setDecorationStyle()to avoid having the default style overriding your custom style. This is currently only important for the Bootstrap 5 theme.By default, this is set to true.
-
isUseDefaultStyle
public boolean isUseDefaultStyle()Returns whether the badge uses the default style.- See Also:
-