T
- select value typepublic abstract class SelectBase<T> extends ComplexWidget implements HasValue<T>, HasEnabled, Focusable, HasType<ButtonType>, HasSize<ButtonSize>, IsEditor<LeafValueEditor<T>>, HasAllSelectHandlers<T>
http://silviomoreto.github.io/bootstrap-select/
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
Modifier and Type | Field and Description |
---|---|
protected AttributeMixin<SelectBase<T>> |
attrMixin |
protected Map<OptionElement,Option> |
itemMap |
protected SelectOptions |
options
Initialize options
|
protected SelectElement |
selectElement |
DEBUG_ID_PREFIX
CHANGED_EVENT, HIDDEN_EVENT, HIDE_EVENT, LOADED_EVENT, REFRESHED_EVENT, RENDERED_EVENT, SHOW_EVENT, SHOWN_EVENT
Modifier | Constructor and Description |
---|---|
protected |
SelectBase() |
Modifier and Type | Method and Description |
---|---|
void |
add(Widget child) |
HandlerRegistration |
addHiddenHandler(HiddenHandler handler)
Adds a
HiddenEvent handler. |
HandlerRegistration |
addHideHandler(HideHandler handler)
Adds a
HideEvent handler. |
HandlerRegistration |
addLoadedHandler(LoadedHandler handler)
Adds a
LoadedEvent handler. |
HandlerRegistration |
addRefreshedHandler(RefreshedHandler handler)
Adds a
RefreshedEvent handler. |
HandlerRegistration |
addRenderedHandler(RenderedHandler handler)
Adds a
RenderedEvent handler. |
HandlerRegistration |
addShowHandler(ShowHandler handler)
Adds a
ShowEvent handler. |
HandlerRegistration |
addShownHandler(ShownHandler handler)
Adds a
ShownEvent handler. |
HandlerRegistration |
addValueChangeHandler(ValueChangeHandler<T> handler) |
LeafValueEditor<T> |
asEditor() |
protected void |
command(Element e,
String command) |
Option |
getItem(int index)
Returns the
Option at the given index. |
int |
getItemCount()
Returns the number of items present in the select.
|
List<Option> |
getItems()
Returns the item list.
|
SelectLanguage |
getLanguage()
Returns the select language.
|
ButtonSize |
getSize()
Returns the
ButtonSize of the select; may be null . |
String |
getStyle()
Returns the style name applied to the select.
|
int |
getTabIndex() |
ButtonType |
getType()
Returns the
ButtonType of the select; may be null . |
void |
hide()
Hides the select.
|
void |
insert(Widget child,
int beforeIndex) |
boolean |
isEnabled() |
boolean |
isItemSelected(int index)
Returns
true if the item at the given index is selected.Note: if the item at the given index is a divider, this method always returns false . |
abstract boolean |
isMultiple()
Returns
true if multiple selection is allowed. |
boolean |
isVisible() |
void |
mobile()
Enables the device's native menu for select menus.
|
protected void |
onLoad() |
protected void |
onUnload() |
void |
refresh()
WHEN CHANGING ANY SETTINGS CALL REFRESH AFTER!!
|
boolean |
remove(Widget w) |
void |
render()
Force a re-render of the bootstrap-select UI.
|
void |
setAccessKey(char key) |
void |
setContainer(String container)
Sets a container to which the select will be appended.
|
void |
setCountSelectedTextHandler(CountSelectedTextHandler handler)
Sets the handler to get the text displayed when selectedTextFormat
is
count or count > # , or null
to use the default text: X of Y selected . |
void |
setDropdownAlignRight(DropdownAlignRight dropdownAlignRight)
|
void |
setDropupAuto(boolean dropupAuto)
Checks to see which has more room, above or below.
|
void |
setEnabled(boolean enabled) |
void |
setFixedMenuSize(int size)
The menu will show the given number of items, even if
the drop-down is cut off.
Defaults to MenuSize.AUTO . |
void |
setFocus(boolean focused) |
void |
setForceDropup(boolean forceDropup)
If drop-up auto is set to
false , force to make
the select a drop-up menu if set to true . |
void |
setHeader(String header)
Adds a header to the top of the menu; includes
a close button by default.
No header by default. |
void |
setHideDisabled(boolean hideDisabled)
Removes disabled options and optgroups from the menu
Defaults to false . |
void |
setLanguage(SelectLanguage language)
Set the select language.
|
void |
setLiveSearch(boolean liveSearch)
When set to
true , adds a search box to the
top of the select picker drop-down.Defaults to false . |
void |
setLiveSearchNormalize(boolean liveSearchNormalize)
Setting liveSearchNormalize to
true allows for
accent-insensitive searching.Defaults to false . |
void |
setLiveSearchPlaceholder(String liveSearchPlaceholder)
Set a placeholder to the live search input.
Defaults to null . |
void |
setLiveSearchStyle(LiveSearchStyle liveSearchStyle)
|
void |
setMenuSize(MenuSize size)
|
void |
setMobile(boolean mobile)
When set to
true , enables the device's native
menu for select menus.Defaults to false . |
void |
setPlaceholder(String placeholder)
Set the default placeholder text when nothing is selected.
|
protected abstract void |
setSelectedValue(T value)
Selects the given value.
|
void |
setSelectOnTab(boolean selectOnTab)
When set to
true , treats the tab character like the
enter or Space characters within the
select picker drop-down.Defaults to false . |
void |
setSelectWidth(SelectWidth width)
|
void |
setShowContent(boolean showContent)
When set to
true , display custom HTML associated with
selected option(s) in the button. |
void |
setShowIcon(boolean showIcon)
When set to
true , display icon(s) associated with
selected option(s) in the button.Defaults to true . |
void |
setShowMenuArrow(boolean showMenuArrow)
Set to
true to add the Bootstrap menu arrow. |
void |
setShowSubtext(boolean showSubtext)
When set to
true , display sub-text associated with a
selected option in the button.Defaults to false . |
void |
setSize(ButtonSize size)
Sets the
ButtonSize of the select.IMPORTANT: This method will override the style set by setStyle(String) . |
void |
setStyle(String styleName)
Set the customized style name to the select.
Defaults to null .IMPORTANT: This method will override the style set by setType(ButtonType) and/or setSize(ButtonSize) . |
void |
setTabIndex(int index) |
void |
setType(ButtonType type)
Sets the
ButtonType of the select.IMPORTANT: This method will override the style set by setStyle(String) . |
void |
setValue(T value) |
void |
setValue(T value,
boolean fireEvents) |
void |
setVisible(boolean visible) |
void |
setWidth(String cssWidth)
Set the select width witch is forced inline to the given value.
|
void |
setWindowPadding(int padding)
Sets the window padding to all sides.
|
void |
setWindowPaddingTopRightBottomLeft(int top,
int right,
int bottom,
int left)
Sets the window padding to top, right, bottom, and right sides.
|
void |
show()
Shows the select.
|
void |
toggle()
Toggles the select menu open/closed.
|
getId, getPull, insert, setColor, setHiddenOn, setId, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPull, setVisibleOn
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, remove
add, adopt, clear, 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, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
forEach, spliterator
protected final SelectElement selectElement
protected final Map<OptionElement,Option> itemMap
protected final AttributeMixin<SelectBase<T>> attrMixin
protected SelectOptions options
protected SelectBase()
public abstract boolean isMultiple()
true
if multiple selection is allowed.true
if multiple selection is allowedpublic void add(Widget child)
add
in interface HasWidgets
add
in class ComplexWidget
public boolean remove(Widget w)
remove
in interface HasWidgets
remove
in class ComplexWidget
public void setLanguage(SelectLanguage language)
language
- public SelectLanguage getLanguage()
public void setContainer(String container)
container
- specific element or selector, e.g., "body", ".my-container"public void setCountSelectedTextHandler(CountSelectedTextHandler handler)
count
or count > #
, or null
to use the default text: X of Y selected
.handler
- public void setDropdownAlignRight(DropdownAlignRight dropdownAlignRight)
dropdownAlignRight
- DropdownAlignRight
public void setDropupAuto(boolean dropupAuto)
false
, drop-ups
must be called manually.true
.dropupAuto
- public void setForceDropup(boolean forceDropup)
false
, force to make
the select a drop-up menu if set to true
.forceDropup
- setDropupAuto(boolean)
public void setHeader(String header)
header
- public void setHideDisabled(boolean hideDisabled)
false
.hideDisabled
- public void setLiveSearch(boolean liveSearch)
true
, adds a search box to the
top of the select picker drop-down.false
.liveSearch
- public void setLiveSearchNormalize(boolean liveSearchNormalize)
true
allows for
accent-insensitive searching.false
.liveSearchNormalize
- public void setLiveSearchStyle(LiveSearchStyle liveSearchStyle)
liveSearchStyle
- LiveSearchStyle
public void setLiveSearchPlaceholder(String liveSearchPlaceholder)
null
.liveSearchPlaceholder
- public void setMobile(boolean mobile)
true
, enables the device's native
menu for select menus.false
.mobile
- public void setSelectOnTab(boolean selectOnTab)
true
, treats the tab character like the
enter
or Space
characters within the
select picker drop-down.false
.selectOnTab
- public void setShowContent(boolean showContent)
true
, display custom HTML associated with
selected option(s) in the button. When set to false
,
the option value will be displayed instead.true
.showContent
- public void setShowIcon(boolean showIcon)
true
, display icon(s) associated with
selected option(s) in the button.true
.showIcon
- public void setShowSubtext(boolean showSubtext)
true
, display sub-text associated with a
selected option in the button.false
.showSubtext
- public void setMenuSize(MenuSize size)
size
- MenuSize
public void setFixedMenuSize(int size)
MenuSize.AUTO
.size
- public void setType(ButtonType type)
ButtonType
of the select.setStyle(String)
.setType
in interface HasType<ButtonType>
public ButtonType getType()
ButtonType
of the select; may be null
.getType
in interface HasType<ButtonType>
ButtonType
of the selectpublic void setSize(ButtonSize size)
ButtonSize
of the select.setStyle(String)
.setSize
in interface HasSize<ButtonSize>
public ButtonSize getSize()
ButtonSize
of the select; may be null
.getSize
in interface HasSize<ButtonSize>
ButtonSize
of the selectpublic void setStyle(String styleName)
null
.setType(ButtonType)
and/or setSize(ButtonSize)
.styleName
- public void setPlaceholder(String placeholder)
null
.title
- UIObject.setTitle(String)
public void setSelectWidth(SelectWidth width)
width
- setWidth(String)
,
SelectWidth
public void setWidth(String cssWidth)
public void setWindowPadding(int padding)
padding
- public void setWindowPaddingTopRightBottomLeft(int top, int right, int bottom, int left)
top
- right
- bottom
- left
- public void setShowMenuArrow(boolean showMenuArrow)
true
to add the Bootstrap menu arrow.showMenuArrow
- public LeafValueEditor<T> asEditor()
asEditor
in interface IsEditor<LeafValueEditor<T>>
protected abstract void setSelectedValue(T value)
null
or does not match any option, no option will be selected.value
- public void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
public boolean isEnabled()
isEnabled
in interface HasEnabled
public int getTabIndex()
getTabIndex
in interface Focusable
public void setAccessKey(char key)
setAccessKey
in interface Focusable
public void setTabIndex(int index)
setTabIndex
in interface Focusable
public int getItemCount()
public boolean isItemSelected(int index)
true
if the item at the given index is selected.false
.index
- public Option getItem(int index)
Option
at the given index.index
- public HandlerRegistration addValueChangeHandler(ValueChangeHandler<T> handler)
addValueChangeHandler
in interface HasValueChangeHandlers<T>
public HandlerRegistration addLoadedHandler(LoadedHandler handler)
HasLoadedHandlers
LoadedEvent
handler.addLoadedHandler
in interface HasLoadedHandlers
handler
- the handlerpublic HandlerRegistration addShowHandler(ShowHandler handler)
HasShowHandlers
ShowEvent
handler.addShowHandler
in interface HasShowHandlers
handler
- the handlerpublic HandlerRegistration addShownHandler(ShownHandler handler)
HasShownHandlers
ShownEvent
handler.addShownHandler
in interface HasShownHandlers
handler
- the handlerpublic HandlerRegistration addHideHandler(HideHandler handler)
HasHideHandlers
HideEvent
handler.addHideHandler
in interface HasHideHandlers
handler
- the handlerpublic HandlerRegistration addHiddenHandler(HiddenHandler handler)
HasHiddenHandlers
HiddenEvent
handler.addHiddenHandler
in interface HasHiddenHandlers
handler
- the handlerpublic HandlerRegistration addRenderedHandler(RenderedHandler handler)
HasRenderedHandlers
RenderedEvent
handler.addRenderedHandler
in interface HasRenderedHandlers
handler
- the handlerpublic HandlerRegistration addRefreshedHandler(RefreshedHandler handler)
HasRefreshedHandlers
RefreshedEvent
handler.addRefreshedHandler
in interface HasRefreshedHandlers
handler
- the handlerpublic void render()
public void toggle()
public void mobile()
public void refresh()
public void show()
public void hide()
public void setVisible(boolean visible)
setVisible
in interface HasVisibility
setVisible
in class UIObject
public boolean isVisible()
isVisible
in interface HasVisibility
isVisible
in class UIObject
Copyright © 2017. All rights reserved.