From d4677ad7a9cecbebb500e917be497a5a53970584 Mon Sep 17 00:00:00 2001 From: Charles du Jeu Date: Mon, 8 Dec 2008 15:08:22 +0000 Subject: [PATCH 1/1] Better way to handle commands'submenus, to be able to duplicate them in context menus. git-svn-id: https://svn.argeo.org/slc/trunk@1955 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../class/org/argeo/ria/event/Command.js | 28 ++++++++++++------- .../org/argeo/ria/event/CommandsManager.js | 7 +++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/Command.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/Command.js index 0026170ad..b42fd4338 100644 --- a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/Command.js +++ b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/Command.js @@ -48,7 +48,7 @@ this.base(arguments, shortcut); this.setId(id); this.setLabel(label); - this.setIcon(icon); + this.setIcon(icon); }, members : @@ -67,8 +67,9 @@ this.addTooltip(button); if(this.getMenu()){ this.addListener("changeMenu", function(event){ - this.setMenu(event.getData()); - }, button); + button.setMenu(this.getMenuClone()); + }, this); + this.menuClones = []; } return button; }, @@ -108,19 +109,27 @@ * @return {qx.ui.menu.Menu} */ getMenuClone : function(){ - if(!this.menuClone){ - this.menuClone = new qx.ui.menu.Menu(); - this.menuClone.setMinWidth(110); + var menuClone = new qx.ui.menu.Menu(); + var submenus = this.getMenu(); + for(var i=0;i