T - The type of the component extending form this classE - The type of the HTML element that represent the root element of the componentV - The type of the component valuepublic abstract class ValueBox<T extends ValueBox<T,E,V>,E extends elemental2.dom.HTMLElement,V> extends BasicFormElement<T,V> implements Focusable<T>, HasPlaceHolder<T>, IsReadOnly<T>, HasChangeHandlers<T,V>
| Modifier and Type | Class and Description |
|---|---|
static interface |
ValueBox.AutoValidate
Implementations of this interface will apply the validations for a component
|
static class |
ValueBox.AutoValidator
A class to wrap an
ValueBox.AutoValidate and provide the ability to attach/remove it from a
component |
BasicFormElement.FieldHandler<T>BaseDominoElement.ElementHandler<T>, BaseDominoElement.ResizeHandler<T>, BaseDominoElement.StyleEditor<E extends elemental2.dom.HTMLElement,T extends org.jboss.elemento.IsElement<E>>, BaseDominoElement.WavesStylerHasChangeHandlers.ChangeHandler<V>HasValidation.Validator| Modifier and Type | Field and Description |
|---|---|
protected List<HasChangeHandlers.ChangeHandler<? super V>> |
changeHandlers |
protected elemental2.dom.EventListener |
changeListener |
static String |
DISABLED
Constant css class name for a focused component
|
protected DominoElement<elemental2.dom.HTMLDivElement> |
fieldContainer |
protected DominoElement<elemental2.dom.HTMLDivElement> |
fieldGroup |
static String |
FLOATING
Constant css class name for a component that has its labels floating above it
|
static String |
FOCUSED
Constant css class name for a focused component
|
protected FlexItem<elemental2.dom.HTMLDivElement> |
inputContainer |
protected elemental2.dom.EventListener |
inputListener |
element| Modifier and Type | Method and Description |
|---|---|
T |
addChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler) |
T |
addLeftAddOn(FlexItem<?> addon)
Adds an element as an add on to the component at left side
|
T |
addLeftAddOn(org.jboss.elemento.IsElement<?> addon)
wrap the element in a
FlexItem and delegate to addLeftAddOn(FlexItem) |
T |
addLeftAddOn(elemental2.dom.Node addon)
wrap the node in a
FlexItem and delegate to addLeftAddOn(FlexItem) |
T |
addOnClearHandler(Consumer<T> onClearHandler)
Adds a handler that will be called when the field value is cleared
|
T |
addRightAddOn(FlexItem<?> rightAddon)
Adds an element as an add on to the component at left side
|
T |
addRightAddOn(org.jboss.elemento.IsElement<?> addon)
wrap the element in a
FlexItem and delegate to addRightAddOn(FlexItem) |
T |
addRightAddOn(elemental2.dom.Node addon)
wrap the node in a
FlexItem and delegate to addRightAddOn(FlexItem) |
protected boolean |
allowEmptyLabel() |
T |
asTableField()
flag the field to be used inside a table row
|
protected void |
autoValidate()
validate the component if auto validation is enabled
|
protected void |
callChangeHandlers()
manually call the change handlers if they are not paused
|
protected void |
changeLabelFloating()
Changes the label floating state when the field get focus or lose focus
|
T |
clear()
Clears the field value and trigger the change handlers
|
T |
clear(boolean silent)
Clears the field value and only triggers the change handlers if silent flag is true
|
T |
clearInvalid()
Removes all error messages and mark the component as valid
|
protected void |
clearValue()
clear the field value
|
protected abstract void |
clearValue(boolean silent)
clear the field value
|
T |
condense()
Reduces the vertical spaces for this component to reduce its height
|
protected abstract ValueBox.AutoValidator |
createAutoValidator(ValueBox.AutoValidate autoValidate)
Create an AutoValidator that will automatically validate the component when it loses focus
|
protected abstract E |
createInputElement(String type)
Creates an input element with the specified type
|
protected DominoElement<elemental2.dom.HTMLLabelElement> |
createLabelElement()
create the label element for this component
|
protected DominoElement<elemental2.dom.HTMLDivElement> |
createMandatoryAddOn() |
T |
disable() |
protected void |
doFocus()
Focus the element and apply focus styles
|
protected abstract void |
doSetValue(V value) |
protected void |
doUnfocus()
un-focus the component and remove the focus styles
|
elemental2.dom.HTMLElement |
element() |
T |
enable() |
T |
floating()
Make the label always floating over the field even if the value is empty
|
protected void |
floatLabel()
Make the label float over the component
|
T |
focus()
focus the component
|
DominoElement<elemental2.dom.HTMLDivElement> |
getAdditionalInfoContainer() |
FlexItem |
getCountItem() |
FlexItem |
getErrorItem() |
protected DominoElement<elemental2.dom.HTMLElement> |
getErrorsContainer() |
DominoElement<elemental2.dom.HTMLDivElement> |
getFieldContainer() |
DominoElement<elemental2.dom.HTMLDivElement> |
getFieldGroup() |
DominoElement<elemental2.dom.HTMLDivElement> |
getFieldInputContainer() |
FieldStyle |
getFieldStyle() |
Color |
getFocusColor() |
protected DominoElement<elemental2.dom.HTMLElement> |
getHelperContainer() |
FlexItem |
getHelpItem() |
FlexItem |
getInputContainer() |
DominoElement<E> |
getInputElement() |
Optional<DominoElement<elemental2.dom.HTMLLabelElement>> |
getLabelElement() |
Optional<DominoElement<elemental2.dom.HTMLElement>> |
getLabelTextElement() |
FlexLayout |
getLeftAddonContainer() |
FlexLayout |
getLeftAddOnsContainer() |
DominoElement<elemental2.dom.HTMLDivElement> |
getMandatoryAddOn() |
DominoElement<elemental2.dom.HTMLDivElement> |
getNotesContainer() |
List<Consumer<T>> |
getOnClearHandlers() |
String |
getPlaceholder() |
String |
getPostfix() |
FlexItem |
getPostFixItem() |
String |
getPrefix() |
FlexItem |
getPrefixItem() |
FlexLayout |
getRightAddonContainer() |
FlexLayout |
getRightAddOnsContainer() |
String |
getStringValue() |
V |
getValue() |
boolean |
hasChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler)
Checks if a component has the specified ChangeHandler
|
T |
hideLabelText() |
protected void |
hidePlaceholder() |
T |
invalidate(List<String> errorMessages)
Mark the component as invalid with a list of error messages
|
T |
invalidate(String errorMessage)
Mark the component as invalid with the specified error message
|
protected boolean |
isAddFocusColor() |
boolean |
isAutoValidation() |
boolean |
isEmpty() |
boolean |
isEmptyIgnoreSpaces() |
boolean |
isFloating() |
boolean |
isFocused() |
boolean |
isReadOnly() |
protected void |
linkLabelToField()
this will set the attribute for on the label with the field id as a value
|
T |
nonfloating()
Make the label floating over the field only when it has value
|
protected void |
onEnterKey() |
T |
pauseChangeHandlers()
Delagete to
setPauseChangeHandlers(boolean) with value true |
T |
pauseFocusValidation()
pauses the validation when the field loses focus so they wont trigger
|
T |
removeChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler) |
T |
removeLeftAddOn(FlexItem addon) |
T |
removeLeftAddOn(int index) |
T |
removeLeftAddOn(org.jboss.elemento.IsElement<?> addon) |
T |
removeLeftAddOn(elemental2.dom.Node addon) |
T |
removeLeftAddOns()
Remove all left addons
|
T |
removeOnClearHandler(Consumer<T> onClearHandler) |
T |
removeRightAddOn(FlexItem addon) |
T |
removeRightAddOn(int index) |
T |
removeRightAddOn(org.jboss.elemento.IsElement<?> addon) |
T |
removeRightAddOn(elemental2.dom.Node addon) |
T |
removeRightAddOns()
Remove all right addons
|
T |
resumeChangeHandlers()
Delagete to
setPauseChangeHandlers(boolean) with value false |
T |
resumeFocusValidation()
resume the validation when the field loses focus so they trigger
|
T |
setAutoValidation(boolean autoValidation) |
T |
setFieldStyle(FieldStyle fieldStyle)
Change the style of the field
|
T |
setFixErrorsPosition(boolean fixPosition) |
T |
setFloating(boolean floating) |
T |
setFocusColor(Color focusColor)
Set a color to use for focus indicators
|
T |
setLabel(org.jboss.elemento.IsElement<?> element)
Sets the label from an element
|
T |
setLabel(elemental2.dom.Node node)
Sets the label as a custom element
|
T |
setLabel(org.gwtproject.safehtml.shared.SafeHtml safeHtml)
Sets the label from html
|
T |
setLabel(String label) |
T |
setLabelTextVisible(boolean visible)
Show/hide the label element text
|
T |
setPauseChangeHandlers(boolean pauseChangeHandlers)
Disable/Enable change handlers
|
T |
setPlaceholder(String placeholder) |
T |
setPostFix(String postfix)
Adds a postfix text that will be a mandatory part of the field string value
|
T |
setPrefix(String prefix)
Adds a prefix text that will be a mandatory part of the field string value
|
T |
setReadOnly(boolean readOnly)
set the readonly attribute value
|
T |
setSpellCheck(boolean spellCheck)
Enable/Disable spellcheck for the component, sets the spellcheck attribute
|
T |
setTableField(boolean asTableField)
based on the flag styles will be added or removed to make inside or outside of a table row
|
protected boolean |
shouldShowPlaceholder() |
T |
showLabelText() |
protected void |
showPlaceholder() |
T |
spread()
Increase the vertical spaces for this component to increase its height
|
protected void |
unfloatLabel()
unfloat a floating label
|
T |
unfocus()
remove the focus from the component
|
protected void |
updateLabel(String label) |
T |
value(V value) |
T |
value(V value,
boolean silent) |
addValidator, getErrorLabels, getErrors, getHelperText, getLabel, getName, getRequiredErrorMessage, groupBy, hasValidator, isDisabled, isEnabled, isFixErrorsPosition, isRequired, isShowRequiredIndicator, isValidationDisabled, makeErrorLabel, removeValidator, setHelperText, setName, setRequired, setRequired, setRequiredErrorMessage, setShowRequiredIndicator, setValidationDisabled, setValue, showErrors, ungroup, validate, withValidationDisabledadd, 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, elevate, elevate, firstChild, getAttachObserver, getAttribute, getBoundingClientRect, getChildElementCount, getClickableElement, getCollapsible, getCollapsibleElement, getDetachObserver, getDominoId, getElementsCount, getElevation, getFirstChild, getId, getTextContent, getTooltip, getWavesElement, hasAttribute, hasChildNodes, hasDirectChild, hide, hideOn, id, init, insertAfter, insertAfter, insertAfter, insertAfter, insertBefore, insertBefore, insertBefore, insertBefore, insertFirst, insertFirst, insertFirst, isAttached, isCollapsed, isEmptyElement, isEqualNode, isForceHidden, isHidden, 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, removeWaves, 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, setRight, setRight, setTabIndex, setTextAlign, setTextAlign, setTextContent, 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, waitvalidateAllisExpandedadd, add, remove, remove, removeProperty, replace, setProperty, setPropertypublic static final String FOCUSED
public static final String FLOATING
public static final String DISABLED
protected final elemental2.dom.EventListener changeListener
protected final elemental2.dom.EventListener inputListener
protected DominoElement<elemental2.dom.HTMLDivElement> fieldGroup
protected DominoElement<elemental2.dom.HTMLDivElement> fieldContainer
protected FlexItem<elemental2.dom.HTMLDivElement> inputContainer
protected List<HasChangeHandlers.ChangeHandler<? super V>> changeHandlers
protected void onEnterKey()
public FieldStyle getFieldStyle()
FieldStylepublic T setFieldStyle(FieldStyle fieldStyle)
fieldStyle - FieldStylepublic T setFixErrorsPosition(boolean fixPosition)
setFixErrorsPosition in class BasicFormElement<T extends ValueBox<T,E,V>,V>fixPosition - boolean, if true the errors message container size will be fixed and
wont change the spacing between the fields when an error message is shown.protected void linkLabelToField()
protected void callChangeHandlers()
protected DominoElement<elemental2.dom.HTMLLabelElement> createLabelElement()
HTMLLabelElement wrapped as DominoElementprotected abstract E createInputElement(String type)
type - String the input element typepublic T setFloating(boolean floating)
floating - boolean, if true delegate to floating() otherwise delegate to nonfloating()public T floating()
public T nonfloating()
public boolean isFloating()
public DominoElement<elemental2.dom.HTMLDivElement> getMandatoryAddOn()
FlexItem that is added as a mandatoryAddOnpublic T focus()
public T unfocus()
protected void doFocus()
protected boolean isAddFocusColor()
protected void doUnfocus()
protected void updateLabel(String label)
updateLabel in class BasicFormElement<T extends ValueBox<T,E,V>,V>label - String new label to replace the old onepublic Optional<DominoElement<elemental2.dom.HTMLElement>> getLabelTextElement()
getLabelTextElement in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLElement that contains the label text wrapped as DominoElementpublic T hideLabelText()
public T showLabelText()
public T setLabelTextVisible(boolean visible)
visible - booleanpublic boolean isFocused()
public T enable()
public T disable()
protected boolean allowEmptyLabel()
public T setLabel(elemental2.dom.Node node)
public T setLabel(org.gwtproject.safehtml.shared.SafeHtml safeHtml)
public T setLabel(org.jboss.elemento.IsElement<?> element)
public T setPlaceholder(String placeholder)
setPlaceholder in interface HasPlaceHolder<T extends ValueBox<T,E,V>>placeholder - String placeholderprotected void showPlaceholder()
protected void hidePlaceholder()
protected boolean shouldShowPlaceholder()
public String getPlaceholder()
getPlaceholder in interface HasPlaceHolder<T extends ValueBox<T,E,V>>public DominoElement<elemental2.dom.HTMLDivElement> getFieldInputContainer()
getFieldInputContainer in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLDivElement that contains this field input element wrapped as DominoElementpublic DominoElement<elemental2.dom.HTMLDivElement> getFieldContainer()
getFieldContainer in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLDivElement that contains this field wrapped as DominoElementpublic T addLeftAddOn(FlexItem<?> addon)
addon - FlexItem that contains the add on elementpublic T addLeftAddOn(org.jboss.elemento.IsElement<?> addon)
FlexItem and delegate to addLeftAddOn(FlexItem)addon - IsElementpublic T addLeftAddOn(elemental2.dom.Node addon)
FlexItem and delegate to addLeftAddOn(FlexItem)addon - IsElementpublic T addRightAddOn(FlexItem<?> rightAddon)
rightAddon - FlexItem that contains the add on elementpublic T addRightAddOn(org.jboss.elemento.IsElement<?> addon)
FlexItem and delegate to addRightAddOn(FlexItem)addon - IsElementpublic T addRightAddOn(elemental2.dom.Node addon)
FlexItem and delegate to addRightAddOn(FlexItem)addon - IsElementpublic T removeRightAddOn(FlexItem addon)
addon - FlexItempublic T removeRightAddOn(org.jboss.elemento.IsElement<?> addon)
addon - IsElementpublic T removeRightAddOn(elemental2.dom.Node addon)
addon - Nodepublic T removeRightAddOn(int index)
index - int index of the addon to removepublic T removeLeftAddOn(FlexItem addon)
addon - FlexItempublic T removeLeftAddOn(org.jboss.elemento.IsElement<?> addon)
addon - IsElementpublic T removeLeftAddOn(elemental2.dom.Node addon)
addon - Nodepublic T removeLeftAddOn(int index)
index - int index of the addon to removepublic T removeRightAddOns()
public T removeLeftAddOns()
public DominoElement<E> getInputElement()
getInputElement in interface HasInputElementDominoElementprotected DominoElement<elemental2.dom.HTMLElement> getHelperContainer()
getHelperContainer in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLElement that contains this field helper text element wrapped as DominoElementprotected DominoElement<elemental2.dom.HTMLElement> getErrorsContainer()
getErrorsContainer in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLElement that contains this field errors element wrapped as DominoElementpublic V getValue()
public boolean isEmpty()
public boolean isEmptyIgnoreSpaces()
isEmptyIgnoreSpaces in interface HasGrouping<T extends ValueBox<T,E,V>>public String getStringValue()
getStringValue in interface HasInputElementpublic Optional<DominoElement<elemental2.dom.HTMLLabelElement>> getLabelElement()
getLabelElement in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLLabelElement wrapped as DominoElementpublic elemental2.dom.HTMLElement element()
public T invalidate(String errorMessage)
invalidate in interface HasValidation<T extends ValueBox<T,E,V>>invalidate in class BasicFormElement<T extends ValueBox<T,E,V>,V>errorMessage - Stringpublic T asTableField()
public T setTableField(boolean asTableField)
asTableField - boolean, if true adds the styles, otherwise removes thempublic T invalidate(List<String> errorMessages)
invalidate in interface HasValidation<T extends ValueBox<T,E,V>>invalidate in class BasicFormElement<T extends ValueBox<T,E,V>,V>errorMessages - List of String error messagespublic T pauseFocusValidation()
public T resumeFocusValidation()
public T clearInvalid()
clearInvalid in interface HasValidation<T extends ValueBox<T,E,V>>clearInvalid in class BasicFormElement<T extends ValueBox<T,E,V>,V>public T setAutoValidation(boolean autoValidation)
setAutoValidation in interface HasAutoValidation<T extends ValueBox<T,E,V>>autoValidation - boolean, true to enable auto validation, false to disable itpublic boolean isAutoValidation()
isAutoValidation in interface HasAutoValidation<T extends ValueBox<T,E,V>>protected abstract ValueBox.AutoValidator createAutoValidator(ValueBox.AutoValidate autoValidate)
autoValidate - ValueBox.AutoValidatepublic T clear()
public T clear(boolean silent)
public T setReadOnly(boolean readOnly)
setReadOnly in interface IsReadOnly<T extends ValueBox<T,E,V>>setReadOnly in class BaseDominoElement<elemental2.dom.HTMLElement,T extends ValueBox<T,E,V>>readOnly - boolean, if true switch the component to readonly mode, otherwise switch out
off readonly modepublic boolean isReadOnly()
isReadOnly in interface IsReadOnly<T extends ValueBox<T,E,V>>isReadOnly in class BaseDominoElement<elemental2.dom.HTMLElement,T extends ValueBox<T,E,V>>protected void changeLabelFloating()
protected void floatLabel()
protected void unfloatLabel()
protected void autoValidate()
public T addChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler)
addChangeHandler in interface HasChangeHandlers<T extends ValueBox<T,E,V>,V>changeHandler - HasChangeHandlers.ChangeHandlerpublic T removeChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler)
removeChangeHandler in interface HasChangeHandlers<T extends ValueBox<T,E,V>,V>changeHandler - HasChangeHandlers.ChangeHandlerpublic T setPauseChangeHandlers(boolean pauseChangeHandlers)
pauseChangeHandlers - boolean, true to pause the change handlers, false to enable thempublic T pauseChangeHandlers()
setPauseChangeHandlers(boolean) with value truepublic T resumeChangeHandlers()
setPauseChangeHandlers(boolean) with value falsepublic FlexLayout getLeftAddonContainer()
FlexLayout element that contains all left addonspublic FlexLayout getRightAddonContainer()
FlexLayout element that contains all right addonspublic boolean hasChangeHandler(HasChangeHandlers.ChangeHandler<? super V> changeHandler)
hasChangeHandler in interface HasChangeHandlers<T extends ValueBox<T,E,V>,V>changeHandler - HasChangeHandlers.ChangeHandlerpublic T setSpellCheck(boolean spellCheck)
spellCheck - boolean, true to enable spellcheck, false to diable itpublic T addOnClearHandler(Consumer<T> onClearHandler)
onClearHandler - Consumer of Tpublic T removeOnClearHandler(Consumer<T> onClearHandler)
onClearHandler - Consumer of Tpublic List<Consumer<T>> getOnClearHandlers()
public T setPrefix(String prefix)
prefix - Stringpublic String getPrefix()
public T setPostFix(String postfix)
postfix - Stringpublic DominoElement<elemental2.dom.HTMLDivElement> getFieldGroup()
HTMLDivElement that groups the different elements of this componentpublic FlexItem getInputContainer()
FlexItem that contains the input element of this componentpublic DominoElement<elemental2.dom.HTMLDivElement> getNotesContainer()
HTMLDivElement that contains the notes of this componentpublic DominoElement<elemental2.dom.HTMLDivElement> getAdditionalInfoContainer()
getAdditionalInfoContainer in class BasicFormElement<T extends ValueBox<T,E,V>,V>HTMLDivElement that contains this field additional info element wrapped as
DominoElementpublic FlexLayout getLeftAddOnsContainer()
FlexLayout that contains all the left addonspublic FlexLayout getRightAddOnsContainer()
FlexLayout that contains all the right addonspublic FlexItem getHelpItem()
FlexItem that contains the helper text of this componentpublic FlexItem getCountItem()
FlexItem that contains the character count for this componentpublic FlexItem getErrorItem()
FlexItem that contains the error messages for this componentpublic FlexItem getPrefixItem()
FlexItem that contains the prefix text for this componentpublic FlexItem getPostFixItem()
FlexItem that contains the postfix for this componentpublic String getPostfix()
protected void clearValue()
protected abstract void clearValue(boolean silent)
protected abstract void doSetValue(V value)
value - V the value to set for this fieldpublic T condense()
public T spread()
protected DominoElement<elemental2.dom.HTMLDivElement> createMandatoryAddOn()
FlexItem that contains the mandatory addonsCopyright © 2019–2022 Dominokit. All rights reserved.