Class ComboBox<T>

    • Constructor Detail

      • ComboBox

        public ComboBox​(ComboBoxCell<T> cell)
        Creates a new combo box with the given cell.
        Parameters:
        cell - the cell
      • ComboBox

        @UiConstructor
        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider)
        Creates a combo box that renders all items with the given label provider.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
      • ComboBox

        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider,
                        ListView<T,​?> listView)
        Creates a combo box that renders the input value with the label provider.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
        listView - the list view
      • ComboBox

        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider,
                        ListView<T,​?> listView,
                        TriggerFieldCell.TriggerFieldAppearance appearance)
        Creates a combo box that renders the input value with the label provider.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
        listView - the list view
        appearance - the appearance
      • ComboBox

        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider,
                        com.google.gwt.text.shared.SafeHtmlRenderer<T> renderer)
        Creates a combo box that renders the input value with the label provider and the drop down values with the renderer.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
        renderer - draws the current model as html in the drop down
      • ComboBox

        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider,
                        com.google.gwt.text.shared.SafeHtmlRenderer<T> renderer,
                        TriggerFieldCell.TriggerFieldAppearance appearance)
        Creates a combo box that renders the input value with the label provider and the drop down values with the renderer.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
        renderer - draws the current model as html in the drop down
        appearance - the appearance
      • ComboBox

        public ComboBox​(ListStore<T> store,
                        LabelProvider<? super T> labelProvider,
                        TriggerFieldCell.TriggerFieldAppearance appearance)
        Creates a combo box that renders all items with the given label provider.
        Parameters:
        store - the store containing the data that can be selected
        labelProvider - converts the current model type into a string value to display in the text box
        appearance - the appearance
    • Method Detail

      • addBeforeSelectionHandler

        public com.google.gwt.event.shared.HandlerRegistration addBeforeSelectionHandler​(com.google.gwt.event.logical.shared.BeforeSelectionHandler<T> handler)
        Specified by:
        addBeforeSelectionHandler in interface com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers<T>
      • addSelectionHandler

        public com.google.gwt.event.shared.HandlerRegistration addSelectionHandler​(com.google.gwt.event.logical.shared.SelectionHandler<T> handler)
        Specified by:
        addSelectionHandler in interface com.google.gwt.event.logical.shared.HasSelectionHandlers<T>
      • collapse

        public void collapse()
        Hides the dropdown list if it is currently expanded.
      • doQuery

        public void doQuery​(String query,
                            boolean force)
        Execute a query to filter the dropdown list. Fires the BeforeQuery event prior to performing the query allowing the query action to be canceled if needed.
        Parameters:
        query - the query
        force - true to force the query to execute even if there are currently fewer characters in the field than the minimum specified by the minChars config option. It also clears any filter previously saved in the current store
      • expand

        public void expand()
        Expands the dropdown list if it is currently hidden.
      • getAllQuery

        public String getAllQuery()
        Returns the all query.
        Returns:
        the all query
      • getLabelProvider

        public LabelProvider<? super T> getLabelProvider()
        Returns the combo's label provider.
        Returns:
        the label provider
      • getListView

        public ListView<T,​?> getListView()
        Returns the combo's list view.
        Returns:
        the list view
      • getLoader

        public Loader<?,​?> getLoader()
        Returns the combo's loader.
        Returns:
        the loader or null if not set
      • getMaxHeight

        public int getMaxHeight()
        Returns the dropdown list's max height.
        Returns:
        the max height
      • getMinChars

        public int getMinChars()
        Returns the minimum characters used for autocomplete and typeahead.
        Returns:
        the minimum number of characters
      • getMinListWidth

        public int getMinListWidth()
        Returns the dropdown list's minimum width.
        Returns:
        the minimum width
      • getPageSize

        public int getPageSize()
        Returns the page size.
        Returns:
        the page size
      • getStore

        public ListStore<T> getStore()
        Returns the combo's list store.
        Returns:
        the list store
      • getTypeAheadDelay

        public int getTypeAheadDelay()
        Returns the type ahead delay in milliseconds.
        Returns:
        the type ahead delay
      • isUseQueryCache

        public boolean isUseQueryCache()
        Returns the state if the query cache is used or not.
        Returns:
        the useQueryCache state
      • getQueryDelay

        public int getQueryDelay()
        Returns the query delay.
        Returns:
        the query delay
      • isExpanded

        public boolean isExpanded()
        Returns true if the dropdown is expanded.
        Returns:
        the expand state
      • isForceSelection

        public boolean isForceSelection()
        Returns true if the field's value is forced to one of the value in the list.
        Returns:
        the force selection state
      • isTypeAhead

        public boolean isTypeAhead()
        Returns true if type ahead is enabled.
        Returns:
        the type ahead state
      • select

        public void select​(int index)
        Select an item in the dropdown list by its numeric index in the list. This function does NOT cause the select event to fire. The list must expanded for this function to work, otherwise use #setValue.
        Parameters:
        index - the index of the item to select
      • select

        public void select​(T item)
        Select an item in the dropdown list. This function does NOT cause the select event to fire. The list must expanded for this function to work, otherwise use #setValue.
        Parameters:
        item - the item to select
      • setAllQuery

        public void setAllQuery​(String allQuery)
        The text query to send to the server to return all records for the list with no filtering (defaults to '').
        Parameters:
        allQuery - the all query
      • setExpanded

        public void setExpanded​(boolean expand)
        Sets the panel's expand state.
        Parameters:
        expand - true to expand
      • setForceSelection

        public void setForceSelection​(boolean forceSelection)
        Sets whether the combo's value is restricted to one of the values in the list, false to allow the user to set arbitrary text into the field (defaults to false).
        Parameters:
        forceSelection - true to force selection
      • setLoader

        public void setLoader​(Loader<?,​?> loader)
        Sets the comobo's loader. Keep in mind setMinChars(int) (defaults to 4 if remote, or 0 if local) when using the loader, as it will only load when the min amount of characters has been met.
        Parameters:
        loader - the loader
      • setMaxHeight

        public void setMaxHeight​(int maxHeight)
        Sets the maximum height in pixels of the dropdown list before scrollbars are shown (defaults to 300).
        Parameters:
        maxHeight - the max hieght
      • setLoadingIndicator

        public void setLoadingIndicator​(com.google.gwt.safehtml.shared.SafeHtml html)
        Sets the loading indicator html to be displayed during a load request.
        • The setLoader(Loader) has to be set for this use.
        • The css class name 'loading-indicator' can style the loading indicator html.
        Parameters:
        html - the loading html
      • setLoadingIndicator

        public void setLoadingIndicator​(String text)
        Sets the loading indicator text to be displayed during a load request.
        • The setLoader(Loader) has to be set for this use.
        • The css class name 'loading-indicator' can style the loading indicator text.
        Parameters:
        text - the loading text
      • setMinChars

        public void setMinChars​(int minChars)
        Sets the minimum number of characters the user must type before autocomplete and typeahead active (defaults to 4 if remote, or 0 if local).
        Parameters:
        minChars - minimum number of characters before autocomplete and typeahead are active
      • setMinListWidth

        public void setMinListWidth​(int minListWidth)
        Sets the minimum width of the dropdown list in pixels (defaults to 70, will be ignored if listWidth has a higher value).
        Parameters:
        minListWidth - the min width
      • setPageSize

        public void setPageSize​(int pageSize)
        Sets the page size. Only applies when using a paging toolbar.
        Parameters:
        pageSize - the page size
      • setStore

        public void setStore​(ListStore<T> store)
        Sets the combo's store.
        Parameters:
        store - the store
      • setTypeAhead

        public void setTypeAhead​(boolean typeAhead)
        True to populate and autoselect the remainder of the text being typed after a configurable delay (setTypeAheadDelay(int)) if it matches a known value (defaults to false)
        Parameters:
        typeAhead - true to enable type ahead
      • setTypeAheadDelay

        public void setTypeAheadDelay​(int typeAheadDelay)
        The length of time in milliseconds to wait until the typeahead text is displayed if typeAhead = true (defaults to 250).
        Parameters:
        typeAheadDelay - the type ahead delay
      • setUseQueryCache

        public void setUseQueryCache​(boolean useQueryCache)
        Set this to false to disable the last query cache (defaults to true). When set to false the store gets queried on each expand for the data that should get displayed in the list. If you use a loader, than each time the ComboBox gets expanded, the server gets asked for the data. You want to do this for example, if you filter the content of this ComboBox against some selection in another field.
        Parameters:
        useQueryCache - the useQueryCache to set
      • setQueryMatcher

        public void setQueryMatcher​(ComboBoxCell.QueryMatcher<T> queryMatcher)
        Filter the items using this query matcher.

        Parameters:
        queryMatcher - the QueryMatcher
        Since:
        4.0.3
      • setQueryDelay

        public void setQueryDelay​(int queryDelay)
        The length of time in milliseconds to delay between the start of typing and sending the query to filter the dropdown list.
        Parameters:
        queryDelay - the query delay