[richfaces-svn-commits] JBoss Rich Faces SVN: r12086 - in trunk/ui/tree/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sun Jan 4 09:49:10 EST 2009


Author: nbelaevski
Date: 2009-01-04 09:49:10 -0500 (Sun, 04 Jan 2009)
New Revision: 12086

Modified:
   trunk/ui/tree/src/main/config/component/tree.xml
   trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
   trunk/ui/tree/src/main/templates/htmlTree.jspx
Log:
https://jira.jboss.org/jira/browse/RF-4226

Modified: trunk/ui/tree/src/main/config/component/tree.xml
===================================================================
--- trunk/ui/tree/src/main/config/component/tree.xml	2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/config/component/tree.xml	2009-01-04 14:49:10 UTC (rev 12086)
@@ -166,6 +166,13 @@
 		   <description>It's an event that is called when something is dropped on a drop zone</description>
         </property>
         
+		<property>
+           <name>oncontextmenu</name>
+           <classname>java.lang.String</classname>
+           <description>JavaScript handler to be called on right click.
+		   Returning false prevents default browser context menu from being displayed</description>
+		</property>
+		
         <property hidden="true">
         	<name>varState</name>
         	<classname>java.lang.String</classname>

Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js	2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree.js	2009-01-04 14:49:10 UTC (rev 12086)
@@ -74,6 +74,8 @@
 		this.onselect = new Function('event', (events.onselect ? events.onselect : "") + "; return true;");
 		this.onexpand = new Function('event', (events.onexpand ? events.onexpand : "") + "; return true;");
 		this.oncollapse = new Function('event', (events.oncollapse ? events.oncollapse : "") + "; return true;");
+		this.oncontextmenu = new Function('event', (events.oncontextmenu ? events.oncontextmenu : "") + "; return true;");
+		
 		this.onAjaxSelect = onAjaxSelect;
 		this.element = $(id);
 		this.element.component=this;
@@ -156,6 +158,12 @@
 				}
 			}
 		}.bindAsEventListener(this));
+		
+		Event.observe(this.element, "contextmenu", function(event) {
+			if (this.oncontextmenu(event) === false) {
+				Event.stop(event);
+			}
+		}.bindAsEventListener(this));
 	},
 	
 	destroy: function() {

Modified: trunk/ui/tree/src/main/templates/htmlTree.jspx
===================================================================
--- trunk/ui/tree/src/main/templates/htmlTree.jspx	2009-01-04 12:35:24 UTC (rev 12085)
+++ trunk/ui/tree/src/main/templates/htmlTree.jspx	2009-01-04 14:49:10 UTC (rev 12086)
@@ -54,7 +54,8 @@
 				{
 					onselect: "#{component.attributes['onselected']}", 
 					onexpand: "#{component.attributes['onexpand']}", 
-					oncollapse: "#{component.attributes['oncollapse']}" 
+					oncollapse: "#{component.attributes['oncollapse']}",
+					oncontextmenu: "#{component.attributes['oncontextmenu']}" 
 				},
 				function(event) {
 					#{this:getAjaxScript(context, component)}




More information about the richfaces-svn-commits mailing list