com.vaadin.client.ui
Class VFilterSelect

java.lang.Object
  extended by Composite
      extended by com.vaadin.client.ui.VFilterSelect
All Implemented Interfaces:
DeferredWorker, Focusable, HandlesAriaCaption, HandlesAriaInvalid, HandlesAriaRequired, Field, SubPartAware

public class VFilterSelect
extends Composite
implements Field, Focusable, SubPartAware, HandlesAriaCaption, HandlesAriaInvalid, HandlesAriaRequired, DeferredWorker

Client side implementation of the Select component. TODO needs major refactoring (to be extensible etc)


Nested Class Summary
 class VFilterSelect.FilterSelectSuggestion
          Represents a suggestion in the suggestion popup box
 class VFilterSelect.FilterSelectTextBox
          TextBox variant used as input element for filter selects, which prevents selecting text when disabled.
static class VFilterSelect.Select
          For internal use only.
 class VFilterSelect.SuggestionMenu
          The menu where the suggestions are rendered
 class VFilterSelect.SuggestionPopup
          Represents the popup box with the selection options.
 
Field Summary
 boolean allowNewItem
          For internal use only.
static java.lang.String CLASSNAME
           
 ApplicationConnection client
          For internal use only.
 int currentPage
          For internal use only.
 VFilterSelect.FilterSelectSuggestion currentSuggestion
          The current suggestion selected from the dropdown.
 java.util.List<VFilterSelect.FilterSelectSuggestion> currentSuggestions
          A collection of available suggestions (options) as received from the server.
 boolean enabled
          For internal use only.
 com.vaadin.shared.ui.combobox.FilteringMode filteringmode
          For internal use only.
static com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_CONTAINS
          Deprecated. 
static com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_OFF
          Deprecated. 
static com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_STARTSWITH
          Deprecated. 
 boolean focused
          For internal use only.
 boolean immediate
          For internal use only.
 boolean initDone
          For internal use only.
 java.lang.String inputPrompt
          For internal use only.
 java.lang.String lastFilter
          For internal use only.
 java.lang.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.
 java.lang.String paintableId
          For internal use only.
 boolean popupOpenerClicked
          Set true when popupopened has been clicked.
 boolean prompting
          For internal use only.
 boolean readonly
          For internal use only.
 java.lang.String selectedOptionKey
          For internal use only.
 VFilterSelect.Select selectPopupItemWhenResponseIsReceived
          For internal use only.
 VFilterSelect.SuggestionPopup suggestionPopup
          For internal use only.
 int suggestionPopupMinWidth
          For internal use only.
 TextBox tb
          The text box where the filter is written
 int totalMatches
          For internal use only.
 boolean updateSelectionWhenReponseIsReceived
          For internal use only.
 boolean waitingForFilteringResponse
          For internal use only.
 
Constructor Summary
VFilterSelect()
          Default constructor.
 
Method Summary
 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  VFilterSelect.SuggestionPopup createSuggestionPopup()
          This method will create the SuggestionPopup used by the VFilterSelect instance.
protected  TextBox createTextBox()
          This method will create the TextBox used by the VFilterSelect instance.
 void filterOptions(int page)
          Filters the options at a certain page.
 void filterOptions(int page, java.lang.String filter)
          Filters the options at certain page using the given filter
 void focus()
          Sets focus to this widget.
 com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
          Locates an element inside a component using the identifier provided in subPart.
 java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
          Provides an identifier that identifies the element within the component.
 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(java.lang.String captions)
          Calculate minimum width for FilterSelect textarea.
 void onBlur(BlurEvent event)
           
 void onBrowserEvent(Event event)
           
 void onClick(ClickEvent event)
          Listener for popupopener
