public class VComboBox extends com.google.gwt.user.client.ui.Composite implements Field, com.google.gwt.event.dom.client.KeyDownHandler, com.google.gwt.event.dom.client.KeyUpHandler, com.google.gwt.event.dom.client.ClickHandler, com.google.gwt.event.dom.client.FocusHandler, com.google.gwt.event.dom.client.BlurHandler, Focusable, SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, HandlesAriaRequired, DeferredWorker, com.google.gwt.event.dom.client.MouseDownHandler
| Modifier and Type | Class and Description |
|---|---|
class |
VComboBox.ComboBoxSuggestion
Represents a suggestion in the suggestion popup box.
|
class |
VComboBox.DataReceivedHandler
Handler receiving notifications from the connector and updating the
widget state accordingly.
|
class |
VComboBox.FilterSelectTextBox
TextBox variant used as input element for filter selects, which prevents
selecting text when disabled.
|
class |
VComboBox.SuggestionMenu
The menu where the suggestions are rendered.
|
class |
VComboBox.SuggestionPopup
Represents the popup box with the selection options.
|
| Modifier and Type | Field and Description |
|---|---|
boolean |
allowNewItems
For internal use only.
|
static String |
CLASSNAME |
ComboBoxConnector |
connector
For internal use only.
|
int |
currentPage
For internal use only.
|
VComboBox.ComboBoxSuggestion |
currentSuggestion
The current suggestion selected from the dropdown.
|
List<VComboBox.ComboBoxSuggestion> |
currentSuggestions
A collection of available suggestions (options) as received from the
server.
|
boolean |
enabled
For internal use only.
|
boolean |
focused
For internal use only.
|
boolean |
initDone
For internal use only.
|
String |
inputPrompt
For internal use only.
|
String |
lastFilter
For internal use only.
|
String |
lastNewItemString
Stores the last new item string to avoid double submissions.
|
boolean |
nullSelectionAllowed
For internal use only.
|
boolean |
nullSelectItem
For internal use only.
|
int |
pageLength
For internal use only.
|
boolean |
readonly
For internal use only.
|
String |
selectedOptionKey
For internal use only.
|
String |
serverSelectedKey
For internal use only.
|
VComboBox.SuggestionPopup |
suggestionPopup
For internal use only.
|
int |
suggestionPopupMinWidth
For internal use only.
|
String |
suggestionPopupWidth |
com.google.gwt.user.client.ui.TextBox |
tb
The text box where the filter is written
|
| Constructor and Description |
|---|
VComboBox()
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindAriaCaption(com.google.gwt.user.client.Element captionElement)
Called to bind the provided caption (label in HTML speak) element to the
main input element of the Widget.
|
protected VComboBox.SuggestionPopup |
createSuggestionPopup()
This method will create the SuggestionPopup used by the VComboBox
instance.
|
protected com.google.gwt.user.client.ui.TextBox |
createTextBox()
This method will create the TextBox used by the VComboBox instance.
|
void |
filterOptions(int page)
Filters the options at a certain page.
|
void |
filterOptions(int page,
String filter)
Filters the options at certain page using the given filter.
|
void |
focus()
Sets focus to this widget.
|
VComboBox.DataReceivedHandler |
getDataReceivedHandler()
Returns a handler receiving notifications from the connector about
communications.
|
String |
getEmptySelectionCaption()
Gets the empty selection caption.
|
boolean |
getNullSelectionItemShouldBeVisible()
Returns null selection item should be visible or not.
|
String |
getSelectedCaption()
This method is meant for internal use and may change in future versions.
|
com.google.gwt.user.client.Element |
getSubPartElement(String subPart)
Locates an element inside a component using the identifier provided in
subPart. |
String |
getSubPartName(com.google.gwt.user.client.Element subElement)
Provides an identifier that identifies the element within the component.
|
int |
getTotalSuggestions()
Gets the total number of suggestions, excluding the null selection item.
|
boolean |
hasNextPage()
Does the Select have more pages?
|
boolean |
isWorkPending()
Checks whether there are operations pending for this widget or connector
that must be executed before reaching a steady state.
|
int |
minWidth(String captions)
Calculate minimum width for FilterSelect textarea.
|
void |
onBlur(com.google.gwt.event.dom.client.BlurEvent event) |
void |
onBrowserEvent(com.google.gwt.user.client.Event event) |
void |
onClick(com.google.gwt.event.dom.client.ClickEvent event)
Listener for popupopener.
|
protected void |
onDetach() |
void |
onFocus(com.google.gwt.event.dom.client.FocusEvent event) |
void |
onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event) |
void |
onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)
Triggered when a key was depressed.
|
void |
onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event) |
void |
onNullSelected()
Triggered when an empty value is selected and null selection is allowed.
|
void |
onSuggestionSelected(VComboBox.ComboBoxSuggestion suggestion)
Triggered when a suggestion is selected.
|
void |
setAllowNewItems(boolean allowNewItems)
Sets whether creation of new items when there is no match is allowed or
not.
|
void |
setAriaInvalid(boolean invalid)
Called to set the element, typically an input element, as invalid.
|
void |
setAriaRequired(boolean required)
Called to set the element, typically an input element, as required.
|
void |
setEmptySelectionCaption(String emptySelectionCaption)
Sets the empty selection caption for this VComboBox.
|
void |
setPageLength(int pageLength)
Sets the number of items to show per page, or 0 for showing all items.
|
void |
setPlaceholder(String placeholder)
Set or reset the placeholder attribute for the text field.
|
void |
setSelectedCaption(String selectedCaption)
Sets the caption of selected item, if "scroll to page" is disabled.
|
void |
setSelectedItemIcon(String iconUri)
Sets the icon URI of the selected item.
|
void |
setStyleName(String style) |
void |
setStylePrimaryName(String style) |
void |
setSuggestionPopupWidth(String suggestionPopupWidth)
Sets the suggestion pop-up's width as a CSS string.
|
void |
setText(String text)
Sets the text in the text box.
|
void |
setTextInputAllowed(boolean textInputAllowed) |
void |
setTotalSuggestions(int totalSuggestions)
Sets the total number of suggestions.
|
void |
setWidth(String width) |
void |
updatePlaceholder()
Update placeholder visibility (hidden when read-only or disabled).
|
void |
updateReadOnly()
For internal use only.
|
void |
updateRootWidth()
Calculates the width of the select if the select has undefined width.
|
protected void |
updateStyleNames() |
void |
updateSuggestionPopupMinWidth()
Update minimum width for combo box textarea based on input prompt and
suggestions.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, render, render, resolvePotentialElement, setWidgetaddAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, 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, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toStringpublic static final String CLASSNAME
public int pageLength
public final com.google.gwt.user.client.ui.TextBox tb
For internal use only. May be removed or replaced in the future.
public final VComboBox.SuggestionPopup suggestionPopup
public ComboBoxConnector connector
public int currentPage
public final List<VComboBox.ComboBoxSuggestion> currentSuggestions
For internal use only. May be removed or replaced in the future.
public String serverSelectedKey
public String selectedOptionKey
public boolean initDone
public String lastFilter
public VComboBox.ComboBoxSuggestion currentSuggestion
For internal use only. May be removed or replaced in the future.
public boolean allowNewItems
public boolean nullSelectionAllowed
public boolean nullSelectItem
public boolean enabled
public boolean readonly
public String inputPrompt
public int suggestionPopupMinWidth
public String suggestionPopupWidth
public String lastNewItemString
For internal use only. May be removed or replaced in the future.
public boolean focused
public void onBrowserEvent(com.google.gwt.user.client.Event event)
onBrowserEvent in interface com.google.gwt.user.client.EventListeneronBrowserEvent in class com.google.gwt.user.client.ui.Compositeprotected com.google.gwt.user.client.ui.TextBox createTextBox()
protected VComboBox.SuggestionPopup createSuggestionPopup()
public void setStyleName(String style)
setStyleName in class com.google.gwt.user.client.ui.UIObjectpublic void setStylePrimaryName(String style)
setStylePrimaryName in class com.google.gwt.user.client.ui.UIObjectprotected void updateStyleNames()
public boolean hasNextPage()
public void filterOptions(int page)
page - The page which items are to be filteredpublic void filterOptions(int page,
String filter)
page - The page to filterfilter - The filter to apply to the componentspublic void updateReadOnly()
public void setTextInputAllowed(boolean textInputAllowed)
public void setText(String text)
text - the text to set in the text boxpublic void setPlaceholder(String placeholder)
placeholder - new placeholder string or null for nonepublic void updatePlaceholder()
public void onSuggestionSelected(VComboBox.ComboBoxSuggestion suggestion)
suggestion - The suggestion that just got selected.public void onNullSelected()
public void setSelectedItemIcon(String iconUri)
iconUri - The URI of the icon, or null to remove iconpublic void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)
onKeyDown in interface com.google.gwt.event.dom.client.KeyDownHandlerpublic void onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)
onKeyUp in interface com.google.gwt.event.dom.client.KeyUpHandlerevent - The KeyUpEvent of the key depressedpublic void onClick(com.google.gwt.event.dom.client.ClickEvent event)
onClick in interface com.google.gwt.event.dom.client.ClickHandlerpublic void updateSuggestionPopupMinWidth()
For internal use only. May be removed or replaced in the future.
public int minWidth(String captions)
For internal use only. May be removed or replaced in the future.
captions - pipe separated string listing all the captions to measurepublic void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
onFocus in interface com.google.gwt.event.dom.client.FocusHandlerpublic void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
onBlur in interface com.google.gwt.event.dom.client.BlurHandlerpublic void focus()
Focusablepublic void updateRootWidth()
For internal use only. May be removed or replaced in the future.
public void setWidth(String width)
setWidth in class com.google.gwt.user.client.ui.UIObjectpublic void onMouseDown(com.google.gwt.event.dom.client.MouseDownEvent event)
onMouseDown in interface com.google.gwt.event.dom.client.MouseDownHandlerprotected void onDetach()
onDetach in class com.google.gwt.user.client.ui.Compositepublic com.google.gwt.user.client.Element getSubPartElement(String subPart)
SubPartAwaresubPart. The subPart identifier is component specific and
may be any string of characters, numbers, space characters and brackets.getSubPartElement in interface SubPartAwaresubPart - The identifier for the element inside the componentpublic String getSubPartName(com.google.gwt.user.client.Element subElement)
SubPartAwaresubElement is a part of the component and must never be null.
Note!
getSubPartElement(getSubPartName(element)) == element is not
always true. A component can choose to provide a more generic
identifier for any given element if the results of all interactions with
subElement are the same as interactions with the element
identified by the return value. For example a button can return an
identifier for the root element even though a DIV inside the button was
passed as subElement because interactions with the DIV and the
root button element produce the same result.
getSubPartName in interface SubPartAwaresubElement - The element the identifier string should uniquely identifysubElement or null
if no identifier could be provided.public void setAriaRequired(boolean required)
HandlesAriaRequiredsetAriaRequired in interface HandlesAriaRequiredrequired - boolean true when the element needs to be set as requiredpublic void setAriaInvalid(boolean invalid)
HandlesAriaInvalidsetAriaInvalid in interface HandlesAriaInvalidinvalid - boolean, true when the element should be marked invalid, false
otherwisepublic void bindAriaCaption(com.google.gwt.user.client.Element captionElement)
HandlesAriaCaptionbindAriaCaption in interface HandlesAriaCaptioncaptionElement - Element of the captionpublic boolean isWorkPending()
DeferredWorkerisWorkPending in interface DeferredWorkerpublic void setSelectedCaption(String selectedCaption)
selectedCaption - the caption of selected itempublic String getSelectedCaption()
public VComboBox.DataReceivedHandler getDataReceivedHandler()
public void setPageLength(int pageLength)
pageLength - new page length or 0 for all itemspublic void setSuggestionPopupWidth(String suggestionPopupWidth)
suggestionPopupWidth - new popup width as CSS string, null for old default width
calculation based on itemspublic void setAllowNewItems(boolean allowNewItems)
allowNewItems - true to allow creation of new items, false to only allow
selection of existing itemspublic void setTotalSuggestions(int totalSuggestions)
NOTE: this excluded the possible null selection item!
NOTE: this just updates the state, but doesn't update any UI.
totalSuggestions - total number of suggestionspublic int getTotalSuggestions()
public boolean getNullSelectionItemShouldBeVisible()
NOTE: this checks for any entered filter value, and whether the feature is enabled
true if it should be visible, public String getEmptySelectionCaption()
public void setEmptySelectionCaption(String emptySelectionCaption)
emptySelectionCaption - the empty selection captionCopyright © 2018 Vaadin Ltd. All rights reserved.