org.gwtbootstrap3.client.ui
Class SuggestBox

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by com.google.gwt.user.client.ui.SuggestBox
                  extended by org.gwtbootstrap3.client.ui.SuggestBox
All Implemented Interfaces:
Editor<String>, HasEditorErrors<String>, IsEditor<LeafValueEditor<String>>, HasAllKeyHandlers, HasKeyDownHandlers, HasKeyPressHandlers, HasKeyUpHandlers, HasAttachHandlers, HasSelectionHandlers<SuggestOracle.Suggestion>, HasValueChangeHandlers<String>, HasHandlers, EventListener, TakesValue<String>, FiresSuggestionEvents, Focusable, HasAnimation, HasEnabled, HasFocus, HasText, HasValue<String>, HasVisibility, IsRenderable, IsWidget, SourcesChangeEvents, SourcesClickEvents, SourcesFocusEvents, SourcesKeyboardEvents, HasAutoComplete, HasId, HasPlaceholder, HasResponsiveness, HasSize<InputSize>, HasErrorHandler, HasBlankValidator<String>, HasValidators<String>

public class SuggestBox
extends SuggestBox
implements HasId, HasResponsiveness, HasPlaceholder, HasAutoComplete, HasSize<InputSize>, HasEditorErrors<String>, HasErrorHandler, HasValidators<String>, HasBlankValidator<String>

Wrapper for a SuggestBox.

The default style is inherited from the 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;
  }
 

Author:
Steven Jardine

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.SuggestBox
SuggestBox.DefaultSuggestionDisplay, SuggestBox.SuggestionCallback, SuggestBox.SuggestionDisplay
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.editor.client.Editor
Editor.Ignore, Editor.Path
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Fields inherited from interface org.gwtbootstrap3.client.ui.base.HasPlaceholder
PLACEHOLDER
 
Fields inherited from interface org.gwtbootstrap3.client.ui.base.HasAutoComplete
AUTO_COMPLETE, OFF, ON
 
Constructor Summary
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.
 
Method Summary
 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()
          
 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.
 
Methods inherited from class com.google.gwt.user.client.ui.SuggestBox
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
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
 

Constructor Detail

SuggestBox

public SuggestBox()
Constructor for SuggestBox. Creates a MultiWordSuggestOracle and TextBox to use with this SuggestBox.


SuggestBox

public SuggestBox(SuggestOracle oracle)
Constructor for SuggestBox. Creates a TextBox to use with this SuggestBox.

Parameters:
oracle - the oracle for this SuggestBox

SuggestBox

public SuggestBox(SuggestOracle oracle,
                  ValueBoxBase<String> box)
Constructor for SuggestBox. The text box will be removed from it's current location and wrapped by the SuggestBox.

Parameters:
oracle - supplies suggestions based upon the current contents of the text widget
box - the text widget

SuggestBox

public SuggestBox(SuggestOracle oracle,
                  ValueBoxBase<String> box,
                  SuggestBox.SuggestionDisplay suggestDisplay)
Constructor for SuggestBox. The text box will be removed from it's current location and wrapped by the SuggestBox.

Parameters:
oracle - supplies suggestions based upon the current contents of the text widget
box - the text widget
suggestDisplay - the class used to display suggestions
Method Detail

addValidator

public void addValidator(Validator<String> validator)
Description copied from interface: HasValidators
Adds the validator.

Specified by:
addValidator in interface HasValidators<String>
Parameters:
validator - the validator

getAllowBlank

public boolean getAllowBlank()
Specified by:
getAllowBlank in interface HasBlankValidator<String>
Returns:
the allow blank

getAutoComplete

public String getAutoComplete()
Get the auto complete attribute from the widget

Specified by:
getAutoComplete in interface HasAutoComplete
Returns:
auto complete attribute

getErrorHandler

public ErrorHandler getErrorHandler()
Gets the error handler.

Specified by:
getErrorHandler in interface HasErrorHandler
Returns:
the error handler

getErrorHandlerType

