KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > design > view > DesignView


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.design.view;
21
22 import java.awt.BorderLayout JavaDoc;
23 import javax.swing.Action JavaDoc;
24 import javax.swing.JComponent JavaDoc;
25 import javax.swing.JPanel JavaDoc;
26 import javax.swing.JToolBar JavaDoc;
27 import org.netbeans.api.visual.action.ActionFactory;
28 import org.netbeans.api.visual.widget.Scene;
29 import org.netbeans.api.visual.widget.Widget;
30 import org.netbeans.modules.websvc.api.jaxws.project.config.Service;
31 import org.netbeans.modules.websvc.design.view.actions.AddOperationAction;
32 import org.netbeans.modules.websvc.design.view.widget.OperationsWidget;
33 import org.openide.filesystems.FileObject;
34
35 /**
36  * WebService Designer
37  *
38  * @author Ajit Bhate
39  */

40 public class DesignView extends JPanel JavaDoc {
41     /** Manages the state of the widgets and corresponding objects. */
42     private Scene scene;
43     /**
44      * Creates a new instance of GraphView.
45      */

46     public DesignView(Service service, FileObject implementationClass) {
47         super(new BorderLayout JavaDoc());
48
49         scene = new Scene();
50         // initialize configuration
51
// add actions
52
scene.getActions().addAction(ActionFactory.createZoomAction ());
53         scene.getActions().addAction(ActionFactory.createPanAction ());
54         scene.getActions().addAction(ActionFactory.createPopupMenuAction(
55                 new DesignViewPopupProvider(new Action JavaDoc [] {
56             new AddOperationAction(service, implementationClass),
57         })));
58
59         //add operations widget
60
Widget opWidget = new OperationsWidget(scene,service);
61         scene.addChild(opWidget);
62
63         add(scene.createView());
64     }
65
66     /**
67      * Adds the graph actions to the given toolbar (no separators are
68      * added to either the beginning or end).
69      *
70      * @param toolbar to which the actions are added.
71      */

72     public void addToolbarActions(JToolBar JavaDoc toolbar) {
73     }
74
75     /**
76      * Return the view content, suitable for printing (i.e. without a
77      * scroll pane, which would result in the scroll bars being printed).
78      *
79      * @return the view content, sans scroll pane.
80      */

81     public JComponent JavaDoc getContent() {
82         return scene.getView();
83     }
84
85     public void requestFocus() {
86         super.requestFocus();
87         // Ensure the graph widgets have the focus.
88
scene.getView().requestFocus();
89     }
90
91     public boolean requestFocusInWindow() {
92         super.requestFocusInWindow();
93         // Ensure the graph widgets have the focus.
94
return scene.getView().requestFocusInWindow();
95     }
96
97 }
98
Popular Tags