summaryrefslogtreecommitdiffstats
path: root/src/com/vaadin/event
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/vaadin/event
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/vaadin/event')
-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
10 files changed, 52 insertions, 69 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);
}