KickJava   Java API By Example, From Geeks To Geeks.

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


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

71     public RequestReplyOperationPanel() {
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         operationTypeLabel = new javax.swing.JLabel JavaDoc();
89         operationTypeComboBox = new javax.swing.JComboBox JavaDoc();
90         jLabel1 = new javax.swing.JLabel JavaDoc();
91         jLabel2 = new javax.swing.JLabel JavaDoc();
92         jLabel3 = new javax.swing.JLabel JavaDoc();
93         jPanel1 = new javax.swing.JPanel JavaDoc();
94         inputMessagePartsConfigurationTable = new org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel(mProject, namespaceToPrefixMap, mModel);
95         inputMessageNameConfigurationPanel1 = new MessageNameConfigurationPanel(this.inputMessagePartsConfigurationTable);
96         jPanel2 = new javax.swing.JPanel JavaDoc();
97         outputMessagePartsConfigurationTable = new org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel(mProject, namespaceToPrefixMap, mModel);
98         outputMessageNameConfigurationPanel1 = new MessageNameConfigurationPanel(this.outputMessagePartsConfigurationTable);
99         jPanel3 = new javax.swing.JPanel JavaDoc();
100         faultMessagePartsConfigurationTable = new org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel(mProject, namespaceToPrefixMap, mModel);
101         faultMessageNameConfigurationPanel1 = new MessageNameConfigurationPanel(this.faultMessagePartsConfigurationTable);
102
103         OperationNameLabel.setLabelFor(operationNameTextField);
104         org.openide.awt.Mnemonics.setLocalizedText(OperationNameLabel, org.openide.util.NbBundle.getMessage(RequestReplyOperationPanel.class, "RequestReplyOperationPanel.OperationNameLabel.text"));
105
106         operationTypeLabel.setLabelFor(operationTypeComboBox);
107         org.openide.awt.Mnemonics.setLocalizedText(operationTypeLabel, org.openide.util.NbBundle.getMessage(RequestReplyOperationPanel.class, "RequestReplyOperationPanel.operationTypeLabel.text"));
108
109         operationTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "Request-Response Operation", "One-Way Operation" }));
110
111         org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(RequestReplyOperationPanel.class, "RequestReplyOperationPanel.jLabel1.text"));
112
113         org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(RequestReplyOperationPanel.class, "RequestReplyOperationPanel.jLabel2.text"));
114
115         org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(RequestReplyOperationPanel.class, "RequestReplyOperationPanel.jLabel3.text"));
116
117         org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
118         jPanel1.setLayout(jPanel1Layout);
119         jPanel1Layout.setHorizontalGroup(
120             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
121             .add(inputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
122             .add(inputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
123         );
124         jPanel1Layout.setVerticalGroup(
125             jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
126             .add(jPanel1Layout.createSequentialGroup()
127                 .add(inputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
128                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
129                 .add(inputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
130                 .addContainerGap())
131         );
132
133         org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
134         jPanel2.setLayout(jPanel2Layout);
135         jPanel2Layout.setHorizontalGroup(
136             jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
137             .add(outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
138             .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
139         );
140         jPanel2Layout.setVerticalGroup(
141             jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
142             .add(jPanel2Layout.createSequentialGroup()
143                 .add(outputMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
144                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
145                 .add(outputMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
146                 .addContainerGap())
147         );
148
149         org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
150         jPanel3.setLayout(jPanel3Layout);
151         jPanel3Layout.setHorizontalGroup(
152             jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
153             .add(faultMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
154             .add(faultMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
155         );
156         jPanel3Layout.setVerticalGroup(
157             jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
158             .add(jPanel3Layout.createSequentialGroup()
159                 .add(faultMessageNameConfigurationPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
160                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
161                 .add(faultMessagePartsConfigurationTable, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
162                 .addContainerGap())
163         );
164
165         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
166         this.setLayout(layout);
167         layout.setHorizontalGroup(
168             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
169             .add(layout.createSequentialGroup()
170                 .addContainerGap()
171                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
172                     .add(OperationNameLabel)
173                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
174                         .add(org.jdesktop.layout.GroupLayout.LEADING, jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
175                         .add(org.jdesktop.layout.GroupLayout.LEADING, operationTypeLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
176                     .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
177                     .add(jLabel3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
178                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
179                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
180                     .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
181                     .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
182                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
183                     .add(operationTypeComboBox, 0, 410, Short.MAX_VALUE)
184                     .add(operationNameTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE))
185                 .addContainerGap())
186         );
187         layout.setVerticalGroup(
188             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
189             .add(layout.createSequentialGroup()
190                 .addContainerGap()
191                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
192                     .add(OperationNameLabel)
193                     .add(operationNameTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
194                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
195                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
196                     .add(operationTypeLabel)
197                     .add(operationTypeComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
198                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
199                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
200                     .add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
201                     .add(jLabel1))
202                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
203                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
204                     .add(jPanel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
205                     .add(jLabel2))
206                 .add(8, 8, 8)
207                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
208                     .add(jLabel3)
209                     .add(jPanel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
210                 .addContainerGap())
211         );
212     }// </editor-fold>//GEN-END:initComponents
213

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

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

346 }
347
Popular Tags