JSF Popup Menu on right click
Hi ,
I want to popup menu on right click of any component(say tree).I searched on the net and found the tomahawk <t:popup> component.
This component popup the menu when mouse pointer enter in to the component but I don't want this behavior.
I want to popup the menu only when I right click on the component.
This is sample program
<t:popup id="a"
styleClass="popup"
closePopupOnExitingElement="true"
closePopupOnExitingPopup="true"
displayAtDistanceX="10"
displayAtDistanceY="10" >
<h:outputText id="oa" value="#{country.name}"/>
<f:facet name="popup">
<h:panelGroup>
<h:panelGrid columns="1" >
<h:outputText value="#{country.cities}"/>
</h:panelGrid>
</h:panelGroup>
</f:facet>
</t:popup>
DO you have any component like this ? Or any other way to do like this ?
Thanks in Advance,
KK
I wrote a component a while back that does something similar to what you want. You'd probably need to fix it up and add any features that you need that it doesn't already have. It pops up a menu on a right-click, it allows you to provide a facet to supply the contents of the menu. I doubt I made sure it works in IE or any browser other than Firefox... so there may be JS issues. It has some other component dependencies you might want to remove also. I could get it to the point where you could try it out and fix it up if you want, but I won't have time until next week.
Ken Paulsen
https://jsftemplating.dev.java.net
Similar Messages
-
I am investigating the feasibility of adding "Personalised Menu"
functionality to a Forms application. The idea is that regardless
of what form a user is currently in, he/she will be able
to right click on the canvas to display a list of "favourite screens".
Next, s/he will pick a screen from this list and hey presto will
be navigated to it. There will need to be "Do you want to save
your changes?" processing of course before hopping to the new screen.
When the user right-clicks s/he should see a customised list of menu options:
user "Peter" could have e.g. a menu with options "Screen A", "Screen C", "Screen D";
user "Paul" could have screens E,F,G,J on his list and "Mary" could have
screens A,B,K,Q,R. There will be companion admin functionality to allow
users to maintain the options they want on their personalised menus but
this is easy to code using standard forms functionality.
To simulate the functionality I have created a little PERSMENU form
to display the user's personalised list of screens on a standard
multi-row block.
This is executed via a CALL_FORM in the PRE-POPUP-MENU trigger.
Of course if I use a called form to display the menu options then
I need to check if the calling form has any unsaved changes beforehand.
Which is a bit clunky.
Another alternative would be to add a PERSMENU block to each form
in the application. If the user were to right-click on a form's canvas
the form would attempt to navigate to PERSMENU and then execute_query.
But of course WHEN-VALIDATE-ITEM triggers etc could prevent the navigation
and once again the proposal is a bit clunky.
I have been reading the "Popup menu with left click on 10g" thread at
Popup menu with left click on 10g
and am interested in the javabean provided by "Nalin R". Unfortunately
I am new to java and don't understand the code. But this looks to be
tantalisingly close to what I am trying to do albeit with "left-click"
rather than "right-click".
Has anyone attempted anything similar? Am I right in thinking that the
javabean approach offers the best solution and if so is there any
sample code that would help?( (BasicInternalFrameUI)internalFrame.getUI() ).getNorthPane().addMouseListener( new MouseListener(){
public void mouseClicked( MouseEvent me ){
//do what ever you want
}); -
Popup menu when right clicking DataGrid column
I have a DataGrid and I'd like the user to be able to
right-click on the header and pick from some options in a menu.
Such as give them the ability to clear the rows in the grid. I saw
on Flex Examples you can add an option to the normal Flash menu
that pops up but thats not what I want. I want an actual Flex popup
to appear with my options in there. I saw this done somewhere once,
but can't find it now.
This would replace the need for a button below the table,
which I think will look nicer.
Any ideas?Hi Miklos, you will have to hang your option in the GoTo Menu (id 5888) while creating your From. This menu is Form dependent, therefore when you open another form it will be reseted. After this you will see your option with the right mouse click.
Catch the MenuEvent and bind it to the class you already use to bring your "Analysis Report" to the front.
Check also object Form.Menu for further info.
oMenuitem = B1_Application.Menus.Item("5888")
MenuParam.Type = SAPbouiCOM.BoMenuType.mt_STRING
MenuParam.UniqueID = "REPTMNU"
MenuParam.String = "Analysis Report"
MenuParam.Enabled = True
oMenus = oMenuitem.SubMenus
oMenus.AddEx(MenuParam)
It's also possible to add it in your Xml Form file as follows:
- <FormMenu>
- <Menus>
- <action type="add">
<Menu Checked="0" Enabled="1" FatherUID="5888" Image="" Position="0" String="Analysis Report" Type="1" UniqueID="REPTMNU" />
</action>
</Menus>
</FormMenu>
Regards,
Felipe -
Menu on right-click for numeric control
Hello,
is there a way to program a "menu on right-click" for a control (e.g. numeric), like there is for table controls?
I'm working with CVI 8.0.1
Thanks & Best Regards,
GregYes, every control can be added a popup menu with a few instructions.
Design the menu nar in the UIR editor; do not associate it to any panel
Load the menu bar when needed with the line menuHandle = LoadMenuBar (0, "myfile.uir", menuBar): by passing 0 as the panel handle it will not be associated to any of them
In the numeric callback add these instructions:
switch (event) {
case EVENT_RIGHT_CLICK:
// Context menu
choice = RunPopupMenu (menuHandle, menuBar_Menu, panel, eventData1, eventData2, 0, 0, 0, 0);
switch (choice) {
case menuBar_menu_item1:
// menu item handling code
break;
break;
Passing eventData parameters to RunPopupMenu function ensures that the menu is displayed at the mouse position.
Proud to use LW/CVI from 3.1 on.
My contributions to the Developer Zone Community
If I have helped you, why not giving me a kudos? -
Displaying a context menu on right click on rich tree
Please see the code below. I want to display a context menu on right click on a rich tree.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
.col1{ width:50%; vertical-align:top;
</style>
<h:form>
<h:panelGrid columns="1" width="100%" columnClasses="col1">
<rich:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
switchType="client"
value="#{simpleTreeBean.treeNode}" var="item" id="item">
<rich:componentControl event="onClick" for="menu" operation="show">
<f:param value="#{item.data}" name="send" />
</rich:componentControl>
</rich:tree>
</h:panelGrid>
<a4j:outputPanel ajaxRendered="true">
<rich:panel>
<f:facet name="header">Last Menu Action</f:facet>
<h:outputText escape="false" value="Right Click : #{simpleTreeBean.nodeTitle}" id="selectedNode" />
<br/>
</rich:panel>
</a4j:outputPanel>
<rich:contextMenu event="oncontextmenu" actionListener="#{SimpleTreeBean.processCurrElement}" attached="true" id="menu" submitMode="ajax">
<rich:menuItem ajaxSingle="true">
<b> #{simpleTreeBean.nodeTitle}</b> Send To
<a4j:actionparam name="det" assignTo="#{ddmenu.current}" value=" #{simpleTreeBean.nodeTitle}"/>
</rich:menuItem>
</rich:contextMenu>
</h:form>
</ui:composition> With this code, i need left click at first then right click, then it will show the selected node. I want to get the value of the node title on right click. Please help me with it. The SimpleTreeBean code:
package com.dW;
import java.awt.event.ActionEvent;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.faces.FacesException;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import org.richfaces.component.UITree;
import org.richfaces.event.NodeSelectedEvent;
import org.richfaces.model.TreeNode;
import org.richfaces.model.TreeNodeImpl;
public class SimpleTreeBean
private TreeNode rootNode = null;
private String nodeTitle;
private static final String DATA_PATH = "images/simpleTreeData.properties";
private void addNodes(String path, TreeNode node, Properties properties) {
boolean end = false;
int counter = 1;
while (!end) {
String key = path != null ? path + '.' + counter : String.valueOf(counter);
String value = properties.getProperty(key);
if (value != null) {
TreeNodeImpl nodeImpl = new TreeNodeImpl();
nodeImpl.setData(value);
node.addChild(new Integer(counter), nodeImpl);
addNodes(key, nodeImpl, properties);
counter++;
} else {
end = true; } } }
private void loadTree() {
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
InputStream dataStream = externalContext.getResourceAsStream(DATA_PATH);
try {
Properties properties = new Properties();
properties.load(dataStream);
rootNode = new TreeNodeImpl();
addNodes(null, rootNode, properties);
} catch (IOException e) {
throw new FacesException(e.getMessage(), e);
} finally {
if (dataStream != null) {
try {
dataStream.close();
} catch (IOException e) {
externalContext.log(e.getMessage(), e);
public TreeNode getTreeNode() {
if (rootNode == null) {
loadTree();
return rootNode;
public void processSelection(NodeSelectedEvent event) {
UITree tree = (UITree) event.getComponent();
nodeTitle = (String) tree.getRowData();
public void processCurrElement(ActionEvent event) {
UITree tree = (UITree)event.getSource();
nodeTitle = (String)tree.getRowData();
System.out.println(nodeTitle);
public String getNodeTitle() {
return nodeTitle;
public void setNodeTitle(String nodeTitle) {
this.nodeTitle = nodeTitle;
}Hi,
Do you have a solution for this? Looking for exactly the same.
As far as I have it at the moment I have the backing object added to the attributes of the node:
<a4j:support event="oncontextmenu"
oncomplete="#{rich:component('foldersContextMenu')}.doShow(event, {})"
actionListener="#{customerBean.buildContextMenu}" reRender="foldersContextMenu, selectedNode">
<f:setPropertyActionListener value="#{item}" target="#{customerBean.nodeTitle}"/>
<f:attribute name="node" value="#{item}"/>
</a4j:support>This allows me to get the object in the backing bean:
public void buildContextMenu(ActionEvent event) {
UIComponent component = event.getComponent();
log.info("component: " + component.getId());
Category node = (Category) component.getAttributes().get("node");
log.debug("node : " + node);But how I translate that to setting this as the current node is causing me problems.
Thanks
Jon -
Pop up menu on right clicking an image?
Hello,
I am new to LabWindows/CVI.
Requirement: "To get a pop-up menu on right clicking on image"
Right now, I display my images in window numbers (0 - 15). Is it possible to be able to get a pop-up menu on right clicking an image window. If yes, how? If not, could you please suggest other methods to achieve this task? Should I display the image in a separate parent panel for example? How could I do this?
Any help would be great.
CheersI would use the code generator for right click event. then fill it up with whatever code you want under right click case. You can access these when you double click your UIR file, then on the top of the page click Code\Preferences\Default... then choose desired events for picture then go to Code\Generate\all callbacks and skip through the ones you don't want to be replaced.
-
"Toast it" appearing in menu when right clicking
The words "Toast it" appears in menu when right clicking an icon but Toast has been uninstalled. How can I remove it please?
Try this previous discussion:
https://discussions.apple.com/message/12533120#12533120
Re: "Toast It" wont go from contextual menu -
Labview edit time menu and right click popup menus
How can i add a menu item to the labview edit time menus and to the right click popup menu of any selected object in a block diagram?
I would like to integrate commonly used tools by me out of the springboard scripting tool into actual labview.
Solved!
Go to Solution.It sounds to me like you are looking for something like the Right-Click Framework. Some people really like it, I have not used it extensively myself. I've had a request to convert a quick drop shortcut into a RCF plug-in, I'll see how it goes. I have also longed for a good way to hook into the LV IDE to add my own tools, what I find are useful, but not fully satisfactory solutions.
1) Right-Click Framework: Some initial startup costs in terms of downloading and installing. Start up is a bit slow (on my machine), and the workflow is a bit different than what I am used to: Select an object, press the hotkey, right-click. You can get used to it, but it is not as responsive as a built-in right-click since you can't right-click in one action. It seems to be easily extensible, I'll know more in a day or two.
2) Quick Drop: Built into LV. Slow startup like RCF. Fairly easily extensible. Not context aware (unless you build it in to your plug-in), so you have to choose your letters wisely. After the initial pain, the response time is not shabby, does require the extra Ctrl-Space action.
3) Tools Menu: I drop a few things in here, like my custom connector pane editor. Not bad, but there are no keyboard shortcuts (what a pain), so it is good for actions that you might call once or twice on a given VI.
In short, all of these methods require extra clicks or keypresses and are a bit sluggish. If something like copy and paste behaved this way we would never use LV again, but if your tool truly saves you a bunch of steps it is well worth it. I have almost run out of letters to use for my QD shortcuts.
Addedendum: Personally I am not quite ready to start talking to my computer, but LVSpeak seems pretty cool, Smashy Smashy. -
How can i get a context menu popup when the user right-clicks a table row? Will the conflict with the selection listener? thanks
[url http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html#popup]Bringing Up a Popup Menu
-
How to get a pop-up menu on right click of JTree?
hi
My application consists of a JTree.I am having a 2 root nodes each one have some child nodes.in the first root node what i want is on right click of child node i have to display one option that is enabled and on the second root node what i want is on right click of child node i have to display one option that is disabled..
how to do that
thanks for your reply in advance,When you are creating your nodes, do node.setUserObject(objectName);
and on right click, do something like this
if (e.isPopupTrigger() == true) {
selPath = tree.getPathForLocation(e.getX(), e.getY());
try {
// If Right Click, Select the Node
Object[] selectedPath = selPath.getPath();
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selectedPath[selectedPath.length - 1];
try {
dataObject = (MyObject) selectedNode.getUserObject(); // Set the Data Object
} catch (ClassCastException ex) {
ex.printStackTrace();
// Check for the right click on Framework Node
if (dataObject.getClass().isInstance(new MyObject()) == true) {
// Disable the pop-up menu
.... -
Adobe LE 2.5 bundled with HTC Touch HD does not show reflow option in the menu at the bottum or the right click options over the document.
Can any one help pleaseI found thw solution in xda developers site
http://forum.xda-developers.com/showthread.php?p=3109636#post3109636 -
Application Key (Menu Key) (Right Click Button)
Hi,
I have an HP Pavillon Notebook 13-b200nt model. But the notebook doesn't have "application (menu) key which is used instead of right click of mouse.
Is it possible to change any key function as rihgt click option? Or as far as i know "shift + F10" is a short cut of right click, may i create another short cut?
Thanks in advance,Hi there @Memo1
Welcome to the HP Support Forums! It is a great place to find the help you need, both from other users, HP experts and other support personnel.
There are several different keyboard mapping tools available on the internet. A quick google search will find several that you can investigate.
Malygris1
I work on behalf of HP
Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
Click Kudos Thumbs Up on the right to say “Thanks” for helping! -
What's This menu on right click?
Hi
Any body tried adding the "What's This?" menu on user form Right Click menu list?
I mean, In Sales Order or any other system form, if we right click on a text box we can see "What's This?" menu item. Which actually resides in "Help -> Documentation".
How to enable the same menu item on user forms?
I am trying to enable the same menu item (UID 281). Not a user defined menu.
Thanks
Anoopon form call
Private Sub addmenu(ByVal oform As SAPbouiCOM.Form)
Dim oCreationPackage As SAPbouiCOM.MenuCreationParams
oCreationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_MenuCreationParams)
oCreationPackage.Type = SAPbouiCOM.BoMenuType.mt_STRING
oCreationPackage.UniqueID = "wt"
oCreationPackage.String = "Whats this"
oCreationPackage.Position = 100
oform.Menu.AddEx(oCreationPackage)
End Sub
it will add own menu to each item on form -
Automate in Drop Down Menu on right click?
Greetings all.
I am just stepping into automator and hope that it can really help with all of the repetitive actions that I do throughout the week. (aside from making me breakfast). I have been surprised at the amazingly small amount of documentation on automator.
How are people effectively applying automator actions? When I right click on a file or a folder I see near the bottom of the drop-down menu a list item for "automator." Currently it only houses a list item called "create workflow." is it possible to save my actions somewhere so that they show up in the drop-down menu? I want to simply right click on an item and scroll to automator > do my action.
Is this possible?
Any other workflow placement techniques or places where I can point to the effective use of workflow would be GREATLY appreciated. Thanks all!
-i
2x2.0 gHz G5 Mac OS X (10.4.1)To save the workflow in the contextual menu, save it as a Finder plugin.
File>Save As Plug-In...>Plugin for Finder.
Most of the other places or ways that you can use the workflow are in that same Save As Plug-in window.
ie. a Folder Action- will run the workflow on any files added to the folder the workflow is applied to as they are added.
iCal Alarms- get added to the list of alarm options for iCal events.
Script Menu- will add the workflow to the script menu on the main menu bar -
Custom menu for right-click on TextArea
Is it possible to have a custom menu when user right clicks
on text area.
Can the defauklt menu be overridden ??Hello LRosenthal49, probably [http://kb.mozillazine.org/Corrupt_localstore.rdf Corrupt localstore.rdf] file.
thank you
Maybe you are looking for
-
Title says it all: How do I use a NORMAL headset (dual 3.5mm) on my new Macbook pro retina? No usb ports available and headset buddy adapter doesn't work.
-
How do I save.cur in Photoshop CC?
How do I save.cur in Photoshop CC?
-
Problem with Custom Tcode.
Hi, I have a report and when I run it it is working fine and I gave a Tcode to it. Now when I give the Tcode in the Trasaction code window and execute it, it is going to the selection screen properly, but after giving the input values and executing i
-
TS4036 When I restored from backup, not all the contacts were restored
How to ensure that all the contacts are restored? It seems that only the iPhone users are restored in my phone. Thanks
-
Dear sir, i am running my phone with business mail which is given by my organization, But i am unable to send PDF file with my mail. Please look into that & resolve at the earliest.