KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > workflow > designer > dnd > DragDataTransferable


1 package com.opensymphony.workflow.designer.dnd;
2
3 import java.awt.datatransfer.DataFlavor JavaDoc;
4 import java.awt.datatransfer.Transferable JavaDoc;
5 import java.awt.datatransfer.UnsupportedFlavorException JavaDoc;
6 import java.io.IOException JavaDoc;
7
8 /**
9  * @author Gulei
10  */

11 public class DragDataTransferable implements Transferable JavaDoc
12 {
13   private DragData data;
14
15   public DragDataTransferable(DragData data)
16   {
17     this.data = data;
18   }
19
20   public DataFlavor JavaDoc[] getTransferDataFlavors()
21   {
22     return new DataFlavor JavaDoc[]{DragData.WORKFLOW_FLAVOR};
23   }
24
25   public boolean isDataFlavorSupported(DataFlavor JavaDoc arg0)
26   {
27     return arg0.equals(DragData.WORKFLOW_FLAVOR);
28   }
29
30   public Object JavaDoc getTransferData(DataFlavor JavaDoc arg0) throws UnsupportedFlavorException JavaDoc, IOException JavaDoc
31   {
32     if(arg0.equals(DragData.WORKFLOW_FLAVOR))
33     {
34       return data;
35     }
36     else
37     {
38       throw new UnsupportedFlavorException JavaDoc(arg0);
39     }
40   }
41
42 }
43
Popular Tags