blob: ca4d0e900d83d6ddedd105e57de25a26befecd73 (
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
|
/*
@VaadinApache2LicenseForJavaFiles@
*/
/**
*
*/
package com.vaadin.terminal.gwt.client.ui.dd;
import com.vaadin.terminal.gwt.client.ComponentConnector;
import com.vaadin.terminal.gwt.client.UIDL;
import com.vaadin.ui.AbstractSelect;
@AcceptCriterion(AbstractSelect.AcceptItem.class)
final public class VItemIdIs extends VAcceptCriterion {
@Override
protected boolean accept(VDragEvent drag, UIDL configuration) {
try {
String pid = configuration.getStringAttribute("s");
ComponentConnector dragSource = drag.getTransferable()
.getDragSource();
VDropHandler currentDropHandler = VDragAndDropManager.get()
.getCurrentDropHandler();
String pid2 = dragSource.getConnectorId();
if (pid2.equals(pid)) {
Object searchedId = drag.getTransferable().getData("itemId");
String[] stringArrayAttribute = configuration
.getStringArrayAttribute("keys");
for (String string : stringArrayAttribute) {
if (string.equals(searchedId)) {
return true;
}
}
}
} catch (Exception e) {
}
return false;
}
}
|