Templates for Admin Console

Back to AdminConsole V3

The GlassFish v3 Admin Console, in addition to providing integration points to use for extending the console, provides a set of page extensible templates to make writing the plugins easier. The table below describes each of these templates, with examples provided following the table.

name Parent Parameters Defines Notes
baseTemplate.tpl None <ul><li>i18nBundle - The name of the resource bundle for i18n. Values will be accessed via #
Unknown macro: {i18n}

</li><li>helpBundle - The name of the resource bundle for help. Values will be accessed via #

Unknown macro: {help}

</li><li>pageTitle - The name of the page. Will be used in both <head> and as the page header</li><li>helpText - This is the text that is displayed under the page header</li><li>bodyOnLoad - Any JavaScript code that needs to be executed when the body is loaded</li><li>helpKey - Defines the key used by the help system</li></ul>

<ul><li>headExtra - Use this !define if your page needs to add content to <head></li><li>titleExtra - Use this !define if you need to add any extra child components to <sun:title/></li><li>pageButtonsTop - Use this !define if you need to add child components to the pageButtonsTop facet of <sun:title/></li><li>formExtra - Use this !define to insert extra markup at the top of the form</li><li>titleExtra - This !define inserts extra content in the top of the sun:title on the page</li><li>pageButtonsTop - This !define allows the page author to provide content in the pageButtonsTop facet for sun:title</li><li>content - This !define is required, and describes what the body of the page will be. This will be defined by "child" templates, but, if you use or extend this template directly, you must make sure this is defined.</li><li>pageButtonsBottom - This !define allows the page author to provide content in the pageButtonsBottom facet for sun:title</li><li>htmlExtra - This !define allows the page author to insert extra HTML at the bottom of the page</li></ul>  
propertySheetTemplate.tpl baseTemplate.tpl <ul><li>hasRequiredFields - If this is set to "true" (the String, not a Boolean, due to conversion errors with the component), a legend will displayed at the top right of page saying "* Indicates required field"</li></ul> <ul><li>properties - In this !define one would list each <sun:property/> need on the page</li><li>propertySheets - If more than one property sheet is needed, this !define can be specified. If used, the page author must provided the <sun:propertySheetSection> component for each sheet desired, as well as the <sun:property/> for each section</li></ul>  
propertyTableTemplate.tpl baseTemplate.tpl <ul><li>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</li></ul>    
propSheetPropTableTemplate.tpl baseTemplate.tpl     This template is an amalgamation of propertySheetTemplate.tpl and propertyTableTable.tpl, so any requirements for those two templates apply here as well. This template will display the property sheet above the table.
adminConsolePropertySheet.tpl propertySheetTemplate.tpl <ul><li>configName - The id of the glassfish server configuration.</li><li>amxConfigAttributes - a List detailing which attributes of the AMXConfig object are to be handled on this page</li></ul>   This template extends the property sheet template, adding support for manipulating an AMXConfig object. The loading and saving of values, including the retrieval of default values, comes for free with this template.
adminConsolePropertyTable.tpl propertyTableTemplate.tpl <i>see adminConsolePropertySheet.tpl</i>   This template extends the property table template, adding support for AMXConfig objects.
adminConsolePropSheetPropTable.tpl propSheetPropTableTemplate.tpl <i>see adminConsolePropertySheet.tpl</i>   This template combines the AMX-enabled property sheet and table templates

Jspwiki style: table

Examples

baseTemplate.tpl

<!composition   layout="/templates/baseTemplate.tpl"
                i18nBundle="com.foo.resources.Messages"
                helpBundle="com.foo.resources.Help"
                pageTitle="Using the Base Templates"
                helpText="The base template is meant to be extended and not used directly, but you can if you need to.">
    <!define name="content">
        "An input field
        <h:inputText value="#{myValue}"/>
    </define>
</composition>

propertySheetTemplate.tpl

A single sheet:

<!composition   layout="/templates/propertySheetTemplate.tpl"
                i18nBundle="com.foo.resources.Messages"
                helpBundle="com.foo.resources.Help"
                pageTitle="Using the Base Templates"
                helpText="The base template is meant to be extended and not used directly, but you can if you need to.">
    <!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>

Multiple sheets:

<!composition   layout="/templates/propertySheetTemplate.tpl"
                i18nBundle="com.foo.resources.Messages"
                helpBundle="com.foo.resources.Help"
                pageTitle="Using the Base Templates"
                helpText="The base template is meant to be extended and not used directly, but you can if you need to.">
    <!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>

