KickJava   Java API By Example, From Geeks To Geeks.

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


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 OneWayOperationPanel 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 OneWayOperationPanel(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     /** Mattise require default constructor otherwise will not load in design view of mattise
69      **/

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

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

97         operationTypeLabel.setLabelFor(operationTypeComboBox);
98         org.openide.awt.Mnemonics.setLocalizedText(operationTypeLabel, org.openide.util.NbBundle.getMessage(OneWayOperationPanel.class, "OneWayOperationPanel.operationTypeLabel.text")); // NOI18N
99

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

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

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

241         
242         
243     }
244     
245     private OperationType selectedOperationType;
246     private JPanel JavaDoc operationCardPanel;
247     
248     // Variables declaration - do not modify//GEN-BEGIN:variables
249
private javax.swing.JLabel JavaDoc OperationNameLabel;
250     private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel inputMessageNameConfigurationPanel1;
251     private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel inputMessagePartsConfigurationTable;
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     // End of variables declaration//GEN-END:variables
258

259 }
260
Popular Tags