5.12.8.9 Toggle Menus

 



 

Overview 

 

The display names of the menu items specified in the Object-Specific menus can be dynamically changed at runtime based on the value for a particular map symbol property or Managed Object property. The display name of menu items in the map menus can be changed depending on any of the map symbol properties. Whereas the display name of menu items in the list menus can be changed depending on any of the managed object properties.

 

For map symbols (i.e., managed objects selected in the map), the corresponding menu configuration files are located in either in <Web NMS Home>/users/<username>/mapmenus directory or in <Web NMS Home>mapdata/menus directory. The client framework first searches for the menu file in the <Web NMS Home>/users/<username>/mapmenus directory and if not found searches the latter directory.

 

For managed objects selected from the table of the Network Database panel, the menu file are located in <Web NMS Home>/users/<username>/listmenus directory or in <Web NMS Home>/listmenus directory. The client framework searches for the menu file first in the <Web NMS Home>/users/<username>/listmenus directory and if not found then searches in the latter directory.

 

Sample Toggle Menu Entry

 

To set the dynamic menu item name based on the map symbol property "managed" for a node, the following entries must be provided in the menu file present in the <Web NMS Home>mapdata/menus/nodemenu.xml directory.

 

<MENU-ITEM name="Delete Object and Traces" ACTION-ON-NO-PRIVILEGE="HIDE">

<OPERATION name="Map Editing Operations"/>

<TOGGLE>

<PROPERTY property_name="managed" property_value="true" display_name="DelObj-Managed"/>

</TOGGLE>

<HTML-UI action_value="/map/deleteObject.do?keys=${name}&amp;viewId=${viewId}&amp;displayName=${displayName}" action_type="rightside"/>

<JAVA-UI action_value="com.adventnet.nms.mapui.DeleteMO?name=${objName}&amp;type=${type}&amp;isContainer=${isContainer}&amp;isGroup=${isGroup}&amp;mapName=${mapName}" action_type="INVOKE_CLASS"/>

</MENU-ITEM>

 

 

Toggling With One Condition

 

<TOGGLE>

<PROPERTY property_name="managed" property_value="true" display_name="DelObj-Managed"/>

</TOGGLE>

 

In the above example, if the value for the map symbol property "managed" is "true", instead of the menu item "Delete Object and Traces", the text specified in the display_name parameter will be displayed. In this case "DelObj-Managed" will be displayed instead of "Delete Object and Traces". If the property value is not equal to "true", then the default menu item "Delete Object and Traces" will be displayed.

 

Toggling With Two Conditions (true or false)

 

<TOGGLE>

<PROPERTY property_name="managed" property_value="true" display_name="DelObj-Managed"/>

<PROPERTY property_name="managed" property_value="false" display_name="DelObj-UnManaged"/>

</TOGGLE>

 

In the above example, if the value for the map symbol property "managed" is "true", instead of the menu item "Delete Object and Traces", the text "DelObj-Managed" will be displayed. It the property value is "false", then the text "DelObj-UnManaged" will be displayed as the menu item.

 

Toggling With Multiple Conditions

 

<TOGGLE>

<PROPERTY property_name="managed" property_value="true" display_name="DelObj-Managed"/>

<PROPERTY property_name="type" property_value="node" display_name="DelObj-Managed Node"/>

<PROPERTY property_name="managed" property_value="false" display_name="DelObj-UnManaged"/>

</TOGGLE>

 

Any number of conditions can be checked for assigning the corresponding display names for the menu item as in the above example. If there are multiple conditions specified and more that one condition is satisfied, then the menu item will be displayed as specified in the display_name of the first satisfied condition. In the above example,  if the "managed" property value is "false" then the second and the third conditions will be satisified.  And the display name specified for the first satisified condition "DelObj-Managed Node" will be displayed.

 

Display Menu Item with Parameter Value

 

<TOGGLE>

<PROPERTY property_name="managed" property_value="true" display_name="Managing ${name} "/>

<PROPERTY property_name="managed" property_value="false" display_name="Managed-false"/>

</TOGGLE>

 

The values of the map symbol or the managed object properties can be provided along with the display_name if required as in the above example.

 

 

 



Copyright © 2011, ZOHO Corp. All Rights Reserved.