The pop-up menu component allows you to
display a static or contextual menu when the application user
right-clicks in the view.
For use of menus in Facelets environments, see also Supporting Facelets and Trinidad.
Pop-up menu tag in the view tag
Since the pop-up menu is attached to a view, its JSPā¢ tag must be enclosed in the JSP
tag of the view.
The pop-up menu can be contextual or
static. The following examples show contextual pop-up menu tags
used in the view tag.
The following code is for JViews
Diagrammer.
<jvdf:diagrammerView [...] > <jvf:contextualMenu [...]/> </jvdf:diagrammerView>
The following code is for JViews
Framework.
<jvf:view [...] > <jvf:contextualMenu [...]> </jvf:view>
Static pop-up menu
The pop-up menu is static and fully on the
client side.
To define a menu and menu items in JViews Diagrammer use
the menu, menuItem, and menuSeparator tags as shown in the
following example.
<jvf:contextualMenu <jv:menu label="root"> <jv:menuItem label="Zoom ..." onclick="zoomButton.doClick()" image="images/zoomrect.gif" /> <jv:menuItem label="Pan ..." onclick="panButton.doClick()" image="images/pan.gif"/> <jv:menuSeparator/> <jv:menuItem label="Zoom In" onclick="viewID.zoomIn()" image="images/zoom.gif" /> <jv:menuItem label="Zoom Out" onclick="viewID.zoomOut()" image="images/unzoom.gif"/> <jv:menuItem label="Zoom to Fit" onclick="viewID.showAll()" image="images/zoomfit.gif"/> <jv:menuSeparator/> <jv:menuItem label="Select" actionListener="#{diagrammerBean.action}" actionListener="#{ganttBean.action}" image="images/arrow.gif" invocationContext="IMAGE_SERVLET_CONTEXT" /> </jv:menu> </jvf:contextualMenu>
To define a menu and menu items at the JViews Framework level
use the menu, menuItem, and menuSeparator tags as in the following
example.
<jvf:contextualMenu <jv:menu label="root"> <jv:menuItem label="Zoom ..." onclick="zoomButton.doClick()" image="images/zoomrect.gif" /> <jv:menuItem label="Pan ..." onclick="panButton.doClick()" image="images/pan.gif"/> <jv:menuSeparator/> <jv:menuItem label="Zoom In" onclick="viewID.zoomIn()" image="images/zoom.gif" /> <jv:menuItem label="Zoom Out" onclick="viewID.zoomOut()" image="images/unzoom.gif"/> <jv:menuItem label="Zoom to Fit" onclick="viewID.showAll()" image="images/zoomfit.gif"/> <jv:menuSeparator/> <jv:menuItem label="Select" actionListener="#{frameworkBean.action}" actionListener="#{ganttBean.action}" image="images/arrow.gif" invocationContext="IMAGE_SERVLET_CONTEXT" /> </jv:menu> </jvf:contextualMenu>
Contextual pop-up menu
The pop-up menu is dynamically generated
on the server side by a menu factory depending on:
- The
menuModelId
property of the current interactor set on the view. - The object selected when the application user triggers the pop-up menu.
JViews Diagrammer
To specify the factory use the factory or the factoryClass attribute of the contextual
pop-up menu tag.
<jvf:contextualMenu factory="#{bean.factory}"/> <jvf:contextualMenu factoryClass="com.xyz.demo.DemoFactory"/>
At the JViews
Framework level
To specify the factory use the factory or the factoryClass attribute of the contextual
pop-up menu tag.
<jvf:contextualMenu factory="#{bean.factory}"/> <jvf:contextualMenu factoryClass="com.xyz.demo.DemoFactory"/>
The factory must implement the IlvMenuFactory interface.