KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > wsitconf > ui > service > ServicePanel


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 2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.wsitconf.ui.service;
21
22 import java.awt.Color JavaDoc;
23 import java.awt.Dialog JavaDoc;
24 import java.util.Collection JavaDoc;
25 import java.util.Set JavaDoc;
26 import javax.swing.undo.UndoManager JavaDoc;
27 import org.netbeans.modules.websvc.api.jaxws.project.config.JaxWsModel;
28 import org.netbeans.modules.websvc.api.jaxws.project.config.Service;
29 import org.netbeans.modules.websvc.wsitconf.spi.SecurityProfile;
30 import org.netbeans.modules.websvc.wsitconf.spi.SecurityProfileRegistry;
31 import org.netbeans.modules.websvc.wsitconf.ui.ComboConstants;
32 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.AdvancedRMPanel;
33 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.KeystorePanel;
34 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.STSConfigServicePanel;
35 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.TruststorePanel;
36 import org.netbeans.modules.websvc.wsitconf.ui.service.subpanels.ValidatorsPanel;
37 import org.netbeans.modules.websvc.wsitconf.util.UndoCounter;
38 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.ProprietarySecurityPolicyModelHelper;
39 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.TransportModelHelper;
40 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.ProfilesModelHelper;
41 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.RMMSModelHelper;
42 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.RMModelHelper;
43 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.RMSunModelHelper;
44 import org.netbeans.modules.websvc.wsitconf.wsdlmodelext.SecurityPolicyModelHelper;
45 import org.netbeans.modules.xml.multiview.ui.SectionInnerPanel;
46 import org.netbeans.modules.xml.multiview.ui.SectionView;
47 import org.netbeans.modules.xml.multiview.ui.SectionVisualTheme;
48 import org.netbeans.modules.xml.wsdl.model.Binding;
49 import org.netbeans.modules.xml.wsdl.model.WSDLModel;
50 import org.netbeans.modules.xml.xam.ComponentEvent;
51 import org.netbeans.modules.xml.xam.ComponentListener;
52 import org.openide.DialogDescriptor;
53 import org.openide.DialogDisplayer;
54 import org.openide.nodes.Node;
55 import javax.swing.*;
56 import org.netbeans.api.project.Project;
57 import org.netbeans.modules.websvc.wsitconf.spi.SecurityCheckerRegistry;
58 import org.netbeans.modules.websvc.wsitconf.util.Util;
59 import org.netbeans.modules.xml.wsdl.model.BindingOperation;
60 import org.openide.util.NbBundle;
61
62 /**
63  *
64  * @author Martin Grebac
65  */