propertyTableTemplate.tpl

<!initPage
    getDataList(TableList=>$attribute{tableList}); // This Handler does not exist, and is only for demonstration purposes
/>
<!composition template="/templates/properyTableTemplate.tpl">
</composition>

propSheetPropTableTemplate.tpl

<!initPage
    if (!#{pageSession.configName}) {
        getRequestValue(key="configName" value=>$page{configName});
    }
    getConfigConfig(configName="#{configName}" configConfig=>$attribute{config}); 
    setAttribute(key="mmlConfig" value="#{config.monitoringServiceConfig.moduleMonitoringLevelsConfig}");
    createAmxConfigMap(moduleConfig="#{mmlConfig}", properties={"HTTPService","webContainer"}, configMap=>$pageSession{configMap});
/>
<!composition template="propSheetPropTableTemplate.tpl" 
              pageTitle="$resource{web.monitoring.Title}" 
              helpText="$resource{web.monitoring.PageHelp}"
              amxConfigName="monitoringServiceConfig.moduleMonitoringLevelsConfig"
              amxConfigAttributes={'HTTPService','webContainer'}
              loadDefaultsHandler='getDefaultConfigurationValue(moduleConfig="#{amxConfig}", key="HTTPService", defaultValue=>$attribute{httpService});
                            getDefaultConfigurationValue(moduleConfig="#{amxConfig}", key="WebContainer", defaultValue=>$attribute{webContainer});
                            
                            setValueExpression(expression="#{configMap.HTTPService}", value="hello");
                            setValueExpression(expression="#{configMap.webContainer}", value="$attribute{webContainer}");'>
    <!beforeCreate 
        //setResourceBundle(key="web" bundle="org.glassfish.web.admingui.Strings")
    />
    <!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>                               
        "<br /><br />
    </define>
</composition>

adminConsolePropertySheet.tpl

<!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>

adminConsolePropertyTable.tpl

<!initPage 
    setResourceBundle(key="web" bundle="org.glassfish.admingui.core.Strings")
/>
<!composition template="/templates/adminConsolePropertyTable.tpl"
    pageTitle="$resource{web.headings.webGeneral}"
    helpBundle="org.glassfish.admingui.core.Helplinks"
    helpKey="$resource{help.webContainerGeneral}"
    amxConfigName="webContainerConfig">
</composition>

adminConsoleSheetTable.tpl

<!initPage
    setResourceBundle(key="web" bundle="org.glassfish.admingui.core.Strings")
/>
<!composition template="/templates/adminConsolePropSheetPropTable.tpl"
    pageTitle="$resource{web.headings.webGeneral}"
    helpBundle="org.glassfish.admingui.core.Helplinks"
    helpKey="$resource{help.webContainerGeneral}"
    amxConfigName="webContainerConfig.sessionConfig.sessionManagerConfig.managerPropertiesConfig"
    // sessionPropertiesConfig
    // sessionManagerConfig

    amxConfigAttributes={"reapIntervalInSeconds","maxSessions","sessionFileName","sessionIdGeneratorClassname"}>
    <!define name="properties">
        <sun:property id="ReapIntervalProp"  labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.webManager.reapIntervalLabel}" helpText="$resource{i18n.webManager.reapIntervalHelp}" >
            <sun:textField id="ReapInterval" styleClass="integer" columns="$int{20}" text="#{configMap['reapInterval']}" />
            <sun:staticText id="sec" style="padding: 8pt" text="$resource{i18n.common.Seconds}"/>
        </sun:property>
        <sun:property id="MaxSessionsProp"  labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.webManager.maxSessionsLabel}" >
            <sun:textField id="MaxSessions" styleClass="integer" columns="$int{20}" text="#{configMap['maxSessions']}" />
        </sun:property>
        <sun:property id="SessFileNameProp"  labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.webManager.sessFileNameLabel}" helpText="$resource{i18n.webManager.sessFileNameHelp}" >
            <sun:textField id="SessFileName" columns="$int{50}" text="#{configMap['sessFileName']}" />
        </sun:property>
        <sun:property id="SessionIdGenProp"  labelAlign="left" noWrap="#{true}" overlapLabel="#{false}" label="$resource{i18n.webManager.sessionIdGenLabel}" helpText="$resource{i18n.webManager.sessionIdGenHelp}" >
            <sun:textField id="SessionIdGen" columns="$int{50}" text="#{configMap['sessionIdGeneratorClassname']}" />
        </sun:property>
    </define>
</composition>