01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19: package org.openharmonise.him.dnd;
20:
21: import java.awt.datatransfer.DataFlavor;
22: import java.awt.datatransfer.Transferable;
23: import java.awt.datatransfer.UnsupportedFlavorException;
24: import java.io.IOException;
25:
26: import org.openharmonise.vfs.*;
27:
28: /**
29: * Transferable for transfering virtual files.
30: *
31: * @author Matthew Large
32: * @version $Revision: 1.1 $
33: *
34: */
35: public class VirtualFileTransferable implements Transferable {
36:
37: public static DataFlavor DAV_FLAVOR = new DataFlavor(
38: VirtualFile.class, "DAV File");
39: DataFlavor flavors[] = { DAV_FLAVOR };
40:
41: private VirtualFile m_src = null;
42:
43: /**
44: * Constructs a new virtual file transferable.
45: *
46: * @param vfFile Virtual file
47: */
48: public VirtualFileTransferable(VirtualFile vfFile) {
49: super ();
50: this .m_src = vfFile;
51: }
52:
53: /* (non-Javadoc)
54: * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
55: */
56: public DataFlavor[] getTransferDataFlavors() {
57: return flavors;
58: }
59:
60: /* (non-Javadoc)
61: * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)
62: */
63: public boolean isDataFlavorSupported(DataFlavor flavor) {
64: return flavor == DAV_FLAVOR;
65: }
66:
67: /* (non-Javadoc)
68: * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor)
69: */
70: public Object getTransferData(DataFlavor arg0)
71: throws UnsupportedFlavorException, IOException {
72: return m_src;
73: }
74:
75: }
|