com.vaadin.ui.

Class ListSelect<T>

    • Field Detail

      • DEFAULT_ROWS

        protected static final int DEFAULT_ROWS

        Default number of rows visible for select.

        See Also:

        Constant Field Values

    • Constructor Detail

      • ListSelect

        public ListSelect()

        Constructs a new ListSelect.

      • ListSelect

        public ListSelect​(String caption)

        Constructs a new ListSelect with the given caption.

        Parameters:

        caption - the caption to set, can be null

      • ListSelect

        public ListSelect​(String caption,
                          DataProvider<T,​?> dataProvider)

        Constructs a new ListSelect with caption and data provider for options.

        Parameters:

        caption - the caption to set, can be null

        dataProvider - the data provider, not null

        Since:

        8.0

      • ListSelect

        public ListSelect​(String caption,
                          Collection<T> options)

        Constructs a new ListSelect with caption and the given options.

        Parameters:

        caption - the caption to set, can be null

        options - the options, cannot be null

    • Method Detail

      • getRows

        public int getRows()

        Returns the number of rows in the select.

        Default value is DEFAULT_ROWS

        Returns:

        the number of rows visible

      • setRows

        public void setRows​(int rows)

        Sets the number of rows in the select. If the number of rows is set to 0, the actual number of displayed rows is determined implicitly by the select.

        If a height if set (using AbstractComponent.setHeight(String) or AbstractComponent.setHeight(float, Unit)) it overrides the number of rows. Leave the height undefined to use this method.

        Default value is DEFAULT_ROWS

        Parameters:

        rows - the number of rows to set.

      • getState

        protected ListSelectState getState()

        Description copied from class: AbstractComponent

        Returns the shared state bean with information to be sent from the server to the client. Subclasses should override this method and set any relevant fields of the state returned by super.getState().

        Overrides:

        getState in class AbstractMultiSelect<T>

        Returns:

        updated component shared state

      • getDataProvider

        public DataProvider<T,​?> getDataProvider()

        Description copied from interface: HasItems

        Returns the source of data items used by this listing.

        Specified by:

        getDataProvider in interface HasItems<T>

        Returns:

        the data provider, not null

      • setDataProvider

        public void setDataProvider​(DataProvider<T,​?> dataProvider)

        Description copied from interface: HasDataProvider

        Sets the data provider for this listing. The data provider is queried for displayed items as needed.

        Specified by:

        setDataProvider in interface HasDataProvider<T>

        Parameters:

        dataProvider - the data provider, not null