RTView® 
User Guide


Extending the Context Menu

This section describes how to extend items in the RTView context menu. The context menu appears when you right-click on an object. The context menu can be extended for a table object (obj_table02), heatmap object (obj_heatmap), grid object (obj_objectgrid) or tree control (obj_c1tree). Configure the context menu if you want to click an element on a tabular object (for example, a row in a table, a cell in a heatmap or grid, or a node in a tree control) and then choose one of several possible actions from a menu. The context menu appears when you right-click on an object (illustrated in the following figure).

The extended context menu is not supported in the Thin Client in iOS Safari (iPad/iPhone).

To configure the context menu, you create a button for each of the possible actions (for example, an Ack button, an Unack button and an Own button) and edit button control properties (menuItemIndex, menuItemGroup and menuItemSubmenu). You also edit properties on the table, heatmap or grid object (menuItemGroup and rightClickActionFlag), which are referred to as the target object. The buttons in the menuItemGroup define the items that are added to the context menu, when the target object with the same menuItemGroup value on the same display is right-clicked. The context menu items are, effectively, shortcuts to the buttons. The buttons are not affected by the properties of the associated target object.

Context menu items can be organized into submenus. The target object can be configured to invoke the first associated menu item when the user double-clicks on the object.

Summary of Steps
  1. Verify that the following is your desired outcome: When a user selects an element on a tabular object (for example, a row in a table), several possible actions are available and the user can choose one to execute.
  2. Configure the target object to set drillDownColumnSubs as necessary to record the selected row. Typically, the rightClickActionFlag property is checked, too.
  3. Configure buttons on the display to perform each of the possible actions, using the drillDownColumnSubs set in step 2.
  4. Choose a name for the menuItemGroup property and specify that name on the target object and all of the buttons.
  5. Set the other menuItem* properties on each of the buttons as appropriate.

Example

To illustrate the how to configure the context menu, consider a display containing a table object. NOTE: A heatmap object is configured similarly to a table object, and has the same behavior when a cell in the heatmap is right-clicked or double-clicked.

In our example, the table object shows the RTView AlertTable. A list of actions (Ack, Unack and Own) are associated with each row in the table. The display also contains three buttons labeled Ack, Unack and Own which execute different alert commands. A single left-click on a row could select the corresponding alert, or be followed by a click on the Ack (or Unack) button to acknowledge (or unacknowledge) the selected alert, or a click on the Own button could set the alert's owner to the current RTView username.

To configure the above described behavior, the table object's drillDownColumnSubs property is configured to set a substitution variable, $alertID, that is equal to the value of the ID column for the selected row. The table object's command property is configured to drill-down to the current display window. This simply means that each click on a row stores the ID of the selected alert in the $alertID substitution variable. Also, the actionCommand property of the Ack button is configured to execute an Acknowledge Alert on ID = $alertID. The actionCommand for the Unack and Own buttons is configured similarly. If necessary, the enabledFlag of each button is attached to a function that determines whether the button's action is appropriate for the current selection.

When an extended context menu is configured on the display:

  • In addition to clicking on the button to execute an action, each action can also be executed from an item in the RTView context menu (selecting an extended context menu item is equivalent to clicking on the corresponding button.).
  • By double-clicking on a row in a table (or a cell in a heatmap or grid), the object's drill-down can be executed or, if the object has no drill-down, the first action in the list can be executed.

The extra menu items appear at the top of the menu. One extra item appears in the menu for each button object (obj_c1button) on the display that meets these requirements:

  • The button's visFlag property is set to 1.
  • The button's menuItemIndex property has a nonzero value.
  • If the menuItemGroup property of the currently selected table or heatmap object is set, it matches the menuItemGroup property of the button.

If multiple buttons meet the requirements above, they also appear in the context menu, ordered by the menuItemIndex property in increasing order.

