Class SelectionBean
java.lang.Object
de.xima.fc.gui.common.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, e.g.
/user/ldap_group 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) <S> Optional<S> getSelectedAs(String key, Function<String, S> backConverter) getSelectedAsLong(String key) getSelectedForCurrentViewAsLong(EEntityKeySelectionType keyType, Class<?> objectClass) voidStores the given value for the given key.voidStores the given value for the given key.voidAssociates the given value to the given key for later retrieval.voidstoreEntityIdFromUrl(EEntityKeySelectionType keyType, String entityClass) Can be used to select an entity by a URL parameter.voidstoreEntityIdFromUrlClient(String entityClass) voidstoreEntityIdFromUrlProject(String entityClass) voidstoreEntityIdFromUrlSystem(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
-
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
-
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
-
getSelectedAsString
-
getSelectedForCurrentViewAsLong
public Optional<Long> getSelectedForCurrentViewAsLong(EEntityKeySelectionType keyType, Class<?> objectClass) - Parameters:
keyType- Type of the key, i.e. whether the key uses the client and current project.objectClass- An additional identifier to be included in the key.- Returns:
- The stored value for the given key, converted to the desired type.
-
createKeyForCurrentView
- Parameters:
keyType- Type of the key, i.e. 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 (
nullfor sadmin) and the current project (nullif the view is not project-specific).
-
createKeyForCurrentView
- Parameters:
keyType- Type of the key, i.e. 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 (
nullfor sadmin) and the current project (nullif the view is not project-specific).
-