Overview
In previous versions of WOW the menus were "operation-based", meaning that they were built by showing the user all operations that user could execute. In the new menuing scheme each menu item is a separate entity, which is usually (but not always) linked to an operation. This allows for submenus, and for menu items to be manipulated separately from that menu item's operation.
Enabling Menus
Applications which were created in the old operation-based menus will continue to use the old menuing scheme until the new menuing scheme is enabled. Enabling the new menuing scheme is done on a per-application basis from the "Menus" link in the builder.
Creating a Menu/Submenu
To demonstrate, we will create a new application created called: “Advanced Menu Example for BG” and utilize our Employee/Department tables from a MySQL DB.
*Note, it is important before changing the type of menuing you want to use, you first create at least one operation or WOW will throw an error message. In this example, we will create an operation to call back all employees from the DB.
Once that operation has been created and inserted, we can enable the advanced menu features by selecting the "Menus" link in the builder. (This link is located near the top of the builder screens.)
The first time this action is attempted, you will be prompted by WOW to enable Advanced Menuing. Select which application you wish to use and press the “click here” button.
This will prompt a warning from WOW as shown below: Click OK.
You will then see in Messages: WOW enabled menus and 2 menu items were generated, the default menubar and “All Employees” menu item created from our original operation. The Default Menubar will allow you to place your submenu items under it or under others that are created.
Now, when running this application, the user can see both the auto created menu item and original operation:
The operation runs and returns data as requested:
Design Mode
When an application is launched from the WOW builder its menus are shown in "design mode". This means that any menu item which would normally be hidden is instead shown as being disabled (so that you can see where it would be if it were visible). In addition, operations may be edited directly from the menus while in design mode. The design mode features are only active when an application is launched from the builder. The edit (and other) icons will not be present when run outside WOW Builder.
Placing Operations
There are 3 fields of an operation which describe how that operation is displayed in the menus: Menu Parent, Display Order, and Label.
The Menu Parent field determines which menu the operation should be displayed in (this field is only displayed for operations which are allowed to appear in menus). New menus/submenus cannot be created while editing an operation, so the operation must be placed within an existing menu. The operation's Label and Display Order fields determine the text and ordering of the operation when it is displayed in the menus, just as they did in the old operation-based menus. *Note, if a menu item is created by WOW through an Operation, the display order must be changed within the operation, you will not be able to edit it by accessing it through the menu screen.
There are 4 types of menus items which are built into WOW
External Link - Goes to a specific URL when clicked
Location - A location on the screen (such as the menubar) where menu items live. Most applications will only have a single Location, however it is possible to have menus in multiple places in an application. For example, an application might have one menubar near the top of the screen, and a second collection of menus along the lefthand side of the screen.
Menu/submenu - Contains other menu items
Operation Link - Executes a particular operation when clicked
To add a new menu/submenu to the application, create a new SQL operation. We will bring back all employees in a specific Department, A00.
Image below shows that WOW automatically chooses the display group “All Employees”
Insert operation and run:
WOW automatically generated the submenu item from the operation and when run, will return appropriate data
To place the new menu directly on the menubar, select "[Default Menubar]" as the menu's parent. Or you can select a different menu as the current menu's parent, which will make the current menu a submenu within that parent.
You can also edit these settings on an existing menu. Let’s say we want to change the title of the submenu. Edit the menu item and uncheck the “controlled by operation” button. This will allow you to label it as you choose - note we have changed it to read “Dept A00 Employees”
When updated, the running application looks like this:
Creating new operations from the WOW Builder will prompt WOW to insert new Menu items for each operation. As an example, let’s create submenu operations to bring back all Male and Female employees under the All Employees menu.
First, in menus, create a new menu/submenu:
You can see that the menu item does exist but has no operations associated with it (as it is being run from design mode):
Create a new SQL operation from WOW Builder (not the menu screen) to return all the male employees: SELECT * FROM PJUSER70.SAMPLE_EMPLOYEE WHERE SEX = 'M' and assign the appropriate menu / display group:
Now, repeat the steps to create an operation to return all Female employees. Here is what the menuing looks like when running application:
When creating the operations for Female/Male employees, WOW Automatically sets a display order. If I would like to change the display order and present the Male employee first on the menu, you’ll need to edit the operation. In this example, WOW set the display of both operations to 26600. By changing the Male Employee operation display order to 26599:
And running the application, you can see the display order has changed:
The “external link” menu item allows you to enter a direct URL link to the menu item:
When inserting, and running the application:
We get this:
Property Groups
Generally each type of menu item (Operation Link, External Link, etc) is associated with a particular property group. For example, Operation Link menu items are associated with OperationLink property group. If this property group is present in the properties of a particular menu item, it will affect that menu item (if it is an Operation Link menu item). If this property group is placed in the properties of a menu item which has children, it will affect all of those children, and those children's children, etc; but it will only ever affect Operation Link menu items (children of other menu item types will ignore the property group). The Menu Control section, which is displayed at the top of the menus screen, is considered the parent of all menu items, so any property groups contained it in will affect all menu items in the application.
The following properties control how menu items are displayed:
css - The CSS class used by the text in the menu item
disabled css - The CSS class used by the text in the menu item when it is disabled
display component - The Java class which will be used to render the menu item. This class must implement IMenuItemDisplayComponent
image - The image which will be displayed in the menu item
Many of these properties can also be specified in the fields of a menu item. When something is set in both the property group and the fields, the setting in the property group is overwritten by the setting in the fields. However, unlike the property groups, settings in the fields are never propagated to other menu items.
Operation Links
Whenever an operation which could appear in the menu is created, a menu item which is linked to the new operation is also created. This new menu item will use the label, display order, and menu parent which have been specified in the operation. However, if the "Controlled By Operation" checkbox is unchecked, then the menu item may provide its own label, display order, or parent and may ignore whatever values are set in the operation.
When an operation is deleted, any menu items which are linked to that operation and have the "Controlled By Operation" checkbox checked are also deleted, but linked menu items which do not have "Controlled By Operations" checked are not deleted.
Hidden Menu Items
There are several reasons why a menu or menu item may be hidden from the users:
The menu item has a validation error (such as having an invalid parent or linking to an invalid operation)
The current user does not have authority to the menu item
The menu item's Hidden field is set to "Always" (or the menu item's parent, grandparent, etc is set to always be hidden)
Menus who have no visible children are themselves hidden
If the Show Hidden Menu Items setting in the Menu Control is set to "During Development" then most menu items which would normally be hidden are instead displayed as disabled when the application is launched from the builder. (The Menu Control is shown at the top portion of the "Work with Menus" screen.) When an application is launched directly from a URL, hidden menu items are never displayed, regardless of the Show Hidden Menu Items setting.