1 19 20 25 26 package org.netbeans.modules.xml.wsdl.ui.view; 27 28 import java.util.HashMap ; 29 import java.util.List ; 30 import java.util.Map ; 31 32 import javax.swing.JComboBox ; 33 import javax.swing.JPanel ; 34 import javax.swing.JTextField ; 35 import javax.swing.text.Document ; 36 37 import org.netbeans.api.project.Project; 38 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 39 40 41 45 public class RequestReplyOperationPanel extends javax.swing.JPanel implements OperationConfigurationPanel.OperationConfiguration { 46 47 private Project mProject = null; 48 private Document mCommonOperationTextFieldDocument; 49 private Map <String , String > namespaceToPrefixMap = new HashMap <String , String >(); 50 private boolean mIsShowMessageComboBoxes = false; 51 private WSDLModel mModel; 52 53 55 public RequestReplyOperationPanel(Project project, 56 Document operationNameTextFieldDocument, 57 Map <String , String > 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 71 public RequestReplyOperationPanel() { 72 initComponents(); 73 initGUI(); 74 } 75 76 81 private void initComponents() { 83 OperationNameLabel = new javax.swing.JLabel (); 84 operationNameTextField = new javax.swing.JTextField (); 85 if(mCommonOperationTextFieldDocument != null) { 86 operationNameTextField.setDocument(mCommonOperationTextFieldDocument); 87 } 88 operationTypeLabel = new javax.swing.JLabel (); 89 operationTypeComboBox = new javax.swing.JComboBox (); 90 jLabel1 = new javax.swing.JLabel (); 91 jLabel2 = new javax.swing.JLabel (); 92 jLabel3 = new javax.swing.JLabel (); 93 jPanel1 = new javax.swing.JPanel (); 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 (); 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 (); 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 (new String [] { "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 } 214 public String getOperationName() { 215 return this.operationNameTextField.getText(); 216 } 217 218 public void setOperationName(String operationName) { 219 this.operationNameTextField.setText(operationName); 220 } 221 222 public OperationType getOperationType() { 223 return (OperationType) this.operationTypeComboBox.getSelectedItem(); 224 } 225 226 public JComboBox getOperationTypeComboBox() { 227 return this.operationTypeComboBox; 228 } 229 230 231 public List <PartAndElementOrTypeTableModel.PartAndElementOrType> getInputMessageParts() { 232 return inputMessagePartsConfigurationTable.getPartAndElementOrType(); 233 } 234 235 public List <PartAndElementOrTypeTableModel.PartAndElementOrType> getOutputMessageParts() { 236 return outputMessagePartsConfigurationTable.getPartAndElementOrType(); 237 } 238 239 public List <PartAndElementOrTypeTableModel.PartAndElementOrType> getFaultMessageParts() { 240 return faultMessagePartsConfigurationTable.getPartAndElementOrType(); 241 } 242 243 public void setInputMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener msgNameDocumentListener) { 244 inputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener); 245 } 246 247 public void setOutputMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener msgNameDocumentListener) { 248 outputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener); 249 } 250 251 public void setFaultMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener 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 getOutputMessageName() { 269 return this.outputMessageNameConfigurationPanel1.getMessageName(); 270 } 271 272 273 public String getInputMessageName() { 274 return this.inputMessageNameConfigurationPanel1.getMessageName(); 275 } 276 277 278 public String 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 getOperationNameTextField() { 308 return this.operationNameTextField; 309 } 310 311 312 public static void main(String [] args) { 313 314 320 321 322 } 323 324 private OperationType selectedOperationType; 325 private JPanel operationCardPanel; 326 327 private javax.swing.JLabel 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 jLabel1; 334 private javax.swing.JLabel jLabel2; 335 private javax.swing.JLabel jLabel3; 336 private javax.swing.JPanel jPanel1; 337 private javax.swing.JPanel jPanel2; 338 private javax.swing.JPanel jPanel3; 339 private javax.swing.JTextField operationNameTextField; 340 private javax.swing.JComboBox operationTypeComboBox; 341 private javax.swing.JLabel operationTypeLabel; 342 private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel outputMessageNameConfigurationPanel1; 343 private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel outputMessagePartsConfigurationTable; 344 346 } 347 | Popular Tags |