Author: pyaschenko
Date: 2009-09-02 08:27:23 -0400 (Wed, 02 Sep 2009)
New Revision: 15437
Modified:
branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js
branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
Log:
https://jira.jboss.org/jira/browse/RF-7156
Modified: branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js
===================================================================
--- branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js 2009-09-02
12:22:33 UTC (rev 15436)
+++ branches/community/3.3.X/framework/impl/src/main/javascript/dnd/dnd.js 2009-09-02
12:27:23 UTC (rev 15437)
@@ -50,9 +50,10 @@
var drag = window.drag;
if (!drag.source.onupdatedrag || (drag.source.onupdatedrag(event) != false)) {
- var x = Event.pointerX(event);
- var y = Event.pointerY(event);
- drag.indicator.position(x + 5, y + 14);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ cursorRect.left += 5;
+ cursorRect.top += 14;
+ drag.indicator.position(cursorRect.left, cursorRect.top);
Event.stop(event);
}
},
Modified:
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js
===================================================================
---
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js 2009-09-02
12:27:23 UTC (rev 15437)
@@ -188,10 +188,9 @@
moveDrag: function(event) {
//TODO handle mouseover to update coords
- var x = Event.pointerX(event);
- var y = Event.pointerY(event);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
- if (!window.drag && (Math.abs(this.lastDragX - x) + Math.abs(this.lastDragY -
y)) > 2) {
+ if (!window.drag && (Math.abs(this.lastDragX - cursorRect.left) +
Math.abs(this.lastDragY - cursorRect.top)) > 2) {
this.updateDrag(event);
}
},
@@ -223,8 +222,9 @@
this.endDragListener.activate(event);
Event.observe(document, "mousemove", this.dragTrigger);
- this.lastDragX = Event.pointerX(event);
- this.lastDragY = Event.pointerY(event);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ this.lastDragX = cursorRect.left;
+ this.lastDragY = cursorRect.top;
}
},
@@ -232,15 +232,16 @@
var type = this.getContentType();
var indicator = this.getIndicator();
var drag = new DnD.Drag(this, indicator, type);
-
+
if (indicator.id.indexOf("_rfDefaultDragIndicator") != -1) {
var target = drag.source.getElement();
- var offSets = Position.cumulativeOffset(target);
indicator.indicatorWidth = Element.getWidth(target);
indicator.indicatorHeight = Element.getHeight(target);
- indicator.position(offSets[0], offSets[1]);
- indicator.removalX = Event.pointerX(event) - offSets[0];
- indicator.removalY = Event.pointerY(event) - offSets[1];
+ var rect = Richfaces.jQuery.getElementRectangle(target);
+ var cursorRect = Richfaces.jQuery.getPointerRectangle(event);
+ indicator.position(rect.left, rect.top);
+ indicator.removalX = cursorRect.left - rect.left;
+ indicator.removalY = cursorRect.top - rect.top;
}
DnD.startDrag(drag);
Modified:
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java
===================================================================
---
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/DnDTest.java 2009-09-02
12:27:23 UTC (rev 15437)
@@ -69,13 +69,7 @@
resetButtonId = parentId + FORMID + DATAID + "reset";
}
- @Override
- protected String getFirefoxTemplate() {
- return "c:/FFProfile";
- }
-
-
@Test
public void testExternalValidationFailure(Template template) {
AutoTester tester = getAutoTester(this);
@@ -110,7 +104,6 @@
tester.testAjaxSingleWithInternalValidationFailed();
}
-
Modified:
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java
===================================================================
---
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DraggableRendererContributor.java 2009-09-02
12:27:23 UTC (rev 15437)
@@ -93,6 +93,8 @@
public String[] getScriptDependencies() {
return new String[] {
PrototypeScript.class.getName(),
+ "/org/richfaces/renderkit/html/scripts/jquery/jquery.js",
+ "/org/richfaces/renderkit/html/scripts/jquery.utils.js",
"/org/richfaces/renderkit/html/scripts/json/json-mini.js",
DnDScript.class.getName(),
"/org/richfaces/renderkit/html/scripts/utils.js",
Modified:
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java
===================================================================
---
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/ui/drag-drop/src/main/java/org/richfaces/renderkit/DropzoneRendererContributor.java 2009-09-02
12:27:23 UTC (rev 15437)
@@ -302,6 +302,8 @@
public String[] getScriptDependencies() {
return new String[] {
PrototypeScript.class.getName(),
+ "/org/richfaces/renderkit/html/scripts/jquery/jquery.js",
+ "/org/richfaces/renderkit/html/scripts/jquery.utils.js",
"/org/richfaces/renderkit/html/scripts/json/json-mini.js",
DnDScript.class.getName(),
"/org/richfaces/renderkit/html/scripts/utils.js",
Modified:
branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js
===================================================================
---
branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/ui/drag-drop/src/main/resources/org/richfaces/renderkit/html/scripts/drag-indicator.js 2009-09-02
12:27:23 UTC (rev 15437)
@@ -88,14 +88,15 @@
}
},
- position: function(x, y) {
+ position: function(x,y) {
if (!this.offsets) {
Element.show(this);
this.style.position = 'absolute';
- }
+ }
+
Element.setStyle(this, {"left": x + "px", "top": y +
"px"});
- this.moveIFrame(x, y);
+ this.moveIFrame(x,y);
},
accept: function() {
Modified:
branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx
===================================================================
---
branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/ui/drag-drop/src/main/templates/org/richfaces/htmlDragIndicator.jspx 2009-09-02
12:27:23 UTC (rev 15437)
@@ -13,6 +13,8 @@
<h:scripts>
new org.ajax4jsf.javascript.PrototypeScript(),
+ /org/richfaces/renderkit/html/scripts/jquery/jquery.js,
+ /org/richfaces/renderkit/html/scripts/jquery.utils.js,
new org.ajax4jsf.javascript.AjaxScript(),
new org.ajax4jsf.javascript.DnDScript(),
/org/richfaces/renderkit/html/scripts/utils.js,
Modified:
branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java
===================================================================
---
branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2009-09-02
12:22:33 UTC (rev 15436)
+++
branches/community/3.3.X/ui/drag-drop/src/test/java/org/richfaces/component/DragDropTest.java 2009-09-02
12:27:23 UTC (rev 15437)
@@ -71,6 +71,8 @@
private static Set javaScripts = new HashSet();
static {
javaScripts.add("org.ajax4jsf.javascript.PrototypeScript");
+ javaScripts.add("scripts/jquery/jquery.js");
+ javaScripts.add("scripts/jquery.utils.js");
javaScripts.add("org.ajax4jsf.javascript.AjaxScript");
javaScripts.add("scripts/browser_info.js");
javaScripts.add("org.ajax4jsf.javascript.DnDScript");