Continuing with our example, let us assume we want context menu items for the Ack, Unack, and Own actions to appear in the context menu when the alert table object is selected, and in that order. To accomplish this, the menuItemIndex property of the Ack, Unack, and Own buttons is set to 1, 2, and 3 respectively. Also, to ensure that the menu items only appear when the alert table object is selected, the menuItemGroup property of the table object and all three buttons is set to the same string, for example "alert_group".

The extra menu items are added to the context menu by increasing order of their menuItemIndex property values. That is, if button X has its menuItemIndex set to a value that is less than the menuItemIndex of button Y, the item for X is situated above (nearer the top of the menu) the item for Y. Note that menuItemIndex can be assigned a value less than or greater than 0 (zero), but a value of 0 (zero) means that no item is added to the menu for that button.

The final required configuration step is to check the rightClickActionFlag property on the table object. This accomplishes two things:

1. Ensures that the substitutions for the right-clicked row are set before the menu is opened.

2. Enables the following double-click behavior on a table row:

  • The table's command, if one is specified, is executed. Typically this sets substitutions on the current display for the selected row.
  • The table's drill-down is executed. If the table has no drilldownTarget, the first enabled button on the display with the same menuItemGroup value is activated.

To summarize, configuring the table and buttons as described in our example, the table object behaves as follows:

  • A single left-click or right-click on a row in the alert table executes the table's command, setting the $alertID substitution variable to the ID of the alert in that row.
  • A right-click on a row in the alert table opens the context menu, in which the Ack, Unack, and Own menu items appear below the Drill Down item. (These menu items are either enabled or disabled, according to the state of the corresponding button).
  • A double-left click on a row executes the Ack command on that row's alert, because the Ack button is the first button in the table's menuItemGroup property (it has the smallest menuItemIndex value in the group, 1 in this example).

Optionally, the extra menu items on the context menu can be organized into one or more submenus. This is done by assigning the same value to the menuItemSubmenu property of each button whose item is to appear in the same submenu. For example, to have the Ack, Unack, and Own menu items appear in a submenu (rather than the top-level context menu), we set the menuItemSubmenu property of the Ack, Unack, and Own buttons to (for example) "Alerts". This adds an item labeled "Alerts ->" to the top-level of the context menu, and selecting that item opens a cascading submenu with the Ack, Unack, and Own menu items.

If multiple submenus are defined, they are ordered by increasing value of the lowest menuItemIndex of the all the buttons in each submenu.

If a grid object is configured to use the context menu and the grid's cells contain a composite display, the behavior is as described above except when a user right-clicks or double-clicks an object in the composite display that has its own drillDownTarget or command property configured. In that case, the click is processed by the object inside the composite and not by the grid.

Limitations

The extended context menu is not supported in the Thin Client in iOS Safari (iPad/iPhone). All of the new properties (rightClickActionFlag, menuItemIndex, menuItemGroup, menuItemSubmenu) are ignored by the Thin Client on iOS Safari, therefore no menu items are added to the context menu and no double-click actions are supported. In particular, if a button is configured on the display so that it is off-screen but has a nonzero menuItemIndex, the button's command is not accessible on iOS Safari.

Extra menu items do not appear in the context menu in the main editing panel of the Builder. (They do appear in the Builder's preview window).

The double-click feature on the obj_table02, obj_heatmap, and obj_objectgrid objects does not work in any window in the Builder.

In the Thin Client, a double-click on a table, heatmap, or grid object that performs the first action in the menu group is sometimes ignored instead. This happens if the Display Server is slow to respond to the first click (which might enable the first button in the menu group), so the button is still disabled when the second click occurs. Its most likely to occur if the user double-clicks on several different cells in quick succession.

 

 
SL, SL-GMS, GMS, RTView, SL Corporation, and the SL logo are trademarks or registered trademarks of Sherrill-Lubinski Corporation in the United States and other countries. Copyright © 1998-2012 Sherrill-Lubinski Corporation. All Rights Reserved.

 

JMS, JMX and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. They are mentioned in this document for identification purposes only. 

 

Third Party Notice Requirements