B - The button subclass being wrappedpublic abstract class BaseButton<B extends BaseButton<?>> extends WavesElement<elemental2.dom.HTMLElement,B> implements HasClickableElement, Sizable<B>, HasBackground<B>, HasContent<B>, Switchable<B>
this class provides commons functionality and methods used in different implementations of a button
BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStyler| Modifier and Type | Field and Description |
|---|---|
protected DominoElement<elemental2.dom.HTMLButtonElement> |
buttonElement
The default element that represent the button HTMLElement.
|
protected String |
content |
wavesSupportelement| Modifier | Constructor and Description |
|---|---|
protected |
BaseButton()
creates a button with default size
ButtonSize.MEDIUM |
protected |
BaseButton(BaseIcon icon)
creates a button with an icon and default size
ButtonSize.MEDIUM |
protected |
BaseButton(BaseIcon icon,
StyleType type)
creates a button with an icon and default size
ButtonSize.MEDIUM and apply a predefined
StyleType |
protected |
BaseButton(String content)
creates a button with text and default size
ButtonSize.MEDIUM |
|
BaseButton(String content,
Color background)
creates a button with a text and default size
ButtonSize.MEDIUM and apply a custom
background Color |
protected |
BaseButton(String content,
StyleType type)
creates a button with an icon and default size
ButtonSize.MEDIUM and apply a predefined
StyleType |
| Modifier and Type | Method and Description |
|---|---|
B |
block()
delegate to
setBlock(boolean) with true |
B |
bordered()
adds a border to the button by applying the
ButtonStyles.BUTTON_BORDERED and removes
the Elevation |
B |
bordered(Color borderColor)
sets the border color for a bordered button
|
B |
circle()
changes the button to a circle button by applying
ButtonStyles.BUTTON_CIRCLE |
B |
deLinkify()
Revert a linkify(ed) button to look like a button by removing
ButtonStyles.BUTTON_LINK
and restore the previous Elevation |
B |
disable()
disables the button, this will effectively set the button HTMLElement disable attribute
|
B |
enable()
enables the button, this will effectively remove the button HTMLElement disable attribute
|
Color |
getBackground() |
elemental2.dom.HTMLElement |
getClickableElement()
return the clickable
HTMLElement of this component, which the component button element. |
ButtonSize |
getSize() |
DominoElement<elemental2.dom.HTMLElement> |
getTextSpan() |
boolean |
isEnabled()
check if the button is enabled or not
|
B |
large()
change the button size to
ButtonSize.LARGE |
B |
linkify()
changes the button to look like a link by applying
ButtonStyles.BUTTON_LINK and remove
the Elevation |
B |
medium()
change the button size to
ButtonSize.MEDIUM |
B |
nonBordered()
removes the button border applied by
bordered() and restore previous Elevation |
B |
setBackground(Color background)
change the button background color
|
B |
setBlock(boolean block)
sets or remove the
ButtonStyles.BUTTON_BLOCK |
B |
setButtonType(StyleType type)
changes the button style type
|
B |
setColor(Color color)
Changes the text color of a button
|
B |
setContent(String content)
replaces the current text of the button
|
B |
setEnabled(boolean enabled)
|
B |
setIcon(BaseIcon<?> icon)
sets the button icon replacing the current icon.
|
B |
setSize(ButtonSize size)
change the size of the button
|
B |
setTextContent(String text)
same as
setContent(String) |
B |
small()
change the button size to
ButtonSize.SMALL |
B |
xSmall()
change the button size to
ButtonSize.XSMALL |
applyWaveStyle, init, initWaves, removeWaves, setWaveColoradd, add, addClickListener, addCss, addCss, addEventListener, addEventListener, addEventsListener, addHideListener, addShowListener, alignCenter, alignRight, appendChild, appendChild, apply, attr, blur, childNodes, clearElement, contains, contains, contains, containsCss, css, css, cssClassByIndex, cssClassesCount, cssText, element, elevate, elevate, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isDisabled, isEmptyElement, isEqualNode, isForceHidden, isHidden, isReadOnly, item, lastChild, length, onAttached, onDetached, onResize, pullLeft, pullRight, querySelector, querySelectorAll, remove, removeAttachObserver, removeAttribute, removeChild, removeChild, removeCss, removeCss, removeCssProperty, removeDetachObserver, removeEventListener, removeEventListener, removeHideListener, removeHideOn, removeShowListener, removeShowOn, removeTooltip, replaceCss, setAlignItems, setAttribute, setAttribute, setAttribute, setBackgroundColor, setBackgroundColor, setBorder, setBorderColor, setBottom, setBottom, setBoxShadow, setCollapseStrategy, setColor, setColor, setContent, setContent, setCssProperty, setCssProperty, setCursor, setCursor, setDisabled, setDisplay, setDisplay, setDropMenu, setFlex, setFloat, setFloat, setFontSize, setFontSize, setForceHidden, setHeight, setHeight, setId, setInnerHtml, setLeft, setLeft, setLineHeight, setLineHeight, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setOpacity, setOpacity, setOverFlow, setOverFlow, setOverFlowY, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPointerEvents, setPosition, setPosition, setReadOnly, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTooltip, setTooltip, setTooltip, setTooltip, setTop, setTop, setTransitionDuration, setWidth, setWidth, setZIndex, show, showOn, style, style, styler, textContent, toggleDisplay, toggleDisplay, withWaves, withWavesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertyprotected String content
protected final DominoElement<elemental2.dom.HTMLButtonElement> buttonElement
protected BaseButton()
ButtonSize.MEDIUMprotected BaseButton(String content)
ButtonSize.MEDIUMcontent - String textprotected BaseButton(BaseIcon icon)
ButtonSize.MEDIUMicon - BaseIconprotected BaseButton(String content, StyleType type)
ButtonSize.MEDIUM and apply a predefined
StyleTypecontent - String texttype - StyleTypeprotected BaseButton(BaseIcon icon, StyleType type)
ButtonSize.MEDIUM and apply a predefined
StyleTypepublic BaseButton(String content, Color background)
ButtonSize.MEDIUM and apply a custom
background Colorcontent - String textbackground - Color the background colorpublic B setContent(String content)
setContent in interface HasContent<B extends BaseButton<?>>content - String, the new textpublic B setTextContent(String text)
setContent(String)setTextContent in class BaseDominoElement<elemental2.dom.HTMLElement,B extends BaseButton<?>>text - String, the new textpublic B setSize(ButtonSize size)
size - ButtonSizepublic B setBlock(boolean block)
ButtonStyles.BUTTON_BLOCKblock - boolean if true add the style otherwise remove itpublic B setBackground(Color background)
setBackground in interface HasBackground<B extends BaseButton<?>>background - the Color of the new backgroundpublic B setColor(Color color)
color - the new Colorpublic B setButtonType(StyleType type)
type - the new StyleTypepublic B disable()
disable in interface Switchable<B extends BaseButton<?>>disable in class BaseDominoElement<elemental2.dom.HTMLElement,B extends BaseButton<?>>public B enable()
enable in interface Switchable<B extends BaseButton<?>>enable in class BaseDominoElement<elemental2.dom.HTMLElement,B extends BaseButton<?>>public B setEnabled(boolean enabled)
public boolean isEnabled()
isEnabled in interface Switchable<B extends BaseButton<?>>public elemental2.dom.HTMLElement getClickableElement()
HTMLElement of this component, which the component button element.getClickableElement in interface HasClickableElementgetClickableElement in class BaseDominoElement<elemental2.dom.HTMLElement,B extends BaseButton<?>>HTMLElement of this button instancepublic B large()
ButtonSize.LARGElarge in interface Sizable<B extends BaseButton<?>>public B medium()
ButtonSize.MEDIUMmedium in interface Sizable<B extends BaseButton<?>>public B small()
ButtonSize.SMALLsmall in interface Sizable<B extends BaseButton<?>>public B xSmall()
ButtonSize.XSMALLxSmall in interface Sizable<B extends BaseButton<?>>public B block()
setBlock(boolean) with truepublic B linkify()
ButtonStyles.BUTTON_LINK and remove
the Elevationpublic B deLinkify()
ButtonStyles.BUTTON_LINK
and restore the previous Elevationpublic B bordered()
ButtonStyles.BUTTON_BORDERED and removes
the Elevationpublic B bordered(Color borderColor)
borderColor - the Color of the borderpublic B nonBordered()
bordered() and restore previous Elevationpublic B circle()
ButtonStyles.BUTTON_CIRCLEpublic B setIcon(BaseIcon<?> icon)
icon - the new BaseIconpublic ButtonSize getSize()
ButtonSizepublic Color getBackground()
public DominoElement<elemental2.dom.HTMLElement> getTextSpan()
DominoElement of HTMLElement that wrap the button textCopyright © 2019–2022 Dominokit. All rights reserved.