public class MaterialListValueBox<T> extends AbstractValueWidget<T> implements JsLoader, HasPlaceholder, com.google.gwt.user.client.ui.HasConstrainedValue<T>, HasReadOnly
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.Feature
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
com.google.gwt.editor.client.Editor.Ignore, com.google.gwt.editor.client.Editor.Path
Modifier and Type | Field and Description |
---|---|
protected List<T> |
values |
$this
Constructor and Description |
---|
MaterialListValueBox() |
Modifier and Type | Method and Description |
---|---|
void |
add(T value) |
void |
addItem(T value)
Adds an item to the list box.
|
void |
addItem(T value,
boolean reload)
Adds an item to the list box.
|
void |
addItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir)
Adds an item to the list box, specifying its direction.
|
void |
addItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
boolean reload)
Adds an item to the list box, specifying its direction.
|
void |
addItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String text)
Adds an item to the list box, specifying its direction and an initial
value for the item.
|
void |
addItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String text,
boolean reload)
Adds an item to the list box, specifying its direction and an initial
value for the item.
|
void |
addItem(T value,
String text)
Adds an item to the list box, specifying an initial value for the item.
|
void |
addItem(T value,
String text,
boolean reload)
Adds an item to the list box, specifying an initial value for the item.
|
void |
clear()
Removes all items from the list box.
|
String |
getEmptyPlaceHolder() |
MaterialLabel |
getErrorLabel() |
ErrorMixin<AbstractValueWidget,MaterialLabel> |
getErrorMixin() |
int |
getIndex(T value)
Gets the index of the specified value.
|
protected int |
getIndexOffset() |
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.
|
Label |
getLabel() |
com.google.gwt.user.client.ui.ListBox |
getListBox() |
String |
getName() |
com.google.gwt.dom.client.OptionElement |
getOptionElement(int index) |
String |
getPlaceholder() |
ReadOnlyMixin<MaterialListValueBox<T>,com.google.gwt.user.client.ui.ListBox> |
getReadOnlyMixin() |
int |
getSelectedIndex()
Gets the currently-selected item.
|
protected int |
getSelectedIndexInternal() |
String |
getSelectedItemText()
Gets the text for currently selected item.
|
T |
getSelectedValue()
Gets the value for currently selected item.
|
protected com.google.gwt.dom.client.SelectElement |
getSelectElement() |
protected ToggleStyleMixin<com.google.gwt.user.client.ui.ListBox> |
getToggleOldMixin() |
T |
getValue() |
T |
getValue(int index)
Gets the value associated with the item at a given index.
|
protected T |
getValueInternal(int index) |
int |
getVisibleItemCount()
Gets the number of items that are visible.
|
protected void |
insertEmptyPlaceHolder(String emptyPlaceHolder) |
void |
insertItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
int index)
Inserts an item into the list box, specifying its direction.
|
void |
insertItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
int index,
boolean reload)
Inserts an item into the list box, specifying its direction.
|
void |
insertItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String text,
int index)
Inserts an item into the list box, specifying its direction and an
initial value for the item.
|
void |
insertItem(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String text,
int index,
boolean reload)
Inserts an item into the list box, specifying its direction and an
initial value for the item.
|
void |
insertItem(T value,
int index)
Inserts an item into the list box.
|
void |
insertItem(T value,
int index,
boolean reload)
Inserts an item into the list box.
|
void |
insertItem(T value,
String text,
int index)
Inserts an item into the list box, specifying an initial value for the
item.
|
void |
insertItem(T value,
String text,
int index,
boolean reload)
Inserts an item into the list box, specifying an initial value for the
item.
|
protected void |
insertItemInternal(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
int index,
boolean reload) |
protected void |
insertItemInternal(T value,
com.google.gwt.i18n.client.HasDirection.Direction dir,
String text,
int index,
boolean reload) |
protected void |
insertItemInternal(T value,
int index,
boolean reload) |
protected void |
insertItemInternal(T value,
String text,
int index,
boolean reload) |
protected boolean |
isEmptyPlaceHolderListed()
|
boolean |
isEnabled() |
boolean |
isItemSelected(int index)
Determines whether an individual list item is selected.
|
boolean |
isMultipleSelect()
Gets whether this list allows multiple selection.
|
boolean |
isOld() |
boolean |
isReadOnly() |
boolean |
isToggleReadOnly() |
void |
load() |
protected void |
onLoad() |
protected void |
onUnload() |
void |
reload() |
protected void |
removeEmptyPlaceHolder() |
void |
removeItem(int index)
Removes the item at the specified index.
|
void |
removeItem(int index,
boolean reload)
Removes the item at the specified index.
|
protected void |
removeItemInternal(int index,
boolean reload) |
void |
removeValue(T value)
Removes a value from the list box.
|
void |
removeValue(T value,
boolean reload)
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 |
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 |
setKeyFactory(KeyFactory<T,String> keyFactory)
Use your own key factory for value keys.
|
void |
setMultipleSelect(boolean multipleSelect)
Sets whether this list allows multiple selections.
|
void |
setName(String name) |
void |
setOld(boolean old) |
void |
setPlaceholder(String placeholder) |
void |
setReadOnly(boolean value) |
void |
setSelectedIndex(int index)
Sets the currently selected index.
|
protected void |
setSelectedIndexInternal(int index) |
void |
setSelectedValue(T value)
Sets the currently selected value.
|
void |
setTitle(String title) |
void |
setToggleReadOnly(boolean toggle) |
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(T value,
boolean selected)
Sets whether an individual list value is selected.
|
void |
setVisibleItemCount(int visibleItems)
Sets the number of items that are visible.
|
void |
unload() |
addValidationChangedHandler, addValidator, addValueChangeHandler, clearErrorOrSuccess, createBlankValidator, getErrorHandler, getErrorHandlerMixin, getErrorHandlerType, getValidatorMixin, isAllowBlank, isValidateOnBlur, removeValidator, setAllowBlank, setError, setErrorHandler, setErrorHandlerType, setHelperText, setSuccess, setupBlurValidation, setValidateOnBlur, setValidators, setValue, showErrors, validate, validate
$this, add, add, addAttachHandler, addBlurHandler, addClickHandler, addDoubleClickHandler, addDragEndHandler, addDragEnterHandler, addDragLeaveHandler, addDragMoveHandler, addDragOverHandler, addDragStartHandler, addDropActivateHandler, addDropDeactivateHandler, addDropHandler, addFocusHandler, addGestureChangeHandler, addGestureEndHandler, addGestureStartHandler, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addMouseDownHandler, addMouseMoveHandler, addMouseOutHandler, addMouseOverHandler, addMouseUpHandler, addMouseWheelHandler, addOrientationChangeHandler, addTouchCancelHandler, addTouchEndHandler, addTouchMoveHandler, addTouchStartHandler, body, clearActiveClass, enableFeature, getBackfaceVisibility, getBackgroundColor, getBorder, getBorderBottom, getBorderLeft, getBorderMixin, getBorderRadius, getBorderRight, getBorderTop, getCenterOn, getCenterOnMixin, getChildren, getChildrenList, getCircleMixin, getColorsMixin, getDataAttribute, getDepth, getDimensionMixin, getEnabledMixin, getFlexboxMixin, getFloat, getFloatMixin, getFocusableMixin, getFontSize, getFontSizeMixin, getFontWeight, getFontWeightMixin, getGridMixin, getHandlerRegistry, getHideOn, getHideOnMixin, getHoverableMixin, getId, getIdMixin, getInitialClasses, getLayoutPosition, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpacity, getOrientation, getOrientationMixin, getPerspective, getPerspectiveOrigin, getScrollspy, getScrollspyMixin, getSeparatorMixin, getShadow, getShadowMixin, getShowOn, getShowOnMixin, getTabIndex, getTextAlign, getTextAlignMixin, getTextColor, getTooltip, getTooltipDelayMs, getTooltipHTML, getTooltipMixin, getTooltipPosition, getTransform, getTransformMixin, getTransformOrigin, getTransformStyle, getTruncateMixin, getVerticalAlign, getVerticalAlignMixin, getWaves, getWavesMixin, getWidth, insert, insert, isCircle, isDetectOrientation, isFeatureEnabled, isHoverable, isSeparator, isTruncate, registerHandler, removeHandler, setAccessKey, setBackfaceVisibility, setBackgroundColor, setBorder, setBorderBottom, setBorderLeft, setBorderRadius, setBorderRight, setBorderTop, setBottom, setCenterOn, setCircle, setClass, setDataAttribute, setDepth, setDetectOrientation, 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, setLineHeight, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setOffset, setOpacity, setOrientation, setOverflow, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPerspective, setPerspectiveOrigin, setRight, setScrollspy, setSeparator, setShadow, setShowOn, setStyle, setTabIndex, setTextAlign, setTextColor, setTooltip, setTooltipDelayMs, setTooltipHTML, setTooltipPosition, setTop, setTransform, setTransformOrigin, setTransformStyle, setTransition, setTruncate, setVerticalAlign, setVisibility, setWaves, stopTouchStartEvent, window
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, remove, remove
add, adopt, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, 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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addValueChangeHandler
setVisible
forEach, spliterator
public MaterialListValueBox()
protected void onLoad()
onLoad
in class MaterialWidget
protected void onUnload()
onUnload
in class MaterialWidget
public void addItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir)
addItem(value, dir, item)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
dir
- the item's directionpublic void addItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, boolean reload)
addItem(value, dir, item)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
dir
- the item's directionreload
- perform a 'material select' reload to update the DOM.public void addItem(T value)
addItem(value, item)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
public void addItem(T value, boolean reload)
addItem(value, item)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
reload
- perform a 'material select' reload to update the DOM.public void addItem(T value, String text)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
text
- the text of the item to be addedpublic void addItem(T value, String text, boolean reload)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
text
- the text of the item to be addedreload
- perform a 'material select' reload to update the DOM.public void addItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, String text)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
dir
- the item's directiontext
- the text of the item to be addedpublic void addItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, String text, boolean reload)
value
- the item's value, to be submitted if it is part of a
FormPanel
; cannot be null
dir
- the item's directiontext
- the text of the item to be addedreload
- perform a 'material select' reload to update the DOM.public void insertItem(T value, int index)
insertItem(value, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.index
- the index at which to insert itpublic void insertItem(T value, int index, boolean reload)
insertItem(value, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.index
- the index at which to insert itreload
- perform a 'material select' reload to update the DOM.protected void insertItemInternal(T value, int index, boolean reload)
public void insertItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, int index)
insertItem(value, dir, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.dir
- the item's directionindex
- the index at which to insert itpublic void insertItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, int index, boolean reload)
insertItem(value, dir, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.dir
- the item's directionindex
- the index at which to insert itreload
- perform a 'material select' reload to update the DOM.protected void insertItemInternal(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, int index, boolean reload)
public void insertItem(T value, String text, int index)
insertItem(value, null, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.text
- the text of the item to be insertedindex
- the index at which to insert itpublic void insertItem(T value, String text, int index, boolean reload)
insertItem(value, null, item, index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.text
- the text of the item to be insertedindex
- the index at which to insert itreload
- perform a 'material select' reload to update the DOM.protected void insertItemInternal(T value, String text, int index, boolean reload)
public void insertItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, String text, int index)
value
- the item's value, to be submitted if it is part of a
FormPanel
.dir
- 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.text
- the text of the item to be insertedindex
- the index at which to insert itpublic void insertItem(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, String text, int index, boolean reload)
value
- the item's value, to be submitted if it is part of a
FormPanel
.dir
- 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.text
- the text of the item to be insertedindex
- the index at which to insert itreload
- perform a 'material select' reload to update the DOM.protected void insertItemInternal(T value, com.google.gwt.i18n.client.HasDirection.Direction dir, String text, int index, boolean reload)
public void removeItem(int index)
index
- the index of the item to be removedIndexOutOfBoundsException
- if the index is out of rangepublic void removeItem(int index, boolean reload)
index
- the index of the item to be removedreload
- perform a 'material select' reload to update the DOM.IndexOutOfBoundsException
- if the index is out of rangeprotected void removeItemInternal(int index, boolean reload)
public void removeValue(T value)
value
- the value to be removed from the listpublic void removeValue(T value, boolean reload)
value
- the value to be removed from the listreload
- perform a 'material select' reload to update the DOM.public void reset()
HasValidators
reset
in interface HasValidators<T>
reset
in class AbstractValueWidget<T>
public void clear()
clear
in interface com.google.gwt.user.client.ui.HasWidgets
clear
in class com.google.gwt.user.client.ui.Panel
public void setPlaceholder(String placeholder)
setPlaceholder
in interface HasPlaceholder
public String getPlaceholder()
getPlaceholder
in interface HasPlaceholder
public com.google.gwt.dom.client.OptionElement getOptionElement(int index)
protected com.google.gwt.dom.client.SelectElement getSelectElement()
public void setMultipleSelect(boolean multipleSelect)
multipleSelect
- true
to allow multiple selectionspublic boolean isMultipleSelect()
true
if multiple selection is allowedpublic void setEmptyPlaceHolder(String value)
public String getEmptyPlaceHolder()
public void setAcceptableValues(Collection<T> values)
setAcceptableValues
in interface com.google.gwt.user.client.ui.HasConstrainedValue<T>
public void setValue(T value)
setValue
in interface com.google.gwt.user.client.TakesValue<T>
setValue
in interface com.google.gwt.user.client.ui.HasValue<T>
setValue
in class AbstractValueWidget<T>
public void setValue(T value, boolean fireEvents)
setValue
in interface com.google.gwt.user.client.ui.HasValue<T>
setValue
in class AbstractValueWidget<T>
public boolean isOld()
public void setOld(boolean old)
public void setValue(int index, String value)
FormPanel
.index
- the index of the item to be setvalue
- the item's new value; cannot be null
IndexOutOfBoundsException
- if the index is out of rangepublic void setTitle(String title)
setTitle
in class com.google.gwt.user.client.ui.UIObject
public 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)
After calling this method, only the specified item in the list will
remain selected. For a ListBox with multiple selection enabled, see
setItemSelected(int, boolean)
to select multiple items at a
time.
index
- the index of the item to be selectedprotected void setSelectedIndexInternal(int index)
public 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 selectedprotected int getSelectedIndexInternal()
public T getValue(int index)
index
- the index of the item to be retrievedIndexOutOfBoundsException
- if the index is out of rangeprotected T getValueInternal(int index)
public T 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 setEnabled(boolean enabled)
setEnabled
in interface com.google.gwt.user.client.ui.HasEnabled
setEnabled
in class MaterialWidget
public boolean isEnabled()
isEnabled
in interface com.google.gwt.user.client.ui.HasEnabled
isEnabled
in class MaterialWidget
public void setKeyFactory(KeyFactory<T,String> keyFactory)
public void setReadOnly(boolean value)
setReadOnly
in interface HasReadOnly
public boolean isReadOnly()
isReadOnly
in interface HasReadOnly
public void setToggleReadOnly(boolean toggle)
setToggleReadOnly
in interface HasReadOnly
public boolean isToggleReadOnly()
isToggleReadOnly
in interface HasReadOnly
public com.google.gwt.user.client.ui.ListBox getListBox()
public ErrorMixin<AbstractValueWidget,MaterialLabel> getErrorMixin()
getErrorMixin
in class AbstractValueWidget<T>
public MaterialLabel getErrorLabel()
public String[] getItemsSelected()
public void setSelectedValue(T value)
After calling this method, only the specified item in the list will
remain selected. For a ListBox with multiple selection enabled, see
#setValueSelected(T, boolean)
to select multiple items at a
time.
value
- the value of the item to be selectedpublic void setValueSelected(T value, boolean selected)
value
- the value of the item to be selected or unselectedselected
- true
to select the itempublic int getIndex(T value)
value
- the value of the item to be foundpublic ReadOnlyMixin<MaterialListValueBox<T>,com.google.gwt.user.client.ui.ListBox> getReadOnlyMixin()
protected ToggleStyleMixin<com.google.gwt.user.client.ui.ListBox> getToggleOldMixin()
protected boolean isEmptyPlaceHolderListed()
emptyPlaceHolder
added/present in both listBox
and values
?protected void insertEmptyPlaceHolder(String emptyPlaceHolder)
protected void removeEmptyPlaceHolder()
protected int getIndexOffset()
emptyPlaceHolder
)Copyright © 2018. All rights reserved.