[richfaces-svn-commits] JBoss Rich Faces SVN: r4571 - 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
Thu Dec 6 14:20:08 EST 2007


Author: abelevich
Date: 2007-12-06 14:20:08 -0500 (Thu, 06 Dec 2007)
New Revision: 4571

Modified:
   trunk/ui/drag-drop/src/main/config/component/dragSupport.xml
   trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
   trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
Log:
add grab and grabbing cursor support for the rich:dragSupport (RF-1403)

Modified: trunk/ui/drag-drop/src/main/config/component/dragSupport.xml
===================================================================
--- trunk/ui/drag-drop/src/main/config/component/dragSupport.xml	2007-12-06 19:18:16 UTC (rev 4570)
+++ trunk/ui/drag-drop/src/main/config/component/dragSupport.xml	2007-12-06 19:20:08 UTC (rev 4571)
@@ -62,6 +62,23 @@
 				JavaScript code for call before submission of ajax event
 			</description>
 		</property>
+		
+		<property>
+			<name>grabCursor</name>
+			<classname>java.lang.String</classname>
+			<description>
+				list of comma separated cursors that indicates then user can grab and drag an object
+			</description>
+		</property>
+		
+		<property>
+			<name>grabbingCursor</name>
+			<classname>java.lang.String</classname>
+			<description>
+				list of comma separated cursors that indicates then the user has grabbed something
+			</description>
+		</property>
+		
 		
 		<property hidden="true" >
                 <name>actionExpression</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-06 19:18:16 UTC (rev 4570)
+++ trunk/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java	2007-12-06 19:20:08 UTC (rev 4571)
@@ -77,6 +77,8 @@
 			super((UIComponent) draggable);
 
 			addOption("dragType", draggable.getDragType());
+			addOption("grab", convertCursorStyle(draggable.getGrabCursor()));
+			addOption("grabbing",convertCursorStyle(draggable.getGrabbingCursor()));
 			addEventHandler("ondragstart", draggable.getOndragstart());
 			addEventHandler("ondragend", draggable.getOndragend());
 			addEventHandler("ondropover",draggable.getOndropover());
@@ -84,6 +86,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 void decode(FacesContext context, UIComponent component, CompositeRenderer compositeRenderer) {
 		DnDEventsExchangeMailer eventsExchanger = DnDEventsExchangeMailer.getInstance(context);

Modified: trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js
===================================================================
--- trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js	2007-12-06 19:18:16 UTC (rev 4570)
+++ trunk/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/simple-draggable.js	2007-12-06 19:20:08 UTC (rev 4571)
@@ -15,13 +15,17 @@
 		this.dragIndicatorId = this.options.dragIndicator;
 
         this.eventMouseDown = this.initDrag.bindAsEventListener(this);
-
+			
 		Event.observe(this.id, "mousedown", this.eventMouseDown);
 		
 		this.form = this.id;
 		while (this.form && !/^form$/i.test(this.form.tagName)) {
 			this.form = this.form.parentNode;
 		}
+		
+		if (this.options.grab || this.options.grabbing) {
+			this.enableDraggableCursors();
+		}	
 	},
 
 	getDnDDragParams: function() {
@@ -63,7 +67,7 @@
 	},
 
 	initDrag: function(event) {
-		if(Event.isLeftClick(event)) {
+		if (Event.isLeftClick(event)) {
 		  var src = Event.element(event);
 		  if(src.tagName && (
 			src.tagName.toUpperCase() == 'INPUT' ||




More information about the richfaces-svn-commits mailing list