KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > jsf > navigation > graph > actions > GraphPopupProvider


1 /*
2  * NodePopupMenuProvider.java
3  *
4  * Created on February 2, 2007, 6:46 PM
5  *
6  * To change this template, choose Tools | Template Manager
7  * and open the template in the editor.
8  */

9
10 package org.netbeans.modules.web.jsf.navigation.graph.actions;
11
12 import org.netbeans.modules.web.jsf.navigation.graph.NavigationBridgeUtilities;
13 import java.awt.Point JavaDoc;
14 import java.awt.event.ActionEvent JavaDoc;
15 import java.awt.event.ActionListener JavaDoc;
16 import java.awt.event.InputEvent JavaDoc;
17 import java.awt.event.KeyEvent JavaDoc;
18 import javax.swing.JMenuItem JavaDoc;
19 import javax.swing.JPopupMenu JavaDoc;
20 import javax.swing.KeyStroke JavaDoc;
21 import org.netbeans.api.visual.action.PopupMenuProvider;
22 import org.netbeans.api.visual.widget.Widget;
23 import org.netbeans.modules.web.jsf.navigation.graph.NavigationGraphScene;
24 import org.openide.util.NbBundle;
25
26 /**
27  *
28  * @author joelle
29  */

30 public class GraphPopupProvider implements PopupMenuProvider, ActionListener JavaDoc {
31     
32     NavigationGraphScene graphScene;
33     
34     private JMenuItem JavaDoc miAddWebPage;
35     private JPopupMenu JavaDoc graphPopup;
36     
37     private String JavaDoc addPage = NbBundle.getMessage(GraphPopupProvider.class, "MSG_AddPage");
38     
39     
40     
41     public GraphPopupProvider(NavigationGraphScene graphScene) {
42         
43         this.graphScene = graphScene;
44         initialize();
45     }
46     
47     private void initialize() {
48         
49         graphPopup = new JPopupMenu JavaDoc("Transition Menu");
50         
51         graphPopup = new JPopupMenu JavaDoc();
52         miAddWebPage = new JMenuItem JavaDoc(addPage);
53         miAddWebPage.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A,InputEvent.CTRL_MASK));
54         miAddWebPage.addActionListener(this);
55         graphPopup.add(miAddWebPage);
56     }
57     
58     
59     
60     public JPopupMenu JavaDoc getPopupMenu(Widget widget, Point JavaDoc point){
61         return graphPopup;
62     }
63     
64     
65     public void actionPerformed(ActionEvent JavaDoc e) {
66         
67         if(e.getSource() == miAddWebPage){
68             NavigationBridgeUtilities.getInstance().createWebPage();
69         }
70         return;
71     }
72     
73 }
74
Popular Tags