public static final class UIFormPaneWithTabs.Tab extends Object
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);
UIFormPaneWithTabs.addTab(Tab)
,
UIFormWriter.addJS_hideTab(String)
,
UIFormWriter.addJS_showTab(String)
Constructor and Description |
---|
Tab(UIFormLabelSpec aTitle,
UIFormPane aPane) |
Tab(UIFormPane aPane)
Constructs a tab without title.
|
Modifier and Type | Method and 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.
|
public Tab(UIFormPane aPane)
This constructor is interesting for the first tab, a default title ("Main") will therefore be assigned.
public Tab(UIFormLabelSpec aTitle, UIFormPane aPane)
public void setId(String id)
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.
id
- the id to set for the tab.public String getId()
null
.setId(String)
public UIFormLabelSpec getTitle()
null
.public void setTitle(UIFormLabelSpec aTitle)
aTitle
- the new titlepublic UIFormPane getPane()
public void setInitiallyHidden()
The tab can be shown or hidden by a JavaScript function and the tab id.
public boolean isInitiallyHidden()
true
if this tab will be initially hidden on the browser screen,
false
if this tab will be initially displayedsetInitiallyHidden()