01: package com.opensymphony.workflow.designer.dnd;
02:
03: import java.awt.datatransfer.DataFlavor;
04: import java.awt.datatransfer.Transferable;
05: import java.awt.datatransfer.UnsupportedFlavorException;
06: import java.io.IOException;
07:
08: /**
09: * @author Gulei
10: */
11: public class DragDataTransferable implements Transferable {
12: private DragData data;
13:
14: public DragDataTransferable(DragData data) {
15: this .data = data;
16: }
17:
18: public DataFlavor[] getTransferDataFlavors() {
19: return new DataFlavor[] { DragData.WORKFLOW_FLAVOR };
20: }
21:
22: public boolean isDataFlavorSupported(DataFlavor arg0) {
23: return arg0.equals(DragData.WORKFLOW_FLAVOR);
24: }
25:
26: public Object getTransferData(DataFlavor arg0)
27: throws UnsupportedFlavorException, IOException {
28: if (arg0.equals(DragData.WORKFLOW_FLAVOR)) {
29: return data;
30: } else {
31: throw new UnsupportedFlavorException(arg0);
32: }
33: }
34:
35: }
|