KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > view > NotificationOperationPanel


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 /*
21  * OperationConfigurationPanel.java
22  *
23  * Created on August 25, 2006, 1:15 PM
24  */

25
26 package org.netbeans.modules.xml.wsdl.ui.view;
27
28 import java.util.HashMap JavaDoc;
29 import java.util.List JavaDoc;
30 import java.util.Map JavaDoc;
31
32 import javax.swing.JComboBox JavaDoc;
33 import javax.swing.JPanel JavaDoc;
34 import javax.swing.JTextField JavaDoc;
35 import javax.swing.text.Document JavaDoc;
36
37 import org.netbeans.api.project.Project;
38 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
39
40
41 /**
42  *
43  * @author radval
44  */

45 public class NotificationOperationPanel extends javax.swing.JPanel JavaDoc implements OperationConfigurationPanel.OperationConfiguration {
46     
47     private Project mProject = null;
48     private Document JavaDoc mCommonOperationTextFieldDocument;
49     private Map JavaDoc<String JavaDoc, String JavaDoc> namespaceToPrefixMap = new HashMap JavaDoc<String JavaDoc, String JavaDoc>();
50     private boolean mIsShowMessageComboBoxes = false;
51     private WSDLModel mModel;
52     
53     /** Creates new form OperationConfigurationPanel
54      * @param project */

55     
56     
57     
58     public NotificationOperationPanel(Project project,
59                                       Document JavaDoc operationNameTextFieldDocument,
60                                       Map JavaDoc<String JavaDoc, String JavaDoc> namespaceToPrefixMap,
61                                       boolean isShowMessageComboBoxes, WSDLModel model) {
62         this.mProject = project;
63         this.mCommonOperationTextFieldDocument = operationNameTextFieldDocument;
64         this.namespaceToPrefixMap = namespaceToPrefixMap;
65         this.mIsShowMessageComboBoxes = isShowMessageComboBoxes;
66         mModel = model;
67         initComponents();
68         initGUI();
69     }
70     
71     /** Mattise require default constructor otherwise will not load in design view of mattise
72      **/

73     public NotificationOperationPanel() {
74         initComponents();
75         initGUI();
76     }
77     
78     /** This method is called from within the constructor to
79      * initialize the form.
80      * WARNING: Do NOT modify this code. The content of this method is
81      * always regenerated by the Form Editor.
82      */

83     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
84
private void initComponents() {
85         OperationNameLabel = new javax.swing.JLabel JavaDoc();
86         operationNameTextField = new javax.swing.JTextField JavaDoc();
87         if(mCommonOperationTextFieldDocument != null) {
88             operationNameTextField.setDocument(mCommonOperationTextFieldDocument);
89         }
90         operationTypeLabel = new javax.swing.JLabel JavaDoc();
91         operationTypeComboBox = new javax.swing.JComboBox JavaDoc();
92         jLabel1 = new javax.swing.JLabel JavaDoc();
93         jPanel1 = new javax.swing.JPanel JavaDoc();
94         outputMessagePartsConfigurationTable = new org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel(mProject, namespaceToPrefixMap, mModel);
95         outputMessageNameConfigurationPanel1 = new MessageNameConfigurationPanel(outputMessagePartsConfigurationTable);
96
97         OperationNameLabel.setLabelFor(operationNameTextField);
98         org.openide.awt.Mnemonics.setLocalizedText(OperationNameLabel, org.openide.util.NbBundle.getMessage(NotificationOperationPanel.class, "NotificationOperationPanel.OperationNameLabel.text")); // NOI18N
99

100         operationTypeLabel.setLabelFor(operationTypeComboBox);
101         org.openide.awt.Mnemonics.setLocalizedText(operationTypeLabel, org.openide.util.NbBundle.getMessage(NotificationOperationPanel.class, "NotificationOperationPanel.operationTypeLabel.text")); // NOI18N
102

103         operationTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "Request-Response Operation", "One-Way Operation" }));
104
105         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(NotificationOperationPanel.class, "NotificationOperationPanel.jLabel1.text")); // NOI18N
106

