summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-03-11 12:52:37 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-03-11 12:52:37 +0000
commitefd5721cf3ff0ac27ad0527d72bdfa14c2252328 (patch)
tree3f73c47c2429aa59e6b111880cba585dde199e1d /src
parent53f6404de418cea003fc5be6314b6d0099300aa7 (diff)
downloadvaadin-framework-efd5721cf3ff0ac27ad0527d72bdfa14c2252328.tar.gz
vaadin-framework-efd5721cf3ff0ac27ad0527d72bdfa14c2252328.zip
changed the code to be java 1.6 compatible
svn changeset:11784/svn branch:6.3
Diffstat (limited to 'src')
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/VTree.java3
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java41
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java20
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java21
6 files changed, 52 insertions, 45 deletions
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java
index 17bee7f318..be86089b38 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VDragAndDropWrapper.java
@@ -19,6 +19,7 @@ import com.vaadin.terminal.gwt.client.RenderInformation;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.RenderInformation.Size;
+import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
import com.vaadin.terminal.gwt.client.ui.dd.HorizontalDropLocation;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
@@ -325,12 +326,12 @@ public class VDragAndDropWrapper extends VCustomComponent implements
}-*/;
public void updateDropDetails(VDragEvent drag) {
- verticalDropLocation = VerticalDropLocation.get(getElement(), drag
- .getCurrentGwtEvent().getClientY(), 0.2);
+ verticalDropLocation = DDUtil.getVerticalDropLocation(getElement(),
+ drag.getCurrentGwtEvent().getClientY(), 0.2);
drag.getDropDetails().put("verticalLocation",
verticalDropLocation.toString());
- horizontalDropLocation = HorizontalDropLocation.get(getElement(), drag
- .getCurrentGwtEvent().getClientX(), 0.2);
+ horizontalDropLocation = DDUtil.getHorizontalDropLocation(getElement(),
+ drag.getCurrentGwtEvent().getClientX(), 0.2);
drag.getDropDetails().put("horizontalLocation",
horizontalDropLocation.toString());
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
index b6c22e9a85..a1c909c7ef 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VScrollTable.java
@@ -42,6 +42,7 @@ import com.vaadin.terminal.gwt.client.RenderSpace;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
import com.vaadin.terminal.gwt.client.ui.VScrollTable.VScrollTableBody.VScrollTableRow;
+import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
@@ -3202,7 +3203,7 @@ public class VScrollTable extends FlowPanel implements Table, ScrollHandler,
int childIndex = DOM.getChildIndex(tr, element);
dropDetails.colkey = tHead.getHeaderCell(childIndex)
.getColKey();
- dropDetails.dropLocation = VerticalDropLocation.get(row
+ dropDetails.dropLocation = DDUtil.getVerticalDropLocation(row
.getElement(), drag.getCurrentGwtEvent().getClientY(),
0.2);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/VTree.java b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
index d78196ed43..b5a1a7013e 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/VTree.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/VTree.java
@@ -24,6 +24,7 @@ import com.vaadin.terminal.gwt.client.MouseEventDetails;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.terminal.gwt.client.Util;
+import com.vaadin.terminal.gwt.client.ui.dd.DDUtil;
import com.vaadin.terminal.gwt.client.ui.dd.VAbstractDropHandler;
import com.vaadin.terminal.gwt.client.ui.dd.VAcceptCallback;
import com.vaadin.terminal.gwt.client.ui.dd.VDragAndDropManager;
@@ -270,7 +271,7 @@ public class VTree extends FlowPanel implements Paintable, VHasDropHandler {
if (treeNode == null) {
return null;
}
- VerticalDropLocation verticalDropLocation = VerticalDropLocation.get(
+ VerticalDropLocation verticalDropLocation = DDUtil.getVerticalDropLocation(
treeNode.nodeCaptionDiv, event.getClientY(), 0.2);
return verticalDropLocation;
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java b/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java
new file mode 100644
index 0000000000..60e81b3607
--- /dev/null
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/DDUtil.java
@@ -0,0 +1,41 @@
+package com.vaadin.terminal.gwt.client.ui.dd;
+
+import com.google.gwt.user.client.Element;
+
+public class DDUtil {
+
+ public static VerticalDropLocation getVerticalDropLocation(Element element,
+ int clientY, double topBottomRatio) {
+
+ int absoluteTop = element.getAbsoluteTop();
+ int offsetHeight = element.getOffsetHeight();
+ int fromTop = clientY - absoluteTop;
+
+ float percentageFromTop = (fromTop / (float) offsetHeight);
+ if (percentageFromTop < topBottomRatio) {
+ return VerticalDropLocation.TOP;
+ } else if (percentageFromTop > 1 - topBottomRatio) {
+ return VerticalDropLocation.BOTTOM;
+ } else {
+ return VerticalDropLocation.MIDDLE;
+ }
+ }
+
+ public static HorizontalDropLocation getHorizontalDropLocation(
+ Element element, int clientX, double leftRightRatio) {
+
+ int absoluteLeft = element.getAbsoluteLeft();
+ int offsetWidth = element.getOffsetWidth();
+ int fromTop = clientX - absoluteLeft;
+
+ float percentageFromTop = (fromTop / (float) offsetWidth);
+ if (percentageFromTop < leftRightRatio) {
+ return HorizontalDropLocation.LEFT;
+ } else if (percentageFromTop > 1 - leftRightRatio) {
+ return HorizontalDropLocation.RIGHT;
+ } else {
+ return HorizontalDropLocation.CENTER;
+ }
+ }
+
+}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java b/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
index c8a09cbc8f..70f5793257 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/HorizontalDropLocation.java
@@ -3,25 +3,7 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.google.gwt.user.client.Element;
public enum HorizontalDropLocation {
- LEFT, RIGHT, CENTER;
-
- public static HorizontalDropLocation get(Element element, int clientX,
- double leftRightRatio) {
-
- int absoluteLeft = element.getAbsoluteLeft();
- int offsetWidth = element.getOffsetWidth();
- int fromTop = clientX - absoluteLeft;
-
- float percentageFromTop = (fromTop / (float) offsetWidth);
- if (percentageFromTop < leftRightRatio) {
- return LEFT;
- } else if (percentageFromTop > 1 - leftRightRatio) {
- return RIGHT;
- } else {
- return CENTER;
- }
- }
+ LEFT, RIGHT, CENTER
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java
index 8c011d8bd8..afd1699278 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VerticalDropLocation.java
@@ -3,25 +3,6 @@
*/
package com.vaadin.terminal.gwt.client.ui.dd;
-import com.google.gwt.user.client.Element;
-
public enum VerticalDropLocation {
- TOP, BOTTOM, MIDDLE;
-
- public static VerticalDropLocation get(Element element, int clientY,
- double topBottomRatio) {
-
- int absoluteTop = element.getAbsoluteTop();
- int offsetHeight = element.getOffsetHeight();
- int fromTop = clientY - absoluteTop;
-
- float percentageFromTop = (fromTop / (float) offsetHeight);
- if (percentageFromTop < topBottomRatio) {
- return TOP;
- } else if (percentageFromTop > 1 - topBottomRatio) {
- return BOTTOM;
- } else {
- return MIDDLE;
- }
- }
+ TOP, BOTTOM, MIDDLE
}