public ErrorHandlerType getErrorHandlerType()
Gets the error handler type.

Specified by:
getErrorHandlerType in interface HasErrorHandler
Returns:
the error handler type

getId

public String getId()
Gets the ID of the widget

Specified by:
getId in interface HasId
Returns:
String widget ID

getPlaceholder

public String getPlaceholder()

Specified by:
getPlaceholder in interface HasPlaceholder

getSize

public InputSize getSize()
Get the size of the widget

Specified by:
getSize in interface HasSize<InputSize>
Returns:
T size of the widget

getValidateOnBlur

public boolean getValidateOnBlur()
Description copied from interface: HasValidators
Gets the validate on blur.

Specified by:
getValidateOnBlur in interface HasValidators<String>
Returns:
the validate on blur

isEnabled

public boolean isEnabled()

Specified by:
isEnabled in interface HasEnabled
Overrides:
isEnabled in class SuggestBox

reset

public void reset()
Description copied from interface: HasValidators
Reset the form element to blank and clear error messages.

Specified by:
reset in interface HasValidators<String>

setAllowBlank

public void setAllowBlank(boolean allowBlank)
Specified by:
setAllowBlank in interface HasBlankValidator<String>
Parameters:
allowBlank - the new allow blank

setAutoComplete

public void setAutoComplete(boolean autoComplete)
Sets the auto complete property on the widget

Specified by:
setAutoComplete in interface HasAutoComplete
Parameters:
autoComplete - auto complete setting for the widget

setEnabled

public void setEnabled(boolean enabled)

Specified by:
setEnabled in interface HasEnabled
Overrides:
setEnabled in class SuggestBox

setErrorHandler

public void setErrorHandler(ErrorHandler handler)
Sets the error handler.

Specified by:
setErrorHandler in interface HasErrorHandler
Parameters:
handler - the new error handler

setErrorHandlerType

public void setErrorHandlerType(ErrorHandlerType type)
Sets the error handler type.

Specified by:
setErrorHandlerType in interface HasErrorHandler
Parameters:
type - the new error handler type

setHiddenOn

public void setHiddenOn(DeviceSize deviceSize)
Sets the devices that the element is hidden on

Specified by:
setHiddenOn in interface HasResponsiveness
Parameters:
deviceSize - device sizes
See Also:
DeviceSize

setId

public void setId(String id)
Sets the ID on the widget

Specified by:
setId in interface HasId
Parameters:
id - String desired ID

setPlaceholder

public void setPlaceholder(String placeHolder)

Specified by:
setPlaceholder in interface HasPlaceholder

setSize

public void setSize(InputSize size)
Set the size of the widget

Specified by:
setSize in interface HasSize<InputSize>
Parameters:
size - T size of the widget

setValidateOnBlur

public void setValidateOnBlur(boolean validateOnBlur)
Description copied from interface: HasValidators
Sets the validate on blur.

Specified by:
setValidateOnBlur in interface HasValidators<String>
Parameters:
validateOnBlur - the new validate on blur

setValidators

public void setValidators(Validator<String>... validators)
Description copied from interface: HasValidators
The validators used to validate this object.

Specified by:
setValidators in interface HasValidators<String>
Parameters:
validators - the new validators

setVisibleOn

public void setVisibleOn(DeviceSize deviceSize)
Sets the devices that the element is visible on

Specified by:
setVisibleOn in interface HasResponsiveness
Parameters:
deviceSize - device size
See Also:
DeviceSize

showErrors

public void showErrors(List<EditorError> errors)

Specified by:
showErrors in interface HasEditorErrors<String>

validate

public boolean validate()
Description copied from interface: HasValidators
Validate the field's value using the supplied validators.

Specified by:
validate in interface HasValidators<String>
Returns:
true, if valid

validate

public boolean validate(boolean show)
Description copied from interface: HasValidators
Validate the field's value using the supplied validators.

Specified by:
validate in interface HasValidators<String>
Parameters:
show - the error to the user.
Returns:
true, if valid


Copyright © 2015. All rights reserved.