Class VFilterSelect
- 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.vaadin.client.ui.VFilterSelect
-
- All Implemented Interfaces:
com.google.gwt.event.dom.client.BlurHandler,com.google.gwt.event.dom.client.ClickHandler,com.google.gwt.event.dom.client.FocusHandler,com.google.gwt.event.dom.client.KeyDownHandler,com.google.gwt.event.dom.client.KeyUpHandler,com.google.gwt.event.logical.shared.HasAttachHandlers,com.google.gwt.event.shared.EventHandler,com.google.gwt.event.shared.HasHandlers,com.google.gwt.user.client.EventListener,com.google.gwt.user.client.ui.HasVisibility,com.google.gwt.user.client.ui.IsRenderable,com.google.gwt.user.client.ui.IsWidget,DeferredWorker,Focusable,HandlesAriaCaption,HandlesAriaInvalid,HandlesAriaRequired,Field,SubPartAware
public class VFilterSelect 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
Client side implementation of the Select component. TODO needs major refactoring (to be extensible etc)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classVFilterSelect.FilterSelectSuggestionRepresents a suggestion in the suggestion popup boxclassVFilterSelect.FilterSelectTextBoxTextBox variant used as input element for filter selects, which prevents selecting text when disabled.static classVFilterSelect.SelectFor internal use only.classVFilterSelect.SuggestionMenuThe menu where the suggestions are renderedclassVFilterSelect.SuggestionPopupRepresents the popup box with the selection options.
-
Field Summary
Fields Modifier and Type Field Description booleanallowNewItemFor internal use only.static StringCLASSNAMEApplicationConnectionclientFor internal use only.intcurrentPageFor internal use only.VFilterSelect.FilterSelectSuggestioncurrentSuggestionThe current suggestion selected from the dropdown.List<VFilterSelect.FilterSelectSuggestion>currentSuggestionsA collection of available suggestions (options) as received from the server.booleanenabledFor internal use only.FilteringModefilteringmodeFor internal use only.static FilteringModeFILTERINGMODE_CONTAINSDeprecated.static FilteringModeFILTERINGMODE_OFFDeprecated.static FilteringModeFILTERINGMODE_STARTSWITHDeprecated.booleanfocusedFor internal use only.booleanimmediateFor internal use only.booleaninitDoneFor internal use only.StringinputPromptFor internal use only.StringlastFilterFor internal use only.StringlastNewItemStringStores the last new item string to avoid double submissions.booleannullSelectionAllowedFor internal use only.booleannullSelectItemFor internal use only.intpageLengthFor internal use only.StringpaintableIdFor internal use only.booleanpopupOpenerClickedSet true when popupopened has been clicked.booleanpromptingFor internal use only.booleanreadonlyFor internal use only.StringselectedOptionKeyFor internal use only.VFilterSelect.SelectselectPopupItemWhenResponseIsReceivedFor internal use only.VFilterSelect.SuggestionPopupsuggestionPopupFor internal use only.intsuggestionPopupMinWidthFor internal use only.booleansuggestionPopupRelativeSizeStringsuggestionPopupWidthcom.google.gwt.user.client.ui.TextBoxtbThe text box where the filter is writteninttotalMatchesFor internal use only.booleanupdateSelectionWhenReponseIsReceivedFor internal use only.booleanwaitingForFilteringResponseFor internal use only.
-
Constructor Summary
Constructors Constructor Description VFilterSelect()Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbindAriaCaption(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 VFilterSelect.SuggestionPopupcreateSuggestionPopup()This method will create the SuggestionPopup used by the VFilterSelect instance.protected com.google.gwt.user.client.ui.TextBoxcreateTextBox()This method will create the TextBox used by the VFilterSelect instance.voidfilterOptions(int page)Filters the options at a certain page.voidfilterOptions(int page, String filter)Filters the options at certain page using the given filtervoidfocus()Sets focus to this widget.StringgetSelectedCaption()This method is meant for internal use and may change in future versions.com.google.gwt.user.client.ElementgetSubPartElement(String subPart)Locates an element inside a component using the identifier provided insubPart.StringgetSubPartName(com.google.gwt.user.client.Element subElement)Provides an identifier that identifies the element within the component.booleanhasNextPage()Does the Select have more pages?booleanisWorkPending()Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.intminWidth(String captions)Calculate minimum width for FilterSelect textarea.voidonBlur(com.google.gwt.event.dom.client.BlurEvent event)voidonBrowserEvent(com.google.gwt.user.client.Event event)voidonClick(com.google.gwt.event.dom.client.ClickEvent event)Listener for popupopenerprotected voidonDetach()voidonFocus(com.google.gwt.event.dom.client.FocusEvent event)voidonKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)voidonKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)Triggered when a key was depressedvoidonSuggestionSelected(VFilterSelect.FilterSelectSuggestion suggestion)Triggered when a suggestion is selectedvoidsetAriaInvalid(boolean invalid)Called to set the element, typically an input element, as invalid.voidsetAriaRequired(boolean required)Called to set the element, typically an input element, as required.voidsetPromptingOff(String text)Turns prompting off.voidsetPromptingOn()Turns prompting on.voidsetSelectedCaption(String selectedCaption)Sets the caption of selected item, if "scroll to page" is disabled.voidsetSelectedItemIcon(String iconUri)Sets the icon URI of the selected item.voidsetStyleName(String style)voidsetStylePrimaryName(String style)voidsetTextboxText(String text)Sets the text in the text box.voidsetTextInputEnabled(boolean textInputEnabled)voidsetWidth(String width)voidupdateReadOnly()For internal use only.voidupdateRootWidth()Calculates the width of the select if the select has undefined width.protected voidupdateStyleNames()voidupdateSuggestionPopupMinWidth()Update minimum width for FilterSelect textarea based on input prompt and suggestions.-
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, 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, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
-
-
-
-
Field Detail
-
FILTERINGMODE_OFF
@Deprecated public static final FilteringMode FILTERINGMODE_OFF
Deprecated.
-
FILTERINGMODE_STARTSWITH
@Deprecated public static final FilteringMode FILTERINGMODE_STARTSWITH
Deprecated.
-
FILTERINGMODE_CONTAINS
@Deprecated public static final FilteringMode FILTERINGMODE_CONTAINS
Deprecated.
-
CLASSNAME
public static final String CLASSNAME
- See Also:
- Constant Field Values
-
pageLength
public int pageLength
For internal use only. May be removed or replaced in the future.
-
tb
public final com.google.gwt.user.client.ui.TextBox tb
The text box where the filter is writtenFor internal use only. May be removed or replaced in the future.
-
suggestionPopup
public final VFilterSelect.SuggestionPopup suggestionPopup
For internal use only. May be removed or replaced in the future.
-
client
public ApplicationConnection client
For internal use only. May be removed or replaced in the future.
-
paintableId
public String paintableId
For internal use only. May be removed or replaced in the future.
-
currentPage
public int currentPage
For internal use only. May be removed or replaced in the future.
-
currentSuggestions
public final List<VFilterSelect.FilterSelectSuggestion> currentSuggestions
A collection of available suggestions (options) as received from the server.For internal use only. May be removed or replaced in the future.
-
immediate
public boolean immediate
For internal use only. May be removed or replaced in the future.
-
selectedOptionKey
public String selectedOptionKey
For internal use only. May be removed or replaced in the future.
-
waitingForFilteringResponse
public boolean waitingForFilteringResponse
For internal use only. May be removed or replaced in the future.
-
updateSelectionWhenReponseIsReceived
public boolean updateSelectionWhenReponseIsReceived
For internal use only. May be removed or replaced in the future.
-
initDone
public boolean initDone
For internal use only. May be removed or replaced in the future.
-
lastFilter
public String lastFilter
For internal use only. May be removed or replaced in the future.
-
selectPopupItemWhenResponseIsReceived
public VFilterSelect.Select selectPopupItemWhenResponseIsReceived
For internal use only. May be removed or replaced in the future.
-
currentSuggestion
public VFilterSelect.FilterSelectSuggestion currentSuggestion
The current suggestion selected from the dropdown. This is one of the values in currentSuggestions except when filtering, in this case currentSuggestion might not be in currentSuggestions.For internal use only. May be removed or replaced in the future.
-
allowNewItem
public boolean allowNewItem
For internal use only. May be removed or replaced in the future.
-
totalMatches
public int totalMatches
For internal use only. May be removed or replaced in the future.
-
nullSelectionAllowed
public boolean nullSelectionAllowed
For internal use only. May be removed or replaced in the future.
-
nullSelectItem
public boolean nullSelectItem
For internal use only. May be removed or replaced in the future.
-
enabled
public boolean enabled
For internal use only. May be removed or replaced in the future.
-
readonly
public boolean readonly
For internal use only. May be removed or replaced in the future.
-
filteringmode
public FilteringMode filteringmode
For internal use only. May be removed or replaced in the future.
-
inputPrompt
public String inputPrompt
For internal use only. May be removed or replaced in the future.
-
prompting
public boolean prompting
For internal use only. May be removed or replaced in the future.
-
popupOpenerClicked
public boolean popupOpenerClicked
Set true when popupopened has been clicked. Cleared on each UIDL-update. This handles the special case where are not filtering yet and the selected value has changed on the server-side. See #2119For internal use only. May be removed or replaced in the future.
-
suggestionPopupMinWidth
public int suggestionPopupMinWidth
For internal use only. May be removed or replaced in the future.
-
suggestionPopupWidth
public String suggestionPopupWidth
-
suggestionPopupRelativeSize
public boolean suggestionPopupRelativeSize
-
lastNewItemString
public String lastNewItemString
Stores the last new item string to avoid double submissions. Cleared on uidl updates.For internal use only. May be removed or replaced in the future.
-
focused
public boolean focused
For internal use only. May be removed or replaced in the future.
-
-
Method Detail
-
onBrowserEvent
public void onBrowserEvent(com.google.gwt.user.client.Event event)
- Specified by:
onBrowserEventin interfacecom.google.gwt.user.client.EventListener- Overrides:
onBrowserEventin classcom.google.gwt.user.client.ui.Composite
-
createTextBox
protected com.google.gwt.user.client.ui.TextBox createTextBox()
This method will create the TextBox used by the VFilterSelect instance. It is invoked during the Constructor and should only be overridden if a custom TextBox shall be used. The overriding method cannot use any instance variables.- Returns:
- TextBox instance used by this VFilterSelect
- Since:
- 7.1.5
-
createSuggestionPopup
protected VFilterSelect.SuggestionPopup createSuggestionPopup()
This method will create the SuggestionPopup used by the VFilterSelect instance. It is invoked during the Constructor and should only be overridden if a custom SuggestionPopup shall be used. The overriding method cannot use any instance variables.- Returns:
- SuggestionPopup instance used by this VFilterSelect
- Since:
- 7.1.5
-
setStyleName
public void setStyleName(String style)
- Overrides:
setStyleNamein classcom.google.gwt.user.client.ui.UIObject
-
setStylePrimaryName
public void setStylePrimaryName(String style)
- Overrides:
setStylePrimaryNamein classcom.google.gwt.user.client.ui.UIObject
-
updateStyleNames
protected void updateStyleNames()
-
hasNextPage
public boolean hasNextPage()
Does the Select have more pages?- Returns:
- true if a next page exists, else false if the current page is the last page
-
filterOptions
public void filterOptions(int page)
Filters the options at a certain page. Uses the text box input as a filter- Parameters:
page- The page which items are to be filtered
-
filterOptions
public void filterOptions(int page, String filter)Filters the options at certain page using the given filter- Parameters:
page- The page to filterfilter- The filter to apply to the components
-
updateReadOnly
public void updateReadOnly()
For internal use only. May be removed or replaced in the future.
-
setTextInputEnabled
public void setTextInputEnabled(boolean textInputEnabled)
-
setTextboxText
public void setTextboxText(String text)
Sets the text in the text box.- Parameters:
text- the text to set in the text box
-
setPromptingOn
public void setPromptingOn()
Turns prompting on. When prompting is turned on a command prompt is shown in the text box if nothing has been entered.
-
setPromptingOff
public void setPromptingOff(String text)
Turns prompting off. When prompting is turned on a command prompt is shown in the text box if nothing has been entered.For internal use only. May be removed or replaced in the future.
- Parameters:
text- The text the text box should contain.
-
onSuggestionSelected
public void onSuggestionSelected(VFilterSelect.FilterSelectSuggestion suggestion)
Triggered when a suggestion is selected- Parameters:
suggestion- The suggestion that just got selected.
-
setSelectedItemIcon
public void setSelectedItemIcon(String iconUri)
Sets the icon URI of the selected item. The icon is shown on the left side of the item caption text. Set the URI to null to remove the icon.- Parameters:
iconUri- The URI of the icon
-
onKeyDown
public void onKeyDown(com.google.gwt.event.dom.client.KeyDownEvent event)
- Specified by:
onKeyDownin interfacecom.google.gwt.event.dom.client.KeyDownHandler
-
onKeyUp
public void onKeyUp(com.google.gwt.event.dom.client.KeyUpEvent event)
Triggered when a key was depressed- Specified by:
onKeyUpin interfacecom.google.gwt.event.dom.client.KeyUpHandler- Parameters:
event- The KeyUpEvent of the key depressed
-
onClick
public void onClick(com.google.gwt.event.dom.client.ClickEvent event)
Listener for popupopener- Specified by:
onClickin interfacecom.google.gwt.event.dom.client.ClickHandler
-
updateSuggestionPopupMinWidth
public void updateSuggestionPopupMinWidth()
Update minimum width for FilterSelect textarea based on input prompt and suggestions.For internal use only. May be removed or replaced in the future.
-
minWidth
public int minWidth(String captions)
Calculate minimum width for FilterSelect textarea.For internal use only. May be removed or replaced in the future.
-
onFocus
public void onFocus(com.google.gwt.event.dom.client.FocusEvent event)
- Specified by:
onFocusin interfacecom.google.gwt.event.dom.client.FocusHandler
-
onBlur
public void onBlur(com.google.gwt.event.dom.client.BlurEvent event)
- Specified by:
onBlurin interfacecom.google.gwt.event.dom.client.BlurHandler
-
focus
public void focus()
Description copied from interface:FocusableSets focus to this widget.
-
updateRootWidth
public void updateRootWidth()
Calculates the width of the select if the select has undefined width. Should be called when the width changes or when the icon changes.For internal use only. May be removed or replaced in the future.
-
setWidth
public void setWidth(String width)
- Overrides:
setWidthin classcom.google.gwt.user.client.ui.UIObject
-
onDetach
protected void onDetach()
- Overrides:
onDetachin classcom.google.gwt.user.client.ui.Composite
-
getSubPartElement
public com.google.gwt.user.client.Element getSubPartElement(String subPart)
Description copied from interface:SubPartAwareLocates an element inside a component using the identifier provided insubPart. ThesubPartidentifier is component specific and may be any string of characters, numbers, space characters and brackets.- Specified by:
getSubPartElementin interfaceSubPartAware- Parameters:
subPart- The identifier for the element inside the component- Returns:
- The element identified by subPart or null if the element could not be found.
-
getSubPartName
public String getSubPartName(com.google.gwt.user.client.Element subElement)
Description copied from interface:SubPartAwareProvides an identifier that identifies the element within the component. ThesubElementis a part of the component and must never be null.Note!
getSubPartElement(getSubPartName(element)) == elementis not always true. A component can choose to provide a more generic identifier for any given element if the results of all interactions withsubElementare 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 assubElementbecause interactions with the DIV and the root button element produce the same result.- Specified by:
getSubPartNamein interfaceSubPartAware- Parameters:
subElement- The element the identifier string should uniquely identify- Returns:
- An identifier that uniquely identifies
subElementor null if no identifier could be provided.
-
setAriaRequired
public void setAriaRequired(boolean required)
Description copied from interface:HandlesAriaRequiredCalled to set the element, typically an input element, as required.- Specified by:
setAriaRequiredin interfaceHandlesAriaRequired- Parameters:
required- boolean true when the element needs to be set as required
-
setAriaInvalid
public void setAriaInvalid(boolean invalid)
Description copied from interface:HandlesAriaInvalidCalled to set the element, typically an input element, as invalid.- Specified by:
setAriaInvalidin interfaceHandlesAriaInvalid- Parameters:
invalid- boolean, true when the element should be marked invalid, false otherwise
-
bindAriaCaption
public void bindAriaCaption(com.google.gwt.user.client.Element captionElement)
Description copied from interface:HandlesAriaCaptionCalled to bind the provided caption (label in HTML speak) element to the main input element of the Widget. Binding should be removed from the main input field when captionElement is null.- Specified by:
bindAriaCaptionin interfaceHandlesAriaCaption- Parameters:
captionElement- Element of the caption
-
isWorkPending
public boolean isWorkPending()
Description copied from interface:DeferredWorkerChecks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.- Specified by:
isWorkPendingin interfaceDeferredWorker
-
setSelectedCaption
public void setSelectedCaption(String selectedCaption)
Sets the caption of selected item, if "scroll to page" is disabled. This method is meant for internal use and may change in future versions.- Parameters:
selectedCaption- the caption of selected item- Since:
- 7.7
-
getSelectedCaption
public String getSelectedCaption()
This method is meant for internal use and may change in future versions.- Returns:
- the caption of selected item, if "scroll to page" is disabled
- Since:
- 7.7
-
-