1 package com.opensymphony.workflow.designer.dnd; 2 3 import java.awt.datatransfer.DataFlavor ; 4 import java.awt.datatransfer.Transferable ; 5 import java.awt.datatransfer.UnsupportedFlavorException ; 6 import java.io.IOException ; 7 8 11 public class DragDataTransferable implements Transferable 12 { 13 private DragData data; 14 15 public DragDataTransferable(DragData data) 16 { 17 this.data = data; 18 } 19 20 public DataFlavor [] getTransferDataFlavors() 21 { 22 return new DataFlavor []{DragData.WORKFLOW_FLAVOR}; 23 } 24 25 public boolean isDataFlavorSupported(DataFlavor arg0) 26 { 27 return arg0.equals(DragData.WORKFLOW_FLAVOR); 28 } 29 30 public Object getTransferData(DataFlavor arg0) throws UnsupportedFlavorException , IOException 31 { 32 if(arg0.equals(DragData.WORKFLOW_FLAVOR)) 33 { 34 return data; 35 } 36 else 37 { 38 throw new UnsupportedFlavorException (arg0); 39 } 40 } 41 42 } 43 | Popular Tags |