Class BaseDyntabCdiBean
- All Implemented Interfaces:
DyntabBeanInterface,Serializable
DyntabBeanInterface for CDI-managed tab beans.
Provides default implementations for tab lifecycle methods, event handling, inter-tab messaging, view navigation within a tab, and dialog management. Application-specific tab beans should extend this class.
Key features:
- Tab lifecycle:
accessPointMethod(java.util.Map)(called on tab open) andexitPointMethod(java.util.Map)(called on tab close) - Event handling:
observeDynTabEvent(dyntabs.DynTabCDIEvent)dispatches toonDynTabAdded(dyntabs.DynTabCDIEvent),onDynTabRemoved(dyntabs.DynTabCDIEvent),onDynTabSelected(dyntabs.DynTabCDIEvent) - Inter-tab messaging:
sendMessageToAppModule(java.lang.String, java.lang.Object)andonApplicationMessage(java.lang.String, java.lang.Object) - Workflow pattern:
closeAndReturnValueToCaller(java.lang.Object)for parent-child tab flows - View navigation:
callViewActivity(java.lang.String)for switching XHTML pages within a tab - PrimeFaces helpers: widget show/hide/filter within the correct dynamic tab
- Author:
- DynTabs
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccessPointMethod(Map parameters) Called when the tab is opened.voidWrapsaccessPointMethod(java.util.Map)with error handling.voidvoidcallMethodActivity(String oldViewActivity, String newViewActivity) voidcallViewActivity(String viewActivity) clearTableFiltersInDynTab(String tableId) voidcloseAndReturnValueToCaller(Object returnValue) voidvoidprotected voidexitPointMethod(Map parameters) Called when the tab is closed.filterTableInDynTab(String tableId) booleanDeprecated.The active flag is no longer needed for @TabScoped beans.the callerID is a special param, signaling that this JobFlow is called from another JobFlow This is a uniqueIdentifier of calling JobFlowhideWidgetInDynTab(String compId) voidinit()booleanbooleanvoidobserveApplicationEvent(ApplicationCDIEvent appEvent) Receives application events (inter-tab communication).voidobserveDynTabEvent(DynTabCDIEvent dynTabEvent) Receives DynTab lifecycle events (dynTabAdded, dynTabRemoved, dynTabSelected).protected voidonApplicationMessage(String senderId, Object payload) protected voidonDynTabAdded(DynTabCDIEvent event) protected voidonDynTabRemoved(DynTabCDIEvent event) protected voidonDynTabSelected(DynTabCDIEvent event) protected voidonJobFlowReturn(String senderId, Object jobFlowReturnValue) protected voidprotected voidvoidsendMessageToAllAppModules(Object payload) voidsendMessageToAppModule(String targetAppModuleId, Object payload) Sends a message to another app module (DynTab) via DynTabManager.voidsetAccessDenied(boolean accessDenied) voidsetActive(boolean active) Deprecated.The active flag is no longer needed for @TabScoped beans since the bean is destroyed together with the tab.voidvoidvoidsetErrPageRendered(boolean value) voidsetMainContentRendered(boolean value) showWidgetInDynTab(String compId)
-
Field Details
-
log
protected static final org.slf4j.Logger log
-
-
Constructor Details
-
BaseDyntabCdiBean
public BaseDyntabCdiBean()
-
-
Method Details
-
init
@PostConstruct public void init()- Specified by:
initin interfaceDyntabBeanInterface
-
getParameters
- Specified by:
getParametersin interfaceDyntabBeanInterface
-
isMainContentRendered
public boolean isMainContentRendered() -
setMainContentRendered
public void setMainContentRendered(boolean value) -
isErrPageRendered
public boolean isErrPageRendered() -
setErrPageRendered
public void setErrPageRendered(boolean value) -
setErrMsg
-
getErrMsg
-
observeDynTabEvent
Receives DynTab lifecycle events (dynTabAdded, dynTabRemoved, dynTabSelected).This is NOT a CDI
@Observesmethod! It is called directly fromDynTabManager.fireDynTabEvent(dyntabs.DynTabCDIEvent)which iterates through all active tabs, sets the correct TabScope for each tab, and calls this method on the corresponding bean.Why not CDI @Observes? CDI can only see beans in the currently active tab scope. If tab r1 is active and HomeBean exists in r0, CDI would create a NEW HomeBean instance in r1 (wrong!) instead of using the existing one from r0.
- Specified by:
observeDynTabEventin interfaceDyntabBeanInterface- Parameters:
dynTabEvent- the tab lifecycle event to handle
-
onDynTabAdded
-
onDynTabRemoved
-
onDynTabSelected
-
onThisTabSelected
protected void onThisTabSelected() -
observeApplicationEvent
Receives application events (inter-tab communication). Called directly from DynTabManager - same reason asobserveDynTabEvent(dyntabs.DynTabCDIEvent).- Specified by:
observeApplicationEventin interfaceDyntabBeanInterface
-
onApplicationMessage
-
onJobFlowReturn
-
sendMessageToAppModule
Sends a message to another app module (DynTab) via DynTabManager. UsesDynTabManager.fireApplicationEvent(dyntabs.ApplicationCDIEvent)which iterates through tabs directly instead of the CDI @Observes mechanism. -
closeAndReturnValueToCaller
-
closeAndSelectCaller
public void closeAndSelectCaller() -
closeCurrentTab
public void closeCurrentTab() -
getCallerID
the callerID is a special param, signaling that this JobFlow is called from another JobFlow This is a uniqueIdentifier of calling JobFlow- Returns:
-
sendMessageToAllAppModules
-
getUniqueIdentifier
- Specified by:
getUniqueIdentifierin interfaceDyntabBeanInterface
-
callViewActivity
- Specified by:
callViewActivityin interfaceDyntabBeanInterface
-
setAccessDenied
public void setAccessDenied(boolean accessDenied) -
accessPointMethod
Called when the tab is opened. Subclasses override this for custom initialization logic. -
callAccessPointMethod
public void callAccessPointMethod()WrapsaccessPointMethod(java.util.Map)with error handling.Note: This method is NOT called for initial tabs (loaded during startup), because those do not go through
DynTabManager.addTab(). This is acceptable since initial tabs are visible to everyone.Cannot be
finalbecause CDI interceptors need to proxy it.- Specified by:
callAccessPointMethodin interfaceDyntabBeanInterface
-
callMethodActivity
- Specified by:
callMethodActivityin interfaceDyntabBeanInterface
-
setActive
Deprecated.The active flag is no longer needed for @TabScoped beans since the bean is destroyed together with the tab. Kept for compatibility.- Specified by:
setActivein interfaceDyntabBeanInterface
-
getActive
Deprecated.The active flag is no longer needed for @TabScoped beans.- Specified by:
getActivein interfaceDyntabBeanInterface
-
exitPointMethod
Called when the tab is closed. Subclasses override this for custom cleanup logic. -
callExitPointMethod
public void callExitPointMethod()- Specified by:
callExitPointMethodin interfaceDyntabBeanInterface
-
getDynTabId
- Specified by:
getDynTabIdin interfaceDyntabBeanInterface
-
setDynTab
- Specified by:
setDynTabin interfaceDyntabBeanInterface
-
getDynTab
- Specified by:
getDynTabin interfaceDyntabBeanInterface
-
removeAppendToBodyElement
-
hideWidgetInDynTab
-
showWidgetInDynTab
-
filterTableInDynTab
-
clearTableFiltersInDynTab
-