KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > dnd > VirtualFileTransferable


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * 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 JavaDoc;
22 import java.awt.datatransfer.Transferable JavaDoc;
23 import java.awt.datatransfer.UnsupportedFlavorException JavaDoc;
24 import java.io.IOException JavaDoc;
25
26 import org.openharmonise.vfs.*;
27
28
29 /**
30  * Transferable for transfering virtual files.
31  *
32  * @author Matthew Large
33  * @version $Revision: 1.1 $
34  *
35  */

36 public class VirtualFileTransferable implements Transferable JavaDoc {
37
38     public static DataFlavor JavaDoc DAV_FLAVOR = new DataFlavor JavaDoc(VirtualFile.class, "DAV File");
39     DataFlavor JavaDoc 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 JavaDoc[] 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 JavaDoc 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 JavaDoc getTransferData(DataFlavor JavaDoc arg0)
71         throws UnsupportedFlavorException JavaDoc, IOException JavaDoc {
72             return m_src;
73     }
74
75 }
76
Popular Tags