Package dyntabs
Class DynTabTracker
java.lang.Object
dyntabs.DynTabTracker
- All Implemented Interfaces:
Serializable
Tracks the state of all dynamic tabs in the current view (session).
This is a @ViewScoped bean that maintains the complete list of DynTab instances
(both active and inactive), the tab-by-ID lookup map, the selected tab ID, and the count
of active tabs.
Tab list structure:
tabList[0..numActive)contains the active (visible) tabstabList[numActive..n)contains the inactive (placeholder) tabs
When a tab is closed, it is not removed from the list but moved to the inactive region. When a tab is opened, an inactive placeholder is reused and moved to the active region.
Initial tabs are loaded in init() based on DynTabConfig.getInitialTabNames(),
using DynTabRegistry to create the DynTab instances.
- Author:
- DynTabs
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringcreateId(int n) Creates a DynTab ID using the pattern"r" + n.Returns the list of tabs that are currently active on screen.Returns the maximum number of tabs the user can open.intintReturns the number of tabs defined in the template.Returns the map containing all tabs indexed by their IDs.voidinit()voidsetNumActive(int numActive) voidsetSelectedTabId(String selectedTabId)
-
Constructor Details
-
DynTabTracker
public DynTabTracker()
-
-
Method Details
-
setNumActive
public void setNumActive(int numActive) -
getNumActive
public int getNumActive() -
getTabMap
Returns the map containing all tabs indexed by their IDs.Used in the XHTML template for the
renderedattribute ofp:tab:<p:tab id="r0" rendered="#{dynTabManager.tabMap['r0'].active}" />- Returns:
- the map containing all tabs (active and inactive) indexed by their IDs
-
init
@PostConstruct public void init() -
createId
Creates a DynTab ID using the pattern"r" + n. These IDs also serve as thep:tabcomponent IDs in the XHTML template.- Parameters:
n- the tab index number- Returns:
- the tab ID (e.g. "r0", "r1")
-
setSelectedTabId
-
getSelectedTabId
-
getTabList
-
getActiveTabList
Returns the list of tabs that are currently active on screen. This list is modifiable and can be used to change the order of the tabs on the screen. This list is backed by, so make sure not to modify both structurally at the same time.getTabList()- Returns:
- the list of tabs that are currently active on screen
- See Also:
-
getNumberOfTabsDefined
public int getNumberOfTabsDefined()Returns the number of tabs defined in the template. Now sourced fromDynTabConfiginstead of the legacy managed-property.- Returns:
- the total number of tab slots (active + placeholder)
-
getMaxNumberOfTabs
Returns the maximum number of tabs the user can open. Now sourced fromDynTabConfig.- Returns:
- the maximum number of open tabs allowed
-