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.

@FunctionalInterface public interface TabSupplier<M>
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(..);
              }
          )
      )
 

See:
UIForTabbedPane.addAll(Vals, TabSupplier),

  • Method Summary

    Modifier and Type
    Method
    Description
    createTabFor(M tabViewModel)
    Creates a tab based on the given model.
  • Method Details

    • createTabFor

      Tab createTabFor(M tabViewModel) throws Exception
      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