com.vaadin.ui.

Class CheckBoxGroup<T>

    • Constructor Detail

      • CheckBoxGroup

        public CheckBoxGroup​(String caption)

        Constructs a new CheckBoxGroup with caption.

        Parameters:

        caption - caption text

      • CheckBoxGroup

        public CheckBoxGroup​(String caption,
                             Collection<T> items)

        Constructs a new CheckBoxGroup with caption and DataProvider containing given items.

        Parameters:

        caption - the caption text

        items - the data items to use, not null

        See Also:

        HasItems.setItems(Collection)

      • CheckBoxGroup

        public CheckBoxGroup()

        Constructs a new CheckBoxGroup.

    • Method Detail

      • setHtmlContentAllowed

        public void setHtmlContentAllowed​(boolean htmlContentAllowed)

        Sets whether html is allowed in the item captions. If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.

        Parameters:

        htmlContentAllowed - true if the captions are used as html, false if used as plain text

      • isHtmlContentAllowed

        public boolean isHtmlContentAllowed()

        Checks whether captions are interpreted as html or plain text.

        Returns:

        true if the captions are used as html, false if used as plain text

        See Also:

        setHtmlContentAllowed(boolean)

      • getState

        protected CheckBoxGroupState 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

      • setItemIconGenerator

        public void setItemIconGenerator​(IconGenerator<T> itemIconGenerator)

        Description copied from class: AbstractListing

        Sets the item icon generator that is used to produce custom icons for shown items. The generator can return null for items with no icon.

        Implementations that support item icons make this method public.

        Overrides:

        setItemIconGenerator in class AbstractListing<T>

        Parameters:

        itemIconGenerator - the item icon generator to set, not null

        See Also:

        IconGenerator

      • setItemEnabledProvider

        public void setItemEnabledProvider​(SerializablePredicate<T> itemEnabledProvider)

        Description copied from class: AbstractMultiSelect

        Sets the item enabled predicate for this multiselect. The predicate is applied to each item to determine whether the item should be enabled ( true) or disabled (false). Disabled items are displayed as grayed out and the user cannot select them. The default predicate always returns true (all the items are enabled).

        Implementation note: Override this method and AbstractMultiSelect.getItemEnabledProvider() as public and invoke super methods to support this feature in the multiselect component.

        Overrides:

        setItemEnabledProvider in class AbstractMultiSelect<T>

        Parameters:

        itemEnabledProvider - the item enabled provider to set, not null

      • setItemDescriptionGenerator

        public void setItemDescriptionGenerator​(DescriptionGenerator<T> descriptionGenerator)

        Sets the description generator that is used for generating descriptions for items. Description is shown as a tooltip when hovering on corresponding element. If the generator returns null, no tooltip is shown.

        Parameters:

        descriptionGenerator - the item description generator to set, not null

        Since:

        8.2

      • getItemDescriptionGenerator

        public DescriptionGenerator<T> getItemDescriptionGenerator()

        Gets the item description generator.

        Returns:

        the item description generator

        Since:

        8.2

      • readItems

        protected void readItems​(org.jsoup.nodes.Element design,
                                 DesignContext context)

        Description copied from class: AbstractListing

        Reads the data source items from the design.

        Overrides:

        readItems in class AbstractMultiSelect<T>

        Parameters:

        design - The element to obtain the state from

        context - The DesignContext instance used for parsing the design

      • readItem

        protected T readItem​(org.jsoup.nodes.Element child,
                             Set<T> selected,
                             DesignContext context)

        Description copied from class: AbstractMultiSelect

        Reads an Item from a design and inserts it into the data source. Hierarchical select components should override this method to recursively recursively read any child items as well.

        Overrides:

        readItem in class AbstractMultiSelect<T>

        Parameters:

        child - a child element representing the item

        selected - A set accumulating selected items. If the item that is read is marked as selected, its item id should be added to this set.

        context - the DesignContext instance used in parsing

        Returns:

        the item id of the new item

      • writeItem

        protected org.jsoup.nodes.Element writeItem​(org.jsoup.nodes.Element design,
                                                    T item,
                                                    DesignContext context)

        Description copied from class: AbstractListing

        Writes a data source Item to a design. Hierarchical select components should override this method to recursively write any child items as well.

        Overrides:

        writeItem in class AbstractMultiSelect<T>

        Parameters:

        design - the element into which to insert the item

        item - the item to write

        context - the DesignContext instance used in writing

        Returns:

        a JSOUP element representing the item

      • 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