Harness, section, and flow action forms forms
|
In a composite portal, a menu bar can allow the user to switch among spaces. In a flow action or sections within a work object form, a menu bar can execute activities or call JavaScript functions.
The structure of a menu bar is defined by an XML Stream rule. Because the XML Stream rule undergoes stream processing and can reference clipboard property values, the runtime menu choices available may differ based on user and context.
Follow these steps to include a menu bar in a composite portal. This facility depends on rules of various types:
1. Define the menu structure with an XML Stream rule
Create an XML Stream rule in your application that defines the structure and elements of the menu.
1. Set the first key part to @baseclass. Enter a second key part of your choice. Set the third key part (XML Type) to Menus.
2. On the XML tab, clear the Auto-generated XML? option.
3. In the XML Source field, enter text to define a well-formed XML structure similar to the following:
<?xml version="1.0" ?>
<pagedata>
<menu value="MenuHome" rows="2" Tooltip= "Return to Home" >
<item value="HomePage" caption="Home" OnClick="pega.desktopshowSpace('Home');" ></item>
<item ...></item>
</menu>
<menu>
....
</menu>
</pagedata>
Where:
Items that do not include an onClick attribute define groupings of menu items at a subordinate level. Your menu many contain several levels; there is no imposed limit.
Ensure that the value attributes are unique within each level; these are keys for nodes in a key structure of other XML Stream rules with MenuItem as the final key part.
4. Save the XML Stream rule.
5. Create and save any additional XML Stream rules referenced through the value attribute of the primary menu. Set the third key part of these to MenuItem
. A MenuItem XML Stream rule defines a (well-formed) XML
fragment, not an entire document. The simple structure is:
<Item Value="myvalue" Caption="mycaption" onClick="function" />
where:
onClick()
target references a JavaScript
function such as pega.desktop.showSpace(), or others in the standard text file rules webwb.DesktopWrapperAPI.js or — for
advanced cases — webwb.MenuActionHandlers.js.The XML Stream rule may contain JSP tags such as <pega:when >, <pega:reference > and <pega:include >. Menus may contain submenus up to five levels deep.
For examples of menu structure, review the XML Stream rules that define the Developer portal menus: @baseclass.DeveloperMenuTools.Menu, @baseclass.DeveloperMenuFile.Menu, and so on. Open the highest version of each rule. These top-level menus reference other standard XML Stream rules in the Pega-ProCom RuleSet with MenuOption as the final key part. (These are advanced, special-purpose examples and cannot be used directly in a composite portal.)
2. Drag and drop the Menu control into a section
Create a section rule to hold the menu.
A new section contains an initial layout, in Smart Layout format. From the Layout tab, select an add a second layout, of type Free Form
with one row and one column, below the Smart Layout. Delete the Smart Layout.
Drag to adjust the width and height of the cell to hold the expanded menu display. Using default styles, each menu row (or tab) requires about 30 pixels of height. You can fine-tune the cell size later.
Click the down-arrow () at the right end of the Advanced control group () and select the menu bar control (). Drag the control. When the pointer changes shape to indicate that you can drop the layout, release the mouse button.
3. Complete the Cell Properties panel — Top fields
Parameters to the standard HTML property rule MenuBar control the menu display.
Field |
Description |
||||||||||||||||||||
Property |
Retain the placeholder property pyTemplateMenuBar. (This property is not used.) |
||||||||||||||||||||
Display As |
Retain the default HTML property rule MenuBar. Click the magnifying glass icon ( ) to enter parameters for the menu. Complete the following parameters:
|
||||||||||||||||||||
Behavior |
Leave blank. Not used. |
4. Complete the Cell Properties panel — General tab
The General tab controls when the menu is visible. In most cases, accept the default values; the menu is always visible.
Field |
Description |
Visible |
Select to determine when the menu appears. Select:
|
Condition |
If you selected
A menu that is not visible is also disabled and cannot be accessed. |
Required |
Not used for menu bars. |
Wrap Text |
Not used for menu bars. |
Read-Only |
Not used for menu bars. |
5. Complete the Cell Properties panel — Advanced tab
Style information on the Advanced tab is not meaningful for menu bars.
Field |
Description |
Default Value |
Leave blank. |
Width |
This field appears only when the cell is not controlled by Smart Layout column restrictions. Enter a positive number for the width in pixels of this cell. (At runtime, normal browser processing for rendering tables determines the actual displayed width.) You can also adjust the width this column directly:
|
Height |
Optional. This field appears only when all columns in the Layout are not controlled by Smart Layout column restrictions. Enter a positive number for the height in pixels of this cell. (At runtime, normal browser processing for rendering tables determines the actual displayed height.) You can also adjust the height of a row directly:
|
Read-Write Style |
Not used. |
Read-Only Style |
Not used. |
Inline Style |
Not used. |
Use Heading Styles |
Not used. |
You can extend the XML Stream rules to take advantage of four features that make the menu bar facility flexible and powerful:
<pega:include >
and <pega:when
>
to make the menu options depend on clipboard
values.Standard menu styles are defined by the text file rule webwb.pega_yui_menu.css, a final rule. To override these and use custom styles in your menu:
Style Prefix
parameter value. Save the panel and the section rule.