66 public class ServicePanel extends SectionInnerPanel {
67
68     private WSDLModel model;
69     private Node node;
70     private Binding binding;
71     private UndoManager JavaDoc undoManager;
72     private Project project;
73     private Service service;
74     private JaxWsModel jaxwsmodel;
75
76     private String JavaDoc oldProfile;
77
78     private boolean doNotSync = false;
79
80     private boolean inSync = false;
81     private boolean isFromJava = true;
82
83     private final Color JavaDoc RED = new java.awt.Color JavaDoc(255, 0, 0);
84     private Color JavaDoc REGULAR = new java.awt.Color JavaDoc(0, 0, 0);
85             
86     public ServicePanel(SectionView view, Node node, Project p, Binding binding, UndoManager JavaDoc undoManager, JaxWsModel jaxwsmodel) {
87         super(view);
88         this.model = binding.getModel();
89         this.project = p;
90         this.node = node;
91         this.undoManager = undoManager;
92         this.binding = binding;
93         this.jaxwsmodel = jaxwsmodel;
94         initComponents();
95
96         REGULAR = profileInfoField.getForeground();
97         
98         if (node != null) {
99             service = (Service)node.getLookup().lookup(Service.class);
100             if (service != null) {
101                 String JavaDoc wsdlUrl = service.getWsdlUrl();
102                 if (wsdlUrl != null) { // WS from WSDL
103
isFromJava = false;
104                 }
105             }
106         } else {
107             isFromJava = false;
108         }
109         
110         mtomChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
111         rmChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
112         orderedChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
113         securityChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
114         profileComboLabel.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
115         profileCombo.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
116         profileInfoField.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
117         profileInfoField.setFont(mtomChBox.getFont());
118         stsChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
119         tcpChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
120         fiChBox.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
121         jSeparator1.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
122         jSeparator2.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
123         jSeparator3.setBackground(SectionVisualTheme.getDocumentBackgroundColor());
124         
125         addImmediateModifier(mtomChBox);
126         addImmediateModifier(rmChBox);
127         addImmediateModifier(orderedChBox);
128         addImmediateModifier(securityChBox);
129         addImmediateModifier(profileCombo);
130         addImmediateModifier(stsChBox);
131         addImmediateModifier(tcpChBox);
132         addImmediateModifier(fiChBox);
133
134         inSync = true;
135         profileCombo.removeAllItems();
136         
137         Set JavaDoc<SecurityProfile> profiles = SecurityProfileRegistry.getDefault().getSecurityProfiles();
138
139         for (SecurityProfile profile : profiles) {
140             if (profile.isProfileSupported(project, binding)) {
141                 profileCombo.addItem(profile.getDisplayName());
142             }
143         }
144
145         inSync = false;
146         sync();
147
148         model.addComponentListener(new ComponentListener() {
149             public void valueChanged(ComponentEvent evt) {
150                 if (!doNotSync) {
151                     sync();
152                 }
153             }
154             public void childrenAdded(ComponentEvent evt) {
155                 if (!doNotSync) {
156                     sync();
157                 }
158             }
159             public void childrenDeleted(ComponentEvent evt) {
160                 if (!doNotSync) {
161                     sync();
162                 }
163             }
164         });
165     }
166
167     private void sync() {
168         inSync = true;
169         
170         boolean mtomEnabled = TransportModelHelper.isMtomEnabled(binding);
171         setChBox(mtomChBox, mtomEnabled);
172         
173         boolean fiEnabled = TransportModelHelper.isFIEnabled(binding);
174         setChBox(fiChBox, !fiEnabled);
175
176         boolean tcpEnabled = TransportModelHelper.isTCPEnabled(binding);
177         setChBox(tcpChBox, tcpEnabled);
178
179         boolean rmEnabled = RMModelHelper.isRMEnabled(binding);
180         setChBox(rmChBox, rmEnabled);
181         setChBox(orderedChBox, RMSunModelHelper.isOrderedEnabled(binding));
182         
183         boolean securityEnabled = SecurityPolicyModelHelper.isSecurityEnabled(binding);
184         setChBox(securityChBox, securityEnabled);
185         if (securityEnabled) {
186             setSecurityProfile(ProfilesModelHelper.getSecurityProfile(binding));
187         } else {
188             setSecurityProfile(ComboConstants.PROF_USERNAME);
189         }
190
191         boolean stsEnabled = ProprietarySecurityPolicyModelHelper.isSTSEnabled(binding);
192         setChBox(stsChBox, stsEnabled);
193         
194         enableDisable();
195         inSync = false;
196     }
197
198     @Override JavaDoc
199     public void setValue(javax.swing.JComponent JavaDoc source, Object JavaDoc value) {
200         if (inSync) return;
201         
202         if (source.equals(rmChBox)) {
203             if (rmChBox.isSelected()) {
204                 if (!(RMModelHelper.isRMEnabled(binding))) {
205                     RMModelHelper.enableRM(binding);
206                 }
207             } else {
208                 if (RMModelHelper.isRMEnabled(binding)) {
209                     RMModelHelper.disableRM(binding);
210                     RMMSModelHelper.disableFlowControl(binding);
211                     RMSunModelHelper.disableOrdered(binding);
212                     RMModelHelper.setInactivityTimeout(binding, null);
213                     RMMSModelHelper.setMaxReceiveBufferSize(binding, null);
214                 }
215             }
216         }
217
218         if (source.equals(orderedChBox)) {
219             if (orderedChBox.isSelected()) {
220                 if (!(RMSunModelHelper.isOrderedEnabled(binding))) {
221                     RMSunModelHelper.enableOrdered(binding);
222                 }
223             } else {
224                 if (RMSunModelHelper.isOrderedEnabled(binding)) {
225                     RMSunModelHelper.disableOrdered(binding);
226                 }
227             }
228         }
229
230         if (source.equals(mtomChBox)) {
231             if (mtomChBox.isSelected()) {
232                 if (!(TransportModelHelper.isMtomEnabled(binding))) {
233                     TransportModelHelper.enableMtom(binding);
234                 }
235             } else {
236                 if (TransportModelHelper.isMtomEnabled(binding)) {
237                     TransportModelHelper.disableMtom(binding);
238                 }
239             }
240         }
241
242         if (source.equals(fiChBox)) {
243             if (!fiChBox.isSelected()) {
244                 if (!(TransportModelHelper.isFIEnabled(binding))) {
245                     TransportModelHelper.enableFI(binding, true);
246                 }
247             } else {
248                 if (TransportModelHelper.isFIEnabled(binding)) {
249                     TransportModelHelper.enableFI(binding, false);
250                 }
251             }
252         }
253         
254         if (source.equals(tcpChBox)) {
255             boolean jsr109 = ((jaxwsmodel.getJsr109() == null) || (jaxwsmodel.getJsr109().equals(Boolean.TRUE)));
256             if (tcpChBox.isSelected()) {
257                 if (!(TransportModelHelper.isTCPEnabled(binding))) {
258                     TransportModelHelper.enableTCP(service, isFromJava, binding, project, true, jsr109);
259                 }
260             } else {
261                 if (TransportModelHelper.isTCPEnabled(binding)) {
262                     TransportModelHelper.enableTCP(service, isFromJava, binding, project, false, jsr109);
263                 }
264             }
265         }
266         
267         if (source.equals(securityChBox)) {
268             if (securityChBox.isSelected()) {
269                 String JavaDoc profile = (String JavaDoc) profileCombo.getSelectedItem();
270                 profileCombo.setSelectedItem(profile);
271                 oldProfile = profile;
272             } else {
273                 SecurityPolicyModelHelper.disableSecurity(binding, true);
274             }
275         }
276
277         if (source.equals(stsChBox)) {
278             if (stsChBox.isSelected()) {
279                 ProprietarySecurityPolicyModelHelper.enableSTS(binding);
280             } else {
281                 ProprietarySecurityPolicyModelHelper.disableSTS(binding);
282             }
283         }
284         
285         if (source.equals(profileCombo)) {
286             doNotSync = true;
287             try {
288                 String JavaDoc profile = (String JavaDoc) profileCombo.getSelectedItem();
289                 ProfilesModelHelper.setSecurityProfile(binding, profile, oldProfile);
290                 profileInfoField.setText(ProfileUtil.getProfileInfo(profile));
291                 oldProfile = profile;
292             } finally {
293                 doNotSync = false;
294             }
295         }
296         
297         enableDisable();
298     }
299
300     public Boolean JavaDoc getMtom() {
301         if (mtomChBox.isSelected()) {
302             return Boolean.TRUE;
303         }
304         return Boolean.FALSE;
305     }
306     
307     public Boolean JavaDoc getRM() {
308         if (rmChBox.isSelected()) {
309             return Boolean.TRUE;
310         }
311         return Boolean.FALSE;
312     }
313
314     public Boolean JavaDoc getOrdered() {
315         if (orderedChBox.isSelected()) {
316             return Boolean.TRUE;
317         }
318         return Boolean.FALSE;
319     }
320
321     public Boolean JavaDoc getSecurity() {
322         if (securityChBox.isSelected()) {
323             return Boolean.TRUE;
324         }
325         return Boolean.FALSE;
326     }
327
328     private void setChBox(JCheckBox chBox, Boolean JavaDoc enable) {
329         if (enable == null) {
330             chBox.setSelected(false);
331         } else {
332             chBox.setSelected(enable);
333         }
334     }
335     
336     // SECURITY PROFILE
337
private void setSecurityProfile(String JavaDoc profile) {
338         this.profileCombo.setSelectedItem(profile);
339         this.profileInfoField.setText(ProfileUtil.getProfileInfo(profile));
340     }
341     
342     @Override JavaDoc
343     public void documentChanged(javax.swing.text.JTextComponent JavaDoc comp, String JavaDoc value) {
344         SectionView view = getSectionView();
345         enableDisable();
346         if (view != null) {
347             view.getErrorPanel().clearError();
348         }
349     }
350
351     @Override JavaDoc
352     public void rollbackValue(javax.swing.text.JTextComponent JavaDoc source) {
353     }
354     
355     @Override JavaDoc
356     protected void endUIChange() { }
357
358     public void linkButtonPressed(Object JavaDoc ddBean, String JavaDoc ddProperty) { }
359
360     public javax.swing.JComponent JavaDoc getErrorComponent(String JavaDoc errorId) {
361         return new JButton();
362     }
363     
364     private void enableDisable() {
365         
366         boolean relSelected = rmChBox.isSelected();
367         orderedChBox.setEnabled(relSelected);
368         rmAdvanced.setEnabled(relSelected);
369
370         boolean isTomcat = Util.isTomcat(project);
371         tcpChBox.setEnabled(!isTomcat);
372         
373         boolean amSec = SecurityCheckerRegistry.getDefault().isNonWsitSecurityEnabled(node, jaxwsmodel);
374         
375         // everything is ok, disable security
376
if (!amSec) {
377
378             boolean jsr109 = ((jaxwsmodel.getJsr109() == null) || (jaxwsmodel.getJsr109().equals(Boolean.TRUE)));
379
380             securityChBox.setEnabled(true);
381             profileInfoField.setForeground(REGULAR);
382             
383             boolean secSelected = securityChBox.isSelected();
384             profileComboLabel.setEnabled(secSelected);
385             profileCombo.setEnabled(secSelected);
386             profileInfoField.setEnabled(secSelected);
387             profConfigButton.setEnabled(secSelected);
388             stsChBox.setEnabled(secSelected && !isFromJava);
389
390             boolean stsSelected = stsChBox.isSelected();
391             stsConfigButton.setEnabled(stsSelected);
392
393             boolean storeConfigRequired = true;
394
395             boolean someSecSelected = secSelected;
396             if (!someSecSelected) {
397                 Collection JavaDoc<BindingOperation> bops = binding.getBindingOperations();
398                 for (BindingOperation bop : bops) {
399                     someSecSelected = SecurityPolicyModelHelper.isSecurityEnabled(bop);
400                     if (someSecSelected) break;
401                 }
402             }
403
404             validatorsButton.setEnabled(someSecSelected && !jsr109);
405             keyButton.setEnabled(storeConfigRequired && someSecSelected);
406             trustButton.setEnabled(storeConfigRequired && someSecSelected);
407         } else { // no wsit fun, there's access manager security selected
408
profileComboLabel.setEnabled(false);
409             profileCombo.setEnabled(false);
410             profileInfoField.setEnabled(false);
411             profConfigButton.setEnabled(false);
412             stsChBox.setEnabled(false);
413             stsConfigButton.setEnabled(false);
414             securityChBox.setEnabled(false);
415             validatorsButton.setEnabled(false);
416             keyButton.setEnabled(false);
417             trustButton.setEnabled(false);
418             profileInfoField.setEnabled(true);
419             profileInfoField.setForeground(RED);
420             profileInfoField.setText(NbBundle.getMessage(ServicePanel.class, "TXT_AMSecSelected"));
421         }
422     }
423     
424     /** This method is called from within the constructor to
425      * initialize the form.
426      * WARNING: Do NOT modify this code. The content of this method is
427      * always regenerated by the Form Editor.
428      */

429     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
430
private void initComponents() {
431
432         mtomChBox = new javax.swing.JCheckBox JavaDoc();
433         rmChBox = new javax.swing.JCheckBox JavaDoc();
434         securityChBox = new javax.swing.JCheckBox JavaDoc();
435         orderedChBox = new javax.swing.JCheckBox JavaDoc();
436         profileComboLabel = new javax.swing.JLabel JavaDoc();
437         profileCombo = new javax.swing.JComboBox JavaDoc();
438         rmAdvanced = new javax.swing.JButton JavaDoc();
439         jSeparator1 = new javax.swing.JSeparator JavaDoc();
440         jSeparator2 = new javax.swing.JSeparator JavaDoc();
441         stsChBox = new javax.swing.JCheckBox JavaDoc();
442         tcpChBox = new javax.swing.JCheckBox JavaDoc();
443         jSeparator3 = new javax.swing.JSeparator JavaDoc();
444         keyButton = new javax.swing.JButton JavaDoc();
445         trustButton = new javax.swing.JButton JavaDoc();
446         stsConfigButton = new javax.swing.JButton JavaDoc();
447         profConfigButton = new javax.swing.JButton JavaDoc();
448         fiChBox = new javax.swing.JCheckBox JavaDoc();
449         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
450         profileInfoField = new javax.swing.JTextArea JavaDoc();
451         validatorsButton = new javax.swing.JButton JavaDoc();
452
453         addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
454             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
455                 formFocusGained(evt);
456             }
457         });
458         addAncestorListener(new javax.swing.event.AncestorListener JavaDoc() {
459             public void ancestorMoved(javax.swing.event.AncestorEvent JavaDoc evt) {
460             }
461             public void ancestorAdded(javax.swing.event.AncestorEvent JavaDoc evt) {
462                 formAncestorAdded(evt);
463             }
464             public void ancestorRemoved(javax.swing.event.AncestorEvent JavaDoc evt) {
465             }
466         });
467
468         org.openide.awt.Mnemonics.setLocalizedText(mtomChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_mtomChBox")); // NOI18N
469
mtomChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
470         mtomChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
471
472         org.openide.awt.Mnemonics.setLocalizedText(rmChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_rmChBox")); // NOI18N
473
rmChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
474         rmChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
475
476         org.openide.awt.Mnemonics.setLocalizedText(securityChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_securityChBox")); // NOI18N
477
securityChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
478         securityChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
479
480         org.openide.awt.Mnemonics.setLocalizedText(orderedChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_OrderedChBox")); // NOI18N
481
orderedChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
482         orderedChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
483
484         profileComboLabel.setLabelFor(profileCombo);
485         org.openide.awt.Mnemonics.setLocalizedText(profileComboLabel, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_profileComboLabel")); // NOI18N
486

487         profileCombo.setModel(new javax.swing.DefaultComboBoxModel JavaDoc(new String JavaDoc[] { "SAML Sender Vouches With Certificates", "Anonymous with Bilateral Certificates" }));
488
489         org.openide.awt.Mnemonics.setLocalizedText(rmAdvanced, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_Advanced")); // NOI18N
490
rmAdvanced.addActionListener(new java.awt.event.ActionListener JavaDoc() {
491             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
492                 rmAdvancedActionPerformed(evt);
493             }
494         });
495
496         org.openide.awt.Mnemonics.setLocalizedText(stsChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_stsChBox")); // NOI18N
497
stsChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
498         stsChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
499
500         org.openide.awt.Mnemonics.setLocalizedText(tcpChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_tcpChBox")); // NOI18N
501
tcpChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
502         tcpChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
503
504         org.openide.awt.Mnemonics.setLocalizedText(keyButton, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_keystoreButton")); // NOI18N
505
keyButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
506             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
507                 keyButtonActionPerformed(evt);
508             }
509         });
510
511         org.openide.awt.Mnemonics.setLocalizedText(trustButton, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_truststoreButton")); // NOI18N
512
trustButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
513             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
514                 trustButtonActionPerformed(evt);
515             }
516         });
517
518         org.openide.awt.Mnemonics.setLocalizedText(stsConfigButton, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_stsConfigButton")); // NOI18N
519
stsConfigButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
520             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
521                 stsConfigButtonActionPerformed(evt);
522             }
523         });
524
525         org.openide.awt.Mnemonics.setLocalizedText(profConfigButton, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_keyConfigButton")); // NOI18N
526
profConfigButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
527             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
528                 profConfigButtonActionPerformed(evt);
529             }
530         });
531
532         org.openide.awt.Mnemonics.setLocalizedText(fiChBox, org.openide.util.NbBundle.getMessage(ServicePanel.class, "LBL_Section_Service_fiChBox")); // NOI18N
533
fiChBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
534         fiChBox.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
535
536         profileInfoField.setEditable(false);
537         profileInfoField.setLineWrap(true);
538         profileInfoField.setText("This is a text This is a text This is a text This is a text This is a text This is a text This is");
539         profileInfoField.setWrapStyleWord(true);
540         profileInfoField.setAutoscrolls(false);
541         profileInfoField.setOpaque(false);
542         jScrollPane1.setViewportView(profileInfoField);
543
544         java.util.ResourceBundle JavaDoc bundle = java.util.ResourceBundle.getBundle("org/netbeans/modules/websvc/wsitconf/ui/service/Bundle"); // NOI18N
545
org.openide.awt.Mnemonics.setLocalizedText(validatorsButton, bundle.getString("LBL_validatorsButton")); // NOI18N
546
validatorsButton.addActionListener(new java.awt.event.ActionListener JavaDoc() {
547             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
548                 validatorsButtonActionPerformed(evt);
549             }
550         });
551
552         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
553         this.setLayout(layout);
554         layout.setHorizontalGroup(
555             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
556             .add(layout.createSequentialGroup()
557                 .addContainerGap()
558                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
559                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
560                         .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator1)
561                         .add(org.jdesktop.layout.GroupLayout.LEADING, jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 404, Short.MAX_VALUE)
562                         .add(org.jdesktop.layout.GroupLayout.LEADING, mtomChBox)
563                         .add(org.jdesktop.layout.GroupLayout.LEADING, rmChBox)
564                         .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
565                             .add(17, 17, 17)
566                             .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
567                                 .add(rmAdvanced)
568                                 .add(orderedChBox))
569                             .add(79, 79, 79))
570                         .add(org.jdesktop.layout.GroupLayout.LEADING, securityChBox)
571                         .add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup()
572                             .add(17, 17, 17)
573                             .add(profileComboLabel)
574                             .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
575                             .add(profileCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 228, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
576                             .add(6, 6, 6)
577                             .add(profConfigButton))
578                         .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 427, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
579                     .add(layout.createSequentialGroup()
580                         .add(stsChBox)
581                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
582                         .add(stsConfigButton))
583                     .add(layout.createSequentialGroup()
584                         .add(17, 17, 17)
585                         .add(keyButton)
586                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
587                         .add(trustButton)
588                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
589                         .add(validatorsButton))
590                     .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 436, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
591                     .add(tcpChBox)
592                     .add(fiChBox))
593                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
594         );
595         layout.setVerticalGroup(
596             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
597             .add(layout.createSequentialGroup()
598                 .addContainerGap()
599                 .add(mtomChBox)
600                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
601                 .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
602                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
603                 .add(rmChBox)
604                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
605                 .add(orderedChBox)
606                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
607                 .add(rmAdvanced)
608                 .add(8, 8, 8)
609                 .add(jSeparator2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
610                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
611                 .add(securityChBox)
612                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
613                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
614                     .add(profileComboLabel)
615                     .add(profileCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
616                     .add(profConfigButton))
617                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
618                 .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 58, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
619                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
620                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
621                     .add(trustButton)
622                     .add(keyButton)
623                     .add(validatorsButton))
624                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
625                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
626                     .add(stsChBox)
627                     .add(stsConfigButton))
628                 .add(11, 11, 11)
629                 .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
630                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
631                 .add(tcpChBox)
632                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
633                 .add(fiChBox)
634                 .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
635         );
636     }// </editor-fold>//GEN-END:initComponents
637

