Sun GlassFish Enterprise Server v3 Prelude Add-On Component Development Guide

Appendix B Template Reference

The Administration Console provides a set of page extensible templates to make it easier to provide Administration Console content for your add-on component. This appendix provides information about these templates.

In an Enterprise Server distribution in which both Enterprise Server and the Administration Console are running, these templates can be found in the directory domain-dir/generated/jsp/__admingui/loader/templates.

To use a template, specify it in the template attribute of the composition directive for your page.

The following topics are addressed here:

Base Template

The base template, baseTemplate.tpl, is included by the other templates.

Parent

None.

Parameters

The baseTemplate.tpl file takes the following parameters. You can specify these parameters as attributes to the composition tag for any JSF page that includes baseTemplate.tpl.

i18nBundle

The name of the resource bundle for internationalization. Specify #{i18n} to access the values.

helpBundle

The name of the resource bundle for help. Specify #{help} to access the values.

pageTitle

The name of the page. Will be used in both the head element and as the page header.

helpText

The inline help text to be displayed under the page header.

Defines

You can use define tags with the following name values.

headExtra

Use this value if your page needs to add content to the head element.

titleExtra

Use this value if you need to add any extra child components to the sun:title custom tag.

pageButtonsTop

Use this value if you need to add child components to the pageButtonsTop facet of the sun:title custom tag.

content

This value is required, and describes what the body of the page will be. The body content is usually defined by child templates, but if you use or extend this template directly, you must specify this value.

Property Sheet Template

Use the property sheet template, propertySheetTemplate.tpl, to specify a property sheet.

Parent

baseTemplate.tpl

Parameters

The propertySheetTemplate.tpl file takes the following parameter in addition to those listed in Base Template:

hasRequiredFields

If this parameter is set to "true" (the String value, not a Boolean, due to conversion errors with the component), the following legend will appear at the top right of the page:


* Indicates required field
Defines

You can use define tags with the following name values, in addition to those listed in Base Template:

properties

Use this value to list each sun:property custom tag needed on the page.

propertySheets

Use this value if you need more than one property sheet. Provide a sun:propertySheetSection custom tag for each sheet you need, along with the sun:property custom tag for each section.


Example B–1 Example Page That Uses a Single Property Sheet

The following page uses the property sheet template to specify a property sheet.

<!composition template="/templates/propertySheetTemplate.tpl"
                i18nBundle="com.foo.resources.Messages"
                helpBundle="com.foo.resources.Help"
                pageTitle="Using the Base Templates"
                helpText="This file uses the property sheet template.">
    <!define name="properties">
        <sun:property id="propOne" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" label="Property One">
            <sun:dropDown id="propOneDD" selected="#{propOne}" 
                          labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
        </sun:property>
        <sun:property id="propTwo" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" label="Property Two">
            <sun:dropDown id="propTwoDD" selected="#{propTwo}" 
                          labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
        </sun:property>
    </define>
</composition>


Example B–2 Example Page That Uses Multiple Property Sheets

The following page uses the property sheet template to specify a set of property sheets.

<!composition template="/templates/propertySheetTemplate.tpl"
                i18nBundle="com.foo.resources.Messages"
                helpBundle="com.foo.resources.Help"
                pageTitle="Using the Base Templates"
                helpText="This page uses two property sheets.">
    <!define name="propertySheets">
        <sun:propertySheetSection>
            <sun:property id="propOne" labelAlign="left" noWrap="#{true}" 
                          overlapLabel="#{false}" label="Property One">
                <sun:dropDown id="propOneDD" selected="#{propOne}" 
                              labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
            </sun:property>
            <sun:property id="propTwo" labelAlign="left" noWrap="#{true}" 
                          overlapLabel="#{false}" label="Property Two">
                <sun:dropDown id="propTwoDD" selected="#{propTwo}" 
                              labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
            </sun:property>
        </sun:propertySheetSection>
        <sun:propertySheetSection>
            <sun:property id="propThree" labelAlign="left" noWrap="#{true}" 
                          overlapLabel="#{false}" label="Property Three">
                <sun:dropDown id="propThreeDD" selected="#{propThree}" 
                              labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
            </sun:property>
            <sun:property id="propFour" labelAlign="left" noWrap="#{true}" 
                          overlapLabel="#{false}" label="Property Four">
                <sun:dropDown id="propFourDD" selected="#{propFour}" 
                              labels={"foo" "bar" "baz"} values={"FOO" "BAR" "BAZ"} />
            </sun:property>
        </sun:propertySheetSection>
    </define>
</composition>

Property Table Template

Use the property table template, propertyTableTemplate.tpl, to specify a property table.

Parent

baseTemplate.tpl

Parameters

