KickJava   Java API By Example, From Geeks To Geeks.

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


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.move.*;
27 import org.openharmonise.vfs.*;
28
29
30 /**
31  * Context menu which is the result of dragging a resource onto a collection
32  * in a tree view.
33  *
34  * @author Matthew Large
35  * @version $Revision: 1.1 $
36  *
37  */

38 public class MoveMenu extends JPopupMenu JavaDoc {
39
40
41     /**
42      * Constructs a new move menu.
43      *
44      * @param vfFrom virtual file to be moved.
45      * @param vfTo collection to move to.
46      */

47     public MoveMenu(VirtualFile vfFrom, VirtualFile vfTo) {
48         super();
49         this.setup(vfFrom, vfTo);
50     }
51     
52     /**
53      * Initialises this component.
54      *
55      * @param vfFrom virtual file to be moved.
56      * @param vfTo collection to move to.
57      */

58     private void setup(VirtualFile vfFrom, VirtualFile vfTo) {
59         String JavaDoc fontName = "Dialog";
60         int fontSize = 11;
61         Font JavaDoc font = new Font JavaDoc(fontName, Font.PLAIN, fontSize);
62         this.setFont(font);
63         
64         HIMAction action = new ActionMove(vfFrom, vfTo);
65         this.add(action.getMenuItem());
66         
67         action = new ActionCopy(vfFrom, vfTo);
68         this.add(action.getMenuItem());
69         
70         this.addSeparator();
71         
72         action = new ActionCancel();
73         this.add(action.getMenuItem());
74     }
75
76     /**
77      * @param arg0
78      */

79     private MoveMenu(String JavaDoc arg0) {
80         super(arg0);
81     }
82
83 }
84
Popular Tags