638 private void formFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_formFocusGained
639
enableDisable();
640 }//GEN-LAST:event_formFocusGained
641

642 private void formAncestorAdded(javax.swing.event.AncestorEvent JavaDoc evt) {//GEN-FIRST:event_formAncestorAdded
643
enableDisable();
644 }//GEN-LAST:event_formAncestorAdded
645

646     private void validatorsButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_validatorsButtonActionPerformed
647
ValidatorsPanel vPanel = new ValidatorsPanel(binding, project); //NOI18N
648
DialogDescriptor dlgDesc = new DialogDescriptor(vPanel,
649                 NbBundle.getMessage(ServicePanel.class, "LBL_Validators_Panel_Title")); //NOI18N
650
Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
651         
652         dlg.setVisible(true);
653         
654         if (dlgDesc.getValue() == dlgDesc.OK_OPTION) {
655             vPanel.storeState();
656         }
657
658     }//GEN-LAST:event_validatorsButtonActionPerformed
659

660     private void profConfigButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_profConfigButtonActionPerformed
661
String JavaDoc prof = (String JavaDoc) profileCombo.getSelectedItem();
662         SecurityProfile p = SecurityProfileRegistry.getDefault().getProfile(prof);
663         p.displayConfig(binding, undoManager);
664     }//GEN-LAST:event_profConfigButtonActionPerformed
665

