Package swingtree.api.mvvm
Interface TabSupplier<M>
- Type Parameters:
M
- the type of the model used to create the tab
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Functional interface for dynamically creating tabs based on a provided model.
This interface is specifically designed for the UIForTabbedPane.addAll(Vals, TabSupplier)
method
in the UIForTabbedPane
class.
Usage:
UI.panel()
.add(
UI.tabbedPane().addAll(tabs, model ->
switch(model.type()) {
case LOGIN -> UI.tab("Login").add(..);
case ABOUT -> UI.tab("About").add(..);
case SETTINGS -> UI.tab("Settings").add(..);
}
)
)
-
Method Summary
Modifier and TypeMethodDescriptioncreateTabFor
(M tabViewModel) Creates a tab based on the given model.
-
Method Details
-
createTabFor
Creates a tab based on the given model.- Parameters:
tabViewModel
- the model used to create the tab- Returns:
- the constructed tab
- Throws:
Exception
- if an error occurs during tab creation
-