1 15 16 package org.apache.ojb.tools.mapping.reversedb2.ojbmetatreemodel; 17 18 import java.awt.datatransfer.DataFlavor ; 19 import java.awt.datatransfer.UnsupportedFlavorException ; 20 21 import org.apache.ojb.broker.metadata.AttributeDescriptorBase; 22 26 public class OjbMetadataTransferable implements java.awt.datatransfer.Transferable 27 { 28 29 public static final DataFlavor OJBMETADATA_FLAVOR 30 = new DataFlavor (org.apache.ojb.broker.metadata.AttributeDescriptorBase[].class, "OJB"); 32 33 private static final DataFlavor [] _flavors = {OJBMETADATA_FLAVOR}; 34 35 private AttributeDescriptorBase[] selectedDescriptors; 36 37 38 public OjbMetadataTransferable(AttributeDescriptorBase[] pSelectedDescriptors) 39 { 40 selectedDescriptors = pSelectedDescriptors; 41 } 42 43 54 public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException , java.io.IOException 55 { 56 if (flavor.isMimeTypeEqual(OJBMETADATA_FLAVOR)) 57 return selectedDescriptors; 58 else 59 throw new UnsupportedFlavorException (flavor); 60 } 61 62 68 public DataFlavor [] getTransferDataFlavors() 69 { 70 return _flavors; 71 } 72 73 79 public boolean isDataFlavorSupported(DataFlavor flavor) 80 { 81 return java.util.Arrays.asList(_flavors).contains(flavor); 82 } 83 84 } 85 | Popular Tags |