666     private void stsConfigButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_stsConfigButtonActionPerformed
667
UndoCounter undoCounter = new UndoCounter();
668         model.addUndoableEditListener(undoCounter);
669
670         STSConfigServicePanel stsConfigPanel = new STSConfigServicePanel(model, project, binding);
671         DialogDescriptor dlgDesc = new DialogDescriptor(stsConfigPanel,
672                 NbBundle.getMessage(ServicePanel.class, "LBL_STSConfig_Panel_Title")); //NOI18N
673
Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
674         
675         dlg.setVisible(true);
676         if (dlgDesc.getValue() == dlgDesc.CANCEL_OPTION) {
677             for (int i=0; i<undoCounter.getCounter();i++) {
678                 if (undoManager.canUndo()) {
679                     undoManager.undo();
680                 }
681             }
682         }
683         
684         model.removeUndoableEditListener(undoCounter);
685     }//GEN-LAST:event_stsConfigButtonActionPerformed
686

687     private void trustButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_trustButtonActionPerformed
688
boolean jsr109 = ((jaxwsmodel.getJsr109() == null) || (jaxwsmodel.getJsr109().equals(Boolean.TRUE)));
689         TruststorePanel storePanel = new TruststorePanel(binding, project, jsr109);
690         DialogDescriptor dlgDesc = new DialogDescriptor(storePanel,
691                 NbBundle.getMessage(ServicePanel.class, "LBL_Truststore_Panel_Title")); //NOI18N
692
Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
693         
694         dlg.setVisible(true);
695         if (dlgDesc.getValue() == dlgDesc.OK_OPTION) {
696             storePanel.storeState();
697         }
698     }//GEN-LAST:event_trustButtonActionPerformed
699

