src/solaris/classes/sun/awt/X11/XClipboard.java

Print this page




  84     }
  85 
  86     protected synchronized void setContentsNative(Transferable contents) {
  87         SortedMap<Long,DataFlavor> formatMap =
  88             DataTransferer.getInstance().getFormatsForTransferable
  89                 (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
  90         long[] formats = DataTransferer.keysToLongArray(formatMap);
  91 
  92         if (!selection.setOwner(contents, formatMap, formats,
  93                                 XToolkit.getCurrentServerTime())) {
  94             this.owner = null;
  95             this.contents = null;
  96         }
  97     }
  98 
  99     public long getID() {
 100         return selection.getSelectionAtom().getAtom();
 101     }
 102 
 103     @Override




 104     public synchronized Transferable getContents(Object requestor) {
 105         if (contents != null) {
 106             return contents;
 107         }
 108         return new ClipboardTransferable(this);
 109     }
 110 
 111     /* Caller is synchronized on this. */
 112     protected void clearNativeContext() {
 113         selection.reset();
 114     }
 115 
 116 
 117     protected long[] getClipboardFormats() {
 118         return selection.getTargets(XToolkit.getCurrentServerTime());
 119     }
 120 
 121     protected byte[] getClipboardData(long format) throws IOException {
 122         return selection.getData(format, XToolkit.getCurrentServerTime());
 123     }




  84     }
  85 
  86     protected synchronized void setContentsNative(Transferable contents) {
  87         SortedMap<Long,DataFlavor> formatMap =
  88             DataTransferer.getInstance().getFormatsForTransferable
  89                 (contents, DataTransferer.adaptFlavorMap(getDefaultFlavorTable()));
  90         long[] formats = DataTransferer.keysToLongArray(formatMap);
  91 
  92         if (!selection.setOwner(contents, formatMap, formats,
  93                                 XToolkit.getCurrentServerTime())) {
  94             this.owner = null;
  95             this.contents = null;
  96         }
  97     }
  98 
  99     public long getID() {
 100         return selection.getSelectionAtom().getAtom();
 101     }
 102 
 103     @Override
 104     public void checkLostOwnership() {
 105     }
 106 
 107     @Override
 108     public synchronized Transferable getContents(Object requestor) {
 109         if (contents != null) {
 110             return contents;
 111         }
 112         return new ClipboardTransferable(this);
 113     }
 114 
 115     /* Caller is synchronized on this. */
 116     protected void clearNativeContext() {
 117         selection.reset();
 118     }
 119 
 120 
 121     protected long[] getClipboardFormats() {
 122         return selection.getTargets(XToolkit.getCurrentServerTime());
 123     }
 124 
 125     protected byte[] getClipboardData(long format) throws IOException {
 126         return selection.getData(format, XToolkit.getCurrentServerTime());
 127     }