Package org.silverpeas.core.web.util
Class SelectableUIEntity<D>
- java.lang.Object
-
- org.silverpeas.core.web.util.SelectableUIEntity<D>
-
- Type Parameters:
D
- the type of the handled data.
- Direct Known Subclasses:
GroupUIEntity
,SimpleContributionUIEntity
,ToDoHeaderUIEntity
,UserNotificationUIEntity
,UserUIEntity
,VariableUIEntity
,WbeFileUIEntity
,WbeUserUIEntity
public abstract class SelectableUIEntity<D> extends Object
Abstraction which permits to get a standardization about managing service data into UI context.- Author:
- silveryocha
-
-
Constructor Summary
Constructors Constructor Description SelectableUIEntity(D data)
Initializes the item with the given data.
By default, item is marked as not selected.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.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <W extends SelectableUIEntity,I>
SilverpeasList<W>convert(List<I> dataList, Function<I,W> converter)
Converts the given data list into aSilverpeasList
of item handling the data.D
getData()
Gets the data handled by the item.abstract String
getId()
Gets the unique identifier of te item into the UI list.protected User
getUserByIdFromCache(String id)
Gets from a dedicated UI cache the details about a user by its id.boolean
isSelected()
Indicates if the UI item is selected.void
setSelected(boolean selected)
Sets the selected indicator.
-
-
-
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 bygetId()
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 aSilverpeasList
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 aSelectableUIEntity
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.
-
-