The propertyTableTemplate.tpl file takes the following parameter in addition to those listed in Base Template.

tableList

A List<Map> that holds the table data. This List can be created by passing a Map<String,PropertyConfig> or Map<String,String> to the handler getTableList.

Defines

See defines for Base Template.

Sheet Table Template

Use the sheet table template, propSheetPropTableTemplate.tpl, to specify a page that contains both a property sheet and a property table. This template is an amalgamation of propertySheetTemplate.tpl and propertyTableTemplate.tpl, so any requirements for those two templates apply here as well. This template will display the property sheet above the table.

Parent

baseTemplate.tpl

Parameters

See parameters for Base Template, Property Sheet Template, and Property Table Template.

Defines

See defines for Base Template and Property Sheet Template.

Administration Console Property Sheet Template

Use the Administration Console property sheet template, adminConsolePropertySheet.tpl, to specify a property sheet that adds support for manipulating an AMXConfig object. (AMX refers to Appserver Management EXtensions.) The loading and saving of values, including the retrieval of default values, is automatic with this template.

Parent

propertySheetTemplate.tpl

Parameters

The adminConsolePropertySheet.tpl file takes the following parameters, in addition to those specified in Base Template and Property Sheet Template.

configName

The id of the Enterprise Server configuration.

amxConfigAttributes

A List detailing which attributes of the AMXConfig object are to be handled on this page.

Defines

See defines for Base Template and Property Sheet Template.


Example B–3 Example That Uses an Administration Console Property Sheet

The following page uses the Administration Console property sheet template to specify a property sheet.

<!initPage 
    setResourceBundle(key="web" bundle="org.glassfish.web.admingui.Strings")
/>
<!composition template="/templates/adminConsolePropertySheet.tpl" 
              pageTitle="$resource{web.monitoring.Title}" 
              helpText="$resource{web.monitoring.PageHelp}"
              helpBundle="org.glassfish.web.admingui.Helplinks"
              amxConfigName="monitoringServiceConfig.moduleMonitoringLevelsConfig"
              amxConfigAttributes={"HTTPService","webContainer", "JVM", "threadPool"}>
    <!define name="properties">
        <sun:property id="httpProp" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" label="$resource{web.monitoring.Http}">
            <sun:dropDown id="Http" selected="#{configMap['HTTPService']}" 
                          labels={"$resource{web.monitoring.Low}" 
                                  "$resource{web.monitoring.High}" 
                                  "$resource{web.monitoring.Off}"} 
                          values={"LOW" "HIGH" "OFF"} />
        </sun:property>
        <sun:property id="webProp" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" label="$resource{web.monitoring.Web}">
            <sun:dropDown id="Web" selected="#{configMap['webContainer']}" 
                          labels={"$resource{web.monitoring.Low}" 
                                  "$resource{web.monitoring.High}" 
                                  "$resource{web.monitoring.Off}"} 
                          values={"LOW" "HIGH" "OFF"} />
        </sun:property>
        <sun:property id="jvm" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" label="$resource{web.monitoring.Jvm}">
            <sun:dropDown id="Http" selected="#{configMap['JVM']}" 
                          labels={"$resource{web.monitoring.Low}" 
                                  "$resource{web.monitoring.High}" 
                                  "$resource{web.monitoring.Off}"} 
                          values={"LOW" "HIGH" "OFF"} />
        </sun:property>          
        <sun:property id="threadPool" labelAlign="left" noWrap="#{true}" 
                      overlapLabel="#{false}" 
                      label="$resource{web.monitoring.ThreadPool}"> 
            <sun:dropDown id="Web" selected="#{configMap['threadPool']}" 
                          labels={"$resource{web.monitoring.Low}" 
                                  "$resource{web.monitoring.High}" 
                                  "$resource{web.monitoring.Off}"} 
                          values={"LOW" "HIGH" "OFF"} />
        </sun:property>
        "<br /><br />
    </define>
</composition>

Administration Console Property Table Template

This template, adminConsolePropertyTable.tpl, extends the property table template, adding support for AMXConfig objects.

Parent

propertyTableTemplate.tpl

Parameters

See parameters for Base Template, Property Table Template, and Administration Console Property Sheet Template.

Defines

See defines for Base Template.

Administration Console Sheet Table Template

Use the Administration Console sheet table template, adminConsoleSheetTable.tpl, to specify a page that contains both a property sheet and a property table. This template extends the property sheet and property table templates, adding support for AMXConfig objects.

Parent

propSheetPropTableTemplate.tpl

Parameters

See parameters for Base Template, Property Sheet Template, Property Table Template, and Administration Console Property Sheet Template.

Defines

See defines for Base Template, Property Sheet Template, and Administration Console Property Sheet Template.