blob: c341ae4115d51e3876a81748544727fb7dd82cd1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
package com.vaadin.terminal.gwt.client.ui.dd;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import com.vaadin.event.dd.DragSource;
import com.vaadin.terminal.gwt.client.Paintable;
/**
* Client side counterpart for Transferable in com.vaadin.event.Transferable
*
*/
public class VTransferable {
private Paintable component;
private final Map<String, Object> variables = new HashMap<String, Object>();
/**
* Returns the component from which the transferable is created (eg. a tree
* which node is dragged).
*
* @return the component
*/
public Paintable getDragSource() {
return component;
}
/**
* Sets the component currently being dragged or from which the transferable
* is created (eg. a tree which node is dragged).
* <p>
* The server side counterpart of the componennt may implement
* {@link DragSource} interface if it wants to translate or complement the
* server side instance of this Transferable.
*
* @param component
* the component to set
*/
public void setDragSource(Paintable component) {
this.component = component;
}
public Object getData(String dataFlawor) {
return variables.get(dataFlawor);
}
public void setData(String dataFlawor, Object value) {
variables.put(dataFlawor, value);
}
public Collection<String> getDataFlavors() {
return variables.keySet();
}
/**
* This helper method should only be called by {@link VDragAndDropManager}.
*
* @return data in this Transferable that needs to be moved to server.
*/
Map<String, Object> getVariableMap() {
return variables;
}
}
|