[richfaces-svn-commits] JBoss Rich Faces SVN: r4788 - in trunk/framework: impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Wed Dec 12 11:21:40 EST 2007


Author: abelevich
Date: 2007-12-12 11:21:40 -0500 (Wed, 12 Dec 2007)
New Revision: 4788

Modified:
   trunk/framework/api/src/main/java/org/richfaces/component/Draggable.java
   trunk/framework/api/src/main/java/org/richfaces/component/Dropzone.java
   trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
   trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js
Log:
add supports for dropzone, rename method in the draggable interface, add methods in the dropzone interface

Modified: trunk/framework/api/src/main/java/org/richfaces/component/Draggable.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/component/Draggable.java	2007-12-12 16:20:24 UTC (rev 4787)
+++ trunk/framework/api/src/main/java/org/richfaces/component/Draggable.java	2007-12-12 16:21:40 UTC (rev 4788)
@@ -126,10 +126,10 @@
 	public void setDragListener(MethodBinding binding);
 	public MethodBinding getDragListener();
 
-	public String getGrabCursor();
-	public void setGrabCursor(String grabCursor);
+	public String getGrabCursors();
+	public void setGrabCursors(String grabCursors);
 
-	public String getGrabbingCursor();
-	public void setGrabbingCursor(String grabbingCursor);
+	public String getGrabbingCursors();
+	public void setGrabbingCursors(String grabbingCursors);
 
 }

Modified: trunk/framework/api/src/main/java/org/richfaces/component/Dropzone.java
===================================================================
--- trunk/framework/api/src/main/java/org/richfaces/component/Dropzone.java	2007-12-12 16:20:24 UTC (rev 4787)
+++ trunk/framework/api/src/main/java/org/richfaces/component/Dropzone.java	2007-12-12 16:21:40 UTC (rev 4788)
@@ -98,4 +98,16 @@
 	 */
 	public abstract void setOndropend(String ondropend);
 	
+	/**
+	 *  Getter for the list of comma separated cursors that indicates when acceptable draggable over dropzone
+	 */
+	public String getAcceptCursors();
+	public void setAcceptCursors(String acceptCursors);
+
+	/**
+	 *  Getter for the list of comma separated cursors that indicates when rejectable draggable over dropzone   
+	 */
+	public String getRejectCursors();
+	public void setRejectCursors(String rejectCursors);
+
 }

Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js	2007-12-12 16:20:24 UTC (rev 4787)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js	2007-12-12 16:21:40 UTC (rev 4788)
@@ -174,8 +174,7 @@
 			}
 			this.grabbingCursor.showCursor();		
 		} 
-		window.status= document.body.style.cursor;
-					
+			
 		if (contentType) {
 			if (!this.endDragListener) {
 				this.dragTrigger = this.moveDrag.bindAsEventListener(this);
@@ -276,9 +275,7 @@
 				grabbingCursor.hideCursor();
 			}	
 		}
-		window.status= document.body.style.cursor;
 		
-		
 		var options = this.getDraggableOptions();
 		if (options && options.ondragend) {
 			options.ondragend(event);
@@ -310,8 +307,6 @@
 				}	
 			}
 		}
-		this.i = this.i + 1
-		window.status= this.i;	
 	},
 	
 	ondragout: function(event) {
@@ -321,7 +316,6 @@
 				grabCursor.hideCursor();
 			}  
 		}
-		window.status= document.body.style.cursor;
 	}, 
 	
 	getCurrentGrabbingCursor: function() {
@@ -353,10 +347,6 @@
 		if(grabCursor) {
 			grabCursor.showCursor();
 		}
-		
-		window.status= document.body.style.cursor;
-		
-		
 	},
 	
 	ondropover: function(event, drag) {
@@ -389,7 +379,7 @@
 				Event.observe(element, "mouseout", this.dragOutBound);
 				Event.observe(element, "mouseover", this.dragOverBound);
 				Event.observe(element, "mouseup", this.dragUpBound);
-				this.i = 0;	
+					
 				this.grabCursor = new DnD.Cursor(element,this.options.grab);
 			} 
 		
@@ -419,7 +409,9 @@
 			this.isCursorsEnabled = false;
 		}
 		return this.isCursorsEnabled;
-	} 
+	}
+	
+
 };
 
 DefaultDragIndicator = {

Modified: trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js
===================================================================
--- trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js	2007-12-12 16:20:24 UTC (rev 4787)
+++ trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js	2007-12-12 16:21:40 UTC (rev 4788)
@@ -60,7 +60,15 @@
 		drag.source.ondropover(event,drag);
 		
 		var indicator = drag.indicator;
-			
+		
+		var accepts = this.accept(drag);
+		
+		if (accepts && this.acceptCursor) {
+			this.acceptCursor.showCursor();
+		} else if (this.rejectCursor){
+			this.rejectCursor.showCursor();
+		}		
+				
 		if (indicator) {
 			var icon = this.getIconCodeForType(drag.type);
 
@@ -79,7 +87,6 @@
 				}
 			}
 
-            var accepts = this.accept(drag);
 			var markerType = accepts ? "accept" : "reject";
 
 			DnD.setDefaultDnDParams(dndParams);
@@ -121,23 +128,52 @@
 		if (indicator) {
 			indicator.leave();
 		}
-
+	
 		var opts = this.getDropzoneOptions();
 		if (opts && opts.ondragexit) {
 			opts.ondragexit(event);
 		}
+		
+		if (this.acceptCursor) {
+			if (this.acceptCursor.visible) { 
+				this.acceptCursor.hideCursor();
+			}	
+		} else if (this.rejectCursor){
+			if (this.rejectCursor.visible) {
+				this.rejectCursor.hideCursor();
+			}	
+		}		
 	},
 
 	dragUp: function(event) {
         this.ondropend(event);
-
+		
+		if (this.acceptCursor) {
+			if (this.acceptCursor.visible) { 
+				this.acceptCursor.hideCursor();
+			}	
+		} else if (this.rejectCursor){
+			if (this.rejectCursor.visible) {
+				this.rejectCursor.hideCursor();
+			}	
+		}		
+		
 		var options = this.getDropzoneOptions();
 		if (options && options.ondropend) {
 			options.ondropend();
 		}
 	},
+	
+	enableDropzoneCursors: function() {
+		if (this.options.acceptCursor) {
+			this.acceptCursor = new DnD.Cursor(this.getElement(),this.options.acceptCursor);
+		} 
+		
+		if (this.options.rejectCursor) {	
+			this.rejectCursor = new DnD.Cursor(this.getElement(),this.options.rejectCursor);
+		}	 
+	}, 
 
-
 	ondropend: function(event) {
 	},
 




More information about the richfaces-svn-commits mailing list