[richfaces-svn-commits] JBoss Rich Faces SVN: r819 - trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon May 21 08:58:33 EDT 2007


Author: sergeyhalipov
Date: 2007-05-21 08:58:33 -0400 (Mon, 21 May 2007)
New Revision: 819

Modified:
   trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
Log:
Panel menu: JavaScript API for end-developers, doExpand(), doCollapse().

Modified: trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js
===================================================================
--- trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js	2007-05-21 12:04:05 UTC (rev 818)
+++ trunk/richfaces/panelmenu/src/main/resources/org/richfaces/renderkit/html/scripts/panelMenu.js	2007-05-21 12:58:33 UTC (rev 819)
@@ -285,4 +285,34 @@
 		Event.observe(this.obj, "mouseover", this.addHoverStyles.bindAsEventListener(this), false);
 		Event.observe(this.obj, "mouseout", this.removeHoverStyles.bindAsEventListener(this), false);
 	}
-};
\ No newline at end of file
+};
+
+Richfaces.doExpand = function (id) {
+	var group = PanelMenuStorage[id];
+	if (group && group.type && "node" == group.type) {
+		var parent = group.parentObj;
+		if (parent.expandSingle){
+			if (group.parentObj.lastExpanded!=null){
+				group.parentObj.lastExpanded.collapse();
+			}
+		}
+		while (parent) {
+			if (parent.type && "node" == parent.type) {
+				parent.expand();
+			}
+			parent = parent.parentObj;
+		}
+		if (!group.expanded && new Function(group.onopen+";return true;")()){
+			group.expand();
+		} 
+	}
+}
+
+Richfaces.doCollapse = function (id) {
+	var group = PanelMenuStorage[id];
+	if (group && group.type && "node" == group.type) {
+		if (group.expanded && new Function(group.onclose+";return true;")()){
+			group.collapse();
+		} 
+	}
+}
\ No newline at end of file




More information about the richfaces-svn-commits mailing list