View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/jaxr/src/com/sun/xml/registry/client/browser/RegistryObjectsTransferable.java,v 1.3 2002/03/14 13:57:05 farrukh_najmi Exp $ 3 */ 4 5 package com.sun.xml.registry.client.browser; 6 7 import java.io.*; 8 import java.util.*; 9 import java.awt.*; 10 import java.awt.datatransfer.*; 11 12 import javax.xml.registry.*; 13 import javax.xml.registry.infomodel.*; 14 15 /*** 16 * An object that represents the clipboard contents for a ArrayList of RegistryObjects selection. 17 * 18 * The object has two representations: 19 * <p> 20 * 1. Richer: Object representtaion 21 * 2. Plain: plain text representation. 22 * 23 * 24 * @author <a href="mailto:Farrukh.Najmi@Sun.COM">Farrukh S. Najmi</a> 25 * 26 */ 27 public class RegistryObjectsTransferable extends com.jgraph.plaf.basic.BasicTransferable 28 implements Serializable, ClipboardOwner { 29 30 /*** Local Machine Reference Data Flavor. */ 31 public static DataFlavor dataFlavor; 32 33 private ArrayList registryObjects = null; 34 35 /*** 36 * Constructs a new transferable selection for <code>cells</code>, 37 * <code>cs</code>and <code>attrMap</code>. 38 */ 39 public RegistryObjectsTransferable(ArrayList registryObjects) { 40 this.registryObjects = registryObjects; 41 } 42 43 /*** 44 * Returns the <code>registryObjects</code> that represent the selection. 45 */ 46 public ArrayList getRegistryObjects() 47 { 48 return registryObjects; 49 } 50 51 52 // from ClipboardOwner 53 public void lostOwnership(Clipboard clip, Transferable contents) { 54 // do nothing 55 } 56 57 // --- Richer ---------------------------------------------------------- 58 59 /*** 60 * Returns the jvm-localreference flavors of the transferable. 61 */ 62 public DataFlavor[] getRicherFlavors() { 63 return new DataFlavor[] { 64 dataFlavor 65 }; 66 } 67 68 /*** 69 * Fetch the data in a jvm-localreference format. 70 */ 71 public Object getRicherData(DataFlavor flavor) throws UnsupportedFlavorException { 72 if (flavor.equals(dataFlavor)) { 73 return this; 74 } 75 else { 76 throw new UnsupportedFlavorException(flavor); 77 } 78 } 79 80 // --- Plain ---------------------------------------------------------- 81 82 /*** 83 * Returns true if the transferable support a text/plain format. 84 */ 85 public boolean isPlainSupported() 86 { 87 return true; 88 } 89 90 /*** 91 * Fetch the data in a text/plain format. 92 */ 93 public String getPlainData() { 94 return "have'nt implemented this yet"; 95 } 96 97 98 /* Local Machine Reference Data Flavor. */ 99 static { 100 DataFlavor localDataFlavor; 101 try { 102 localDataFlavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType+ 103 "; class=com.sun.xml.registry.client.browser.RegistryObjectsTransferable"); 104 } catch (ClassNotFoundException cnfe) { 105 localDataFlavor = null; 106 } 107 dataFlavor = localDataFlavor; 108 } 109 110 }

This page was automatically generated by Maven