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()
UUID
getViewId()
static boolean
isDifferentView(UUID viewId)
static boolean
isSameView(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:
true
when called within a JSF context and the current view equals the given view ID,false
otherwise.
-
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
:true
when either not within a JSF context or the current view is different from the given view ID,false
otherwise. When the given view ID isnull
:true
when there is a an active view ID,false
otherwise.
-
-