Class 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)
    • Field Detail

      • 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 written

        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 #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.
      • suggestionPopupWidth

        public String suggestionPopupWidth
      • 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.
    • Constructor Detail

      • VFilterSelect

        public VFilterSelect()
        Default constructor.
    • Method Detail

      • onBrowserEvent

        public void onBrowserEvent​(com.google.gwt.user.client.Event event)
        Specified by:
        onBrowserEvent in interface com.google.gwt.user.client.EventListener
        Overrides:
        onBrowserEvent in class com.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:
        setStyleName in class com.google.gwt.user.client.ui.UIObject
      • setStylePrimaryName

        public void setStylePrimaryName​(String style)
        Overrides:
        setStylePrimaryName in class com.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 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​(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:
        onKeyDown in interface com.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:
        onKeyUp in interface com.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:
        onClick in interface com.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:
        onFocus in interface com.google.gwt.event.dom.client.FocusHandler
      • onBlur

        public void onBlur​(com.google.gwt.event.dom.client.BlurEvent event)
        Specified by:
        onBlur in interface com.google.gwt.event.dom.client.BlurHandler
      • focus

        public void focus()
        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​(String width)
        Overrides:
        setWidth in class com.google.gwt.user.client.ui.UIObject
      • onDetach

        protected void onDetach()
        Overrides:
        onDetach in class com.google.gwt.user.client.ui.Composite
      • bindAriaCaption

        public void bindAriaCaption​(com.google.gwt.user.client.Element captionElement)
        Specified by:
        bindAriaCaption in interface HandlesAriaCaption
      • 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