aboutsummaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-18 15:00:50 +0000
committerMatti Tahvonen <matti.tahvonen@itmill.com>2010-02-18 15:00:50 +0000
commit7ce8cb30bff4d1ff8b90c3be00dabf6f6fc66f01 (patch)
treecbe37b83a47fc51454ae6328177e245f74ceacda /src/com
parentd95fb932d6b88d882659d06801e78fe9a2f152bb (diff)
downloadvaadin-framework-7ce8cb30bff4d1ff8b90c3be00dabf6f6fc66f01.tar.gz
vaadin-framework-7ce8cb30bff4d1ff8b90c3be00dabf6f6fc66f01.zip
some refactoring
svn changeset:11384/svn branch:6.3_dd
Diffstat (limited to 'src/com')
-rw-r--r--src/com/vaadin/event/ComponentTransferable.java33
-rw-r--r--src/com/vaadin/event/DataBoundTransferable.java15
-rw-r--r--src/com/vaadin/event/dd/DragAndDropEvent.java8
-rw-r--r--src/com/vaadin/event/dd/DragEvent.java34
-rw-r--r--src/com/vaadin/event/dd/DragSource.java9
-rw-r--r--src/com/vaadin/event/dd/DropEvent.java10
-rw-r--r--src/com/vaadin/event/dd/DropHandler.java2
-rw-r--r--src/com/vaadin/event/dd/DropTarget.java4
-rw-r--r--src/com/vaadin/event/dd/DropTargetDetails.java (renamed from src/com/vaadin/event/dd/TargetDetails.java)2
-rw-r--r--src/com/vaadin/event/dd/DropTargetDetailsImpl.java (renamed from src/com/vaadin/event/dd/TargetDetailsImpl.java)4
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java11
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java29
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java30
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VComponentFilter.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlawor.java17
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDataBound.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VDropDetailEquals.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VIdentifierIs.java15
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java17
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java13
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VOverTreeNode.java17
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java9
-rw-r--r--src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsSameAsTarget.java15
-rw-r--r--src/com/vaadin/terminal/gwt/server/DragAndDropService.java67
-rw-r--r--src/com/vaadin/ui/AbstractSelect.java4
-rw-r--r--src/com/vaadin/ui/DragAndDropWrapper.java37
-rw-r--r--src/com/vaadin/ui/DragDropPane.java12
-rw-r--r--src/com/vaadin/ui/Table.java49
-rw-r--r--src/com/vaadin/ui/Tree.java38
31 files changed, 236 insertions, 328 deletions
diff --git a/src/com/vaadin/event/ComponentTransferable.java b/src/com/vaadin/event/ComponentTransferable.java
index c1b713690a..2b7ac6696e 100644
--- a/src/com/vaadin/event/ComponentTransferable.java
+++ b/src/com/vaadin/event/ComponentTransferable.java
@@ -1,12 +1,35 @@
package com.vaadin.event;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
import com.vaadin.ui.Component;
-public interface ComponentTransferable extends Transferable {
+public class ComponentTransferable implements Transferable {
+ private Map<String, Object> rawVariables = new HashMap<String, Object>();
+ private Component sourceComponent;
+
+ public ComponentTransferable(Component sourceComponent,
+ Map<String, Object> rawVariables) {
+ this.sourceComponent = sourceComponent;
+ this.rawVariables = rawVariables;
+ }
+
+ public Component getSourceComponent() {
+ return sourceComponent;
+ }
+
+ public Object getData(String dataFlawor) {
+ return rawVariables.get(dataFlawor);
+ }
+
+ public void setData(String dataFlawor, Object value) {
+ rawVariables.put(dataFlawor, value);
+ }
- /**
- * @return the component that started the drag operation
- */
- public Component getSourceComponent();
+ public Collection<String> getDataFlawors() {
+ return rawVariables.keySet();
+ }
}
diff --git a/src/com/vaadin/event/DataBoundTransferable.java b/src/com/vaadin/event/DataBoundTransferable.java
index fd259f0481..ddb3cb17ce 100644
--- a/src/com/vaadin/event/DataBoundTransferable.java
+++ b/src/com/vaadin/event/DataBoundTransferable.java
@@ -1,9 +1,18 @@
package com.vaadin.event;
-public interface DataBoundTransferable extends ComponentTransferable {
+import java.util.Map;
- public Object getItemId();
+import com.vaadin.ui.Component;
- public Object getPropertyId();
+public abstract class DataBoundTransferable extends ComponentTransferable {
+
+ public DataBoundTransferable(Component sourceComponent,
+ Map<String, Object> rawVariables) {
+ super(sourceComponent, rawVariables);
+ }
+
+ public abstract Object getItemId();
+
+ public abstract Object getPropertyId();
}
diff --git a/src/com/vaadin/event/dd/DragAndDropEvent.java b/src/com/vaadin/event/dd/DragAndDropEvent.java
index 126edb15d8..4adc4e757e 100644
--- a/src/com/vaadin/event/dd/DragAndDropEvent.java
+++ b/src/com/vaadin/event/dd/DragAndDropEvent.java
@@ -4,12 +4,12 @@ import java.io.Serializable;
import com.vaadin.event.Transferable;
-public abstract class DragAndDropEvent implements Serializable {
+public class DragAndDropEvent implements Serializable {
private static final long serialVersionUID = -2232591107911385564L;
private Transferable transferable;
- private TargetDetails dropDetails;
+ private DropTargetDetails dropDetails;
- public DragAndDropEvent(Transferable tr, TargetDetails details) {
+ public DragAndDropEvent(Transferable tr, DropTargetDetails details) {
transferable = tr;
dropDetails = details;
}
@@ -18,7 +18,7 @@ public abstract class DragAndDropEvent implements Serializable {
return transferable;
}
- public TargetDetails getDropTargetData() {
+ public DropTargetDetails getDropTargetData() {
return dropDetails;
}
}
diff --git a/src/com/vaadin/event/dd/DragEvent.java b/src/com/vaadin/event/dd/DragEvent.java
deleted file mode 100644
index 951f850dc7..0000000000
--- a/src/com/vaadin/event/dd/DragEvent.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.vaadin.event.dd;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.vaadin.event.Transferable;
-
-public class DragEvent extends DragAndDropEvent {
-
- private HashMap<String, Object> responseData;
-
- public DragEvent(Transferable tr, TargetDetails details) {
- super(tr, details);
- }
-
- private static final long serialVersionUID = 7105802828455781246L;
-
- public void setResponseData(String key, Object value) {
- if (responseData != null) {
- responseData = new HashMap<String, Object>();
- }
- responseData.put(key, value);
- }
-
- /**
- * non-api, used by terminal
- *
- * @return
- */
- public Map<String, Object> getResponseData() {
- return responseData;
- }
-
-}
diff --git a/src/com/vaadin/event/dd/DragSource.java b/src/com/vaadin/event/dd/DragSource.java
index 3b69f1b028..73f8c09a41 100644
--- a/src/com/vaadin/event/dd/DragSource.java
+++ b/src/com/vaadin/event/dd/DragSource.java
@@ -18,14 +18,9 @@ public interface DragSource extends Serializable {
*
* <p>
*
- * @param transferable
- * the Transferable object if one has been created for this drag
- * and drop operation, null if Transferable is not yet
- * instantiated
* @param rawVariables
- * @return
+ * @return the drag source related transferable
*/
- public Transferable getTransferable(Transferable transferable,
- Map<String, Object> rawVariables);
+ public Transferable getTransferable(Map<String, Object> rawVariables);
} \ No newline at end of file
diff --git a/src/com/vaadin/event/dd/DropEvent.java b/src/com/vaadin/event/dd/DropEvent.java
deleted file mode 100644
index 546da317f6..0000000000
--- a/src/com/vaadin/event/dd/DropEvent.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package com.vaadin.event.dd;
-
-import com.vaadin.event.Transferable;
-
-public class DropEvent extends DragAndDropEvent {
-
- public DropEvent(Transferable tr, TargetDetails details) {
- super(tr, details);
- }
-}
diff --git a/src/com/vaadin/event/dd/DropHandler.java b/src/com/vaadin/event/dd/DropHandler.java
index b5ebbc0fa1..4bdc435b9e 100644
--- a/src/com/vaadin/event/dd/DropHandler.java
+++ b/src/com/vaadin/event/dd/DropHandler.java
@@ -7,7 +7,7 @@ import com.vaadin.event.dd.acceptCriteria.AcceptCriterion;
public interface DropHandler extends Serializable {
- public void drop(DropEvent dropEvent);
+ public void drop(DragAndDropEvent dropEvent);
/**
* Returns the {@link AcceptCriterion} used to evaluate whether the
diff --git a/src/com/vaadin/event/dd/DropTarget.java b/src/com/vaadin/event/dd/DropTarget.java
index 9b24d7d2f5..407bb23958 100644
--- a/src/com/vaadin/event/dd/DropTarget.java
+++ b/src/com/vaadin/event/dd/DropTarget.java
@@ -18,7 +18,7 @@ public interface DropTarget extends Component {
* Called before a drop operation to translate the drop data provided by the
* client widget. Should return a DropData implementation with the new
* values. If null is returned the terminal implementation will
- * automatically create a {@link TargetDetails} with all the client
+ * automatically create a {@link DropTargetDetails} with all the client
* variables.
* <p>
* If this method returns null the data from client side will be passed
@@ -28,7 +28,7 @@ public interface DropTarget extends Component {
* Parameters passed from the client side widget.
* @return A DropData object with the translated data or null.
*/
- public TargetDetails translateDragDropDetails(
+ public DropTargetDetails translateDragDropDetails(
Map<String, Object> clientVariables);
} \ No newline at end of file
diff --git a/src/com/vaadin/event/dd/TargetDetails.java b/src/com/vaadin/event/dd/DropTargetDetails.java
index 7711160f6e..6b8f124535 100644
--- a/src/com/vaadin/event/dd/TargetDetails.java
+++ b/src/com/vaadin/event/dd/DropTargetDetails.java
@@ -2,7 +2,7 @@ package com.vaadin.event.dd;
import java.io.Serializable;
-public interface TargetDetails extends Serializable {
+public interface DropTargetDetails extends Serializable {
public Object getData(String key);
diff --git a/src/com/vaadin/event/dd/TargetDetailsImpl.java b/src/com/vaadin/event/dd/DropTargetDetailsImpl.java
index ae7c7d0a5e..3046f03b88 100644
--- a/src/com/vaadin/event/dd/TargetDetailsImpl.java
+++ b/src/com/vaadin/event/dd/DropTargetDetailsImpl.java
@@ -5,11 +5,11 @@ import java.util.Map;
import com.vaadin.terminal.gwt.server.DragAndDropService;
-public class TargetDetailsImpl implements TargetDetails {
+public class DropTargetDetailsImpl implements DropTargetDetails {
private HashMap<String, Object> data = new HashMap<String, Object>();
- public TargetDetailsImpl(Map<String, Object> rawDropData) {
+ public DropTargetDetailsImpl(Map<String, Object> rawDropData) {
data.putAll(rawDropData);
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
index 78a58cbc4c..6bca3f97f9 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptAll.java
@@ -5,13 +5,10 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VAcceptAll implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
- callback.accepted(drag);
- }
+final public class VAcceptAll extends VAcceptCriterion {
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return true;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
index 0a759b383a..032045f847 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAcceptCriterion.java
@@ -2,7 +2,7 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-public interface VAcceptCriterion {
+public abstract class VAcceptCriterion {
/**
* Checks if current drag event has valid drop target and target accepts the
@@ -12,9 +12,30 @@ public interface VAcceptCriterion {
* @param configuration
* @param callback
*/
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback);
+ public void accept(final VDragEvent drag, UIDL configuration,
+ final VAcceptCallback callback) {
+ if (needsServerSideCheck(drag, configuration)) {
+ VDragEventServerCallback acceptCallback = new VDragEventServerCallback() {
+ public void handleResponse(boolean accepted, UIDL response) {
+ if (accepted) {
+ callback.accepted(drag);
+ }
+ }
+ };
+ VDragAndDropManager.get().visitServer(acceptCallback);
+ } else {
+ boolean validates = validates(drag, configuration);
+ if (validates) {
+ callback.accepted(drag);
+ }
+ }
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL);
+ }
+
+ public abstract boolean validates(VDragEvent drag, UIDL configuration);
+
+ public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
+ return false;
+ }
}
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
index d12632349a..5681d5144d 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VAnd.java
@@ -6,21 +6,31 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VAnd implements VAcceptCriterion {
+/**
+ * TODO implementation could now be simplified/optimized
+ *
+ */
+final public class VAnd extends VAcceptCriterion {
private boolean b1;
private boolean b2;
private VAcceptCriterion crit1;
private VAcceptCriterion crit2;
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+ private VAcceptCriterion getCriteria(VDragEvent drag, UIDL configuration,
+ int i) {
+ UIDL childUIDL = configuration.getChildUIDL(i);
+ return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
+ }
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
if (crit1 == null) {
crit1 = getCriteria(drag, configuration, 0);
crit2 = getCriteria(drag, configuration, 1);
if (crit1 == null || crit2 == null) {
ApplicationConnection.getConsole().log(
"And criteria didn't found a chidl criteria");
- return;
+ return false;
}
}
@@ -40,18 +50,8 @@ final public class VAnd implements VAcceptCriterion {
crit1.accept(drag, configuration.getChildUIDL(0), accept1cb);
crit2.accept(drag, configuration.getChildUIDL(1), accept2cb);
- if (b1 && b2) {
- callback.accepted(drag);
- }
- }
- private VAcceptCriterion getCriteria(VDragEvent drag, UIDL configuration,
- int i) {
- UIDL childUIDL = configuration.getChildUIDL(i);
- return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
+ return b1 && b2;
}
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false; // TODO enforce on server side
- }
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VComponentFilter.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VComponentFilter.java
index 50abae6d4b..6c3216bbc3 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VComponentFilter.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VComponentFilter.java
@@ -6,9 +6,10 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VComponentFilter implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VComponentFilter extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
try {
Paintable component = drag.getTransferable().getDragSource();
int c = configuration.getIntAttribute("c");
@@ -19,15 +20,11 @@ final public class VComponentFilter implements VAcceptCriterion {
.getCurrentDropHandler().getApplicationConnection()
.getPaintable(requiredPid);
if (paintable == component) {
- callback.accepted(drag);
+ return true;
}
}
} catch (Exception e) {
}
- return;
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return false;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlawor.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlawor.java
index 7829a32024..0e16515bc7 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlawor.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VContainsDataFlawor.java
@@ -5,18 +5,11 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VContainsDataFlawor implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
- String name = configuration.getStringAttribute("p");
- boolean contains = drag.getTransferable().getDataFlawors().contains(
- name);
- if (contains) {
- callback.accepted(drag);
- }
- }
+final public class VContainsDataFlawor extends VAcceptCriterion {
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ String name = configuration.getStringAttribute("p");
+ return drag.getTransferable().getDataFlawors().contains(name);
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDataBound.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDataBound.java
index 8b4e7fbc54..8384c156da 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDataBound.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDataBound.java
@@ -5,15 +5,10 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VDataBound implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
- if (drag.getTransferable().getData("itemId") != null) {
- callback.accepted(drag);
- }
- }
+final public class VDataBound extends VAcceptCriterion {
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return drag.getTransferable().getData("itemId") != null;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VDropDetailEquals.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VDropDetailEquals.java
index fab84f17b8..1b0dd3d2ef 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VDropDetailEquals.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VDropDetailEquals.java
@@ -5,18 +5,13 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VDropDetailEquals implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VDropDetailEquals extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
String name = configuration.getStringAttribute("p");
String value = configuration.getStringAttribute("v");
Object object = drag.getDropDetails().get(name);
- if (value.equals(object)) {
- callback.accepted(drag);
- }
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ return value.equals(object);
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VIdentifierIs.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VIdentifierIs.java
index f353e8db9d..c9b8a1d018 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VIdentifierIs.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VIdentifierIs.java
@@ -7,22 +7,17 @@ import java.util.Set;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VIdentifierIs implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VIdentifierIs extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
try {
Object data = drag.getTransferable().getData("itemId");
Set<String> stringArrayVariableAsSet = configuration
.getStringArrayVariableAsSet("keys");
- if (stringArrayVariableAsSet.contains(data)) {
- callback.accepted(drag);
- }
+ return stringArrayVariableAsSet.contains(data);
} catch (Exception e) {
}
- return;
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return false;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
index e1a5df8d18..defdb559a4 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VIsOverId.java
@@ -7,22 +7,17 @@ import java.util.Set;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VIsOverId implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VIsOverId extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
try {
Set<String> stringArrayVariableAsSet = configuration
.getStringArrayVariableAsSet("keys");
- if (stringArrayVariableAsSet.contains(drag.getDropDetails().get(
- "itemIdOver"))) {
- callback.accepted(drag);
- }
+ return stringArrayVariableAsSet.contains(drag.getDropDetails().get(
+ "itemIdOver"));
} catch (Exception e) {
}
- return;
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return false;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
index 42b5a23801..5a49d9dbe0 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VLazyInitItemIdentifiers.java
@@ -12,11 +12,12 @@ import com.vaadin.terminal.gwt.client.UIDL;
* @deprecated example class testing custom behavior
*/
@Deprecated
-final public class VLazyInitItemIdentifiers implements VAcceptCriterion {
+final public class VLazyInitItemIdentifiers extends VAcceptCriterion {
private boolean loaded = false;
private HashSet<String> hashSet;
private VDragEvent lastDragEvent;
+ @Override
public void accept(final VDragEvent drag, UIDL configuration,
final VAcceptCallback callback) {
if (lastDragEvent == null || lastDragEvent != drag) {
@@ -51,7 +52,13 @@ final public class VLazyInitItemIdentifiers implements VAcceptCriterion {
}
+ @Override
public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return loaded;
}
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return false; // not used is this implementation
+ }
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
index fe6fa8b6fb..2838137025 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VNot.java
@@ -6,10 +6,15 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VNot implements VAcceptCriterion {
+/**
+ * TODO implementation could now be simplified/optimized
+ *
+ */
+final public class VNot extends VAcceptCriterion {
private boolean b1;
private VAcceptCriterion crit1;
+ @Override
public void accept(VDragEvent drag, UIDL configuration,
VAcceptCallback callback) {
if (crit1 == null) {
@@ -41,7 +46,13 @@ final public class VNot implements VAcceptCriterion {
return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
}
+ @Override
public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return false; // TODO enforce on server side
}
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return false; // not used
+ }
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
index 114794f509..1c001ce9a6 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VOr.java
@@ -6,12 +6,17 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.ApplicationConnection;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VOr implements VAcceptCriterion {
+/**
+ * TODO implementation could now be simplified/optimized
+ *
+ */
+final public class VOr extends VAcceptCriterion {
private boolean b1;
private boolean b2;
private VAcceptCriterion crit1;
private VAcceptCriterion crit2;
+ @Override
public void accept(VDragEvent drag, UIDL configuration,
VAcceptCallback callback) {
if (crit1 == null) {
@@ -51,8 +56,14 @@ final public class VOr implements VAcceptCriterion {
return VAcceptCriteria.get(childUIDL.getStringAttribute("name"));
}
+ @Override
public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return false; // TODO enforce on server side
}
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return false; // not used here
+ }
+
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VOverTreeNode.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VOverTreeNode.java
index db59d526ae..f5fd4dec7f 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VOverTreeNode.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VOverTreeNode.java
@@ -5,19 +5,12 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VOverTreeNode implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VOverTreeNode extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
Boolean containsKey = (Boolean) drag.getDropDetails().get(
"itemIdOverIsNode");
- if (containsKey != null && containsKey.booleanValue()) {
- callback.accepted(drag);
- return;
- }
- return;
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ return containsKey != null && containsKey.booleanValue();
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
index b1cea05d54..68eb09c422 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VServerAccept.java
@@ -5,7 +5,8 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VServerAccept implements VAcceptCriterion {
+final public class VServerAccept extends VAcceptCriterion {
+ @Override
public void accept(final VDragEvent drag, UIDL configuration,
final VAcceptCallback callback) {
@@ -19,7 +20,13 @@ final public class VServerAccept implements VAcceptCriterion {
VDragAndDropManager.get().visitServer(acceptCallback);
}
+ @Override
public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
return true;
}
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
+ return false; // not used
+ }
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsSameAsTarget.java b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsSameAsTarget.java
index 5a7608366a..8e5bc54126 100644
--- a/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsSameAsTarget.java
+++ b/src/com/vaadin/terminal/gwt/client/ui/dd/VSourceIsSameAsTarget.java
@@ -6,19 +6,14 @@ package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.Paintable;
import com.vaadin.terminal.gwt.client.UIDL;
-final public class VSourceIsSameAsTarget implements VAcceptCriterion {
- public void accept(VDragEvent drag, UIDL configuration,
- VAcceptCallback callback) {
+final public class VSourceIsSameAsTarget extends VAcceptCriterion {
+
+ @Override
+ public boolean validates(VDragEvent drag, UIDL configuration) {
Paintable dragSource = drag.getTransferable().getDragSource();
Paintable paintable = VDragAndDropManager.get().getCurrentDropHandler()
.getPaintable();
- if (paintable == dragSource) {
- callback.accepted(drag);
- }
- }
-
- public boolean needsServerSideCheck(VDragEvent drag, UIDL criterioUIDL) {
- return false;
+ return paintable == dragSource;
}
} \ No newline at end of file
diff --git a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
index 5a318f071c..8255aadbbb 100644
--- a/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
+++ b/src/com/vaadin/terminal/gwt/server/DragAndDropService.java
@@ -7,13 +7,12 @@ import java.util.Map;
import com.vaadin.event.ComponentTransferable;
import com.vaadin.event.Transferable;
-import com.vaadin.event.dd.DragEvent;
+import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DragSource;
-import com.vaadin.event.dd.DropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.TargetDetails;
-import com.vaadin.event.dd.TargetDetailsImpl;
+import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.DropTargetDetailsImpl;
import com.vaadin.event.dd.acceptCriteria.AcceptCriterion;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.VariableOwner;
@@ -30,11 +29,9 @@ public class DragAndDropService implements VariableOwner {
private int currentEventId;
- private Transferable transferable;
-
private boolean lastVisitAccepted = false;
- private DragEvent dragEvent;
+ private DragAndDropEvent dragEvent;
private final AbstractCommunicationManager manager;
@@ -95,8 +92,10 @@ public class DragAndDropService implements VariableOwner {
* source for Transferable, drop target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- TargetDetails dropData = constructDragDropDetails(dropTarget, variables);
- DropEvent dropEvent = new DropEvent(transferable, dropData);
+ DropTargetDetails dropData = constructDragDropDetails(dropTarget,
+ variables);
+ DragAndDropEvent dropEvent = new DragAndDropEvent(transferable,
+ dropData);
if (dropHandler.getAcceptCriterion().accepts(dropEvent)) {
dropHandler.drop(dropEvent);
}
@@ -120,10 +119,10 @@ public class DragAndDropService implements VariableOwner {
* source for Transferable, current target for DragDropDetails).
*/
Transferable transferable = constructTransferable(dropTarget, variables);
- TargetDetails dragDropDetails = constructDragDropDetails(dropTarget,
- variables);
+ DropTargetDetails dragDropDetails = constructDragDropDetails(
+ dropTarget, variables);
- dragEvent = new DragEvent(transferable, dragDropDetails);
+ dragEvent = new DragAndDropEvent(transferable, dragDropDetails);
lastVisitAccepted = acceptCriterion.accepts(dragEvent);
}
@@ -138,17 +137,17 @@ public class DragAndDropService implements VariableOwner {
* @return
*/
@SuppressWarnings("unchecked")
- private TargetDetails constructDragDropDetails(DropTarget dropTarget,
+ private DropTargetDetails constructDragDropDetails(DropTarget dropTarget,
Map<String, Object> variables) {
Map<String, Object> rawDragDropDetails = (Map<String, Object>) variables
.get("evt");
- TargetDetails dropData = dropTarget
+ DropTargetDetails dropData = dropTarget
.translateDragDropDetails(rawDragDropDetails);
if (dropData == null) {
// Create a default DragDropDetails with all the raw variables
- dropData = new TargetDetailsImpl(rawDragDropDetails);
+ dropData = new DropTargetDetailsImpl(rawDragDropDetails);
}
dropData.setData(DROPTARGET_KEY, dropTarget);
@@ -169,9 +168,6 @@ public class DragAndDropService implements VariableOwner {
private Transferable constructTransferable(DropTarget dropHandlerOwner,
Map<String, Object> variables) {
int eventId = (Integer) variables.get("eventId");
- if (currentEventId != eventId) {
- transferable = null;
- }
currentEventId = eventId;
final Component sourceComponent = (Component) variables
@@ -179,33 +175,15 @@ public class DragAndDropService implements VariableOwner {
variables = (Map<String, Object>) variables.get("tra");
+ Transferable transferable = null;
if (sourceComponent != null && sourceComponent instanceof DragSource) {
- transferable = ((DragSource) sourceComponent).getTransferable(
- transferable, variables);
+ transferable = ((DragSource) sourceComponent)
+ .getTransferable(variables);
} else {
if (transferable == null) {
if (sourceComponent != null) {
- transferable = new ComponentTransferable() {
-
- private Map<String, Object> td = new HashMap<String, Object>();
-
- public Component getSourceComponent() {
- return sourceComponent;
- }
-
- public Object getData(String dataFlawor) {
- return td.get(dataFlawor);
- }
-
- public void setData(String dataFlawor, Object value) {
- td.put(dataFlawor, value);
- }
-
- public Collection<String> getDataFlawors() {
- return td.keySet();
- }
-
- };
+ transferable = new ComponentTransferable(sourceComponent,
+ variables);
} else {
transferable = new Transferable() {
private Map<String, Object> td = new HashMap<String, Object>();
@@ -227,13 +205,6 @@ public class DragAndDropService implements VariableOwner {
}
}
- /*
- * Add remaining (non-handled) variables to transferable as is
- */
- for (String key : variables.keySet()) {
- transferable.setData(key, variables.get(key));
- }
-
return transferable;
}
diff --git a/src/com/vaadin/ui/AbstractSelect.java b/src/com/vaadin/ui/AbstractSelect.java
index cdaf2715e2..a553a9ad90 100644
--- a/src/com/vaadin/ui/AbstractSelect.java
+++ b/src/com/vaadin/ui/AbstractSelect.java
@@ -22,7 +22,7 @@ import com.vaadin.data.util.IndexedContainer;
import com.vaadin.event.DataBoundTransferable;
import com.vaadin.event.Transferable;
import com.vaadin.event.dd.DragAndDropEvent;
-import com.vaadin.event.dd.TargetDetailsImpl;
+import com.vaadin.event.dd.DropTargetDetailsImpl;
import com.vaadin.event.dd.acceptCriteria.ClientCriterion;
import com.vaadin.event.dd.acceptCriteria.ClientSideCriterion;
import com.vaadin.terminal.KeyMapper;
@@ -1756,7 +1756,7 @@ public abstract class AbstractSelect extends AbstractField implements
}
- public class AbstractSelectDropDetails extends TargetDetailsImpl {
+ public class AbstractSelectDropDetails extends DropTargetDetailsImpl {
private Object idOver;
diff --git a/src/com/vaadin/ui/DragAndDropWrapper.java b/src/com/vaadin/ui/DragAndDropWrapper.java
index 827aa354b0..e2fb2942e7 100644
--- a/src/com/vaadin/ui/DragAndDropWrapper.java
+++ b/src/com/vaadin/ui/DragAndDropWrapper.java
@@ -1,6 +1,5 @@
package com.vaadin.ui;
-import java.util.Collection;
import java.util.Map;
import com.vaadin.event.ComponentTransferable;
@@ -8,7 +7,7 @@ import com.vaadin.event.Transferable;
import com.vaadin.event.dd.DragSource;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.TargetDetails;
+import com.vaadin.event.dd.DropTargetDetails;
import com.vaadin.terminal.PaintException;
import com.vaadin.terminal.PaintTarget;
import com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper;
@@ -17,28 +16,11 @@ import com.vaadin.terminal.gwt.client.ui.VDragAndDropWrapper;
public class DragAndDropWrapper extends CustomComponent implements DropTarget,
DragSource {
- public class DDWrapperTransferable implements ComponentTransferable {
- private final Map<String, Object> rawVariables;
+ public class DDWrapperTransferable extends ComponentTransferable {
- private DDWrapperTransferable(Map<String, Object> rawVariables) {
- this.rawVariables = rawVariables;
- }
-
- public void setData(String dataFlawor, Object value) {
- // TODO Auto-generated method stub
-
- }
-
- public Collection<String> getDataFlawors() {
- return rawVariables.keySet();
- }
-
- public Object getData(String dataFlawor) {
- return rawVariables.get(dataFlawor);
- }
-
- public Component getSourceComponent() {
- return DragAndDropWrapper.this;
+ public DDWrapperTransferable(Component sourceComponent,
+ Map<String, Object> rawVariables) {
+ super(sourceComponent, rawVariables);
}
/**
@@ -48,7 +30,7 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
* @return
*/
public Component getDraggedComponent() {
- Component object = (Component) rawVariables.get("component");
+ Component object = (Component) getData("component");
return object;
}
}
@@ -87,15 +69,14 @@ public class DragAndDropWrapper extends CustomComponent implements DropTarget,
requestRepaint();
}
- public TargetDetails translateDragDropDetails(
+ public DropTargetDetails translateDragDropDetails(
Map<String, Object> clientVariables) {
// TODO Auto-generated method stub
return null;
}
- public Transferable getTransferable(Transferable transferable,
- final Map<String, Object> rawVariables) {
- return new DDWrapperTransferable(rawVariables);
+ public Transferable getTransferable(final Map<String, Object> rawVariables) {
+ return new DDWrapperTransferable(this, rawVariables);
}
public void setDragStartMode(DragStartMode dragStartMode) {
diff --git a/src/com/vaadin/ui/DragDropPane.java b/src/com/vaadin/ui/DragDropPane.java
index 923c594551..3c8a9c2f80 100644
--- a/src/com/vaadin/ui/DragDropPane.java
+++ b/src/com/vaadin/ui/DragDropPane.java
@@ -5,11 +5,11 @@ import java.util.Map;
import com.vaadin.event.ComponentTransferable;
import com.vaadin.event.DataBoundTransferable;
import com.vaadin.event.Transferable;
-import com.vaadin.event.dd.DropEvent;
+import com.vaadin.event.dd.DragAndDropEvent;
import com.vaadin.event.dd.DropHandler;
import com.vaadin.event.dd.DropTarget;
-import com.vaadin.event.dd.TargetDetails;
-import com.vaadin.event.dd.TargetDetailsImpl;
+import com.vaadin.event.dd.DropTargetDetails;
+import com.vaadin.event.dd.DropTargetDetailsImpl;
import com.vaadin.event.dd.acceptCriteria.AcceptAll;
import com.vaadin.event.dd.acceptCriteria.AcceptCriterion;
import com.vaadin.terminal.PaintException;
@@ -70,7 +70,7 @@ public class DragDropPane extends AbsoluteLayout implements DropTarget {
}
public static class ImportPrettyMuchAnything implements DropHandler {
- public void drop(DropEvent event) {
+ public void drop(DragAndDropEvent event) {
DragDropPane pane = (DragDropPane) event.getDropTargetData()
.getTarget();
@@ -163,7 +163,7 @@ public class DragDropPane extends AbsoluteLayout implements DropTarget {
}
}
- class DragEventDetails extends TargetDetailsImpl {
+ class DragEventDetails extends DropTargetDetailsImpl {
public DragEventDetails(Map<String, Object> rawVariables) {
super(rawVariables);
@@ -188,7 +188,7 @@ public class DragDropPane extends AbsoluteLayout implements DropTarget {
}
- public TargetDetails translateDragDropDetails(
+ public DropTargetDetails translateDragDropDetails(
Map<String, Object> clientVariables) {
return new DragEventDetails(clientVariables);
}
diff --git a/src/com/vaadin/ui/Table.java b/src/com/vaadin/ui/Table.java
index f6e01025d3..42e9d95b49 100644
--- a/src/com/vaadin/ui/Table.java
+++ b/src/com/vaadin/ui/Table.java
@@ -25,7 +25,6 @@ import com.vaadin.data.util.IndexedContainer;
import com.vaadin.event.Action;
import com.vaadin.event.DataBoundTransferable;
import com.vaadin.event.ItemClickEvent;
-import com.vaadin.event.Transferable;
import com.vaadin.event.Action.Handler;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.event.ItemClickEvent.ItemClickSource;
@@ -3330,51 +3329,31 @@ public class Table extends AbstractSelect implements Action.Container,
requestRepaint();
}
- class TableTransferable implements DataBoundTransferable {
+ class TableTransferable extends DataBoundTransferable {
- private final HashMap<String, Object> data = new HashMap<String, Object>();
+ public TableTransferable(Map<String, Object> rawVariables) {
+ super(Table.this, rawVariables);
+ Object object = rawVariables.get("itemId");
+ if (object != null) {
+ setData("itemId", itemIdMapper.get((String) object));
+ }
+ }
+ @Override
public Object getItemId() {
- return data.get("itemId");
+ return getData("itemId");
}
+ @Override
public Object getPropertyId() {
return getItemCaptionPropertyId();
}
- public Component getSourceComponent() {
- return Table.this;
- }
-
- public Object getData(String dataFlawor) {
- return data.get(dataFlawor);
- }
-
- public Collection<String> getDataFlawors() {
- return data.keySet();
- }
-
- public void setData(String dataFlawor, Object value) {
- data.put(dataFlawor, value);
- }
-
}
- private void updateTransferable(Map<String, Object> payload, Transferable tr) {
- Object object = payload.get("itemId");
- if (object != null) {
- tr.setData("itemId", itemIdMapper.get((String) object));
- payload.remove("itemId");
- }
- }
-
- public TableTransferable getTransferable(Transferable transferable,
- Map<String, Object> rawVariables) {
- if (transferable == null) {
- transferable = new TableTransferable();
- }
- updateTransferable(rawVariables, transferable);
- return (TableTransferable) transferable;
+ public TableTransferable getTransferable(Map<String, Object> rawVariables) {
+ TableTransferable transferable = new TableTransferable(rawVariables);
+ return transferable;
}
public DropHandler getDropHandler() {
diff --git a/src/com/vaadin/ui/Tree.java b/src/com/vaadin/ui/Tree.java
index 02b486046f..850519f9f7 100644
--- a/src/com/vaadin/ui/Tree.java
+++ b/src/com/vaadin/ui/Tree.java
@@ -118,49 +118,31 @@ public class Tree extends AbstractSelect implements Container.Hierarchical,
private int itemDragModes = DRAG_OUT;
- class TreeTransferable implements DataBoundTransferable {
+ class TreeTransferable extends DataBoundTransferable {
- private final HashMap<String, Object> data = new HashMap<String, Object>();
+ public TreeTransferable(Component sourceComponent,
+ Map<String, Object> rawVariables) {
+ super(sourceComponent, rawVariables);
+ }
+ @Override
public Object getItemId() {
- return data.get("itemId");
+ return getData("itemId");
}
+ @Override
public Object getPropertyId() {
return getItemCaptionPropertyId();
}
-
- public Component getSourceComponent() {
- return Tree.this;
- }
-
- public Object getData(String dataFlawor) {
- if (dataFlawor.equals("Text")) {
- return getItemCaption(getItemId());
- }
- return data.get(dataFlawor);
- }
-
- public Collection<String> getDataFlawors() {
- return data.keySet();
- }
-
- public void setData(String dataFlawor, Object value) {
- data.put(dataFlawor, value);
- }
}
- public Transferable getTransferable(Transferable transferable,
- Map<String, Object> payload) {
- if (transferable == null) {
- transferable = new TreeTransferable();
- }
+ public Transferable getTransferable(Map<String, Object> payload) {
+ TreeTransferable transferable = new TreeTransferable(this, payload);
// updating drag source variables
Object object = payload.get("itemId");
if (object != null) {
transferable.setData("itemId", itemIdMapper.get((String) object));
}
- payload.remove("itemId");
return transferable;
}