1 19 20 package org.netbeans.modules.websvc.wsitconf.ui.service; 21 22 import java.awt.Dialog ; 23 import javax.swing.undo.UndoManager ; 24 import org.netbeans.modules.websvc.wsitconf.ui.ComboConstants; 25 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.SecurityPolicyModelHelper; 26 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.TxModelHelper; 27 import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel; 28 import org.netbeans.modules.xml.multiview.ui.SectionView; 29 import org.netbeans.modules.xml.multiview.ui.SectionVisualTheme; 30 import org.netbeans.modules.xml.wsdl.model.BindingOperation; 31 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 32 import org.netbeans.modules.xml.xam.ComponentEvent; 33 import org.netbeans.modules.xml.xam.ComponentListener; 34 import org.openide.nodes.Node; 35 import javax.swing.*; 36 import org.netbeans.api.project.Project; 37 import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; 38 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 39 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.TargetsPanel; 40 import org.netbeans.modules.websvc.wsitconf.util.UndoCounter; 41 import org.netbeans.modules.websvc.wsitconf.util.Util; 42 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.ProfilesModelHelper; 43 import org.netbeans.modules.xml.wsdl.model.Binding; 44 import org.netbeans.modules.xml.wsdl.model.BindingInput; 45 import org.netbeans.modules.xml.wsdl.model.BindingOutput; 46 import org.openide.DialogDescriptor; 47 import org.openide.DialogDisplayer; 48 import org.openide.util.NbBundle; 49 50 54 public class OperationPanel extends SectionInnerPanel { 55 56 private WSDLModel model; 57 private Node node; 58 private Binding binding; 59 private BindingOperation operation; 60 private UndoManager undoManager; 61 private boolean inSync = false; 62 private Project project; 63 private JaxWsModel jaxwsmodel; 64 65 public OperationPanel(SectionView view, Node node, Project p, BindingOperation operation, UndoManager undoManager, JaxWsModel jaxwsmodel) { 66 super(view); 67 this.model = operation.getModel(); 68 this.node = node; 69 this.binding = (Binding)operation.getParent(); 70 this.undoManager = undoManager; 71 this.project = p; 72 this.operation = operation; 73 this.jaxwsmodel = jaxwsmodel; 74 initComponents(); 75 76 txCombo.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); 77 txLbl.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); 78 addImmediateModifier(txCombo); 88 89 inSync = true; 90 txCombo.removeAllItems(); 91 txCombo.addItem(ComboConstants.TX_NOTSUPPORTED); 93 txCombo.addItem(ComboConstants.TX_MANDATORY); 94 txCombo.addItem(ComboConstants.TX_REQUIRED); 95 txCombo.addItem(ComboConstants.TX_REQUIRESNEW); 96 txCombo.addItem(ComboConstants.TX_SUPPORTED); 97 98 113 inSync = false; 114 sync(); 115 116 model.addComponentListener(new ComponentListener() { 117 public void valueChanged(ComponentEvent evt) { 118 sync(); 119 } 120 public void childrenAdded(ComponentEvent evt) { 121 sync(); 122 } 123 public void childrenDeleted(ComponentEvent evt) { 124 sync(); 125 } 126 }); 127 } 128 129 private void sync() { 130 inSync = true; 131 132 String txValue = TxModelHelper.getTx(operation, node); 133 txCombo.setSelectedItem(txValue); 134 135 enableDisable(); 144 inSync = false; 145 } 146 147 @Override 164 public void setValue(javax.swing.JComponent source, Object value) { 165 if (inSync) return; 166 if (source.equals(txCombo)) { 167 String selected = (String ) txCombo.getSelectedItem(); 168 if ((selected != null) && (!selected.equals(TxModelHelper.getTx(operation, node)))) { 169 TxModelHelper.setTx(operation, node, selected); 170 } 171 } 172 173 enableDisable(); 185 } 186 187 @Override 188 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 189 SectionView view = getSectionView(); 190 enableDisable(); 191 if (view != null) { 192 view.getErrorPanel().clearError(); 193 } 194 } 195 196 @Override 197 public void rollbackValue(javax.swing.text.JTextComponent source) { 198 } 199 200 @Override 201 protected void endUIChange() { } 202 203 public void linkButtonPressed(Object ddBean, String ddProperty) { } 204 205 public javax.swing.JComponent getErrorComponent(String errorId) { 206 return new JButton(); 207 } 208 209 private void enableDisable() { 210 211 boolean isTomcat = Util.isTomcat(project); 212 boolean isWebProject = Util.isWebProject(project); 213 214 boolean txConfigEnabled = !isTomcat && isWebProject; 215 txCombo.setEnabled(txConfigEnabled); 216 txLbl.setEnabled(txConfigEnabled); 217 218 227 } 231 232 247 253 258 private void initComponents() { 260 261 txLbl = new javax.swing.JLabel (); 262 txCombo = new javax.swing.JComboBox (); 263 264 txLbl.setLabelFor(txCombo); 265 org.openide.awt.Mnemonics.setLocalizedText(txLbl, org.openide.util.NbBundle.getMessage(OperationPanel.class, "LBL_Section_Operation_Tx")); 267 txCombo.setModel(new javax.swing.DefaultComboBoxModel (new String [] { "None", "Not Supported", "Required", "Requires New", "Mandatory", "Supported" })); 268 269 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 270 this.setLayout(layout); 271 layout.setHorizontalGroup( 272 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 273 .add(layout.createSequentialGroup() 274 .addContainerGap() 275 .add(txLbl) 276 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 277 .add(txCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) 278 .addContainerGap(156, Short.MAX_VALUE)) 279 ); 280 layout.setVerticalGroup( 281 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 282 .add(layout.createSequentialGroup() 283 .addContainerGap() 284 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) 285 .add(txLbl) 286 .add(txCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) 287 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 288 ); 289 } 291 private javax.swing.JComboBox txCombo; 293 private javax.swing.JLabel txLbl; 294 296 } 297 | Popular Tags |