KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > web > jsf > JSFConfigEditorTopComponent


1 /*
2  * JSFConfigEditorTopComponent.java
3  *
4  * Created on February 7, 2007, 5:26 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;
11
12 import java.awt.BorderLayout JavaDoc;
13 import javax.swing.JComponent JavaDoc;
14 import org.netbeans.modules.web.jsf.api.editor.JSFConfigEditorContext;
15 import org.openide.filesystems.FileObject;
16 import org.openide.loaders.DataObject;
17 import org.openide.nodes.Node;
18 import org.openide.util.Lookup;
19 import org.openide.windows.TopComponent;
20
21 /**
22  *
23  * @author petr
24  */

25 public class JSFConfigEditorTopComponent extends TopComponent{
26     
27     private JComponent JavaDoc view;
28
29     public JSFConfigEditorTopComponent (JSFConfigEditorContext context, Lookup lookup, JComponent JavaDoc view) {
30         this.view = view;
31         setLayout (new BorderLayout JavaDoc ());
32         setFocusable (true);
33         add (view, BorderLayout.CENTER);
34         // TODO the try shouldn't be here
35
try{
36             Node node = DataObject.find(context.getFacesConfigFile()).getNodeDelegate();
37             setActivatedNodes (new Node[] { node });
38         }
39         catch (Exception JavaDoc e){}
40 // lookup = new ProxyLookup (lookup, node.getLookup (), Lookups.singleton (getActionMap ()));
41
// associateLookup (lookup);
42
}
43
44     public void requestFocus () {
45         super.requestFocus ();
46         view.requestFocus ();
47     }
48
49     public boolean requestFocusInWindow () {
50         super.requestFocusInWindow ();
51         return view.requestFocusInWindow ();
52     }
53     
54 }
55
Popular Tags