01: ///////////////////////////////////////////////////////////////////////////////
02: //
03: // This program is free software; you can redistribute it and/or modify
04: // it under the terms of the GNU General Public License and GNU Library
05: // General Public License as published by the Free Software Foundation;
06: // either version 2, or (at your option) any later version.
07: //
08: // This program is distributed in the hope that it will be useful,
09: // but WITHOUT ANY WARRANTY; without even the implied warranty of
10: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11: // GNU General Public License and GNU Library General Public License
12: // for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // and GNU Library General Public License along with this program; if
16: // not, write to the Free Software Foundation, 675 Mass Ave, Cambridge,
17: // MA 02139, USA.
18: //
19: //////////////////////////////////////////////////////////////////////////////
20:
21: package org.rdesktop.server.rdp.rdp5.cliprdr;
22:
23: import java.io.*;
24: import java.awt.*;
25: import java.awt.datatransfer.*;
26:
27: public class ImageSelection implements Transferable {
28: protected static DataFlavor m_imageFlavor = new DataFlavor(
29: java.awt.Image.class, "image/x-java-image");
30:
31: private Image m_image;
32:
33: public ImageSelection(Image image) {
34: m_image = image;
35: }
36:
37: public DataFlavor[] getTransferDataFlavors() {
38: return new DataFlavor[] { m_imageFlavor };
39: }
40:
41: public boolean isDataFlavorSupported(DataFlavor flavor) {
42: return m_imageFlavor.equals(flavor);
43: }
44:
45: public Object getTransferData(DataFlavor flavor)
46: throws UnsupportedFlavorException, IOException {
47: if (m_imageFlavor.equals(flavor) == false) {
48: throw new UnsupportedFlavorException(flavor);
49: }
50:
51: return m_image;
52: }
53: }
|