protected  void onDetach()
           
 void onFocus(FocusEvent event)
           
 void onKeyDown(KeyDownEvent event)
           
 void onKeyUp(KeyUpEvent event)
          Triggered when a key was depressed
 void onSuggestionSelected(VFilterSelect.FilterSelectSuggestion suggestion)
          Triggered when a suggestion is selected
 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 setPromptingOff(java.lang.String text)
          Turns prompting off.
 void setPromptingOn()
          Turns prompting on.
 void setSelectedItemIcon(java.lang.String iconUri)
          Sets the icon URI of the selected item.
 void setStyleName(java.lang.String style)
           
 void setStylePrimaryName(java.lang.String style)
           
 void setTextboxText(java.lang.String text)
          Sets the text in the text box.
 void setTextInputEnabled(boolean textInputEnabled)
           
 void setWidth(java.lang.String width)
           
 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 FilterSelect textarea based on input prompt and suggestions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILTERINGMODE_OFF

@Deprecated
public static final com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_OFF
Deprecated. 

FILTERINGMODE_STARTSWITH

@Deprecated
public static final com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_STARTSWITH
Deprecated. 

FILTERINGMODE_CONTAINS

@Deprecated
public static final com.vaadin.shared.ui.combobox.FilteringMode FILTERINGMODE_CONTAINS
Deprecated. 

CLASSNAME

public static final java.lang.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 TextBox tb
The text box where the filter is written

For 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 java.lang.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 java.util.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 java.lang.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 java.lang.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 com.vaadin.shared.ui.combobox.FilteringMode filteringmode
For internal use only. May be removed or replaced in the future.


inputPrompt

public java.lang.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 #2119

For 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.


lastNewItemString

public java.lang.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.

Constructor Detail

VFilterSelect

public VFilterSelect()
Default constructor.

Method Detail

onBrowserEvent

public void onBrowserEvent(Event event)

createTextBox

protected 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(java.lang.String style)

setStylePrimaryName

public void setStylePrimaryName(java.lang.String style)

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,
                          java.lang.String filter)
Filters the options at certain page using the given filter

Parameters:
page - The page to filter
filter - 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(java.lang.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(java.lang.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(java.lang.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(KeyDownEvent event)

onKeyUp

public void onKeyUp(KeyUpEvent event)
Triggered when a key was depressed

Parameters:
event - The KeyUpEvent of the key depressed

onClick

public void onClick(ClickEvent event)
Listener for popupopener


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(java.lang.String captions)
Calculate minimum width for FilterSelect textarea.

For internal use only. May be removed or replaced in the future.


onFocus

public void onFocus(FocusEvent event)

onBlur

public void onBlur(BlurEvent event)

focus

public void focus()
Description copied from interface: Focusable
Sets focus to this widget.

Specified by:
focus in interface Focusable

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(java.lang.String width)

onDetach

protected void onDetach()

getSubPartElement

public com.google.gwt.user.client.Element getSubPartElement(java.lang.String subPart)
Description copied from interface: SubPartAware
Locates an element inside a component using the identifier provided in subPart. The subPart identifier is component specific and may be any string of characters, numbers, space characters and brackets.

Specified by:
getSubPartElement in interface SubPartAware
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 java.lang.String getSubPartName(com.google.gwt.user.client.Element subElement)
Description copied from interface: SubPartAware
Provides an identifier that identifies the element within the component. The subElement 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.

Specified by:
getSubPartName in interface SubPartAware
Parameters:
subElement - The element the identifier string should uniquely identify
Returns:
An identifier that uniquely identifies subElement or null if no identifier could be provided.

setAriaRequired

public void setAriaRequired(boolean required)
Description copied from interface: HandlesAriaRequired
Called to set the element, typically an input element, as required.

Specified by:
setAriaRequired in interface HandlesAriaRequired
Parameters:
required - boolean true when the element needs to be set as required

setAriaInvalid

public void setAriaInvalid(boolean invalid)
Description copied from interface: HandlesAriaInvalid
Called to set the element, typically an input element, as invalid.

Specified by:
setAriaInvalid in interface HandlesAriaInvalid
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: HandlesAriaCaption
Called 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:
bindAriaCaption in interface HandlesAriaCaption
Parameters:
captionElement - Element of the caption

isWorkPending

public boolean isWorkPending()
Description copied from interface: DeferredWorker
Checks whether there are operations pending for this widget or connector that must be executed before reaching a steady state.

Specified by:
isWorkPending in interface DeferredWorker


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.