public class MaterialListValueBox<T> extends MaterialWidget implements HasId, HasGrid, HasColors, HasPlaceholder, com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>, com.google.gwt.user.client.ui.HasConstrainedValue<T>, com.google.gwt.editor.client.HasEditorErrors<T>, HasErrorHandler, HasValidators<T>, com.google.gwt.event.dom.client.HasBlurHandlers
Material ListBox is another dropdown component that will set / get the value depends on the selected index
<m:MaterialListBox ui:field="lstBox" />
// functions
lstBox.setSelectedIndex(2);
lstBox.getSelectedIndex();
lstBox.addValueChangeHandler(handler);
MaterialWidget.Featurecom.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledcom.google.gwt.editor.client.Editor.Ignore, com.google.gwt.editor.client.Editor.Path| Constructor and Description |
|---|
MaterialListValueBox() |
| Modifier and Type | Method and Description |
|---|---|
com.google.gwt.event.shared.HandlerRegistration |
addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler) |
void |
addItem(String item)
Adds an item to the list box.
|
void |
addItem(String item,
com.google.gwt.i18n.client.HasDirection.Direction dir)
Adds an item to the list box, specifying its direction.
|
void |
addItem(String item,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String value)
Adds an item to the list box, specifying its direction and an initial
value for the item.
|
void |
addItem(String item,
String value)
Adds an item to the list box, specifying an initial value for the item.
|
com.google.web.bindery.event.shared.HandlerRegistration |
addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
Adds a validation changed handler.
|
void |
addValidator(Validator<T> validator)
Adds the validator.
|
Option |
addValue(T value) |
com.google.gwt.event.shared.HandlerRegistration |
addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> handler) |
void |
clear()
Removes all items from the list box.
|
protected void |
createInternalChangeHandler(com.google.gwt.dom.client.Element element)
Creates the internal change handler needed to trigger change events for
Materialize CSS change events.
|
ErrorHandler |
getErrorHandler()
Gets the error handler.
|
ErrorHandlerType |
getErrorHandlerType()
Gets the error handler type.
|
int |
getIndex(String value)
Gets the index of the specified value.
|
int |
getItemCount()
Gets the number of items present in the list box.
|
String[] |
getItemsSelected()
Returns all selected values of the list box, or empty array if none.
|
String |
getItemText(int index)
Gets the text associated with the item at the specified index.
|
String |
getName() |
com.google.gwt.dom.client.OptionElement |
getOptionElement(int index) |
String |
getPlaceholder() |
int |
getSelectedIndex()
Gets the currently-selected item.
|
String |
getSelectedItemText()
Gets the text for currently selected item.
|
String |
getSelectedValue()
Gets the value for currently selected item.
|
protected com.google.gwt.dom.client.SelectElement |
getSelectElement() |
T |
getValue() |
String |
getValue(int index)
Gets the value associated with the item at a given index.
|
int |
getVisibleItemCount()
Gets the number of items that are visible.
|
protected void |
initializeMaterial(com.google.gwt.dom.client.Element element)
Initializes the Materialize CSS list box.
|
void |
insertItem(String item,
com.google.gwt.i18n.client.HasDirection.Direction dir,
int index)
Inserts an item into the list box, specifying its direction.
|
void |
insertItem(String item,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String value,
int index)
Inserts an item into the list box, specifying its direction and an
initial value for the item.
|
void |
insertItem(String item,
int index)
Inserts an item into the list box.
|
void |
insertItem(String item,
String value,
int index)
Inserts an item into the list box, specifying an initial value for the
item.
|
boolean |
isItemSelected(int index)
Determines whether an individual list item is selected.
|
boolean |
isMultipleSelect()
Gets whether this list allows multiple selection.
|
boolean |
isOld() |
boolean |
isValidateOnBlur()
Gets the validate on blur.
|
protected void |
onChangeInternal() |
void |
onLoad() |
void |
reinitialize()
Re initialize the material listbox component
|
void |
removeItem(int index)
Removes the item at the specified index.
|
boolean |
removeValidator(Validator<T> validator)
Removes the validator.
|
void |
removeValue(String value)
Removes a value from the list box.
|
void |
reset()
Reset the form element to blank and clear error messages.
|
void |
setAcceptableValues(Collection<T> values) |
void |
setEmptyPlaceHolder(String value) |
void |
setEnabled(boolean enabled) |
void |
setErrorHandler(ErrorHandler errorHandler)
Sets the error handler.
|
void |
setErrorHandlerType(ErrorHandlerType errorHandlerType)
Sets the error handler type.
|
void |
setItemSelected(int index,
boolean selected)
Sets whether an individual list item is selected.
|
void |
setItemText(int index,
String text)
Sets the text associated with the item at a given index.
|
void |
setItemText(int index,
String text,
com.google.gwt.i18n.client.HasDirection.Direction dir)
Sets the text associated with the item at a given index.
|
void |
setMultipleSelect(boolean multipleSelect)
Sets whether this list allows multiple selections.
|
void |
setName(String name) |
void |
setOld(boolean old) |
void |
setPlaceholder(String placeholder) |
void |
setSelectedIndex(int index)
Sets the currently selected index.
|
void |
setSelectedValue(String value)
Sets the currently selected value.
|
void |
setTitle(String title) |
void |
setValidateOnBlur(boolean validateOnBlur)
Sets the validate on blur.
|
void |
setValidators(Validator<T>... validators)
The validators used to validate this object.
|
void |
setValue(int index,
String value)
Sets the value associated with the item at a given index.
|
void |
setValue(T value) |
void |
setValue(T value,
boolean fireEvents) |
void |
setValueSelected(String value,
boolean selected)
Sets whether an individual list value is selected.
|
void |
setVisibleItemCount(int visibleItems)
Sets the number of items that are visible.
|
void |
showErrors(List<com.google.gwt.editor.client.EditorError> errors) |
boolean |
validate()
Validate the field's value using the supplied validators.
|
boolean |
validate(boolean show)
Validate the field's value using the supplied validators.
|
add, add, clearActiveClass, enableFeature, getBackgroundColor, getCenterOn, getCenterOnMixin, getCircleMixin, getColorsMixin, getDataAttribute, getDepth, getEnabledMixin, getFlexboxMixin, getFloat, getFloatMixin, getFocusableMixin, getFontSize, getFontSizeMixin, getFontWeight, getFontWeightMixin, getGridMixin, getHideOn, getHideOnMixin, getHoverableMixin, getId, getIdMixin, getInitialClasses, getOpacity, getScrollspy, getScrollspyMixin, getSeparatorMixin, getShadow, getShadowMixin, getShowOn, getShowOnMixin, getTabIndex, getTextAlign, getTextAlignMixin, getTextColor, getTooltip, getTooltipDelayMs, getTooltipMixin, getTooltipPosition, getTruncateMixin, getWaves, getWavesMixin, getWidth, getWidth, insert, insert, isCircle, isEnabled, isFeatureEnabled, isHoverable, isSeparator, setAccessKey, setBackgroundColor, setBottom, setCenterOn, setCircle, setDataAttribute, setDepth, setDisplay, setFlex, setFlexAlignContent, setFlexAlignItems, setFlexAlignSelf, setFlexBasis, setFlexDirection, setFlexGrow, setFlexJustifyContent, setFlexOrder, setFlexShrink, setFlexWrap, setFloat, setFocus, setFontSize, setFontSize, setFontWeight, setGrid, setGwtDisplay, setHideOn, setHoverable, setId, setInitialClasses, setLayoutPosition, setLeft, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setOffset, setOpacity, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setRight, setScrollspy, setSeparator, setShadow, setShowOn, setTabIndex, setTextAlign, setTextColor, setTooltip, setTooltipDelayMs, setTooltipPosition, setTop, setTruncate, setVisibility, setWaves, stopTouchStartEvent, stopTouchStartEventadd, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, remove, removeadd, adopt, doAttachChildren, doDetachChildren, orphan, removeaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEventsaddStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBackgroundColor, getTextColor, setBackgroundColor, setTextColorsetVisibleforEach, spliteratorpublic MaterialListValueBox()
public void onLoad()
onLoad in class MaterialWidgetpublic void setPlaceholder(String placeholder)
setPlaceholder in interface HasPlaceholderpublic String getPlaceholder()
getPlaceholder in interface HasPlaceholderpublic com.google.gwt.dom.client.OptionElement getOptionElement(int index)
public void clear()
clear in interface com.google.gwt.user.client.ui.HasWidgetsclear in class com.google.gwt.user.client.ui.Panelprotected com.google.gwt.dom.client.SelectElement getSelectElement()
protected void onChangeInternal()
protected void createInternalChangeHandler(com.google.gwt.dom.client.Element element)
protected void initializeMaterial(com.google.gwt.dom.client.Element element)
public void reinitialize()
public void setMultipleSelect(boolean multipleSelect)
multipleSelect - true to allow multiple selectionspublic boolean isMultipleSelect()
true if multiple selection is allowedpublic void setEmptyPlaceHolder(String value)
public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> handler)
addValueChangeHandler in interface com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>public void setAcceptableValues(Collection<T> values)
setAcceptableValues in interface com.google.gwt.user.client.ui.HasConstrainedValue<T>public void setValue(T value, boolean fireEvents)
setValue in interface com.google.gwt.user.client.ui.HasValue<T>public boolean isOld()
public void setOld(boolean old)
public void insertItem(String item, com.google.gwt.i18n.client.HasDirection.Direction dir, String value, int index)
item - the text of the item to be inserteddir - the item's direction. If null, the item is displayed
in the widget's overall direction, or, if a direction
estimator has been set, in the item's estimated direction.value - the item's value, to be submitted if it is part of a
FormPanel.index - the index at which to insert itpublic void setValue(int index, String value)
FormPanel.index - the index of the item to be setvalue - the item's new value; cannot be nullIndexOutOfBoundsException - if the index is out of rangepublic void setTitle(String title)
setTitle in class com.google.gwt.user.client.ui.UIObjectpublic void addItem(String item, com.google.gwt.i18n.client.HasDirection.Direction dir)
addItem(item, dir, item)
item - the text of the item to be addeddir - the item's directionpublic void addItem(String item)
addItem(item, item)
item - the text of the item to be addedpublic void addItem(String item, String value)
item - the text of the item to be addedvalue - the item's value, to be submitted if it is part of a
FormPanel; cannot be nullpublic void addItem(String item, com.google.gwt.i18n.client.HasDirection.Direction dir, String value)
item - the text of the item to be addeddir - the item's directionvalue - the item's value, to be submitted if it is part of a
FormPanel; cannot be nullpublic void insertItem(String item, int index)
insertItem(item, item, index)
item - the text of the item to be insertedindex - the index at which to insert itpublic void insertItem(String item, com.google.gwt.i18n.client.HasDirection.Direction dir, int index)
insertItem(item, dir, item, index)
item - the text of the item to be inserteddir - the item's directionindex - the index at which to insert itpublic void insertItem(String item, String value, int index)
insertItem(item, null, value, index)
item - the text of the item to be insertedvalue - the item's value, to be submitted if it is part of a
FormPanel.index - the index at which to insert itpublic void setItemSelected(int index, boolean selected)
index - the index of the item to be selected or unselectedselected - true to select the itemIndexOutOfBoundsException - if the index is out of rangepublic void setItemText(int index, String text)
index - the index of the item to be settext - the item's new textIndexOutOfBoundsException - if the index is out of rangepublic void setItemText(int index, String text, com.google.gwt.i18n.client.HasDirection.Direction dir)
index - the index of the item to be settext - the item's new textdir - the item's direction.IndexOutOfBoundsException - if the index is out of rangepublic void setSelectedIndex(int index)
setItemSelected(int, boolean) to select multiple items at a
time.index - the index of the item to be selectedpublic void setVisibleItemCount(int visibleItems)
visibleItems - the visible item countpublic int getItemCount()
public String getItemText(int index)
index - the index of the item whose text is to be retrievedIndexOutOfBoundsException - if the index is out of rangepublic String getSelectedItemText()
null if none is selectedpublic int getSelectedIndex()
isItemSelected(int)
can be used to query individual items).-1 if none is selectedpublic String getValue(int index)
index - the index of the item to be retrievedIndexOutOfBoundsException - if the index is out of rangepublic String getSelectedValue()
null if none is selectedpublic int getVisibleItemCount()
public boolean isItemSelected(int index)
index - the index of the item to be testedtrue if the item is selectedIndexOutOfBoundsException - if the index is out of rangepublic void removeItem(int index)
index - the index of the item to be removedIndexOutOfBoundsException - if the index is out of rangepublic String[] getItemsSelected()
public void setSelectedValue(String value)
setValueSelected(String, boolean) to select multiple items at a
time.value - the value of the item to be selectedpublic int getIndex(String value)
value - the value of the item to be foundpublic void setValueSelected(String value, boolean selected)
value - the value of the item to be selected or unselectedselected - true to select the itempublic void removeValue(String value)
value - the value to be removed from the listpublic void setEnabled(boolean enabled)
setEnabled in interface com.google.gwt.user.client.ui.HasEnabledsetEnabled in class MaterialWidgetpublic void showErrors(List<com.google.gwt.editor.client.EditorError> errors)
showErrors in interface com.google.gwt.editor.client.HasEditorErrors<T>public ErrorHandler getErrorHandler()
HasErrorHandlergetErrorHandler in interface HasErrorHandlerpublic void setErrorHandler(ErrorHandler errorHandler)
HasErrorHandlersetErrorHandler in interface HasErrorHandlererrorHandler - the new error handlerpublic ErrorHandlerType getErrorHandlerType()
HasErrorHandlergetErrorHandlerType in interface HasErrorHandlerpublic void setErrorHandlerType(ErrorHandlerType errorHandlerType)
HasErrorHandlersetErrorHandlerType in interface HasErrorHandlererrorHandlerType - the new error handler typepublic void addValidator(Validator<T> validator)
HasValidatorsaddValidator in interface HasValidators<T>validator - the validatorpublic boolean isValidateOnBlur()
HasValidatorsisValidateOnBlur in interface HasValidators<T>public boolean removeValidator(Validator<T> validator)
HasValidatorsremoveValidator in interface HasValidators<T>validator - the validatorpublic void reset()
HasValidatorsreset in interface HasValidators<T>public void setValidateOnBlur(boolean validateOnBlur)
HasValidatorssetValidateOnBlur in interface HasValidators<T>validateOnBlur - the new validate on blurpublic void setValidators(Validator<T>... validators)
HasValidatorssetValidators in interface HasValidators<T>validators - the new validatorspublic boolean validate()
HasValidatorsvalidate in interface HasValidators<T>public boolean validate(boolean show)
HasValidatorsvalidate in interface HasValidators<T>show - the error to the user.public com.google.web.bindery.event.shared.HandlerRegistration addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
ValidationChangedEvent.HasValidationChangedHandlersaddValidationChangedHandler in interface ValidationChangedEvent.HasValidationChangedHandlershandler - the handlerpublic com.google.gwt.event.shared.HandlerRegistration addBlurHandler(com.google.gwt.event.dom.client.BlurHandler handler)
addBlurHandler in interface com.google.gwt.event.dom.client.HasBlurHandlersCopyright © 2016. All rights reserved.