public class SuggestBox extends SuggestBox implements HasId, HasResponsiveness, HasPlaceholder, HasAutoComplete, HasSize<InputSize>, HasEditorErrors<String>, HasErrorHandler, HasValidators<String>, HasBlankValidator<String>
SuggestBox
.Styles.DROPDOWN_MENU
. Styling of the suggestions items need
a bit of css in order to be pleasing to the eye.
.dropdown-menu .item {
padding: 5px;
}
.dropdown-menu .item-selected {
background-color: #eee;
}
SuggestBox.DefaultSuggestionDisplay, SuggestBox.SuggestionCallback, SuggestBox.SuggestionDisplay
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
Editor.Ignore, Editor.Path
DEBUG_ID_PREFIX
PLACEHOLDER
AUTO_COMPLETE, OFF, ON
Constructor and Description |
---|
SuggestBox()
Constructor for
SuggestBox . |
SuggestBox(SuggestOracle oracle)
Constructor for
SuggestBox . |
SuggestBox(SuggestOracle oracle,
ValueBoxBase<String> box)
Constructor for
SuggestBox . |
SuggestBox(SuggestOracle oracle,
ValueBoxBase<String> box,
SuggestBox.SuggestionDisplay suggestDisplay)
Constructor for
SuggestBox . |
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
Adds a validation changed handler.
|
void |
addValidator(Validator<String> validator)
Adds the validator.
|
boolean |
getAllowBlank() |
String |
getAutoComplete()
Get the auto complete attribute from the widget
|
ErrorHandler |
getErrorHandler()
Gets the error handler.
|
ErrorHandlerType |
getErrorHandlerType()
Gets the error handler type.
|
String |
getId()
Gets the ID of the widget
|
String |
getPlaceholder() |
InputSize |
getSize()
Get the size of the widget
|
boolean |
getValidateOnBlur()
Gets the validate on blur.
|
boolean |
isEnabled() |
protected void |
onAttach() |
boolean |
removeValidator(Validator<String> validator)
Removes the validator.
|
void |
reset()
Reset the form element to blank and clear error messages.
|
void |
setAllowBlank(boolean allowBlank) |
void |
setAutoComplete(boolean autoComplete)
Sets the auto complete property on the widget
|
void |
setEnabled(boolean enabled) |
void |
setErrorHandler(ErrorHandler handler)
Sets the error handler.
|
void |
setErrorHandlerType(ErrorHandlerType type)
Sets the error handler type.
|
void |
setHiddenOn(DeviceSize deviceSize)
Sets the devices that the element is hidden on
|
void |
setId(String id)
Sets the ID on the widget
|
void |
setPlaceholder(String placeHolder) |
void |
setSize(InputSize size)
Set the size of the widget
|
void |
setValidateOnBlur(boolean validateOnBlur)
Sets the validate on blur.
|
void |
setValidators(Validator<String>... validators)
The validators used to validate this object.
|
void |
setVisibleOn(DeviceSize deviceSize)
Sets the devices that the element is visible on
|
void |
showErrors(List<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.
|
addChangeListener, addClickListener, addEventHandler, addFocusListener, addKeyboardListener, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addSelectionHandler, addValueChangeHandler, asEditor, getLimit, getSuggestionDisplay, getSuggestOracle, getTabIndex, getText, getTextBox, getValue, getValueBox, hideSuggestionList, isAnimationEnabled, isAutoSelectEnabled, isSuggestionListShowing, onEnsureDebugId, refreshSuggestionList, removeChangeListener, removeClickListener, removeEventHandler, removeFocusListener, removeKeyboardListener, setAccessKey, setAnimationEnabled, setAutoSelectEnabled, setFocus, setLimit, setPopupStyleName, setTabIndex, setText, setValue, setValue, showSuggestionList, wrap
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public SuggestBox()
SuggestBox
. Creates a MultiWordSuggestOracle
and TextBox
to use
with this SuggestBox
.public SuggestBox(SuggestOracle oracle)
oracle
- the oracle for this SuggestBox
public SuggestBox(SuggestOracle oracle, ValueBoxBase<String> box)
SuggestBox
. The text box will be removed from it's current location and wrapped
by the SuggestBox
.oracle
- supplies suggestions based upon the current contents of the text widgetbox
- the text widgetpublic SuggestBox(SuggestOracle oracle, ValueBoxBase<String> box, SuggestBox.SuggestionDisplay suggestDisplay)
SuggestBox
. The text box will be removed from it's current location and wrapped
by the SuggestBox
.oracle
- supplies suggestions based upon the current contents of the text widgetbox
- the text widgetsuggestDisplay
- the class used to display suggestionspublic HandlerRegistration addValidationChangedHandler(ValidationChangedEvent.ValidationChangedHandler handler)
addValidationChangedHandler
in interface ValidationChangedEvent.HasValidationChangedHandlers
handler
- the handlerpublic void addValidator(Validator<String> validator)
addValidator
in interface HasValidators<String>
validator
- the validatorpublic boolean getAllowBlank()
getAllowBlank
in interface HasBlankValidator<String>
public String getAutoComplete()
getAutoComplete
in interface HasAutoComplete
public ErrorHandler getErrorHandler()
getErrorHandler
in interface HasErrorHandler
public ErrorHandlerType getErrorHandlerType()
getErrorHandlerType
in interface HasErrorHandler
public String getPlaceholder()
getPlaceholder
in interface HasPlaceholder
public boolean getValidateOnBlur()
HasValidators
getValidateOnBlur
in interface HasValidators<String>
public boolean isEnabled()
isEnabled
in interface HasEnabled
isEnabled
in class SuggestBox
public boolean removeValidator(Validator<String> validator)
removeValidator
in interface HasValidators<String>
validator
- the validatorpublic void reset()
HasValidators
reset
in interface HasValidators<String>
public void setAllowBlank(boolean allowBlank)
setAllowBlank
in interface HasBlankValidator<String>
allowBlank
- the new allow blankpublic void setAutoComplete(boolean autoComplete)
setAutoComplete
in interface HasAutoComplete
autoComplete
- auto complete setting for the widgetpublic void setEnabled(boolean enabled)
setEnabled
in interface HasEnabled
setEnabled
in class SuggestBox
public void setErrorHandler(ErrorHandler handler)
setErrorHandler
in interface HasErrorHandler
handler
- the new error handlerpublic void setErrorHandlerType(ErrorHandlerType type)
setErrorHandlerType
in interface HasErrorHandler
type
- the new error handler typepublic void setHiddenOn(DeviceSize deviceSize)
setHiddenOn
in interface HasResponsiveness
deviceSize
- device sizesDeviceSize
public void setPlaceholder(String placeHolder)
setPlaceholder
in interface HasPlaceholder
public void setValidateOnBlur(boolean validateOnBlur)
HasValidators
setValidateOnBlur
in interface HasValidators<String>
validateOnBlur
- the new validate on blurpublic void setValidators(Validator<String>... validators)
HasValidators
setValidators
in interface HasValidators<String>
validators
- the new validatorspublic void setVisibleOn(DeviceSize deviceSize)
setVisibleOn
in interface HasResponsiveness
deviceSize
- device sizeDeviceSize
public void showErrors(List<EditorError> errors)
showErrors
in interface HasEditorErrors<String>
public boolean validate()
validate
in interface HasValidators<String>
public boolean validate(boolean show)
validate
in interface HasValidators<String>
show
- the error to the user.Copyright © 2017. All rights reserved.