KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > gjt > jclasslib > nbmodule > ClassFileNode


1 /*
2     This library is free software; you can redistribute it and/or
3     modify it under the terms of the GNU General Public
4     License as published by the Free Software Foundation; either
5     version 2 of the license, or (at your option) any later version.
6 */

7
8 package org.gjt.jclasslib.nbmodule;
9
10 import org.openide.filesystems.FileObject;
11 import org.openide.nodes.*;
12
13 /**
14     Node for a <tt>ClassFileViewer</tt> component.
15  
16     @author <a HREF="mailto:jclasslib@ej-technologies.com">Ingo Kegel</a>
17     @version $Revision: 1.4 $ $Date: 2003/08/18 07:57:52 $
18 */

19 public class ClassFileNode extends AbstractNode {
20
21     private FileObject fo;
22
23     /**
24         Constructor.
25         @param fo the file object.
26      */

27     public ClassFileNode(FileObject fo) {
28         super(Children.LEAF);
29         this.fo = fo;
30         setIconBase("/org/gjt/jclasslib/nbmodule/nbmodule");
31         setName(fo.getName());
32     }
33
34     /**
35      * Get the associated file object.
36      * @return the file object.
37      */

38     public FileObject getFileObject() {
39         return fo;
40     }
41
42     /**
43      * Get the associated node handle.
44      * @return the node handle.
45      */

46     public Node.Handle getHandle() {
47         return new ClassFileNodeHandle(this);
48     }
49
50     /** Node handle for a <tt>ClassFileNode</tt>. */
51     public static class ClassFileNodeHandle implements Node.Handle {
52         private FileObject fo;
53
54         /**
55             Constructor.
56             @param node the class file node.
57          */

58         public ClassFileNodeHandle(ClassFileNode node) {
59             fo = node.fo;
60         }
61         
62         public Node getNode() {
63             return new ClassFileNode(fo);
64         }
65     }
66
67 }
68
Popular Tags