Class SelectableUIEntity<D>

    • Constructor Detail

      • SelectableUIEntity

        public SelectableUIEntity​(D data)
        Initializes the item with the given data.
        By default, item is marked as not selected.
        Parameters:
        data - the data to handle.
      • SelectableUIEntity

        public SelectableUIEntity​(D data,
                                  Set<String> selectedIds)
        Initializes the item with the given data and a set of item identifiers which will provide the selected indicator lazily.
        If no selected id set is given, then the item is marked as not selected by default.
        Parameters:
        data - the data to handle.
        selectedIds - the set of selected identifiers (identifiers provided by getId() method).
    • Method Detail

      • convert

        public static <W extends SelectableUIEntity,​I> SilverpeasList<W> convert​(List<I> dataList,
                                                                                       Function<I,​W> converter)
        Converts the given data list into a SilverpeasList of item handling the data.
        Type Parameters:
        W - the type of the item data handler.
        I - the type of the data.
        Parameters:
        dataList - the list of data.
        converter - the function which converts the data into a SelectableUIEntity one.
        Returns:
        the SilverpeasList of handled data item.
      • getId

        public abstract String getId()
        Gets the unique identifier of te item into the UI list.
        Returns:
        a unique identifier as string.
      • getData

        public D getData()
        Gets the data handled by the item.
        Returns:
        the data.
      • isSelected

        public boolean isSelected()
        Indicates if the UI item is selected.
        Returns:
        true if selected, false otherwise.
      • setSelected

        public void setSelected​(boolean selected)
        Sets the selected indicator.
        Parameters:
        selected - true if selected, false otherwise.
      • getUserByIdFromCache

        protected User getUserByIdFromCache​(String id)
        Gets from a dedicated UI cache the details about a user by its id.
        Parameters:
        id - identifier of a user.
        Returns:
        a User instance if any, null otherwise.