1 19 package org.netbeans.modules.websvc.wsitconf.ui.client; 20 21 import javax.swing.JCheckBox ; 22 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel; 23 import org.netbeans.modules.websvc.wsitconf.spi.SecurityCheckerRegistry; 24 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.TransportModelHelper; 25 import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel; 26 import org.netbeans.modules.xml.multiview.ui.SectionView; 27 import org.netbeans.modules.xml.multiview.ui.SectionVisualTheme; 28 import org.netbeans.modules.xml.wsdl.model.Binding; 29 import org.netbeans.modules.xml.wsdl.model.WSDLModel; 30 import org.openide.nodes.Node; 31 32 36 public class TransportPanelClient extends SectionInnerPanel { 37 38 private WSDLModel clientModel; 39 private WSDLModel serviceModel; 40 41 private Node node; 42 private Binding binding; 43 private boolean inSync = false; 44 private JaxWsModel jaxwsmodel; 45 46 public TransportPanelClient(SectionView view, Node node, Binding binding, WSDLModel serviceModel, JaxWsModel jaxWsModel) { 47 super(view); 48 this.clientModel = binding.getModel(); 49 this.serviceModel = serviceModel; 50 this.node = node; 51 this.binding = binding; 52 this.jaxwsmodel = jaxWsModel; 53 54 initComponents(); 55 56 optimalEncChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); 57 optimalTransportChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor()); 58 59 addImmediateModifier(optimalEncChBox); 60 addImmediateModifier(optimalTransportChBox); 61 62 sync(); 63 } 64 65 public void sync() { 66 inSync = true; 67 68 setChBox(optimalEncChBox, TransportModelHelper.isAutoEncodingEnabled(binding)); 69 setChBox(optimalTransportChBox, TransportModelHelper.isAutoTransportEnabled(binding)); 70 71 enableDisable(); 72 73 inSync = false; 74 } 75 76 @Override 77 public void setValue(javax.swing.JComponent source, Object value) { 78 if (!inSync) { 79 if (source.equals(optimalEncChBox)) { 80 TransportModelHelper.setAutoEncoding(binding, optimalEncChBox.isSelected()); 81 } 82 83 if (source.equals(optimalTransportChBox)) { 84 TransportModelHelper.setAutoTransport(binding, optimalTransportChBox.isSelected()); 85 } 86 enableDisable(); 87 } 88 } 89 90 private void enableDisable() { 91 boolean amSec = SecurityCheckerRegistry.getDefault().isNonWsitSecurityEnabled(node, jaxwsmodel); 92 93 optimalEncChBox.setEnabled(!amSec); 94 optimalTransportChBox.setEnabled(!amSec); 95 } 96 97 private void setChBox(JCheckBox chBox, Boolean enable) { 98 if (enable == null) { 99 chBox.setSelected(false); 100 } else { 101 chBox.setSelected(enable); 102 } 103 } 104 105 @Override 106 public void documentChanged(javax.swing.text.JTextComponent comp, String value) { 107 } 108 109 @Override 110 public void rollbackValue(javax.swing.text.JTextComponent source) { 111 } 112 113 @Override 114 protected void endUIChange() { 115 } 116 117 public void linkButtonPressed(Object ddBean, String ddProperty) { 118 } 119 120 public javax.swing.JComponent getErrorComponent(String errorId) { 121 return null; 122 } 123 124 129 private void initComponents() { 131 132 optimalEncChBox = new javax.swing.JCheckBox (); 133 optimalTransportChBox = new javax.swing.JCheckBox (); 134 135 addFocusListener(new java.awt.event.FocusAdapter () { 136 public void focusGained(java.awt.event.FocusEvent evt) { 137 formFocusGained(evt); 138 } 139 }); 140 addAncestorListener(new javax.swing.event.AncestorListener () { 141 public void ancestorMoved(javax.swing.event.AncestorEvent evt) { 142 } 143 public void ancestorAdded(javax.swing.event.AncestorEvent evt) { 144 formAncestorAdded(evt); 145 } 146 public void ancestorRemoved(javax.swing.event.AncestorEvent evt) { 147 } 148 }); 149 150 org.openide.awt.Mnemonics.setLocalizedText(optimalEncChBox, org.openide.util.NbBundle.getMessage(TransportPanelClient.class, "LBL_Transport_OptimalEncoding")); optimalEncChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 152 optimalEncChBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 153 154 org.openide.awt.Mnemonics.setLocalizedText(optimalTransportChBox, org.openide.util.NbBundle.getMessage(TransportPanelClient.class, "LBL_Transport_OptimalTransport")); optimalTransportChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 156 optimalTransportChBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 157 158 org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); 159 this.setLayout(layout); 160 layout.setHorizontalGroup( 161 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 162 .add(layout.createSequentialGroup() 163 .addContainerGap() 164 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 165 .add(optimalTransportChBox) 166 .add(optimalEncChBox)) 167 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 168 ); 169 layout.setVerticalGroup( 170 layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) 171 .add(layout.createSequentialGroup() 172 .addContainerGap() 173 .add(optimalEncChBox) 174 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) 175 .add(optimalTransportChBox) 176 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 177 ); 178 } 180 private void formFocusGained(java.awt.event.FocusEvent evt) { enableDisable(); 182 } 184 private void formAncestorAdded(javax.swing.event.AncestorEvent evt) { enableDisable(); 186 } 188 189 private javax.swing.JCheckBox optimalEncChBox; 191 private javax.swing.JCheckBox optimalTransportChBox; 192 194 } 195 | Popular Tags |