DropTarget imageDropTarget = new DropTarget() {
@Override
public DropAction dragEnter(Component component, Manifest dragContent,
int supportedDropActions, DropAction userDropAction) {
DropAction dropAction = null;
ImageView imageView = (ImageView)component;
if (imageView.getImage() == null
&& dragContent.containsImage()
&& DropAction.MOVE.isSelected(supportedDropActions)) {
dropAction = DropAction.MOVE;
component.getStyles().put("backgroundColor", "#f0e68c");
}
return dropAction;
}
@Override
public void dragExit(Component component) {
component.getStyles().put("backgroundColor", null);
}
@Override
public DropAction dragMove(Component component, Manifest dragContent,
int supportedDropActions, int x, int y, DropAction userDropAction) {
ImageView imageView = (ImageView)component;
return (imageView.getImage() == null
&& dragContent.containsImage() ? DropAction.MOVE : null);
}
@Override
public DropAction userDropActionChange(Component component, Manifest dragContent,
int supportedDropActions, int x, int y, DropAction userDropAction) {
ImageView imageView = (ImageView)component;
return (imageView.getImage() == null
&& dragContent.containsImage() ? DropAction.MOVE : null);
}
@Override
public DropAction drop(Component component, Manifest dragContent,
int supportedDropActions, int x, int y, DropAction userDropAction) {
DropAction dropAction = null;
ImageView imageView = (ImageView)component;
if (imageView.getImage() == null
&& dragContent.containsImage()) {
try {