You can add a tab to an existing tab set, or you can create a tab set for your own page. One way to add a tab or tab set is to use an integration point of type org.glassfish.admingui:serverInstTab, which adds a tab to the tab set on the main Application Server page of the Administration Console. You can also create sub-tabs. Once again, the parentId element specifies where to place the tab or tab set.
In the example, the following integration-point element adds a new tab on the main Application Server page of the Administration Console:
<integration-point id="sampleTab" parentId="serverInstTabs" type="org.glassfish.admingui:serverInstTab" priority="500" content="sampleTab.jsf" />
This example specifies the following values:
The id value, sampleTab, specifies the integration point ID.
The parentId value, serverInstTabs, specifies the tab set associated with the server instance. The Application Server page is the only one of the default Administration Console pages that has a tab set.
The type value, org.glassfish.admingui:serverInstTab, specifies the integration point type as a tab associated with the server instance.
The priority value, 500, specifies the order of the tab within the tab set. This value is optional.
The content value, sampleTab.jsf, specifies the JavaServer Faces page that displays the tab.
The following integration-point elements add a new tab with two sub-tabs, also on the main Application Server page of the Administration Console:
<integration-point id="sampleTabWithSubTab" parentId="serverInstTabs" type="org.glassfish.admingui:serverInstTab" priority="300" content="sampleTabWithSubTab.jsf" /> <integration-point id="sampleSubTab1" parentId="sampleTabWithSubTab" type="org.glassfish.admingui:serverInstTab" priority="300" content="sampleSubTab1.jsf" /> <integration-point id="sampleSubTab2" parentId="sampleTabWithSubTab" type="org.glassfish.admingui:serverInstTab" priority="400" content="sampleSubTab2.jsf" />
These examples specify the following values:
The id values, sampleTabWithSubTab, sampleSubTab1, and sampleSubTab2, specify the integration point IDs for the tab and its sub-tabs.
The parentId of the new tab, serverInstTabs, specifies the tab set associated with the server instance. The parentId of the two sub-tabs, sampleTabWithSubTab, is the id value of this new tab.
The type value, org.glassfish.admingui:serverInstTab, specifies the integration point type for all the tabs as a tab associated with the server instance.
The priority values specify the order of the tabs within the tab set. This value is optional. In this case, the priority value for sampleTabWithSubTab is 300, which is higher than the value for sampleTab. That means that sampleTabWithSubTab appears to the left of sampleTab in the Administration Console. The priority values for sampleSubTab1 and sampleSubTab2 are 300 and 400 respectively, so sampleSubTab1 appears to the left of sampleSubTab2.
The content values, sampleTabWithSubTab.jsf, sampleSubTab1.jsf, and sampleSubTab2.jsf, specify the JavaServer Faces pages that display the tabs.
A JavaServer Faces page for a tab uses the JSFTemplating tag sun:tab. This tag provides all the capabilities of the Project Woodstock tag webuijsf:tab.
In the example, the sampleTab.jsf file has the following content:
<sun:tab id="sampleTab" immediate="true" text="Sample First Tab"> <!command setSessionAttribute(key="serverInstTabs" value="sampleTab"); redirect(page="#{request.contextPath}/page/ tabPage.jsf?name=Sample%20First%20Tab"); /> </sun:tab>
In the actual file there are no line breaks in the redirect value.
In your own JavaServer Faces pages, specify the attributes of this tag as follows:
A unique identifier for the tab, in this case sampleTab.
If set to true, event handling for this component should be handled immediately (in the Apply Request Values phase) rather than waiting until the Invoke Application phase.
The tab name that appears in the tab set.
The JSFTemplating page displays tab content differently from the way the page for a node displays node content. It invokes two handlers for the command event: setSessionAttribute and redirect. The redirect handler has the same effect for a tab that the url attribute has for a node. It invokes a simple JavaServer Faces page called tabPage.jsf, in the src/main/resources/page/ directory, passing the text “Sample First Tab” to the page in a name parameter.
The sampleSubTab1.jsf and sampleSubTab2.jsf files are almost identical to sampleTab.jsf. The most important difference is that each sets the session attribute serverInstTabs to the base name of the JavaServer Faces file that corresponds to that tab:
setSessionAttribute(key="serverInstTabs" value="sampleTab");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab1");
setSessionAttribute(key="serverInstTabs" value="sampleSubTab2");