700     private void keyButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_keyButtonActionPerformed
701
boolean jsr109 = ((jaxwsmodel.getJsr109() == null) || (jaxwsmodel.getJsr109().equals(Boolean.TRUE)));
702         KeystorePanel storePanel = new KeystorePanel(binding, project, jsr109);
703         DialogDescriptor dlgDesc = new DialogDescriptor(storePanel,
704                 NbBundle.getMessage(ServicePanel.class, "LBL_Keystore_Panel_Title")); //NOI18N
705
Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
706         
707         dlg.setVisible(true);
708         
709         if (dlgDesc.getValue() == dlgDesc.OK_OPTION) {
710             storePanel.storeState();
711         }
712     }//GEN-LAST:event_keyButtonActionPerformed
713

714     private void rmAdvancedActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_rmAdvancedActionPerformed
715
AdvancedRMPanel advancedRMPanel = new AdvancedRMPanel(binding); //NOI18N
716
DialogDescriptor dlgDesc = new DialogDescriptor(advancedRMPanel,
717                 NbBundle.getMessage(ServicePanel.class, "LBL_AdvancedRM_Title")); //NOI18N
718
Dialog JavaDoc dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);
719         
720         dlg.setVisible(true);
721
722         if (dlgDesc.getValue() == dlgDesc.OK_OPTION) {
723             advancedRMPanel.storeState();
724         }
725     }//GEN-LAST:event_rmAdvancedActionPerformed
726

