Package de.xima.fc.gui.bean
Class SelectionBean
java.lang.Object
de.xima.fc.gui.bean.SelectionBean
- All Implemented Interfaces:
Serializable
This bean stores the currently selected item for each page/view throughout the session. It keeps a map between the
selection key and the selected value. The selected key should be generated in a way that is unique. Currently, we
only store the selected entity of various list views in the application, eg.
/user/ldapgroup
or
/system/client
.- Author:
- XIMA MEDIA GmbH
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateKeyForCurrentView
(EEntityKeySelectionType keyType, Class<?> objectClass) createKeyForCurrentView
(EEntityKeySelectionType keyType, String additionalKey) <T,
S> Optional<S> getSelectedAs
(String key, Function<String, S> backConverter) getSelectedAsLong
(String key) void
Stores the given value for the given key.void
Stores the given value for the given key.void
Associates the given value to the given key for later retrieval.void
storeEntityIdFromUrl
(EEntityKeySelectionType keyType, String entityClass) Can be used to select an entity by a URL parameter.void
storeEntityIdFromUrlClient
(String entityClass) void
storeEntityIdFromUrlProject
(String entityClass) void
storeEntityIdFromUrlSystem
(String entityClass)
-
Constructor Details
-
SelectionBean
public SelectionBean()
-
-
Method Details
-
storeEntityIdFromUrlSystem
-
storeEntityIdFromUrlClient
-
storeEntityIdFromUrlProject
-
storeEntityIdFromUrl
Can be used to select an entity by a URL parameter. May be called from an xhtml page viaf:viewAction
. Reads the ID from the URL parameter "preselect" and stores that selection. -
store
Associates the given value to the given key for later retrieval.- Parameters:
selectionKey
- Key at which to the value.selectionValue
- Value to store.
-
store
Stores the given value for the given key.- Parameters:
key
- Key at which to store the value.valueEntity
- Value to store. This stores the ID of the given entity.
-
store
Stores the given value for the given key.- Parameters:
key
- Key at which to store the value.id
- ID to store.
-
getSelectedAs
- Parameters:
key
- Key for which to retrieve the stored value.backConverter
- Some way of converting the stored string value to another type.- Returns:
- The stored value for the given key, converted to the desired type.
-
getSelectedAsLong
- Parameters:
key
- Key for which to retrieve the stored value.- Returns:
- The stored long for the given key, empty if none is found.
-
getSelectedAsString
- Parameters:
key
- Key for which to retrieve the stored value.- Returns:
- The value for the given key, empty if none is found.
-
createKeyForCurrentView
- Parameters:
keyType
- Type of the key, ie. whether the key uses the client and current project.objectClass
- An additional identifier to be included in the key.- Returns:
- The selection key for the current view. It consists of the view, the client (
null
for sadmin) and the current project (null
if the view is not project-specific).
-
createKeyForCurrentView
- Parameters:
keyType
- Type of the key, ie. whether the key uses the client and current project.additionalKey
- An additional identifier to be included in the key.- Returns:
- The selection key for the current view. It consists of the view, the client (
null
for sadmin) and the current project (null
if the view is not project-specific).
-