incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r543256 - in /incubator/xap/trunk: codebase/src/xap/bridges/dojo/MenuItemBridge.js samples/WebContent/examples/widgets/popupMenu.xal
Date Thu, 31 May 2007 20:58:05 GMT
Author: jmargaris
Date: Thu May 31 13:58:04 2007
New Revision: 543256

URL: http://svn.apache.org/viewvc?view=rev&rev=543256
Log:
>From David Gennaco: https://issues.apache.org/jira/browse/XAP-463 

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js
    incubator/xap/trunk/samples/WebContent/examples/widgets/popupMenu.xal

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js?view=diff&rev=543256&r1=543255&r2=543256
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/MenuItemBridge.js Thu May 31 13:58:04
2007
@@ -109,7 +109,31 @@
 
 
 xap.bridges.dojo.MenuItemBridge.prototype.onClick = function( ){
-	var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession());
+    var clientEvent = new xap.session.ClientEvent(this.getElement(),this.getSession());
+	var parent = this.getPeer().parent;
+	
+	//get the cached event that made the popup appear, this will deal with nested popups
+	if (parent.getTopOpenEvent) {
+	    var contextEvent = parent.getTopOpenEvent();
+	    var topLevelInvokingNode = contextEvent.target;
+	    
+        //search for the first parent node with an "id" set
+        var invokerId = null;
+        while (!invokerId && topLevelInvokingNode) {
+            invokerId = topLevelInvokingNode.id;
+            topLevelInvokingNode = topLevelInvokingNode.parentNode;
+        }
+        
+        // add in the invoker related information
+	    if (invokerId) {
+	        var invokingElement = this.getSession().getDocumentContainer().getUiDocument().getElementById(invokerId);
+	        clientEvent.invoker = invokerId;
+            if (invokingElement) {
+                clientEvent.invokerName = invokingElement.getAttribute('name');
+            }
+	    }
+	}
+	
 	this.fireEvent("onCommand",null,null,clientEvent);
 }	
 

Modified: incubator/xap/trunk/samples/WebContent/examples/widgets/popupMenu.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/samples/WebContent/examples/widgets/popupMenu.xal?view=diff&rev=543256&r1=543255&r2=543256
==============================================================================
--- incubator/xap/trunk/samples/WebContent/examples/widgets/popupMenu.xal (original)
+++ incubator/xap/trunk/samples/WebContent/examples/widgets/popupMenu.xal Thu May 31 13:58:04
2007
@@ -33,17 +33,17 @@
 					id="testComponentFreePane">
 					<xal:defs>
 						<xal:popupMenu id="testComponent">
-							<xal:menuItem text="Cut" id="cut"
+							<xal:menuItem text="Cut" id="OuterCut"
 								onCommand="mco:attributeSetter.reportEvent(event)"
 								onCreate="mco:attributeSetter.registerElement(this)"/>
-							<xal:menuItem text="Copy"/>
+							<xal:menuItem text="Copy" id="OuterCopy"/>
 							<xal:horizontalSeparator/>
-							<xal:menuItem text="Paste">
+							<xal:menuItem text="Paste" id="OuterPaste">
 								<xal:popupMenu>
-									<xal:menuItem text="Cut"/>
-									<xal:menuItem text="Copy"/>
+									<xal:menuItem text="Cut" id="innerCut" onCommand="mco:attributeSetter.reportEvent(event)"/>
+									<xal:menuItem text="Copy" id="innerCopy" onCommand="mco:attributeSetter.reportEvent(event)"/>
 									<xal:horizontalSeparator/>
-									<xal:menuItem text="Paste"/>
+									<xal:menuItem text="Paste" id="innerPaste" onCommand="mco:attributeSetter.reportEvent(event)"/>
 								</xal:popupMenu>
 							</xal:menuItem>
 						</xal:popupMenu>
@@ -54,9 +54,9 @@
 							onCreate="mco:attributeSetter.registerElement(this)"> </xal:popupMenu>
 					</xal:defs>
 
-					<xal:button text="I have a popup" popup="#testComponent"/>
+					<xal:button id="HavePopup" name="Harvey" text="I have a popup" popup="#testComponent"/>
 
-					<xal:label x="0px" y="40px" text="I have the same popup" popup="#testComponent"/>
+					<xal:label id="HaveSamePopup" x="0px" y="40px" text="I have the same popup" popup="#testComponent"/>
 
 					<xal:checkBox x="0px" y="80px" text="I have a different, empty one"
 						popup="#testComponent2"/>



Mime
View raw message