KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > window > menus > CollectionContextMenu


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.window.menus;
20
21 import java.awt.Font JavaDoc;
22
23 import javax.swing.JPopupMenu JavaDoc;
24
25 import org.openharmonise.him.actions.*;
26 import org.openharmonise.him.actions.dir.*;
27 import org.openharmonise.him.actions.file.*;
28 import org.openharmonise.him.actions.system.*;
29 import org.openharmonise.vfs.*;
30 import org.openharmonise.vfs.context.*;
31
32
33 /**
34  * Context menu for right clicks in the table view that are not on
35  * any specific resource.
36  *
37  * @author Matthew Large
38  * @version $Revision: 1.1 $
39  *
40  */

41 public class CollectionContextMenu extends JPopupMenu JavaDoc {
42
43     /**
44      * Constructs a new collection context menu.
45      *
46      * @param sPath full path to the collection.
47      * @param vfs virtual file system of the collection.
48      */

49     public CollectionContextMenu(String JavaDoc sPath, AbstractVirtualFileSystem vfs) {
50         super();
51         this.setup(sPath, vfs);
52     }
53     
54     /**
55      * Initialises this component.
56      *
57      * @param sPath full path to the collection.
58      * @param vfs virtual file system of the collection.
59      */

60     private void setup(String JavaDoc sPath, AbstractVirtualFileSystem vfs) {
61         String JavaDoc fontName = "Dialog";
62         int fontSize = 11;
63         Font JavaDoc font = new Font JavaDoc(fontName, Font.PLAIN, fontSize);
64         this.setFont(font);
65             
66         ContextEvent ce = new ContextEvent(ContextType.CONTEXT_DIRS, "", vfs, sPath);
67             
68         HIMAction action = new ActionNewFile();
69         this.add(action.getMenuItem());
70         action.isEnabled(ce);
71         
72         action = new ActionNewCollection();
73         this.add(action.getMenuItem());
74         action.isEnabled(ce);
75         
76         action = new ActionUpload();
77         this.add(action.getMenuItem());
78         action.isEnabled(ce);
79         
80         action = new ActionOrder();
81         this.add(action.getMenuItem());
82         action.isEnabled(ce);
83         
84         action = new ActionRefresh();
85         this.add(action.getMenuItem());
86         action.isEnabled(ce);
87         
88     }
89
90     /**
91      * @param arg0
92      */

93     private CollectionContextMenu(String JavaDoc arg0) {
94         super(arg0);
95     }
96
97 }
98
Popular Tags