I have just released my second component for Vaadin 6.2, ContextMenu.
ContextMenu is a popup dialog menu that is inteded to be used with LayoutClickListeners. The purpose of this component is to popup an operating system like ContextMenu, that would apper when you right click on your desktop.
ContextMenu support submenus so it’s hierarchical. API resembels Vaadin’s MenuBar component, so by adding new item to menu you get reference to menu item as a return value. This reference can be used to insert sub menus.
Henri’s idea sounds very good indeed. I implemented the requested feature in version 2.1 and it’s now available. I also added checks to make sure that the opened menu will fit to screen area. If it won’t, it will be opened leftwards from clicked location. This also works with submenus.
New is also updated to virtuallypreinstalled, so you can test it from there if you wish.
Hi I’m a beginner with Vaadin and I’m trying to use this component but I always get this error:
[i]
Widgetset does not contain implementation for org.vaadin.peter.contextmenu.ContextMenu. Check its @ClientWidget mapping, widgetsets GWT module descrioption file and re-compile your widgetset. Unrendered UIDL:
Hi and sorry that it’s taken so long to answer. I’ve been quite busy.
I looked through the code and was almost certain that there’s nothing wrong with it until I realized that there’s an elementary bug in ContextMenu. Click is recognized only when opening a sub menu.
Sorry about it, I’ll fix it right away and release a new version.
I’ve now released a new 2.2 version which is available from the Directory. Hopefully this one works with out any problems, sorry for the inconvenience.
Hi! I can’t get the hide()-function work for this component. Contextmenu disappears only if I click something, but I can’t find any other ways to remove it. It doesn’t help if I try to for example remove it from the layout.
Could you find any workarounf for disapearing the context menu? I have called the hide() function of the context menu every time when got a trigger in the contextItemClick(ClickEvent event) & it seems to work…
BR,
;-D
contextMenu.addListener(new ContextMenu.ClickListener() {
public void contextItemClick(ClickEvent event) {
mainWindow.showNotification(event.getClickedItem().getName());
// do actions
contextMenu.hide();
}
I’ve got one issue with it. I have combined it with Drag&Drop Layout addon.
Each time I rightclick and don’t choose any of context menu (leftclick elsewhere)
and then drag and drop some layout element, the contextmenu appears without right-click,
like it is just hidden and not closed.