Class SuggestBoxNewEditor
- java.lang.Object
-
- com.google.gwt.user.client.ui.UIObject
-
- com.google.gwt.user.client.ui.Widget
-
- com.google.gwt.user.client.ui.Composite
-
- com.google.gwt.user.client.ui.AbstractSuggestBoxNewEditor
-
- de.knightsoftnet.mtwidgets.client.ui.widget.SuggestBoxNewEditor
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasAllKeyHandlers,com.google.gwt.event.dom.client.HasKeyDownHandlers,com.google.gwt.event.dom.client.HasKeyPressHandlers,com.google.gwt.event.dom.client.HasKeyUpHandlers,com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.logical.shared.HasSelectionHandlers<com.google.gwt.user.client.ui.SuggestOracle.Suggestion>,com.google.gwt.event.logical.shared.HasValueChangeHandlers<String>,com.google.gwt.event.shared.HasHandlers,com.google.gwt.user.client.EventListener,com.google.gwt.user.client.TakesValue<String>,com.google.gwt.user.client.ui.Focusable,com.google.gwt.user.client.ui.HasAnimation,com.google.gwt.user.client.ui.HasEnabled,com.google.gwt.user.client.ui.HasText,com.google.gwt.user.client.ui.HasValue<String>,com.google.gwt.user.client.ui.HasVisibility,com.google.gwt.user.client.ui.IsRenderable,com.google.gwt.user.client.ui.IsWidget,org.gwtproject.editor.client.IsEditor<org.gwtproject.editor.client.LeafValueEditor<String>>,org.gwtproject.editor.client.TakesValue<String>
- Direct Known Subclasses:
SuggestBoxWithEditorErrors
public class SuggestBoxNewEditor extends AbstractSuggestBoxNewEditor implements org.gwtproject.editor.client.IsEditor<org.gwtproject.editor.client.LeafValueEditor<String>>, org.gwtproject.editor.client.TakesValue<String>
ASuggestBoxNewEditoris a text box or text area which displays a pre-configured set of selections that match the user's input.Each
SuggestBoxNewEditoris associated with a singleSuggestOracle. TheSuggestOracleis used to provide a set of selections given a specific query string.By default, the
SuggestBoxNewEditoruses aMultiWordSuggestOracleas its oracle. Below we show how aMultiWordSuggestOraclecan be configured:MultiWordSuggestOracle oracle = new MultiWordSuggestOracle(); oracle.add("Cat"); oracle.add("Dog"); oracle.add("Horse"); oracle.add("Canary"); SuggestBoxNewEditor box = new SuggestBoxNewEditor(oracle);Using the example above, if the user types "C" into the text widget, the oracle will configure the suggestions with the "Cat" and "Canary" suggestions. Specifically, whenever the user types a key into the text widget, the value is submitted to the
MultiWordSuggestOracle.Note that there is no method to retrieve the "currently selected suggestion" in a SuggestBoxNewEditor, because there are points in time where the currently selected suggestion is not defined. For example, if the user types in some text that does not match any of the SuggestBoxNewEditor's suggestions, then the SuggestBoxNewEditor will not have a currently selected suggestion. It is more useful to know when a suggestion has been chosen from the SuggestBoxNewEditor's list of suggestions. A SuggestBoxNewEditor fires
SelectionEventswhenever a suggestion is chosen, and handlers for these events can be added using theAbstractSuggestBoxNewEditor.addSelectionHandler(SelectionHandler)method.
CSS Style Rules
- .gwt-SuggestBox
- the suggest box itself
- See Also:
SuggestOracle,MultiWordSuggestOracle,ValueBoxBaseWithEditorErrors
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.AbstractSuggestBoxNewEditor
AbstractSuggestBoxNewEditor.DefaultSuggestionDisplay, AbstractSuggestBoxNewEditor.SuggestionCallback, AbstractSuggestBoxNewEditor.SuggestionDisplay
-
-
Field Summary
-
Fields inherited from class com.google.gwt.user.client.ui.AbstractSuggestBoxNewEditor
callback, currentText, display, limit, oracle, selectsFirstItem, STYLENAME_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description SuggestBoxNewEditor()Constructor forSuggestBoxNewEditor.SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle)Constructor forSuggestBoxNewEditor.SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle, ValueBoxBaseWithEditorErrors<String> box)Constructor forSuggestBoxNewEditor.SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle, ValueBoxBaseWithEditorErrors<String> box, AbstractSuggestBoxNewEditor.SuggestionDisplay suggestDisplay)Constructor forSuggestBoxNewEditor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddEventsToTextBox(com.google.gwt.event.shared.EventHandler events)org.gwtproject.editor.client.LeafValueEditor<String>asEditor()Returns aTakesValueEditorbacked by the SuggestBoxNewEditor.protected com.google.gwt.user.client.ui.FocusWidgetgetBoxAsFoucsWidget()intgetTabIndex()StringgetText()StringgetValue()ValueBoxBaseWithEditorErrors<String>getValueBox()Get the ValueBoxBaseWithEditorErrors associated with this suggest box.booleanisEnabled()Gets whether this widget is enabled.voidsetAccessKey(char key)voidsetEnabled(boolean enabled)Sets whether this widget is enabled.voidsetFocus(boolean focused)voidsetTabIndex(int index)voidsetText(String text)voidsetValue(String newValue)voidsetValue(String value, boolean fireEvents)static SuggestBoxNewEditorwrap(com.google.gwt.user.client.ui.SuggestOracle oracle, com.google.gwt.dom.client.Element element)Creates aSuggestBoxNewEditorwidget that wraps an existing <input type='text'> element.-
Methods inherited from class com.google.gwt.user.client.ui.AbstractSuggestBoxNewEditor
addEventsToTextBox, addKeyDownHandler, addKeyPressHandler, addKeyUpHandler, addSelectionHandler, addValueChangeHandler, getLimit, getSuggestionDisplay, getSuggestOracle, hideSuggestionList, isAnimationEnabled, isAutoSelectEnabled, isSuggestionListShowing, onEnsureDebugId, refreshSuggestionList, setAnimationEnabled, setAutoSelectEnabled, setLimit, setOracle, setPopupStyleName, showSuggestionList
-
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
-
-
-
-
Constructor Detail
-
SuggestBoxNewEditor
public SuggestBoxNewEditor()
Constructor forSuggestBoxNewEditor. Creates aMultiWordSuggestOracleandTextBoxto use with thisSuggestBoxNewEditor.
-
SuggestBoxNewEditor
public SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle)
- Parameters:
oracle- the oracle for thisSuggestBoxNewEditor
-
SuggestBoxNewEditor
public SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle, ValueBoxBaseWithEditorErrors<String> box)Constructor forSuggestBoxNewEditor. The text box will be removed from it's current location and wrapped by theSuggestBoxNewEditor.- Parameters:
oracle- supplies suggestions based upon the current contents of the text widgetbox- the text widget
-
SuggestBoxNewEditor
public SuggestBoxNewEditor(com.google.gwt.user.client.ui.SuggestOracle oracle, ValueBoxBaseWithEditorErrors<String> box, AbstractSuggestBoxNewEditor.SuggestionDisplay suggestDisplay)Constructor forSuggestBoxNewEditor. The text box will be removed from it's current location and wrapped by theSuggestBoxNewEditor.- Parameters:
oracle- supplies suggestions based upon the current contents of the text widgetbox- the text widgetsuggestDisplay- the class used to display suggestions
-
-
Method Detail
-
wrap
public static SuggestBoxNewEditor wrap(com.google.gwt.user.client.ui.SuggestOracle oracle, com.google.gwt.dom.client.Element element)
Creates aSuggestBoxNewEditorwidget that wraps an existing <input type='text'> element.This element must already be attached to the document. If the element is removed from the document, you must call
RootPanel.detachNow(Widget).- Parameters:
oracle- the suggest box oracle to useelement- the element to be wrapped
-
getBoxAsFoucsWidget
protected com.google.gwt.user.client.ui.FocusWidget getBoxAsFoucsWidget()
- Specified by:
getBoxAsFoucsWidgetin classAbstractSuggestBoxNewEditor
-
asEditor
public org.gwtproject.editor.client.LeafValueEditor<String> asEditor()
Returns aTakesValueEditorbacked by the SuggestBoxNewEditor.- Specified by:
asEditorin interfaceorg.gwtproject.editor.client.IsEditor<org.gwtproject.editor.client.LeafValueEditor<String>>
-
getTabIndex
public int getTabIndex()
- Specified by:
getTabIndexin interfacecom.google.gwt.user.client.ui.Focusable- Specified by:
getTabIndexin classAbstractSuggestBoxNewEditor
-
getText
public String getText()
- Specified by:
getTextin interfacecom.google.gwt.user.client.ui.HasText- Specified by:
getTextin classAbstractSuggestBoxNewEditor
-
getValue
public String getValue()
- Specified by:
getValuein interfacecom.google.gwt.user.client.ui.HasValue<String>- Specified by:
getValuein interfacecom.google.gwt.user.client.TakesValue<String>- Specified by:
getValuein interfaceorg.gwtproject.editor.client.TakesValue<String>- Specified by:
getValuein classAbstractSuggestBoxNewEditor
-
getValueBox
@Ignore public ValueBoxBaseWithEditorErrors<String> getValueBox()
Get the ValueBoxBaseWithEditorErrors associated with this suggest box.- Returns:
- this suggest box's value box
-
isEnabled
public boolean isEnabled()
Gets whether this widget is enabled.- Specified by:
isEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled- Returns:
trueif the widget is enabled
-
setAccessKey
public void setAccessKey(char key)
- Specified by:
setAccessKeyin interfacecom.google.gwt.user.client.ui.Focusable- Specified by:
setAccessKeyin classAbstractSuggestBoxNewEditor
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether this widget is enabled.- Specified by:
setEnabledin interfacecom.google.gwt.user.client.ui.HasEnabled- Overrides:
setEnabledin classAbstractSuggestBoxNewEditor- Parameters:
enabled-trueto enable the widget,falseto disable it
-
setFocus
public void setFocus(boolean focused)
- Specified by:
setFocusin interfacecom.google.gwt.user.client.ui.Focusable- Specified by:
setFocusin classAbstractSuggestBoxNewEditor
-
setTabIndex
public void setTabIndex(int index)
- Specified by:
setTabIndexin interfacecom.google.gwt.user.client.ui.Focusable
-
setText
public void setText(String text)
- Specified by:
setTextin interfacecom.google.gwt.user.client.ui.HasText
-
setValue
public void setValue(String newValue)
-
setValue
public void setValue(String value, boolean fireEvents)
- Specified by:
setValuein interfacecom.google.gwt.user.client.ui.HasValue<String>
-
addEventsToTextBox
protected void addEventsToTextBox(com.google.gwt.event.shared.EventHandler events)
- Specified by:
addEventsToTextBoxin classAbstractSuggestBoxNewEditor
-
-