Oracle GlassFish Server 3.0.1 Add-On Component Development Guide

Adding a Node to the Navigation Tree

You can add a node to the navigation tree, either at the top level or under another node. To add a node, use an integration point of type org.glassfish.admingui:navNode. Use the parentId attribute to specify where the new node should be placed. Any tree node, including those added by other add-on components, can be specified. Examples include the following:

tree

At the top level

applicationServer

Under the GlassFish Server node

applications

Under the Applications node

resources

Under the Resources node

configuration

Under the Configuration node

webContainer

Under the Web Container node

httpService

Under the HTTP Service node


Note –

The webContainer and httpService nodes are available only if you installed the web container module for the Administration Console (the console-web-gui.jar OSGi bundle).


If you do not specify a parentId, the new content is added to the root of the integration point, in this case the top level node, tree.


Example 3–2 Example Tree Node Integration Point

For example, the following integration-point element uses a parentId of tree to place the new node at the top level.

        <integration-point 
                id="sampleNode" 
                parentId="tree" 
                type="org.glassfish.admingui:treeNode" 
                priority="200" 
                content="sampleNode.jsf" 
        />

This example specifies the following values in addition to the parentId:

The example console-config.xml file provides other examples of tree nodes under the Resources and Configuration nodes.

Creating a JavaServer Faces Page for Your Node

A JavaServer Faces page for a tree node uses the tag sun:treeNode. This tag provides all the capabilities of the Project Woodstock tag webuijsf:treeNode.


Example 3–3 Example JavaServer Faces Page for a Tree Node

In the example, the sampleNode.jsf file has the following content:

<sun:treeNode 
        id="treeNode1"
        text="SampleTop"
        url="/sample/page/testPage.jsf?name=SampleTop"
        imageURL="/resource/sample/images/sample.png"
        >
    <sun:treeNode 
            id="treeNodeBB"
            text="SampleBB"
            url="/sample/page/testPage.jsf?name=SampleBB"
            imageURL="resource/sample/images/sample.png" />
</sun:treeNode>

This file uses the sun:treenode tag to specify both a top-level tree node and another node nested beneath it. In your own JavaServer Faces pages, specify the attributes of this tag as follows:

id

A unique identifier for the tree node.

text

The node name that appears in the tree.

url

The location of the JavaServer Faces page that appears when you click the node. In the example, most of the integration points use a very simple JavaServer Faces page called testPage.jsf, which is in the src/main/resources/page/ directory. Specify the integration point id value as the root of the URL; in this case, it is sample (see Specifying the ID of an Add-On Component). The rest of the URL is relative to the src/main/resources/ directory, where sampleNode.jsf resides.

The url tag in this example passes a name parameter to the JavaServer Faces page.

imageURL

The location of a graphic to display next to the node name. In the example, the graphic is always sample.png, which is in the src/main/resources/images/ directory. The URL for this image is an absolute path, /resource/sample/images/sample.png, where sample in the path is the integration point id value (see Specifying the ID of an Add-On Component).