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

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Feb 4 20:10:42 EST 2008


Author: nbelaevski
Date: 2008-02-04 20:10:42 -0500 (Mon, 04 Feb 2008)
New Revision: 5796

Modified:
   trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js
   trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
Log:
http://jira.jboss.com/jira/browse/RF-1850

Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js	2008-02-05 01:09:52 UTC (rev 5795)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item-dnd.js	2008-02-05 01:10:42 UTC (rev 5796)
@@ -104,18 +104,27 @@
 	},
 	
 	getDraggableOptions: function() {
-		if (window.drag && window.drag.treeDraggableOptions) {
-			return window.drag.treeDraggableOptions;		
-		}
+		var drag = window.drag;
+		
+		if (drag && drag.treeDraggableOptions) {
+			
+			return drag.treeDraggableOptions;		
+		} else {
+			var opts = this._getDraggableOptions();
 
-		var attr = Richfaces.getNSAttribute("draggableoptions", this.elements.iconElement);
-		if (attr) {
-			var opts = attr.parseJSON(EventHandlersWalk);
-			if (window.drag) {
-				window.drag.treeDraggableOptions = opts;
+			if (drag) {
+				drag.treeDraggableOptions = opts;
 			}
+			
 			return opts;
 		}
+	},
+	
+	_getDraggableOptions: function() {
+		var attr = Richfaces.getNSAttribute("draggableoptions", this.elements.iconElement);
+		if (attr) {
+			return attr.parseJSON(EventHandlersWalk);
+		}
 		
 		return null;
 	},

Modified: trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js
===================================================================
--- trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js	2008-02-05 01:09:52 UTC (rev 5795)
+++ trunk/ui/tree/src/main/resources/org/richfaces/renderkit/html/scripts/tree-item.js	2008-02-05 01:10:42 UTC (rev 5796)
@@ -1,4 +1,5 @@
 Tree.Item = Class.create();
+
 Tree.Item.prototype = {
 	initialize: function(id, tree, parent, ajaxUpdate) {
 		this.parent = parent;
@@ -60,10 +61,10 @@
 		var handleImgExpandedId = handleId + Tree.ID_DEVIDER + Tree.ID_HANDLE_IMG_EXPANDED;
 		var handleImgCollapsedId = handleId + Tree.ID_DEVIDER + Tree.ID_HANDLE_IMG_COLLAPSED;
 
-		this.elements.handle = Element.firstDescendant(Element.firstDescendant(handles));
+		this.elements.handle = Richfaces.firstDescendant(Richfaces.firstDescendant(handles));//Element.firstDescendant(Element.firstDescendant(handles));
 		if (this.elements.handle.id == handleId) {
-			this.elements.handleImgCollapsed = this.elements.handle.firstDescendant();
-			this.elements.handleImgExpanded = this.elements.handleImgCollapsed.next();
+			this.elements.handleImgCollapsed = Richfaces.firstDescendant(this.elements.handle);
+			this.elements.handleImgExpanded = Richfaces.next(this.elements.handleImgCollapsed);
 			
 			if (this.elements.handleImgExpanded.id != handleImgExpandedId || 
 					this.elements.handleImgCollapsed.id != handleImgCollapsedId) {
@@ -76,12 +77,12 @@
 		this.eventMouseOut = this.processMouseOut.bindAsEventListener(this);
 		this.eventMouseOver = this.processMouseOver.bindAsEventListener(this);
 		
-		var dragOpts = this.getDraggableOptions();
+		var dragOpts = this._getDraggableOptions();
 		if(dragOpts) {
 			this.enableDraggableCursors(dragOpts.grab, dragOpts.grabbing);
 		}	
 			
-		var dropOpts = this.getDropzoneOptions();;
+		var dropOpts = this.getDropzoneOptions();
 		if	(dropOpts) {
 			this.enableDropzoneCursors(dropOpts.acceptCursor, dropOpts.rejectCursor);
 		}
@@ -99,7 +100,6 @@
 		}
 		
 		this.childs = null;
-		this.elements = null;
 	},
 
 	observeEvents: function() {
@@ -386,10 +386,10 @@
 
 				if (this.tree.options.onSelection) this.tree.options.onSelection(this.id);
 				this.tree.showNode(eText.parentNode);
+			}
 
-				if (e && e["originatingEventType"] == "mousedown" /* can be keydown */) {
-					this.startDrag(e);
-				}
+			if (e && e["originatingEventType"] == "mousedown" /* can be keydown */) {
+				this.startDrag(e);
 			}
 
 			return true;




More information about the richfaces-svn-commits mailing list