1 package org.apache.ojb.tools.mapping.reversedb2.dnd2; 2 3 17 18 import org.apache.ojb.tools.mapping.reversedb2.dbmetatreemodel.*; 19 import org.apache.ojb.tools.mapping.reversedb2.datatransfer.*; 20 21 25 public class ReverseDbNodesDropWorker implements DropPasteWorkerInterface 26 { 27 28 public ReverseDbNodesDropWorker () 29 { 30 } 31 32 public int getAcceptableActions (java.awt.Component c) 33 { 34 return DnDWorkerConstants.DRAG_MOVE | DnDWorkerConstants.DRAG_COPY ; 35 } 36 37 public int getAcceptableActions (java.awt.Component c, java.awt.datatransfer.DataFlavor [] flavor) 38 { 39 for (int j = 0; j < flavor.length; j++) 40 if (flavor[j].isMimeTypeEqual (TransferableDBMetaTreeNodes.DBMETATABLENODE_FLAVOR_REMOTE)) 41 return DnDWorkerConstants.DRAG_MOVE | DnDWorkerConstants.DRAG_COPY; 42 return DnDWorkerConstants.NONE; 43 } 44 45 public java.awt.datatransfer.DataFlavor getSupportedDataFlavor () 46 { 47 return TransferableDBMetaTreeNodes.DBMETATABLENODE_FLAVOR_REMOTE; 48 } 49 50 public boolean importData (java.awt.Component c, java.awt.datatransfer.Transferable t, int action) 51 { 52 if (t.isDataFlavorSupported(TransferableDBMetaTreeNodes.DBMETATABLENODE_FLAVOR_REMOTE)) 53 { 54 try 55 { 56 ReverseDbTreeNode[] nodes = 57 (ReverseDbTreeNode[])t.getTransferData(TransferableDBMetaTreeNodes.DBMETATABLENODE_FLAVOR_REMOTE); 58 for (int i = 0; i < nodes.length; i++) 59 System.err.println("Transfered: " + nodes[i]); 60 return true; 61 } 62 catch (Throwable throwable) 63 { 64 throwable.printStackTrace(); 65 return false; 66 } 67 } 68 else 69 { 70 return false; 71 } 72 } 73 } 74 | Popular Tags |