[richfaces-svn-commits] JBoss Rich Faces SVN: r4787 - in trunk/ui/drag-drop/src/main: java/org/richfaces/renderkit and 1 other directories.

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


Author: abelevich
Date: 2007-12-12 11:20:24 -0500 (Wed, 12 Dec 2007)
New Revision: 4787

Modified:
   trunk/ui/drag-drop/src/main/config/component/dragSupport.xml
   trunk/ui/drag-drop/src/main/config/component/dropSupport.xml
   trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
   trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
   trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js
Log:
add cursors for dropzone

Modified: trunk/ui/drag-drop/src/main/config/component/dragSupport.xml
===================================================================
--- trunk/ui/drag-drop/src/main/config/component/dragSupport.xml	2007-12-12 16:18:24 UTC (rev 4786)
+++ trunk/ui/drag-drop/src/main/config/component/dragSupport.xml	2007-12-12 16:20:24 UTC (rev 4787)
@@ -64,19 +64,21 @@
 		</property>
 		
 		<property>
-			<name>grabCursor</name>
+			<name>grabCursors</name>
 			<classname>java.lang.String</classname>
 			<description>
 				list of comma separated cursors that indicates then user can grab and drag an object
 			</description>
+			<defaultvalue>""</defaultvalue>
 		</property>
 		
 		<property>
-			<name>grabbingCursor</name>
+			<name>grabbingCursors</name>
 			<classname>java.lang.String</classname>
 			<description>
 				list of comma separated cursors that indicates then the user has grabbed something
 			</description>
+			<defaultvalue>""</defaultvalue>
 		</property>
 		
 		

Modified: trunk/ui/drag-drop/src/main/config/component/dropSupport.xml
===================================================================
--- trunk/ui/drag-drop/src/main/config/component/dropSupport.xml	2007-12-12 16:18:24 UTC (rev 4786)
+++ trunk/ui/drag-drop/src/main/config/component/dropSupport.xml	2007-12-12 16:20:24 UTC (rev 4787)
@@ -55,6 +55,25 @@
 				JavaScript code for call before submission of ajax event
 			</description>
 		</property>
+		
+		<property>
+			<name>acceptCursors</name>
+			<classname>java.lang.String</classname>
+			<description>
+				list of comma separated cursors that indicates when acceptable draggable over dropzone
+			</description>
+			<defaultvalue>""</defaultvalue>
+		</property>
+				
+		<property>
+			<name>rejectCursors</name>
+			<classname>java.lang.String</classname>
+			<description>
+				list of comma separated cursors that indicates when rejectable draggable over dropzone   
+			</description>
+			<defaultvalue>""</defaultvalue>
+		</property>
+		
 		<!--
 		<property>
 			<name>param</name>

Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java	2007-12-12 16:18:24 UTC (rev 4786)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java	2007-12-12 16:20:24 UTC (rev 4787)
@@ -77,8 +77,8 @@
 			super((UIComponent) draggable);
 
 			addOption("dragType", draggable.getDragType());
-			addOption("grab", convertCursorStyle(draggable.getGrabCursor()));
-			addOption("grabbing",convertCursorStyle(draggable.getGrabbingCursor()));
+			addOption("grab", convertCursorStyle(draggable.getGrabCursors()));
+			addOption("grabbing",convertCursorStyle(draggable.getGrabbingCursors()));
 			addEventHandler("ondragstart", draggable.getOndragstart());
 			addEventHandler("ondragend", draggable.getOndragend());
 			addEventHandler("ondropover",draggable.getOndropover());

Modified: trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
--- trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java	2007-12-12 16:18:24 UTC (rev 4786)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java	2007-12-12 16:20:24 UTC (rev 4787)
@@ -116,6 +116,18 @@
 			}
 			addOption("typeMapping", typeMapping);
 			
+			String acceptCursors = zone.getAcceptCursors(); 
+			if (!acceptCursors.equals("")) {
+				acceptCursors = convertCursorStyle(acceptCursors);
+				addOption("acceptCursor", acceptCursors);
+			}
+				
+			String rejectCursors = zone.getRejectCursors();
+			if (!rejectCursors.equals("")) {
+				rejectCursors = convertCursorStyle(rejectCursors);
+				addOption("rejectCursor", rejectCursors);
+			}
+							
 			addEventHandler("ondragenter", zone.getOndragenter());
 			addEventHandler("ondragexit", zone.getOndragexit());
 			addEventHandler("onafterdrag");
@@ -124,6 +136,17 @@
 		}
 	}
 
+	public String convertCursorStyle(String cursors){
+		StringBuffer cursorStyle = new StringBuffer();
+		if(cursors != null){
+			String [] entries = cursors.split(",");
+			for (int i = 0; i < entries.length; i++) {
+				cursorStyle.append("cursor: " + entries[i] + ";");
+			}
+		}	
+		return cursorStyle.toString(); 
+	}
+	
 	public ScriptOptions buildOptions(FacesContext context, UIComponent drop) {
 		if (drop instanceof Dropzone) {
 			return new DropZoneOptions((Dropzone) drop);

Modified: trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js
===================================================================
--- trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js	2007-12-12 16:18:24 UTC (rev 4786)
+++ trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-dropzone.js	2007-12-12 16:20:24 UTC (rev 4787)
@@ -31,8 +31,14 @@
 		Event.observe(element, "mouseout", this.mouseoutBound);
 		Event.observe(element, "mouseup", this.mouseupBound);
 		
+		
+			
 		this.options = options || {};
 		
+		if (options.acceptCursor || options.rejectCursor) {
+			this.enableDropzoneCursors();
+		}
+		
 	},
 
 	getDropzoneOptions: function() {




More information about the richfaces-svn-commits mailing list