Package dyntabs
Class DynTabConfig
java.lang.Object
dyntabs.DynTabConfig
Abstract configuration class that defines which tabs are opened at startup
and the maximum number of tabs allowed.
To use DynTabs, create an @ApplicationScoped subclass of this class
in your application. For example, given a HomeBean annotated with
@DynTab:
@Named
@TabScoped
@DynTab(name = "HomeDynTab",
title = "Welcome",
includePage = "/WEB-INF/include/home/home.xhtml",
closeable = false)
public class HomeBean implements DyntabBeanInterface {
// ...
}
Override getInitialTabNames() to specify which tabs open on startup:
@ApplicationScoped
public class MyAppTabConfig extends DynTabConfig {
@Override
public List<String> getInitialTabNames() {
return List.of("HomeDynTab");
}
@Override
public int getMaxNumberOfTabs() {
return 7;
}
}
Startup call chain for initial tabs:
- CDI bootstrap:
DynTabDiscoveryExtensionscans@DynTabannotations and stores discovered tabs - User opens the page:
DynTabTrackeris created (@ViewScoped) DynTabTracker.init()callsconfig.getInitialTabNames()to get the list of tab names (e.g.["HomeDynTab"])- For each name, calls
DynTabRegistry.createTab(String)which invokes the registered Supplier to create a fresh DynTab instance with all annotation data - The tab gets an ID (r0), is set to active, and its CDI bean is resolved
- Author:
- DynTabs
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the names of tabs to open when the application starts.intReturns the maximum number of tabs that can be open simultaneously.
-
Constructor Details
-
DynTabConfig
public DynTabConfig()
-
-
Method Details
-
getInitialTabNames
Returns the names of tabs to open when the application starts. These tabs must be previously registered inDynTabRegistry(either via@DynTabannotation or manualregister()call).- Returns:
- list of registered tab names (e.g.
List.of("HomeDynTab", "DashboardDynTab"))
-
getMaxNumberOfTabs
public int getMaxNumberOfTabs()Returns the maximum number of tabs that can be open simultaneously. Default is 7. Override to change.- Returns:
- the maximum number of open tabs
-