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 SolicitResponseOperationPanel 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 SolicitResponseOperationPanel(Project project, 56 Document operationNameTextFieldDocument, 57 Map <String , String > 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 71 public SolicitResponseOperationPanel() { 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 89 operationTypeLabel = new javax.swing.JLabel (); 90 operationTypeComboBox = new javax.swing.JComboBox (); 91 jLabel1 = new javax.swing.JLabel (); 92 jLabel2 = new javax.swing.JLabel (); 93 jLabel3 = new javax.swing.JLabel (); 94 jPanel1 = new javax.swing.JPanel (); 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 (); 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 (); 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")); 107 operationTypeLabel.setLabelFor(operationTypeComboBox); 108 org.openide.awt.Mnemonics.setLocalizedText(operationTypeLabel, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.operationTypeLabel.text")); 110 operationTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel (new String [] { "Request-Response Operation", "One-Way Operation" })); 111 112 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel1.text")); 114 org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel2.text")); 116 org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(SolicitResponseOperationPanel.class, "SolicitResponseOperationPanel.jLabel3.text")); 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 } 215 public void setInputMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener msgNameDocumentListener) { 216 inputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener); 217 } 218 219 public void setOutputMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener msgNameDocumentListener) { 220 outputMessageNameConfigurationPanel1.setMessages(existingMessages, newMessageName, msgNameDocumentListener); 221 } 222 223 public void setFaultMessages(String [] existingMessages, String newMessageName, javax.swing.event.DocumentListener 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 getOutputMessageName() { 241 return this.outputMessageNameConfigurationPanel1.getMessageName(); 242 } 243 244 245 public String getInputMessageName() { 246 return this.inputMessageNameConfigurationPanel1.getMessageName(); 247 } 248 249 250 public String getFaultMessageName() { 251 return this.faultMessageNameConfigurationPanel1.getMessageName(); 252 } 253 254 255 public String getOperationName() { 256 return this.operationNameTextField.getText(); 257 } 258 259 public void setOperationName(String operationName) { 260 this.operationNameTextField.setText(operationName); 261 } 262 263 public OperationType getOperationType() { 264 return (OperationType) this.operationTypeComboBox.getSelectedItem(); 265 } 266 267 public JComboBox getOperationTypeComboBox() { 268 return this.operationTypeComboBox; 269 } 270 271 272 public List <PartAndElementOrTypeTableModel.PartAndElementOrType> getInputMessageParts() { 273 return inputMessagePartsConfigurationTable.getPartAndElementOrType(); 274 } 275 276 public List <PartAndElementOrTypeTableModel.PartAndElementOrType> getOutputMessageParts() { 277 return outputMessagePartsConfigurationTable.getPartAndElementOrType(); 278 } 279 280 public List <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 getOperationNameTextField() { 307 return this.operationNameTextField; 308 } 309 310 public static void main(String [] args) { 311 319 320 } 321 322 private OperationType selectedOperationType; 323 private JPanel operationCardPanel; 324 325 private javax.swing.JLabel 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 jLabel1; 332 private javax.swing.JLabel jLabel2; 333 private javax.swing.JLabel jLabel3; 334 private javax.swing.JPanel jPanel1; 335 private javax.swing.JPanel jPanel2; 336 private javax.swing.JPanel jPanel3; 337 private javax.swing.JTextField operationNameTextField; 338 private javax.swing.JComboBox operationTypeComboBox; 339 private javax.swing.JLabel operationTypeLabel; 340 private org.netbeans.modules.xml.wsdl.ui.view.MessageNameConfigurationPanel outputMessageNameConfigurationPanel1; 341 private org.netbeans.modules.xml.wsdl.ui.view.CommonMessageConfigurationPanel outputMessagePartsConfigurationTable; 342 344 } 345 | Popular Tags |