KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

107         operationTypeLabel.setLabelFor(operationTypeComboBox);
108         org.openide.awt.Mnemonics.setLocalizedText(operationTypeLabel, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.operationTypeLabel.text")); // NOI18N
109

110         operationTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "Request-Response Operation", "One-Way Operation" }));
111
112         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel1.text")); // NOI18N
113

114         org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel2.text")); // NOI18N
115

116         org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel3.text")); // NOI18N
117

118         org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
119         jPanel1.setLayout(jPanel1Layout);
120         jPanel1Layout.setHorizontalGroup(
121             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
122             .add(org.jdesktop.layout.GroupLayout.TRAILING, outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
123             .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
124         );
125         jPanel1Layout.setVerticalGroup(
126             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
127             .add(jPanel1Layout.createSequentialGroup()
128                 .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
129                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
130                 .add(outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
131                 .addContainerGap())
132         );
133
134         org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
135         jPanel2.setLayout(jPanel2Layout);
136         jPanel2Layout.setHorizontalGroup(
137             jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
138             .add(org.jdesktop.layout.GroupLayout.TRAILING, inputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
139             .add(inputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
140         );
141         jPanel2Layout.setVerticalGroup(
142             jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
143             .add(jPanel2Layout.createSequentialGroup()
144                 .add(inputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
145                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
146                 .add(inputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
147                 .addContainerGap())
148         );
149
150         org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
151         jPanel3.setLayout(jPanel3Layout);
152         jPanel3Layout.setHorizontalGroup(
153             jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154             .add(org.jdesktop.layout.GroupLayout.TRAILING, faultMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
155             .add(faultMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
156         );
157         jPanel3Layout.setVerticalGroup(
158             jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
159             .add(jPanel3Layout.createSequentialGroup()
160                 .add(faultMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
161                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
162                 .add(faultMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 104, Short.MAX_VALUE)
163                 .addContainerGap())
164         );
165
166         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
167         this.setLayout(layout);
168         layout.setHorizontalGroup(
169             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
170             .add(layout.createSequentialGroup()
171                 .addContainerGap()
172                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
173                     .add(OperationNameLabel)
174                     .add(operationTypeLabel)
175                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
176                         .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
177                         .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
178                         .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
179                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
180                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
181                     .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
182                     .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
183                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
184                     .add(operationTypeComboBox, 0, 410, Short.MAX_VALUE)
185                     .add(operationNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE))
186                 .addContainerGap())
187         );
188         layout.setVerticalGroup(
189             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
190             .add(layout.createSequentialGroup()
191                 .addContainerGap()
192                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
193                     .add(OperationNameLabel)
194                     .add(operationNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
195                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
196                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
197                     .add(operationTypeLabel)
198                     .add(operationTypeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
199                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
200                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
201                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
202                     .add(jLabel1))
203                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
204                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
205                     .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
206                     .add(jLabel2))
207                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
208                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
209                     .add(jLabel3)
210                     .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
211                 .addContainerGap())
212         );
213     }// </editor-fold>//GEN-END:initComponents
214

215     public void setInputMessages(String JavaDoc[] existingMessages, String JavaDoc newMessageName, javax.swing.event.DocumentListener JavaDoc msgNameDocumentListener) {
216         inputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener);
217     }
218     
219     public void setOutputMessages(String JavaDoc[] existingMessages, String JavaDoc newMessageName, javax.swing.event.DocumentListener JavaDoc msgNameDocumentListener) {
220         outputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener);
221     }
222     
223     public void setFaultMessages(String JavaDoc[] existingMessages, String JavaDoc newMessageName, javax.swing.event.DocumentListener JavaDoc msgNameDocumentListener) {
224         faultMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener);
225     }
226     
227     public boolean isNewInputMessage() {
228        return inputMessageNameConfigurationPanel1.isNewMessage();
229     }
230     
231     public boolean isNewOutputMessage() {
232        return outputMessageNameConfigurationPanel1.isNewMessage();
233     }
234     
235     
236     public boolean isNewFaultMessage() {
237        return faultMessageNameConfigurationPanel1.isNewMessage();
238     }
239     
240     public String JavaDoc getOutputMessageName() {
241         return this.outputMessageNameConfigurationPanel1.getMessageName();
242     }
243     
244     
245     public String JavaDoc getInputMessageName() {
246         return this.inputMessageNameConfigurationPanel1.getMessageName();
247     }
248
249
250     public String JavaDoc getFaultMessageName() {
251         return this.faultMessageNameConfigurationPanel1.getMessageName();
252     }
253
254     
255     public String JavaDoc getOperationName() {
256         return this.operationNameTextField.getText();
257     }
258     
259     public void setOperationName(String JavaDoc operationName) {
260         this.operationNameTextField.setText(operationName);
261     }
262     
263     public OperationType getOperationType() {
264         return (OperationType) this.operationTypeComboBox.getSelectedItem();
265     }
266     
267     public JComboBox JavaDoc getOperationTypeComboBox() {
268         return this.operationTypeComboBox;
269     }
270     
271     
272     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getInputMessageParts() {
273         return inputMessagePartsConfigurationTable.getPartAndElementOrType();
274     }
275         
276     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getOutputMessageParts() {
277         return outputMessagePartsConfigurationTable.getPartAndElementOrType();
278     }
279
280     public List JavaDoc<PartAndElementOrTypeTableModel.PartAndElementOrType> getFaultMessageParts() {
281         return faultMessagePartsConfigurationTable.getPartAndElementOrType();
282     }
283     
284     private void initGUI() {
285         inputMessagePartsConfigurationTable.addNewRow();
286         inputMessagePartsConfigurationTable.clearSelection();
287         outputMessagePartsConfigurationTable.addNewRow();
288         outputMessagePartsConfigurationTable.clearSelection();
289         
290         inputMessageNameConfigurationPanel1.setVisible(this.mIsShowMessageComboBoxes);
291         outputMessageNameConfigurationPanel1.setVisible(this.mIsShowMessageComboBoxes);
292         faultMessageNameConfigurationPanel1.setVisible(this.mIsShowMessageComboBoxes);
293         
294         if (mIsShowMessageComboBoxes) {
295             jLabel2.setLabelFor(inputMessageNameConfigurationPanel1);
296             jLabel1.setLabelFor(outputMessageNameConfigurationPanel1);
297             jLabel3.setLabelFor(faultMessageNameConfigurationPanel1);
298         } else {
299             jLabel2.setLabelFor(inputMessagePartsConfigurationTable);
300             jLabel1.setLabelFor(outputMessagePartsConfigurationTable);
301             jLabel3.setLabelFor(faultMessagePartsConfigurationTable);
302         }
303         
304     }
305     
306     public JTextField JavaDoc getOperationNameTextField() {
307         return this.operationNameTextField;
308     }
309     
310     public static void main(String JavaDoc[] args) {
311 /*
312         JFrame frame = new JFrame();
313         frame.getContentPane().setLayout(new BorderLayout());
314         OperationConfigurationPanel p = new OperationConfigurationPanel();
315         frame.getContentPane().add(p, BorderLayout.CENTER);
316         frame.setSize(200, 200);
317         frame.setVisible(true);
318         */

319         
320     }
321     
322     private OperationType selectedOperationType;
323     private JPanel JavaDoc operationCardPanel;
324     
325     // Variables declaration - do not modify//GEN-BEGIN:variables
326
private javax.swing.JLabel JavaDoc OperationNameLabel;
327     private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel faultMessageNameConfigurationPanel1;
328     private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel faultMessagePartsConfigurationTable;
329     private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel inputMessageNameConfigurationPanel1;
330     private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel inputMessagePartsConfigurationTable;
331     private javax.swing.JLabel JavaDoc jLabel1;
332     private javax.swing.JLabel JavaDoc jLabel2;
333     private javax.swing.JLabel JavaDoc jLabel3;
334     private javax.swing.JPanel JavaDoc jPanel1;
335     private javax.swing.JPanel JavaDoc jPanel2;
336     private javax.swing.JPanel JavaDoc jPanel3;
337     private javax.swing.JTextField JavaDoc operationNameTextField;
338     private javax.swing.JComboBox JavaDoc operationTypeComboBox;
339     private javax.swing.JLabel JavaDoc operationTypeLabel;
340     private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel outputMessageNameConfigurationPanel1;
341     private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel outputMessagePartsConfigurationTable;
342     // End of variables declaration//GEN-END:variables
343

344 }
345
Popular Tags