Package com.orchestranetworks.ui.form

# Class UIFormPaneWithTabs.Tab

java.lang.Object
com.orchestranetworks.ui.form.UIFormPaneWithTabs.Tab

Enclosing class:
  UIFormPaneWithTabs

public static final class UIFormPaneWithTabs.Tab extends Object
This class offers a tab to have a `UIFormLabelSpec` for the title and thus can have a `UIFormLabelSpec.DocumentationPane`.

It is designed to be added to a `UIFormPaneWithTabs` by using the method `UIFormPaneWithTabs.addTab(Tab)`.

The `id` can be set, and be used to `hide` or `show` a tab via JavaScript. The initial hiding state `can be set`.

Example of implementation:

     UIFormPaneWithTabs aPaneWithTabs = new UIFormPaneWithTabs();

     aPaneWithTabs.addTab("Tab before example tab", new UITabBeforeExampleTabFormPane());

     String exampleTabId = "exampleTabId";

     Tab exampleTab = new Tab(new UIFormLabelSpec(new DocumentationPane(
            "Example tab documentation pane"), "Example tab title"), new UIExampleTabFormPane());
     exampleTab.setId(exampleTabId);
     exampleTab.setInitiallyHidden();
     aPaneWithTabs.addTab(exampleTab);

     String showExampleTabJSfnName = "displayExampleTab";
     String hideExampleTabJSfnName = "hideExampleTab";

     UIButtonSpecJSActionToggle toggleExampleTabDisplay = new UIButtonSpecJSActionToggle(
            UserMessage.createInfo("Display example tab"),
            showExampleTabJSfnName + "()",
            hideExampleTabJSfnName + "()");
     aWriter.addButtonJavaScriptToggle(toggleExampleTabDisplay);

     aWriter.addJS("function ").addJS(showExampleTabJSfnName).addJS("(){");
     aWriter.addJS_showTab(exampleTabId);
     aWriter.addJS("}");

     aWriter.addJS("function ").addJS(hideExampleTabJSfnName).addJS("(){");
     aWriter.addJS_hideTab(exampleTabId);
     aWriter.addJS("}");

     aWriter.includePane(aPaneWithTabs);

Since:
  5.7.0
See Also:
  - `UIFormPaneWithTabs.addTab(Tab)`
  - `UIFormWriter.addJS_hideTab(String)`
  - `UIFormWriter.addJS_showTab(String)`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Tab(UIFormPane aPane)`
  Constructs a tab without title.
  `Tab(UIFormLabelSpec aTitle, UIFormPane aPane)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getId()`
  `UIFormPane`
  `getPane()`
  `UIFormLabelSpec`
  `getTitle()`
  `boolean`
  `isInitiallyHidden()`
  `void`
  `setId(String id)`
  Sets an id for the tab.
  `void`
  `setInitiallyHidden()`
  Sets this tab to initially hidden on the browser screen.
  `void`
  `setTitle(UIFormLabelSpec aTitle)`
  Changes the tab title.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Tab

    public Tab(UIFormPane aPane)
    Constructs a tab without title.

    This constructor is interesting for the first tab, a default title ("Main") will therefore be assigned.

  - ### Tab

    public Tab(UIFormLabelSpec aTitle, UIFormPane aPane)

- ## Method Details

  - ### setId

    public void setId(String id)
    Sets an id for the tab.

    The id attribute must respect the W3C Recommendation (in particular, by being unique in the page). See https://www.w3.org/TR/REC-html40/struct/global.html#adef-id for more information.

    If no id is specified, an id will be generated.

    If the list of tabs is dynamic to the record state (or an extra info), please set a fixed id. Otherwise, this tab won't be reselected after page reloading, record saving, etc.

    Parameters:
      `id` - the id to set for the tab.
    Since:
      5.8.0

  - ### getId

    public String getId()
    Returns:
      the id previously defined, or `null`.
    See Also:
      - `setId(String)`

  - ### getTitle

    public UIFormLabelSpec getTitle()
    Returns:
      the title previously defined, or `null`.

  - ### setTitle

    public void setTitle(UIFormLabelSpec aTitle)
    Changes the tab title.
    Parameters:
      `aTitle` - the new title
    Since:
      5.8.0

  - ### getPane

    public UIFormPane getPane()
    Returns:
      the pane defined in the constructor

  - ### setInitiallyHidden

    public void setInitiallyHidden()
    Sets this tab to initially hidden on the browser screen.

    The tab can be shown or hidden by a JavaScript function and the tab id.

    See Also:
      - `UIFormWriter.addJS_hideTab(String)`
      - `UIFormWriter.addJS_showTab(String)`

  - ### isInitiallyHidden

    public boolean isInitiallyHidden()
    Returns:
      `true` if this tab will be initially hidden on the browser screen, `false` if this tab will be initially displayed
    See Also:
      - `setInitiallyHidden()`