Interface IBadge<I extends IAnyGroup>
- All Superinterfaces:
IAnyGroup<IBadge<I>>,IChildable<IBadge<I>,,I> IComponent<IBadge<I>>,IHtmlBasedComponent<IBadge<I>>,IXulElement<IBadge<I>>
Badge component.
A badge (count or status indicator). Used standalone, or wrapping a child
component to pin the indicator onto it — see getPlacement(), which is
only effective in that wrap mode.
- Since:
- 11.0.0
- Author:
- peaker
- See Also:
-
Badge
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classIBadge.Builder<I extends IAnyGroup>Builds instances of typeIBadge.static classBuilds an updater of typeIBadgeforUiAgent.smartUpdate(Locator, SmartUpdater). -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault intgetCount()Returns the count of this badge.default intgetMax()Returns the maximum count to display before falling back to"{max}+".default StringReturns the placement of the indicator relative to the wrapped child, or null when it was reset to the default.default StringReturns the severity (color theme), or null when it was reset to the default.default StringgetValue()Returns the text value of this badge.default StringReturns the client widget class.default booleanisDot()Returns whether to render as a small dot, ignoring value and count text.default booleanReturns whether to display when the count is zero.of(int count) Returns the instance with the given count.Returns the instance with the given text value.Returns the instance with the given id.withCount(int count) Returns a copy ofthisimmutable component with the specifiedcount.withDot(boolean dot) Returns a copy ofthisimmutable component with the specifieddot.withMax(int max) Returns a copy ofthisimmutable component with the specifiedmax.withPlacement(String placement) Returns a copy ofthisimmutable component with the specifiedplacement.withSeverity(String severity) Returns a copy ofthisimmutable component with the specifiedseverity.withShowZero(boolean showZero) Returns a copy ofthisimmutable component with the specifiedshowZero.Returns a copy ofthisimmutable component with the specifiedvalue.Methods inherited from interface org.zkoss.stateless.sul.IChildable
getChildren, withChildren, withChildrenMethods inherited from interface org.zkoss.stateless.sul.IComponent
getAction, getActions, getClientAttributes, getId, getMold, getWidgetListeners, getWidgetOverrides, isVisible, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withAction, withActions, withActions, withClientAttribute, withClientAttributes, withId, withMold, withVisible, withWidgetClass, withWidgetListener, withWidgetListeners, withWidgetOverride, withWidgetOverridesMethods inherited from interface org.zkoss.stateless.sul.IHtmlBasedComponent
getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getSkeleton, getStyle, getTabindex, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZIndex, isFocus, withClientAction, withDraggable, withDroppable, withFocus, withHeight, withHflex, withLeft, withRenderdefer, withSclass, withSkeleton, withStyle, withTabindex, withTabindex, withTooltiptext, withTop, withVflex, withWidth, withZclass, withZIndexMethods inherited from interface org.zkoss.stateless.sul.IXulElement
getContext, getCtrlKeys, getPopup, getTooltip, withContext, withCtrlKeys, withPopup, withTooltip
-
Field Details
-
DEFAULT
Constant for default attributes of this immutable component.
-
-
Method Details
-
getWidgetClass
Returns the client widget class.Default:
"zul.wgt.Badge"- Specified by:
getWidgetClassin interfaceIComponent<I extends IAnyGroup>
-
getValue
Returns the text value of this badge.Default:
null. When non-null, takes precedence overgetCount(). -
withValue
Returns a copy ofthisimmutable component with the specifiedvalue.Sets the text value of this badge.
- Parameters:
value- the text to show; takes precedence overgetCount().Default:
null.- Returns:
- A modified copy of the
thisobject
-
getCount
default int getCount()Returns the count of this badge.Default:
0. -
withCount
Returns a copy ofthisimmutable component with the specifiedcount.Sets the count of this badge.
- Parameters:
count- the number to show; must not be negative.Default:
0.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifcountis negative
-
getMax
default int getMax()Returns the maximum count to display before falling back to"{max}+".Default:
99. -
withMax
Returns a copy ofthisimmutable component with the specifiedmax.Sets the maximum count.
- Parameters:
max- the cap above which"{max}+"is shown; must be at least 1.Default:
99.- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifmaxis less than 1
-
isShowZero
default boolean isShowZero()Returns whether to display when the count is zero.Default:
false. -
withShowZero
Returns a copy ofthisimmutable component with the specifiedshowZero.Sets whether to display when the count is zero.
- Parameters:
showZero- whether the badge shows when the count is zero.Default:
false.- Returns:
- A modified copy of the
thisobject
-
isDot
default boolean isDot()Returns whether to render as a small dot, ignoring value and count text.Default:
false. -
withDot
Returns a copy ofthisimmutable component with the specifieddot.Sets whether to render as a small dot, ignoring value and count text.
- Parameters:
dot- whether to render as a dot instead of value/count text.Default:
false.- Returns:
- A modified copy of the
thisobject
-
getSeverity
Returns the severity (color theme), or null when it was reset to the default.Default:
"info". -
withSeverity
Returns a copy ofthisimmutable component with the specifiedseverity.Sets the severity.
- Parameters:
severity-"info","success","warning","error"or"neutral".Default:
"info".- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifseverityis not one of the accepted tokens
-
getPlacement
Returns the placement of the indicator relative to the wrapped child, or null when it was reset to the default.Default:
"top_right". -
withPlacement
Returns a copy ofthisimmutable component with the specifiedplacement.Sets the placement.
- Parameters:
placement-"top_right","top_left","bottom_right"or"bottom_left".Default:
"top_right".- Returns:
- A modified copy of the
thisobject - Throws:
org.zkoss.zk.ui.WrongValueException- ifplacementis not one of the accepted tokens
-
of
Returns the instance with the given count.- Parameters:
count- The count of the badge
-
of
Returns the instance with the given text value.- Parameters:
value- The text value of the badge
-
ofId
Returns the instance with the given id.- Parameters:
id- The id to identify this component
-