Jetspeed provides layout components for defining the layout of a portal page. In this tutorial we will concentrate on components used to create navigational menus. Components are defined by editing the PSML file with a text editor, or using the Jetspeed Customizer, which makes portal layout much easier.
Before seeing how easy it is with the customizer, look at the PSML file for the anonymous user.
<?xml version="1.0" encoding="iso-8859-1"?> <portlets id="100" xmlns="http://xml.apache.org/jetspeed/2000/psml"> <metainfo> <title>Welcome Page</title> </metainfo> <control name="TabControl"/> <controller name="CardPortletController"/> <portlets id="101"> <metainfo> <title>Basic Tutorials</title> </metainfo> </portlets> <portlets id="102"> <metainfo> <title>Advanced Tutorials</title> </metainfo> </portlets> <portlets id="103"> <metainfo> <title>Jetspeed Portlets</title> </metainfo> </portlets> <portlets id="104"> <controller name="OneColumn"/> <metainfo> <title>Referenced Portlets</title> </metainfo> <reference path="group/apache/media-type/html/page/default"/> <reference path="group/Jetspeed/media-type/html/page/default"/> </portlets> </portlets>
There are several types of elements in the layout of a PSML file. Here are the common navigational components:
<portlets> defines a pane <controller> defines the type of layout. Must be a card controller for menus <control> defines the type of menu . Must be used with a card controller
For each menu option, we specify a pane. Panes hold collections of portlets. The portlets on a pane have their own layout. We will discuss that in the next section. A pane is specified like this:
<portlets id="101"> <metainfo> <title>Basic Tutorials</title> </metainfo> </portlets>
The title tag is used as the menu option text.
Panes are a special kind of a controller. There is one important difference between a pane (PanedPortletController) and other controllers: the pane does not render all of its managed portlets at the same time. That is why it needs to be used with a menu control, allowing us to navigate to the appropriate pane while hiding the other panes.
Controls are decorators around a pane or portlet. In the case of a pane, it is always used in combination with a portlet controller. There are two types of controls for panes:
1. TabControl - puts menu options across the top of the page 2. MenuControl - puts menu options on the left-side of the page
Here is the PSML for a Tab Control and Card Controller (layout):
<control name="TabControl"/> <controller name="CardPortletController"/>
Controls are sometimes used in combination with controllers. Controllers define the layout of a pane, such as the number of columns and rows. When defining menus, you must select the CardPortletController, which enables collections of portlets to occupy the same page, and is used in combination with the a TabControl or MenuControl to create menu components. These collections of portlets are called panes.
Each of the four menu options correspond to a pane. A pane is configured in PSML using the portlets tag. The metainfo tag defines the title of the pane which is displayed in the menu.