Class Tab

java.lang.Object
com.oorian.html.layout.Tab
All Implemented Interfaces:
ClientEventListener, MouseClickListener, EventListener

public class Tab extends Object implements MouseClickListener
An individual tab within a TabbedLayout.

Tab consists of two parts:

  • Header - The clickable tab button/label
  • Content - The panel content shown when this tab is active

Usage:


 // Create a tab
 Tab tab = new Tab("Settings", settingsPanel);

 // Or with custom header
 Tab tab = new Tab();
 tab.setHeader(customHeader);
 tab.setContent(content);

 // Add to tabbed layout
 tabbedLayout.addTab(tab);
 
Since:
2025
Version:
1.0
Author:
Marvin P. Warble Jr.
See Also:
  • Constructor Details

    • Tab

      public Tab()
      Constructs an empty Tab.
    • Tab

      public Tab(String label, Element<?> contentElement)
      Constructs a Tab with the specified label and content.
      Parameters:
      label - the tab label
      contentElement - the content element
  • Method Details

    • setLabel

      public Tab setLabel(String label)
      Sets the tab label text.
      Parameters:
      label - the label text
      Returns:
      this Tab for method chaining
    • setHeader

      public Tab setHeader(Element<?> headerElement)
      Sets a custom header element.
      Parameters:
      headerElement - the header element
      Returns:
      this Tab for method chaining
    • setContent

      public Tab setContent(Element<?> contentElement)
      Sets the tab content.
      Parameters:
      contentElement - the content element
      Returns:
      this Tab for method chaining
    • isActive

      public boolean isActive()
      Checks if this tab is currently active.
      Returns:
      true if active, false otherwise
    • getHeader

      public Div getHeader()
      Returns the header element.
      Returns:
      the header div
    • getContent

      public Div getContent()
      Returns the content element.
      Returns:
      the content div
    • onEvent

      public void onEvent(MouseClickedEvent event)
      Handles click events on the tab header.
      Specified by:
      onEvent in interface MouseClickListener
      Parameters:
      event - the mouse click event
    • setHeaderPadding

      public Tab setHeaderPadding(int padding)
      Sets padding for the header.
      Parameters:
      padding - the padding in pixels
      Returns:
      this Tab for method chaining
    • setHeaderPadding

      public Tab setHeaderPadding(String padding)
      Sets padding for the header.
      Parameters:
      padding - the padding value (e.g., "0.75rem 1rem")
      Returns:
      this Tab for method chaining
    • setContentPadding

      public Tab setContentPadding(int padding)
      Sets padding for the content area.
      Parameters:
      padding - the padding in pixels
      Returns:
      this Tab for method chaining
    • setContentPadding

      public Tab setContentPadding(String padding)
      Sets padding for the content area.
      Parameters:
      padding - the padding value (e.g., "1rem")
      Returns:
      this Tab for method chaining