Package de.xima.fc.gui.common.bean
Class ViewIdBean
- java.lang.Object
-
- de.xima.fc.gui.common.bean.ViewIdBean
-
- All Implemented Interfaces:
Serializable
@ViewScoped @Named public class ViewIdBean extends Object implements Serializable
Bean that associates a UUID with each view. This is better that relying on the internaljava.faces.ViewState, which may not contain an ID in case of client-side state saving etc.- Since:
- 7.0.0
- Author:
- XIMA MEDIA GmbH
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ViewIdBean()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Optional<UUID>getCurrentViewId()UUIDgetViewId()static booleanisDifferentView(UUID viewId)static booleanisSameView(UUID viewId)
-
-
-
Method Detail
-
getViewId
public UUID getViewId()
- Returns:
- The ID of the current view.
-
getCurrentViewId
public static Optional<UUID> getCurrentViewId()
- Returns:
- The ID of the current view, if this method is called within a JSF context. Otherwise,returns an empty optional.
-
isSameView
public static boolean isSameView(UUID viewId)
- Parameters:
viewId- A view ID against which to check.- Returns:
truewhen called within a JSF context and the current view equals the given view ID,falseotherwise.
-
isDifferentView
public static boolean isDifferentView(UUID viewId)
- Parameters:
viewId- A view ID against which to check.- Returns:
- When the given view ID is not
null:truewhen either not within a JSF context or the current view is different from the given view ID,falseotherwise. When the given view ID isnull:truewhen there is a an active view ID,falseotherwise.
-
-