727     // Variables declaration - do not modify//GEN-BEGIN:variables
728
private javax.swing.JCheckBox JavaDoc fiChBox;
729     private javax.swing.JScrollPane JavaDoc jScrollPane1;
730     private javax.swing.JSeparator JavaDoc jSeparator1;
731     private javax.swing.JSeparator JavaDoc jSeparator2;
732     private javax.swing.JSeparator JavaDoc jSeparator3;
733     private javax.swing.JButton JavaDoc keyButton;
734     private javax.swing.JCheckBox JavaDoc mtomChBox;
735     private javax.swing.JCheckBox JavaDoc orderedChBox;
736     private javax.swing.JButton JavaDoc profConfigButton;
737     private javax.swing.JComboBox JavaDoc profileCombo;
738     private javax.swing.JLabel JavaDoc profileComboLabel;
739     private javax.swing.JTextArea JavaDoc profileInfoField;
740     private javax.swing.JButton JavaDoc rmAdvanced;
741     private javax.swing.JCheckBox JavaDoc rmChBox;
742     private javax.swing.JCheckBox JavaDoc securityChBox;
743     private javax.swing.JCheckBox JavaDoc stsChBox;
744     private javax.swing.JButton JavaDoc stsConfigButton;
745     private javax.swing.JCheckBox JavaDoc tcpChBox;
746     private javax.swing.JButton JavaDoc trustButton;
747     private javax.swing.JButton JavaDoc validatorsButton;
748     // End of variables declaration//GEN-END:variables
749

750 }
751
Popular Tags