107         org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
108         jPanel1.setLayout(jPanel1Layout);
109         jPanel1Layout.setHorizontalGroup(
110             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
111             .add(outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 354, Short.MAX_VALUE)
112             .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
113         );
114         jPanel1Layout.setVerticalGroup(
115             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
116             .add(jPanel1Layout.createSequentialGroup()
117                 .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
118                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
119                 .add(outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
120                 .add(20, 20, 20))
121         );
122
123         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
124         this.setLayout(layout);
125         layout.setHorizontalGroup(
126             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
127             .add(layout.createSequentialGroup()
128                 .addContainerGap()
129                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
130                     .add(OperationNameLabel)
131                     .add(operationTypeLabel)
132                     .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
133                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
134                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
135                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
136                     .add(org.jdesktop.layout.GroupLayout.LEADING, operationTypeComboBox, 0, 354, Short.MAX_VALUE)
137                     .add(org.jdesktop.layout.GroupLayout.LEADING, operationNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE))
138                 .addContainerGap())
139         );
140         layout.setVerticalGroup(
141             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
142             .add(layout.createSequentialGroup()
143                 .addContainerGap()
144                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
145                     .add(OperationNameLabel)
146                     .add(operationNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
147                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
148                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
149                     .add(operationTypeLabel)
150                     .add(operationTypeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
151                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
152                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
153                     .add(jLabel1)
154                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
155                 .add(97, 97, 97))
156         );
157     }// </editor-fold>//GEN-END:initComponents
158

159     
160     public void setOutputMessages(String JavaDoc[] existingMessages, String JavaDoc newMessageName, javax.swing.event.DocumentListener JavaDoc msgNameDocumentListener) {
161         outputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener);
162     }
163     
164     public boolean isNewOutputMessage() {
165        return outputMessageNameConfigurationPanel1.isNewMessage();
166     }
167     
168     public boolean isNewInputMessage() {
169        return false;
170     }
171     
172     
173     public boolean isNewFaultMessage() {
174        return false;
175     }
176     
177     public String JavaDoc getOutputMessageName() {
178         return this.outputMessageNameConfigurationPanel1.getMessageName();
179     }
180     
181     
182     public String JavaDoc getInputMessageName() {
183         return null;
184     }
185
186
187     public String JavaDoc getFaultMessageName() {
188         return null;
189     }
190     
191     public String JavaDoc getOperationName() {
192         return this.operationNameTextField.getText();
193     }
194     
195     public void setOperationName(String JavaDoc operationName) {
196         this.operationNameTextField.setText(operationName);
197     }
198     
199     public OperationType getOperationType() {
200         return (OperationType) this.operationTypeComboBox.getSelectedItem();
201     }
202     
203     public JComboBox JavaDoc getOperationTypeComboBox() {
204         return this.operationTypeComboBox;
205     }
206     
207     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getInputMessageParts() {
208         return null;
209     }
210         
211     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getOutputMessageParts() {
212         return outputMessagePartsConfigurationTable.getPartAndElementOrType();
213     }
214
215     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getFaultMessageParts() {
216         return null;
217     }
218         
219     private void initGUI() {
220         outputMessagePartsConfigurationTable.addNewRow();
221         outputMessagePartsConfigurationTable.clearSelection();
222         outputMessageNameConfigurationPanel1.setVisible(this.mIsShowMessageComboBoxes);
223         if (mIsShowMessageComboBoxes) {
224             jLabel1.setLabelFor(outputMessageNameConfigurationPanel1);
225         } else {
226             jLabel1.setLabelFor(outputMessagePartsConfigurationTable);
227         }
228     }
229     
230     public JTextField JavaDoc getOperationNameTextField() {
231         return this.operationNameTextField;
232     }
233         
234     
235     public static void main(String JavaDoc[] args) {
236         
237 /* JFrame frame = new JFrame();
238         frame.getContentPane().setLayout(new BorderLayout());
239         OperationConfigurationPanel p = new OperationConfigurationPanel();
240         frame.getContentPane().add(p, BorderLayout.CENTER);
241         frame.setSize(200, 200);
242         frame.setVisible(true);
243         */

244         
245     }
246     
247     private OperationType selectedOperationType;
248     private JPanel JavaDoc operationCardPanel;
249     
250     // Variables declaration - do not modify//GEN-BEGIN:variables
251
private javax.swing.JLabel JavaDoc OperationNameLabel;
252     private javax.swing.JLabel JavaDoc jLabel1;
253     private javax.swing.JPanel JavaDoc jPanel1;
254     private javax.swing.JTextField JavaDoc operationNameTextField;
255     private javax.swing.JComboBox JavaDoc operationTypeComboBox;
256     private javax.swing.JLabel JavaDoc operationTypeLabel;
257     private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel outputMessageNameConfigurationPanel1;
258     private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel outputMessagePartsConfigurationTable;
259     // End of variables declaration//GEN-END:variables
260

261 }
262
Popular Tags