00001 package edu.ksu.cis.bandera.pdgslicer.dependency;
00002
00003 import javax.swing.tree.*;
00004 import java.awt.dnd.*;
00005 import java.awt.datatransfer.*;
00006 import java.io.*;
00007 import edu.ksu.cis.bandera.pdgslicer.datastructure.*;
00008
00009 public class TransferableSliceVariable extends SliceVariable implements Transferable {
00010 final static int SLICE_VARIABLE = 0;
00011
00012
00013
00014 final public static DataFlavor SLICE_VARIABLE_FLAVOR =
00015 new DataFlavor(SliceVariable.class, "Slice Variable");
00016
00017 static DataFlavor flavors[] = {SLICE_VARIABLE_FLAVOR};
00018
00019
00020
00021 private SliceVariable data;
00022
00023 public TransferableSliceVariable(SliceVariable data) {
00024 this.data = data;
00025 }
00026 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException {
00027
00028 if (isDataFlavorSupported(flavor))
00029 return this.data;
00030 return null;
00031 }
00032 public DataFlavor[] getTransferDataFlavors() {
00033 return flavors;
00034 }
00035 public boolean isDataFlavorSupported(DataFlavor flavor) {
00036 boolean returnValue = false;
00037 for (int i = 0, n = flavors.length; i < n; i++) {
00038 if (flavor.equals(flavors[i])) {
00039 returnValue = true;
00040 break;
00041 }
00042 }
00043 return returnValue;
00044 }
00045
00046
00047
00048
00049
00050 public String toString() {
00051 return data.toString();
00052 }
00053 }