Source Code Cross Referenced for PartnerLinkMainPanel.java in  » IDE-Netbeans » bpel » org » netbeans » modules » bpel » properties » editors » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » IDE Netbeans » bpel » org.netbeans.modules.bpel.properties.editors 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * The contents of this file are subject to the terms of the Common Development
0003:         * and Distribution License (the License). You may not use this file except in
0004:         * compliance with the License.
0005:         * 
0006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
0007:         * or http://www.netbeans.org/cddl.txt.
0008:         * 
0009:         * When distributing Covered Code, include this CDDL Header Notice in each file
0010:         * and include the License file at http://www.netbeans.org/cddl.txt.
0011:         * If applicable, add the following below the CDDL Header, with the fields
0012:         * enclosed by brackets [] replaced by your own identifying information:
0013:         * "Portions Copyrighted [year] [name of copyright owner]"
0014:         * 
0015:         * The Original Software is NetBeans. The Initial Developer of the Original
0016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
0017:         * Microsystems, Inc. All Rights Reserved.
0018:         */
0019:        package org.netbeans.modules.bpel.properties.editors;
0020:
0021:        import java.awt.Component;
0022:        import java.awt.event.ActionEvent;
0023:        import java.awt.event.ActionListener;
0024:        import java.awt.event.FocusAdapter;
0025:        import java.awt.event.FocusEvent;
0026:        import java.awt.event.FocusListener;
0027:        import java.awt.event.ItemEvent;
0028:        import java.awt.event.ItemListener;
0029:        import java.util.ArrayList;
0030:        import java.util.Iterator;
0031:        import java.util.List;
0032:        import java.util.StringTokenizer;
0033:        import javax.swing.Timer;
0034:        import javax.swing.DefaultComboBoxModel;
0035:        import javax.swing.DefaultListCellRenderer;
0036:        import javax.swing.ImageIcon;
0037:        import javax.swing.JList;
0038:        import javax.swing.event.DocumentEvent;
0039:        import javax.swing.event.DocumentListener;
0040:        import org.netbeans.api.project.FileOwnerQuery;
0041:        import org.netbeans.api.project.Project;
0042:        import org.openide.loaders.DataObject;
0043:        import org.netbeans.modules.bpel.design.DnDHandler;
0044:        import org.netbeans.modules.bpel.design.model.PartnerLinkHelper;
0045:        import org.netbeans.modules.bpel.editors.api.nodes.NodeType;
0046:        import org.netbeans.modules.bpel.model.api.BpelModel;
0047:        import org.netbeans.modules.bpel.model.api.PartnerLink;
0048:        import org.netbeans.modules.bpel.model.api.references.WSDLReference;
0049:        import org.netbeans.modules.bpel.properties.ImportRegistrationHelper;
0050:        import org.netbeans.modules.bpel.properties.Util;
0051:        import org.netbeans.modules.soa.ui.form.CustomNodeEditor;
0052:        import org.netbeans.modules.soa.ui.form.valid.Validator;
0053:        import org.openide.ErrorManager;
0054:        import static org.netbeans.modules.bpel.properties.PropertyType.*;
0055:        import org.netbeans.modules.soa.ui.form.EditorLifeCycleAdapter;
0056:        import org.netbeans.modules.soa.ui.form.valid.DefaultValidator;
0057:        import org.netbeans.modules.bpel.editors.api.ui.valid.ErrorMessagesBundle;
0058:        import org.netbeans.modules.bpel.nodes.BpelNode;
0059:        import org.netbeans.modules.soa.ui.form.valid.ValidStateManager;
0060:        import org.netbeans.modules.soa.ui.form.valid.ValidStateManager.ValidStateListener;
0061:        import org.netbeans.modules.bpel.properties.Constants;
0062:        import org.netbeans.modules.bpel.properties.ResolverUtility;
0063:        import org.netbeans.modules.bpel.properties.editors.controls.EmptyComboBoxModel;
0064:        import org.netbeans.modules.xml.wsdl.model.Definitions;
0065:        import org.netbeans.modules.xml.wsdl.model.PortType;
0066:        import org.netbeans.modules.xml.wsdl.model.Import;
0067:        import org.netbeans.modules.xml.wsdl.model.WSDLModel;
0068:        import org.netbeans.modules.xml.wsdl.model.extensions.bpel.BPELComponentFactory;
0069:        import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType;
0070:        import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role;
0071:        import org.netbeans.modules.xml.wsdl.model.visitor.WSDLUtilities;
0072:        import org.netbeans.modules.xml.wsdl.model.visitor.WSDLModelVisitor;
0073:        import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
0074:        import org.openide.filesystems.FileObject;
0075:        import org.openide.util.HelpCtx;
0076:        import org.openide.util.NbBundle;
0077:        import org.netbeans.modules.bpel.properties.importchooser.WSDLFileImportDialog;
0078:        import org.netbeans.modules.xml.catalogsupport.util.ProjectUtilities;
0079:        import org.netbeans.modules.xml.catalogsupport.util.ProjectWSDL;
0080:        import org.netbeans.modules.xml.schema.ui.basic.UIUtilities;
0081:        import org.openide.DialogDescriptor;
0082:        import org.openide.DialogDisplayer;
0083:
0084:        /**
0085:         * @author nk160297
0086:         */
0087:        public class PartnerLinkMainPanel extends EditorLifeCycleAdapter
0088:                implements  Validator.Provider, HelpCtx.Provider {
0089:
0090:            static final long serialVersionUID = 1L;
0091:            private CustomNodeEditor<PartnerLink> myEditor;
0092:            private ArrayList<Role> rolesList;
0093:            private Role myRole;
0094:            private Role partnerRole;
0095:            private DefaultValidator myValidator;
0096:            private Timer inputDelayTimer;
0097:
0098:            private static final String ROLE_NA = "-----"; // NOI18N
0099:            private static final String SLASH = "/"; // NOI18N
0100:
0101:            private static final EmptyComboBoxModel emptyModel = new EmptyComboBoxModel();
0102:
0103:            public PartnerLinkMainPanel(CustomNodeEditor<PartnerLink> anEditor) {
0104:                myEditor = anEditor;
0105:                createContent();
0106:            }
0107:
0108:            private void bindControls2PropertyNames() {
0109:                fldPartnerLinkName.putClientProperty(
0110:                        CustomNodeEditor.PROPERTY_BINDER, NAME);
0111:            }
0112:
0113:            private Project getProject() {
0114:                return FileOwnerQuery
0115:                        .getOwner(((DataObject) myEditor.getLookup().lookup(
0116:                                DataObject.class)).getPrimaryFile());
0117:            }
0118:
0119:            @Override
0120:            public void createContent() {
0121:                initComponents();
0122:                bindControls2PropertyNames();
0123:
0124:                // vlv
0125:                List<ProjectWSDL> wsdlFiles = ProjectUtilities
0126:                        .getProjectWSDLRecursively(getProject());
0127:                ProjectWSDL[] wsdlFilesArr = wsdlFiles
0128:                        .toArray(new ProjectWSDL[wsdlFiles.size()]);
0129:                cbxWsdlFile.setModel(new DefaultComboBoxModel(wsdlFilesArr));
0130:                cbxWsdlFile.setRenderer(new WsdlFileRenderer());
0131:                //
0132:                cbxProcessPortType.setRenderer(new PortTypeRenderer());
0133:                cbxPartnerPortType.setRenderer(new PortTypeRenderer());
0134:                //
0135:                cbxWsdlFile.addItemListener(new ItemListener() {
0136:                    public void itemStateChanged(ItemEvent event) {
0137:                        if (event.getStateChange() == ItemEvent.SELECTED) {
0138:                            processWsdlFileChange();
0139:                        } else if (event.getStateChange() == ItemEvent.DESELECTED) {
0140:                            cbxPartnerLinkType.setSelectedIndex(-1);
0141:                            cbxPartnerLinkType.setModel(emptyModel);
0142:                        }
0143:                    }
0144:                });
0145:                //
0146:                cbxPartnerLinkType.setRenderer(new DefaultListCellRenderer() {
0147:                    static final long serialVersionUID = 1L;
0148:
0149:                    @Override
0150:                    public Component getListCellRendererComponent(JList list,
0151:                            Object value, int index, boolean isSelected,
0152:                            boolean cellHasFocus) {
0153:                        super .getListCellRendererComponent(list, value, index,
0154:                                isSelected, cellHasFocus);
0155:                        if (value != null && value instanceof  PartnerLinkType) {
0156:                            PartnerLinkType plType = (PartnerLinkType) value;
0157:                            String text = plType.getName();
0158:                            setText(text);
0159:                        }
0160:                        return this ;
0161:                    }
0162:                });
0163:                //
0164:                cbxPartnerLinkType.addItemListener(new ItemListener() {
0165:                    public void itemStateChanged(ItemEvent event) {
0166:                        if (event.getStateChange() == ItemEvent.SELECTED) {
0167:                            reloadRoles();
0168:                            setRolesByDefault();
0169:                        } else if (event.getStateChange() == ItemEvent.DESELECTED) {
0170:                            getRolesList().clear();
0171:                            setRole(false, null);
0172:                            setRole(true, null);
0173:                        }
0174:                    }
0175:                });
0176:                //
0177:                btnSwapRoles.addActionListener(new ActionListener() {
0178:                    public void actionPerformed(ActionEvent e) {
0179:                        swapRoles();
0180:                    }
0181:                });
0182:                //
0183:                ActionListener updateStateListener = new ActionListener() {
0184:                    public void actionPerformed(ActionEvent event) {
0185:                        updateEnabledState();
0186:                        //
0187:                        getValidator().revalidate(true);
0188:                    }
0189:                };
0190:                //
0191:                rbtnUseExistingPLT.addActionListener(updateStateListener);
0192:                rbtnCreateNewPLT.addActionListener(updateStateListener);
0193:                chbxProcessWillImplement.addActionListener(updateStateListener);
0194:                chbxPartnerWillImpement.addActionListener(updateStateListener);
0195:                //
0196:                updateEnabledState();
0197:                //
0198:                myEditor.getValidStateManager(true).addValidStateListener(
0199:                        new ValidStateListener() {
0200:                            public void stateChanged(ValidStateManager source,
0201:                                    boolean isValid) {
0202:                                if (source.isValid()) {
0203:                                    lblErrorMessage.setText("");
0204:                                } else {
0205:                                    lblErrorMessage.setText(source
0206:                                            .getHtmlReasons());
0207:                                }
0208:                            }
0209:                        });
0210:                //
0211:                ActionListener timerListener = new ActionListener() {
0212:                    public void actionPerformed(ActionEvent e) {
0213:                        getValidator().revalidate(true);
0214:                    }
0215:                };
0216:                inputDelayTimer = new Timer(Constants.INPUT_VALIDATION_DELAY,
0217:                        timerListener);
0218:                inputDelayTimer.setCoalesce(true);
0219:                inputDelayTimer.setRepeats(false);
0220:                //
0221:                DocumentListener docListener = new DocumentListener() {
0222:                    public void changedUpdate(DocumentEvent e) {
0223:                        inputDelayTimer.restart();
0224:                    }
0225:
0226:                    public void insertUpdate(DocumentEvent e) {
0227:                        inputDelayTimer.restart();
0228:                    }
0229:
0230:                    public void removeUpdate(DocumentEvent e) {
0231:                        inputDelayTimer.restart();
0232:                    }
0233:                };
0234:                fldPartnerLinkName.getDocument().addDocumentListener(
0235:                        docListener);
0236:                fldPartnerRoleName.getDocument().addDocumentListener(
0237:                        docListener);
0238:                fldProcessRoleName.getDocument().addDocumentListener(
0239:                        docListener);
0240:                fldNewPLTName.getDocument().addDocumentListener(docListener);
0241:                //
0242:                FocusListener fl = new FocusAdapter() {
0243:                    @Override
0244:                    public void focusLost(FocusEvent e) {
0245:                        inputDelayTimer.stop();
0246:                        getValidator().revalidate(true);
0247:                    }
0248:                };
0249:                fldPartnerLinkName.addFocusListener(fl);
0250:                fldPartnerRoleName.addFocusListener(fl);
0251:                fldProcessRoleName.addFocusListener(fl);
0252:                fldNewPLTName.addFocusListener(fl);
0253:                //
0254:            }
0255:
0256:            private void updateEnabledState() {
0257:                if (cbxWsdlFile.getSelectedIndex() == -1) {
0258:                    rbtnUseExistingPLT.setEnabled(false);
0259:                    rbtnCreateNewPLT.setEnabled(false);
0260:                    //
0261:                    cbxPartnerLinkType.setEnabled(false);
0262:                    btnSwapRoles.setEnabled(false);
0263:                    //
0264:                    fldNewPLTName.setEnabled(false);
0265:                    chbxProcessWillImplement.setEnabled(false);
0266:                    fldProcessRoleName.setEnabled(false);
0267:                    cbxProcessPortType.setEnabled(false);
0268:                    chbxPartnerWillImpement.setEnabled(false);
0269:                    fldPartnerRoleName.setEnabled(false);
0270:                    cbxPartnerPortType.setEnabled(false);
0271:                    myWsdlWrapperName.setEnabled(false);
0272:                    myBrowseButton.setEnabled(false);
0273:                } else {
0274:                    rbtnUseExistingPLT.setEnabled(true);
0275:                    rbtnCreateNewPLT.setEnabled(true);
0276:                    //
0277:                    if (rbtnUseExistingPLT.isSelected()) {
0278:                        cbxPartnerLinkType.setEnabled(true);
0279:                        btnSwapRoles.setEnabled(true);
0280:                        //
0281:                        myWsdlWrapperName.setEnabled(false);
0282:                        myBrowseButton.setEnabled(false);
0283:                        fldNewPLTName.setEnabled(false);
0284:                        chbxProcessWillImplement.setEnabled(false);
0285:                        fldProcessRoleName.setEnabled(false);
0286:                        cbxProcessPortType.setEnabled(false);
0287:                        chbxPartnerWillImpement.setEnabled(false);
0288:                        fldPartnerRoleName.setEnabled(false);
0289:                        cbxPartnerPortType.setEnabled(false);
0290:                    } else {
0291:                        cbxPartnerLinkType.setEnabled(false);
0292:                        btnSwapRoles.setEnabled(false);
0293:                        //
0294:                        myWsdlWrapperName.setEnabled(true);
0295:                        myBrowseButton.setEnabled(true);
0296:                        fldNewPLTName.setEnabled(true);
0297:                        chbxProcessWillImplement.setEnabled(true);
0298:                        boolean processWill = chbxProcessWillImplement
0299:                                .isSelected();
0300:                        fldProcessRoleName.setEnabled(processWill);
0301:                        cbxProcessPortType.setEnabled(processWill);
0302:                        //
0303:                        chbxPartnerWillImpement.setEnabled(true);
0304:                        boolean partnerWill = chbxPartnerWillImpement
0305:                                .isSelected();
0306:                        fldPartnerRoleName.setEnabled(partnerWill);
0307:                        cbxPartnerPortType.setEnabled(partnerWill);
0308:                    }
0309:                }
0310:            }
0311:
0312:            @Override
0313:            public boolean initControls() {
0314:                try {
0315:                    // remove selection to guarantee that selection will always send event
0316:                    cbxWsdlFile.setSelectedIndex(-1);
0317:                    //
0318:                    // Indicates if the wsdl file was passed as a parameter
0319:                    // A wsdl file is usually passed when the DnD of Wsdl is performed
0320:                    boolean wsdlFileWasSpecified = false;
0321:                    //
0322:                    PartnerLink pLink = myEditor.getEditedObject();
0323:                    WSDLReference<PartnerLinkType> pltRef = pLink
0324:                            .getPartnerLinkType();
0325:                    PartnerLinkType plType = null;
0326:                    FileObject resultWsdlFile = null;
0327:                    WSDLModel wsdlModel = null;
0328:                    //
0329:                    if (pltRef != null) {
0330:                        plType = pltRef.get();
0331:                        if (plType != null) {
0332:                            resultWsdlFile = (FileObject) plType.getModel()
0333:                                    .getModelSource().getLookup().lookup(
0334:                                            FileObject.class);
0335:                        }
0336:                    }
0337:                    //
0338:                    if (resultWsdlFile == null) {
0339:                        Object cookieObj = pLink.getCookie(DnDHandler.class);
0340:                        if (cookieObj != null && cookieObj instanceof  WSDLModel) {
0341:                            wsdlModel = (WSDLModel) cookieObj;
0342:                            resultWsdlFile = (FileObject) wsdlModel
0343:                                    .getModelSource().getLookup().lookup(
0344:                                            FileObject.class);
0345:                            wsdlFileWasSpecified = true;
0346:                        } else if (cookieObj != null
0347:                                && cookieObj instanceof  FileObject) {
0348:                            resultWsdlFile = (FileObject) cookieObj;
0349:                            wsdlModel = PartnerLinkHelper
0350:                                    .getWSDLModel(resultWsdlFile);
0351:                            wsdlFileWasSpecified = true;
0352:                        }
0353:                    }
0354:                    //
0355:                    // Set selection to the WSDL file combo-box
0356:                    if (resultWsdlFile != null) {
0357:                        cbxWsdlFile.setSelectedItem(new ProjectWSDL(
0358:                                resultWsdlFile, getProject()));
0359:                    } else {
0360:                        if (cbxWsdlFile.getModel().getSize() > 0) {
0361:                            cbxWsdlFile.setSelectedIndex(0);
0362:                        }
0363:                    }
0364:                    // Set selection to the Parthner Link Type combo-box
0365:                    if (plType != null) {
0366:                        cbxPartnerLinkType.setSelectedItem(plType);
0367:                    } else {
0368:                        if (cbxPartnerLinkType.getModel().getSize() > 0) {
0369:                            cbxPartnerLinkType.setSelectedIndex(0);
0370:                        }
0371:                    }
0372:                    //
0373:                    if (myEditor.getEditingMode() == CustomNodeEditor.EditingMode.EDIT_INSTANCE) {
0374:                        //
0375:                        // Load roles from the Partner Link
0376:                        WSDLReference<Role> myRoleRef = pLink.getMyRole();
0377:                        setRoleByRef(true, myRoleRef);
0378:                        //
0379:                        WSDLReference<Role> partnerRoleRef = pLink
0380:                                .getPartnerRole();
0381:                        setRoleByRef(false, partnerRoleRef);
0382:                    }
0383:                    //
0384:                } catch (Exception ex) {
0385:                    ErrorManager.getDefault().notify(ex);
0386:                }
0387:                // vlv
0388:                setWrapper(getCurrentWsdlFile());
0389:                myWsdlWrapperName.addFocusListener(new FocusAdapter() {
0390:                    @Override
0391:                    public void focusLost(FocusEvent e) {
0392:                        getValidator().revalidate(true);
0393:                    }
0394:                });
0395:                //
0396:                updateEnabledState();
0397:                getValidator().revalidate(true);
0398:                return true;
0399:            }
0400:
0401:            private void processWsdlFileChange() {
0402:                reloadPartnerLinkTypes();
0403:                //
0404:                if (cbxPartnerLinkType.getModel().getSize() > 0) {
0405:                    cbxPartnerLinkType.setSelectedIndex(0);
0406:                } else {
0407:                    cbxPartnerLinkType.setSelectedIndex(-1);
0408:                }
0409:                //
0410:                reloadPortTypes();
0411:                //
0412:                setWrapper(getCurrentWsdlFile());
0413:                //
0414:                boolean isThereAnyPLT = false;
0415:
0416:                // vlv
0417:                WSDLModel wsdlModel = getCurrentWsdlModel();
0418:                List<PartnerLinkType> pltList = getPartnerLinkTypeRecursively(wsdlModel);
0419:                isThereAnyPLT = !pltList.isEmpty();
0420:                //
0421:                if (isThereAnyPLT) {
0422:                    rbtnUseExistingPLT.setSelected(true);
0423:                    setRolesByDefault();
0424:                } else {
0425:                    rbtnCreateNewPLT.setSelected(true);
0426:                    if (wsdlModel != null) {
0427:                        setDefaultParamsForNewPLT(wsdlModel);
0428:                    }
0429:                }
0430:                //
0431:                updateEnabledState();
0432:                getValidator().revalidate(true);
0433:            }
0434:
0435:            private void setDefaultParamsForNewPLT(final WSDLModel wsdlModel) {
0436:                // vlv
0437:                List<PortType> portTypeList = getPortTypeRecursively(wsdlModel);
0438:
0439:                if (portTypeList.isEmpty()) {
0440:                    return;
0441:                }
0442:                PortType portType = portTypeList.iterator().next();
0443:                String portTypeName = portType.getName();
0444:                //
0445:                // Try correct the name by cutting the unnecessary suffix
0446:                String suffixToRemove = "PortType"; // NOI18N
0447:                if (portTypeName != null
0448:                        && portTypeName.endsWith(suffixToRemove)) {
0449:                    int index = portTypeName.length() - suffixToRemove.length();
0450:                    String correctedName = portTypeName.substring(0, index);
0451:
0452:                    if (correctedName.length() != 0) {
0453:                        portTypeName = correctedName;
0454:                    }
0455:                }
0456:                //
0457:                chbxPartnerWillImpement.setSelected(true);
0458:                fldNewPLTName.setText(portTypeName + "LinkType"); // NOI18N
0459:                fldPartnerRoleName.setText(portTypeName + "Role"); // NOI18N
0460:                cbxPartnerPortType.setSelectedItem(portType);
0461:            }
0462:
0463:            private void reloadPartnerLinkTypes() {
0464:                List<PartnerLinkType> pltList = getPartnerLinkTypeRecursively(getCurrentWsdlModel());
0465:
0466:                if (pltList != null && pltList.size() > 0) {
0467:                    cbxPartnerLinkType.setModel(new DefaultComboBoxModel(
0468:                            pltList.toArray()));
0469:                    cbxPartnerLinkType.setSelectedIndex(-1);
0470:                }
0471:            }
0472:
0473:            private List<Role> getRolesList() {
0474:                if (rolesList == null) {
0475:                    rolesList = new ArrayList<Role>(2);
0476:                    reloadRoles();
0477:                }
0478:                return rolesList;
0479:            }
0480:
0481:            private void reloadRoles() {
0482:                PartnerLinkType plType = (PartnerLinkType) cbxPartnerLinkType
0483:                        .getSelectedItem();
0484:                getRolesList().clear();
0485:                //
0486:                if (plType != null) {
0487:                    //
0488:                    Role role;
0489:                    //
0490:                    role = plType.getRole1();
0491:                    if (role != null) {
0492:                        rolesList.add(role);
0493:                    }
0494:                    //
0495:                    role = plType.getRole2();
0496:                    if (role != null) {
0497:                        rolesList.add(role);
0498:                    }
0499:                }
0500:            }
0501:
0502:            private void setRolesByDefault() {
0503:                Role firstRole = null;
0504:                Role secondRole = null;
0505:                //
0506:                Iterator<Role> itr = getRolesList().iterator();
0507:                if (itr.hasNext()) {
0508:                    firstRole = itr.next();
0509:                }
0510:                if (itr.hasNext()) {
0511:                    secondRole = itr.next();
0512:                }
0513:                //
0514:                setRole(true, firstRole);
0515:                setRole(false, secondRole);
0516:            }
0517:
0518:            private void setRoleByRef(boolean isMyRole,
0519:                    WSDLReference<Role> newValue) {
0520:                if (newValue == null) {
0521:                    setRole(isMyRole, null);
0522:                    return;
0523:                }
0524:                //
0525:                Role role = newValue.get();
0526:                if (role == null) {
0527:                    String localRoleName = newValue.getRefString();
0528:                    if (isMyRole) {
0529:                        if (localRoleName == null
0530:                                || localRoleName.length() == 0) {
0531:                            fldMyRole.setText(ROLE_NA);
0532:                        } else {
0533:                            fldMyRole.setText(localRoleName);
0534:                        }
0535:                    } else {
0536:                        if (localRoleName == null
0537:                                || localRoleName.length() == 0) {
0538:                            fldPartnerRole.setText(ROLE_NA);
0539:                        } else {
0540:                            fldPartnerRole.setText(localRoleName);
0541:                        }
0542:                    }
0543:                } else {
0544:                    setRole(isMyRole, role);
0545:                }
0546:            }
0547:
0548:            private void setRole(boolean isMyRole, Role newValue) {
0549:                if (isMyRole) {
0550:                    myRole = newValue;
0551:                    if (newValue == null) {
0552:                        fldMyRole.setText(ROLE_NA);
0553:                    } else {
0554:                        fldMyRole.setText(newValue.getName());
0555:                    }
0556:                } else {
0557:                    partnerRole = newValue;
0558:                    if (newValue == null) {
0559:                        fldPartnerRole.setText(ROLE_NA);
0560:                    } else {
0561:                        fldPartnerRole.setText(newValue.getName());
0562:                    }
0563:                }
0564:            }
0565:
0566:            private void swapRoles() {
0567:                Role tempRole = myRole;
0568:                String tempRoleName = fldMyRole.getText();
0569:                //
0570:                myRole = partnerRole;
0571:                String partnerRoleName = fldPartnerRole.getText();
0572:                fldMyRole.setText(partnerRoleName);
0573:                //
0574:                partnerRole = tempRole;
0575:                fldPartnerRole.setText(tempRoleName);
0576:            }
0577:
0578:            private void reloadPortTypes() {
0579:                List<PortType> portTypeList = getPortTypeRecursively(getCurrentWsdlModel());
0580:
0581:                if (portTypeList != null && portTypeList.size() > 0) {
0582:                    cbxProcessPortType.setModel(new DefaultComboBoxModel(
0583:                            portTypeList.toArray()));
0584:                    cbxPartnerPortType.setModel(new DefaultComboBoxModel(
0585:                            portTypeList.toArray()));
0586:                }
0587:                getValidator().revalidate(true);
0588:            }
0589:
0590:            @Override
0591:            public boolean applyNewValues() {
0592:                try {
0593:                    PartnerLink pLink = myEditor.getEditedObject();
0594:                    PartnerLinkType plType = null;
0595:                    //
0596:                    if (rbtnUseExistingPLT.isSelected()) {
0597:                        plType = tuneForExistingPLT(pLink);
0598:                    } else {
0599:                        plType = tuneFromNewPLT(pLink);
0600:                    }
0601:                    //
0602:                    if (plType != null) {
0603:                        new ImportRegistrationHelper(pLink.getBpelModel())
0604:                                .addImport(plType.getModel());
0605:                    }
0606:                } catch (Exception ex) {
0607:                    ErrorManager.getDefault().notify(ex);
0608:                }
0609:                return true;
0610:            }
0611:
0612:            // vlv
0613:            private WSDLModel getCurrentWsdlModel(boolean isWsdlWrapperSet,
0614:                    boolean isCreate) {
0615:                FileObject currentFile = getCurrentWsdlFile();
0616:                WSDLModel currentModel = PartnerLinkHelper
0617:                        .getWSDLModel(currentFile);
0618:
0619:                if (isWsdlWrapperSet) {
0620:                    WsdlWrapper wsdlWrapper = new WsdlWrapper(ResolverUtility
0621:                            .getProjectSource(myEditor.getLookup()),
0622:                            myWsdlWrapperName.getText(), isCreate);
0623:                    WSDLModel wrapperModel = wsdlWrapper.getModel();
0624:
0625:                    if (wrapperModel == null) {
0626:                        return null;
0627:                    }
0628:                    FileObject wrapperFile = wsdlWrapper.getFile();
0629:                    addImport(wrapperModel, wrapperFile, currentModel,
0630:                            currentFile);
0631:                    return wrapperModel;
0632:                }
0633:                return currentModel;
0634:            }
0635:
0636:            private FileObject getSource() {
0637:                BpelModel model = myEditor.getLookup().lookup(BpelModel.class);
0638:
0639:                return org.netbeans.modules.bpel.editors.api.utils.Util
0640:                        .getFileObjectByModel(model);
0641:            }
0642:
0643:            // vlv
0644:            private void addImport(WSDLModel model, FileObject file,
0645:                    WSDLModel importedModel, FileObject importedFile) {
0646:                if (file.equals(importedFile)) {
0647:                    return;
0648:                }
0649:                Definitions definitions = model.getDefinitions();
0650:                Import inport = model.getFactory().createImport();
0651:                inport.setLocation(getRelativePath(file, importedFile));
0652:                inport.setNamespace(importedModel.getDefinitions()
0653:                        .getTargetNamespace());
0654:
0655:                if (containsImport(model, inport)) {
0656:                    return;
0657:                }
0658:                model.startTransaction();
0659:                definitions.addImport(inport);
0660:                model.endTransaction();
0661:            }
0662:
0663:            // vlv
0664:            private boolean containsImport(WSDLModel model, Import inport) {
0665:                Definitions definitions = model.getDefinitions();
0666:                Iterator<Import> imports = definitions.getImports().iterator();
0667:
0668:                while (imports.hasNext()) {
0669:                    Import impord = imports.next();
0670:
0671:                    if (equals(impord, inport)) {
0672:                        return true;
0673:                    }
0674:                }
0675:                return false;
0676:            }
0677:
0678:            // vlv
0679:            private boolean equals(Import import1, Import import2) {
0680:                return import1.getLocation().equals(import2.getLocation())
0681:                        && import1.getNamespace()
0682:                                .equals(import2.getNamespace());
0683:            }
0684:
0685:            // vlv
0686:            private String getRelativePath(FileObject file1, FileObject file2) {
0687:                StringTokenizer stk1 = new StringTokenizer(file1.getPath(),
0688:                        SLASH);
0689:                StringTokenizer stk2 = new StringTokenizer(file2.getPath(),
0690:                        SLASH);
0691:                String relative = ""; // NOI18N
0692:
0693:                while (stk1.hasMoreTokens() && stk2.hasMoreTokens()) {
0694:                    relative = stk2.nextToken();
0695:
0696:                    if (!stk1.nextToken().equals(relative)) {
0697:                        break;
0698:                    }
0699:                }
0700:                while (stk1.hasMoreTokens()) {
0701:                    relative = "../".concat(relative); // NOI18N
0702:                    stk1.nextToken();
0703:                }
0704:                while (stk2.hasMoreTokens()) {
0705:                    relative = relative.concat(SLASH); // NOI18N
0706:                    relative = relative.concat(stk2.nextToken());
0707:                }
0708:                return relative;
0709:            }
0710:
0711:            /**
0712:             * Returns the current WSDL model which is selected in the combo-box.
0713:             * Method can return null!
0714:             */
0715:            private WSDLModel getCurrentWsdlModel() {
0716:                return getCurrentWsdlModel(false, false);
0717:            }
0718:
0719:            private FileObject getCurrentWsdlFile() {
0720:                Object object = cbxWsdlFile.getSelectedItem();
0721:
0722:                if (object == null) {
0723:                    return null;
0724:                }
0725:                return ((ProjectWSDL) object).getFile();
0726:            }
0727:
0728:            private PartnerLinkType tuneFromNewPLT(final PartnerLink pLink) {
0729:                PartnerLinkType plType = null;
0730:                Role newMyRole = null;
0731:                Role newPartnerRole = null;
0732:                //
0733:                // Create a New Partner Link Type in the WSDL model.
0734:                // It has to be done first because of the PLT will not be
0735:                // visible until end of WSDL transaction.
0736:                WSDLModel wsdlModel = getCurrentWsdlModel(true, true);
0737:                //
0738:                if (wsdlModel != null) {
0739:                    wsdlModel.startTransaction();
0740:                    try {
0741:                        boolean isFirstRoleOccupied = false;
0742:                        BPELComponentFactory factory = new BPELComponentFactory(
0743:                                wsdlModel);
0744:                        plType = factory.createPartnerLinkType(wsdlModel
0745:                                .getDefinitions());
0746:                        //
0747:                        String newPLTypeName = fldNewPLTName.getText();
0748:                        plType.setName(newPLTypeName);
0749:                        //
0750:                        wsdlModel.getDefinitions().addExtensibilityElement(
0751:                                plType);
0752:                        //
0753:                        if (chbxProcessWillImplement.isSelected()) {
0754:                            newMyRole = factory.createRole(wsdlModel
0755:                                    .getDefinitions());
0756:                            //
0757:                            String myRoleName = fldProcessRoleName.getText();
0758:                            newMyRole.setName(myRoleName);
0759:                            //
0760:                            plType.setRole1(newMyRole);
0761:                            isFirstRoleOccupied = true;
0762:                            //
0763:                            PortType processPortType = (PortType) cbxProcessPortType
0764:                                    .getSelectedItem();
0765:                            NamedComponentReference<PortType> processPortTypeRef = newMyRole
0766:                                    .createReferenceTo(processPortType,
0767:                                            PortType.class);
0768:                            newMyRole.setPortType(processPortTypeRef);
0769:                        }
0770:                        //
0771:                        if (chbxPartnerWillImpement.isSelected()) {
0772:                            newPartnerRole = factory.createRole(wsdlModel
0773:                                    .getDefinitions());
0774:                            //
0775:                            String partnerRoleName = fldPartnerRoleName
0776:                                    .getText();
0777:                            newPartnerRole.setName(partnerRoleName);
0778:                            //
0779:                            if (isFirstRoleOccupied) {
0780:                                plType.setRole2(newPartnerRole);
0781:                            } else {
0782:                                plType.setRole1(newPartnerRole);
0783:                            }
0784:                            //
0785:                            PortType partnerPortType = (PortType) cbxPartnerPortType
0786:                                    .getSelectedItem();
0787:                            NamedComponentReference<PortType> partnerPortTypeRef = newPartnerRole
0788:                                    .createReferenceTo(partnerPortType,
0789:                                            PortType.class);
0790:                            newPartnerRole.setPortType(partnerPortTypeRef);
0791:                        }
0792:                    } finally {
0793:                        wsdlModel.endTransaction();
0794:                    }
0795:                    //Flush changes from WSDL model to file
0796:
0797:                    PartnerLinkHelper.saveModel(wsdlModel);
0798:
0799:                    //
0800:                    // Put changes to the BPEL model
0801:                    if (plType != null) {
0802:                        pLink.setPartnerLinkType(pLink.createWSDLReference(
0803:                                plType, PartnerLinkType.class));
0804:                        //
0805:                        if (newMyRole != null) {
0806:                            WSDLReference<Role> newMyRoleRef = pLink
0807:                                    .createWSDLReference(newMyRole, Role.class);
0808:                            pLink.setMyRole(newMyRoleRef);
0809:                        } else {
0810:                            pLink.removeMyRole();
0811:                        }
0812:                        //
0813:                        if (newPartnerRole != null) {
0814:                            WSDLReference<Role> newPatnerRoleRef = pLink
0815:                                    .createWSDLReference(newPartnerRole,
0816:                                            Role.class);
0817:                            pLink.setPartnerRole(newPatnerRoleRef);
0818:                        } else {
0819:                            pLink.removePartnerRole();
0820:                        }
0821:                    }
0822:                }
0823:                return plType;
0824:            }
0825:
0826:            private PartnerLinkType tuneForExistingPLT(final PartnerLink pLink) {
0827:                PartnerLinkType plType = (PartnerLinkType) cbxPartnerLinkType
0828:                        .getSelectedItem();
0829:                //
0830:                if (plType != null) {
0831:                    pLink.setPartnerLinkType(pLink.createWSDLReference(plType,
0832:                            PartnerLinkType.class));
0833:                }
0834:                //
0835:                if (myRole == null) {
0836:                    pLink.removeMyRole();
0837:                } else {
0838:                    WSDLReference<Role> roleRef = pLink.createWSDLReference(
0839:                            myRole, Role.class);
0840:                    pLink.setMyRole(roleRef);
0841:                }
0842:                //
0843:                if (partnerRole == null) {
0844:                    pLink.removePartnerRole();
0845:                } else {
0846:                    WSDLReference<Role> roleRef = pLink.createWSDLReference(
0847:                            partnerRole, Role.class);
0848:                    pLink.setPartnerRole(roleRef);
0849:                }
0850:                //
0851:                return plType;
0852:            }
0853:
0854:            public DefaultValidator getValidator() {
0855:                if (myValidator == null) {
0856:                    myValidator = new DefaultValidator(myEditor,
0857:                            ErrorMessagesBundle.class) {
0858:
0859:                        public void doFastValidation() {
0860:                            // vlv
0861:                            WsdlWrapper wrapper = new WsdlWrapper(
0862:                                    ResolverUtility.getProjectSource(myEditor
0863:                                            .getLookup()), myWsdlWrapperName
0864:                                            .getText(), false);
0865:
0866:                            FileObject file = wrapper.getFile();
0867:
0868:                            if (file != null && !file.canWrite()) {
0869:                                addReasonKey(Severity.ERROR,
0870:                                        "ERR_FILE_IS_READ_ONLY",
0871:                                        myWsdlWrapperName.getText()); //NOI18N
0872:                            }
0873:
0874:                            String plName = fldPartnerLinkName.getText();
0875:                            //
0876:                            if (plName == null || plName.length() == 0) {
0877:                                addReasonKey(Severity.ERROR, "ERR_NAME_EMPTY"); //NOI18N
0878:                            }
0879:                            //
0880:                            if (cbxWsdlFile.getSelectedIndex() == -1) {
0881:                                addReasonKey(Severity.ERROR,
0882:                                        "ERR_WSDL_FILE_NOT_SPECIFIED"); //NOI18N
0883:                            }
0884:                            //
0885:                            if (rbtnUseExistingPLT.isSelected()) {
0886:                                if (cbxPartnerLinkType.getSelectedIndex() == -1) {
0887:                                    addReasonKey(Severity.ERROR,
0888:                                            "ERR_PL_TYPE_NOT_SPECIFIED"); //NOI18N
0889:                                }
0890:                                //
0891:                                if (myRole == null && partnerRole == null) {
0892:                                    addReasonKey(Severity.ERROR,
0893:                                            "ERR_PL_TYPE_WITHOUT_ROLES"); //NOI18N
0894:                                }
0895:                            } else {
0896:                                String pltName = fldNewPLTName.getText();
0897:                                if (pltName == null || pltName.length() == 0) {
0898:                                    addReasonKey(Severity.ERROR,
0899:                                            "ERR_PLT_NAME_EMPTY"); //NOI18N
0900:                                } else {
0901:                                    boolean isCorrectPLTName = Util
0902:                                            .isNCName(pltName);
0903:                                    if (!isCorrectPLTName) {
0904:                                        addReasonKey(Severity.ERROR,
0905:                                                "ERR_PLT_NAME_INVALID"); //NOI18N
0906:                                    } else {
0907:                                        // vlv
0908:                                        WSDLModel wsdlModel = getCurrentWsdlModel(
0909:                                                true, false);
0910:
0911:                                        if (wsdlModel != null) {
0912:                                            isCorrectPLTName = Util
0913:                                                    .isUniquePartnerLinkTypeName(
0914:                                                            wsdlModel, pltName);
0915:                                            if (!isCorrectPLTName) {
0916:                                                addReasonKey(Severity.ERROR,
0917:                                                        "ERR_PLT_NAME_NOT_UNIQUE"); //NOI18N
0918:                                            }
0919:                                        }
0920:                                    }
0921:                                }
0922:                                //
0923:                                if (!chbxProcessWillImplement.isSelected()
0924:                                        && !chbxPartnerWillImpement
0925:                                                .isSelected()) {
0926:                                    addReasonKey(Severity.ERROR,
0927:                                            "ERR_NEW_PLT_ROLES_NOT_SPECIFIED"); //NOI18N
0928:                                }
0929:                                //
0930:                                if (chbxProcessWillImplement.isSelected()) {
0931:                                    String myRoleName = fldProcessRoleName
0932:                                            .getText();
0933:                                    if (myRoleName == null
0934:                                            || myRoleName.length() == 0) {
0935:                                        addReasonKey(Severity.ERROR,
0936:                                                "ERR_PLT_MY_ROLE_NAME_EMPTY"); //NOI18N
0937:                                    } else {
0938:                                        boolean isCorrectMyRoleName = Util
0939:                                                .isNCName(myRoleName);
0940:                                        if (!isCorrectMyRoleName) {
0941:                                            addReasonKey(Severity.ERROR,
0942:                                                    "ERR_PLT_MY_ROLE_NAME_INVALID"); //NOI18N
0943:                                        }
0944:                                    }
0945:                                    //
0946:                                    int processPortTypeIndex = cbxProcessPortType
0947:                                            .getSelectedIndex();
0948:                                    if (processPortTypeIndex == -1) {
0949:                                        addReasonKey(Severity.ERROR,
0950:                                                "ERR_PLT_MY_ROLE_PORT_TYPE_EMPTY"); //NOI18N
0951:                                    }
0952:                                }
0953:                                //
0954:                                if (chbxPartnerWillImpement.isSelected()) {
0955:                                    String myRoleName = fldPartnerRoleName
0956:                                            .getText();
0957:                                    if (myRoleName == null
0958:                                            || myRoleName.length() == 0) {
0959:                                        addReasonKey(Severity.ERROR,
0960:                                                "ERR_PLT_PARTNER_ROLE_NAME_EMPTY"); //NOI18N
0961:                                    } else {
0962:                                        boolean isCorrectPartnerRoleName = Util
0963:                                                .isNCName(myRoleName);
0964:                                        if (!isCorrectPartnerRoleName) {
0965:                                            addReasonKey(Severity.ERROR,
0966:                                                    "ERR_PLT_PARTNER_ROLE_NAME_INVALID"); //NOI18N
0967:                                        }
0968:                                    }
0969:                                    //
0970:                                    int partnerPortTypeIndex = cbxPartnerPortType
0971:                                            .getSelectedIndex();
0972:                                    if (partnerPortTypeIndex == -1) {
0973:                                        addReasonKey(Severity.ERROR,
0974:                                                "ERR_PLT_PARTNER_ROLE_PORT_TYPE_EMPTY"); //NOI18N
0975:                                    }
0976:                                }
0977:                                //
0978:                                if (chbxPartnerWillImpement.isSelected()
0979:                                        && chbxProcessWillImplement
0980:                                                .isSelected()) {
0981:                                    String myRoleName = fldProcessRoleName
0982:                                            .getText();
0983:                                    String partnerRoleName = fldPartnerRoleName
0984:                                            .getText();
0985:                                    if (myRoleName != null
0986:                                            && myRoleName.length() > 0
0987:                                            && myRoleName
0988:                                                    .equals(partnerRoleName)) {
0989:                                        addReasonKey(Severity.ERROR,
0990:                                                "ERR_PLT_ROLES_NOT_UNIQUE"); //NOI18N
0991:                                    }
0992:                                }
0993:                            }
0994:                        }
0995:                    };
0996:                }
0997:                return myValidator;
0998:            }
0999:
1000:            public HelpCtx getHelpCtx() {
1001:                String helpId = ((BpelNode) myEditor.getEditedNode())
1002:                        .getNodeType().getHelpId();
1003:                return new HelpCtx(helpId);
1004:            }
1005:
1006:            private static class WsdlFileRenderer extends
1007:                    DefaultListCellRenderer {
1008:                static final long serialVersionUID = 1L;
1009:
1010:                public WsdlFileRenderer() {
1011:                    super ();
1012:                    setIcon(new ImageIcon(NodeType.WSDL_FILE.getImage()));
1013:                }
1014:
1015:                @Override
1016:                public Component getListCellRendererComponent(JList list,
1017:                        Object value, int index, boolean isSelected,
1018:                        boolean cellHasFocus) {
1019:                    super .getListCellRendererComponent(list, value, index,
1020:                            isSelected, cellHasFocus);
1021:
1022:                    if (value instanceof  ProjectWSDL) {
1023:                        setText(((ProjectWSDL) value).getName());
1024:                    }
1025:                    return this ;
1026:                }
1027:            }
1028:
1029:            private class PortTypeRenderer extends DefaultListCellRenderer {
1030:                static final long serialVersionUID = 1L;
1031:
1032:                @Override
1033:                public Component getListCellRendererComponent(JList list,
1034:                        Object value, int index, boolean isSelected,
1035:                        boolean cellHasFocus) {
1036:                    super .getListCellRendererComponent(list, value, index,
1037:                            isSelected, cellHasFocus);
1038:                    if (value != null && value instanceof  PortType) {
1039:                        String portTypeName = ((PortType) value).getName();
1040:                        setText(portTypeName);
1041:                        // setBorder(BorderFactory.createEmptyBorder(2, 5, 2, 2));
1042:                    }
1043:                    return this ;
1044:                }
1045:            }
1046:
1047:            /** This method is called from within the constructor to
1048:             * initialize the form.
1049:             * WARNING: Do NOT modify this code. The content of this method is
1050:             * always regenerated by the Form Editor.
1051:             */
1052:            // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
1053:            private void initComponents() {
1054:
1055:                btngrPLT = new javax.swing.ButtonGroup();
1056:                lblName = new javax.swing.JLabel();
1057:                fldPartnerLinkName = new javax.swing.JTextField();
1058:                lblWsdlFile = new javax.swing.JLabel();
1059:                lblPartnerLinkType = new javax.swing.JLabel();
1060:                lblMyRole = new javax.swing.JLabel();
1061:                lblPartnerRole = new javax.swing.JLabel();
1062:                cbxPartnerLinkType = new javax.swing.JComboBox();
1063:                cbxWsdlFile = new javax.swing.JComboBox();
1064:                lblErrorMessage = new javax.swing.JLabel();
1065:                rbtnUseExistingPLT = new javax.swing.JRadioButton();
1066:                rbtnCreateNewPLT = new javax.swing.JRadioButton();
1067:                lblNewPLTypeName = new javax.swing.JLabel();
1068:                chbxProcessWillImplement = new javax.swing.JCheckBox();
1069:                lblProcessRoleName = new javax.swing.JLabel();
1070:                lblProcessPortType = new javax.swing.JLabel();
1071:                chbxPartnerWillImpement = new javax.swing.JCheckBox();
1072:                lblPartnerRoleName = new javax.swing.JLabel();
1073:                lblPartnerPortType = new javax.swing.JLabel();
1074:                fldNewPLTName = new javax.swing.JTextField();
1075:                fldProcessRoleName = new javax.swing.JTextField();
1076:                cbxProcessPortType = new javax.swing.JComboBox();
1077:                fldPartnerRoleName = new javax.swing.JTextField();
1078:                cbxPartnerPortType = new javax.swing.JComboBox();
1079:                btnSwapRoles = new javax.swing.JButton();
1080:                fldMyRole = new javax.swing.JTextField();
1081:                fldPartnerRole = new javax.swing.JTextField();
1082:                lblNewPLTypeName1 = new javax.swing.JLabel();
1083:                myWsdlWrapperName = new javax.swing.JTextField();
1084:                myBrowseButton = new javax.swing.JButton();
1085:
1086:                lblName.setLabelFor(fldPartnerLinkName);
1087:                lblName.setText(org.openide.util.NbBundle.getMessage(
1088:                        FormBundle.class, "LBL_Name")); // NOI18N
1089:
1090:                fldPartnerLinkName.setColumns(30);
1091:
1092:                lblWsdlFile.setLabelFor(cbxWsdlFile);
1093:                lblWsdlFile.setText(org.openide.util.NbBundle.getMessage(
1094:                        FormBundle.class, "LBL_WsdlFile")); // NOI18N
1095:
1096:                lblPartnerLinkType.setLabelFor(cbxPartnerLinkType);
1097:                lblPartnerLinkType.setText(org.openide.util.NbBundle
1098:                        .getMessage(FormBundle.class, "LBL_PartnerLinkType")); // NOI18N
1099:
1100:                lblMyRole.setLabelFor(fldMyRole);
1101:                lblMyRole.setText(org.openide.util.NbBundle.getMessage(
1102:                        FormBundle.class, "LBL_MyRole")); // NOI18N
1103:
1104:                lblPartnerRole.setLabelFor(fldPartnerRole);
1105:                lblPartnerRole.setText(org.openide.util.NbBundle.getMessage(
1106:                        FormBundle.class, "LBL_PartnerRole")); // NOI18N
1107:
1108:                lblErrorMessage.setForeground(new java.awt.Color(255, 0, 0));
1109:
1110:                btngrPLT.add(rbtnUseExistingPLT);
1111:                rbtnUseExistingPLT.setSelected(true);
1112:                rbtnUseExistingPLT.setText(org.openide.util.NbBundle
1113:                        .getMessage(FormBundle.class, "RBTN_UseExisingPLType")); // NOI18N
1114:                rbtnUseExistingPLT.setBorder(javax.swing.BorderFactory
1115:                        .createEmptyBorder(0, 0, 0, 0));
1116:                rbtnUseExistingPLT.setMargin(new java.awt.Insets(0, 0, 0, 0));
1117:
1118:                btngrPLT.add(rbtnCreateNewPLT);
1119:                rbtnCreateNewPLT.setText(org.openide.util.NbBundle.getMessage(
1120:                        FormBundle.class, "RBTN_CreateNewPLType")); // NOI18N
1121:                rbtnCreateNewPLT.setBorder(javax.swing.BorderFactory
1122:                        .createEmptyBorder(0, 0, 0, 0));
1123:                rbtnCreateNewPLT.setMargin(new java.awt.Insets(0, 0, 0, 0));
1124:
1125:                lblNewPLTypeName.setLabelFor(fldNewPLTName);
1126:                lblNewPLTypeName.setText(org.openide.util.NbBundle.getMessage(
1127:                        FormBundle.class, "LBL_NewPLTypeName")); // NOI18N
1128:
1129:                chbxProcessWillImplement.setText(org.openide.util.NbBundle
1130:                        .getMessage(FormBundle.class,
1131:                                "CHBX_ProcessWillImpement")); // NOI18N
1132:                chbxProcessWillImplement.setBorder(javax.swing.BorderFactory
1133:                        .createEmptyBorder(0, 0, 0, 0));
1134:                chbxProcessWillImplement.setMargin(new java.awt.Insets(0, 0, 0,
1135:                        0));
1136:
1137:                lblProcessRoleName.setLabelFor(fldProcessRoleName);
1138:                lblProcessRoleName.setText(org.openide.util.NbBundle
1139:                        .getMessage(FormBundle.class, "LBL_ProcessRoleName")); // NOI18N
1140:
1141:                lblProcessPortType.setLabelFor(cbxProcessPortType);
1142:                lblProcessPortType.setText(org.openide.util.NbBundle
1143:                        .getMessage(FormBundle.class, "LBL_ProcessProtType")); // NOI18N
1144:
1145:                chbxPartnerWillImpement.setText(org.openide.util.NbBundle
1146:                        .getMessage(FormBundle.class,
1147:                                "CHBX_PartnerWillImplement")); // NOI18N
1148:                chbxPartnerWillImpement.setBorder(javax.swing.BorderFactory
1149:                        .createEmptyBorder(0, 0, 0, 0));
1150:                chbxPartnerWillImpement.setMargin(new java.awt.Insets(0, 0, 0,
1151:                        0));
1152:
1153:                lblPartnerRoleName.setLabelFor(fldPartnerRoleName);
1154:                lblPartnerRoleName.setText(org.openide.util.NbBundle
1155:                        .getMessage(FormBundle.class, "LBL_PartnerRoleName")); // NOI18N
1156:
1157:                lblPartnerPortType.setLabelFor(cbxPartnerPortType);
1158:                lblPartnerPortType.setText(org.openide.util.NbBundle
1159:                        .getMessage(FormBundle.class, "LBL_PartnerPortType")); // NOI18N
1160:
1161:                btnSwapRoles.setText(org.openide.util.NbBundle.getMessage(
1162:                        FormBundle.class, "BTN_SwapRoles")); // NOI18N
1163:
1164:                fldMyRole.setEditable(false);
1165:
1166:                fldPartnerRole.setEditable(false);
1167:
1168:                lblNewPLTypeName1.setLabelFor(myWsdlWrapperName);
1169:                lblNewPLTypeName1.setText("Create in &File:");
1170:
1171:                myBrowseButton.setText("&Browse");
1172:                myBrowseButton
1173:                        .addActionListener(new java.awt.event.ActionListener() {
1174:                            public void actionPerformed(
1175:                                    java.awt.event.ActionEvent evt) {
1176:                                browseWsdlFile(evt);
1177:                            }
1178:                        });
1179:
1180:                org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(
1181:                        this );
1182:                this .setLayout(layout);
1183:                layout
1184:                        .setHorizontalGroup(layout
1185:                                .createParallelGroup(
1186:                                        org.jdesktop.layout.GroupLayout.LEADING)
1187:                                .add(
1188:                                        layout
1189:                                                .createSequentialGroup()
1190:                                                .addContainerGap()
1191:                                                .add(
1192:                                                        layout
1193:                                                                .createParallelGroup(
1194:                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1195:                                                                .add(
1196:                                                                        layout
1197:                                                                                .createSequentialGroup()
1198:                                                                                .add(
1199:                                                                                        17,
1200:                                                                                        17,
1201:                                                                                        17)
1202:                                                                                .add(
1203:                                                                                        lblNewPLTypeName1)
1204:                                                                                .addPreferredGap(
1205:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1206:                                                                                .add(
1207:                                                                                        myWsdlWrapperName,
1208:                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1209:                                                                                        373,
1210:                                                                                        Short.MAX_VALUE)
1211:                                                                                .addPreferredGap(
1212:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1213:                                                                                .add(
1214:                                                                                        myBrowseButton))
1215:                                                                .add(
1216:                                                                        lblErrorMessage,
1217:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1218:                                                                        577,
1219:                                                                        Short.MAX_VALUE)
1220:                                                                .add(
1221:                                                                        rbtnUseExistingPLT)
1222:                                                                .add(
1223:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
1224:                                                                        layout
1225:                                                                                .createSequentialGroup()
1226:                                                                                .add(
1227:                                                                                        layout
1228:                                                                                                .createParallelGroup(
1229:                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING)
1230:                                                                                                .add(
1231:                                                                                                        layout
1232:                                                                                                                .createSequentialGroup()
1233:                                                                                                                .add(
1234:                                                                                                                        layout
1235:                                                                                                                                .createParallelGroup(
1236:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1237:                                                                                                                                .add(
1238:                                                                                                                                        lblName)
1239:                                                                                                                                .add(
1240:                                                                                                                                        lblWsdlFile))
1241:                                                                                                                .addPreferredGap(
1242:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1243:                                                                                                                .add(
1244:                                                                                                                        layout
1245:                                                                                                                                .createParallelGroup(
1246:                                                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING)
1247:                                                                                                                                .add(
1248:                                                                                                                                        fldPartnerLinkName,
1249:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1250:                                                                                                                                        500,
1251:                                                                                                                                        Short.MAX_VALUE)
1252:                                                                                                                                .add(
1253:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING,
1254:                                                                                                                                        cbxWsdlFile,
1255:                                                                                                                                        0,
1256:                                                                                                                                        500,
1257:                                                                                                                                        Short.MAX_VALUE)))
1258:                                                                                                .add(
1259:                                                                                                        layout
1260:                                                                                                                .createSequentialGroup()
1261:                                                                                                                .add(
1262:                                                                                                                        17,
1263:                                                                                                                        17,
1264:                                                                                                                        17)
1265:                                                                                                                .add(
1266:                                                                                                                        layout
1267:                                                                                                                                .createParallelGroup(
1268:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1269:                                                                                                                                .add(
1270:                                                                                                                                        lblMyRole)
1271:                                                                                                                                .add(
1272:                                                                                                                                        lblPartnerRole)
1273:                                                                                                                                .add(
1274:                                                                                                                                        lblPartnerLinkType))
1275:                                                                                                                .add(
1276:                                                                                                                        0,
1277:                                                                                                                        0,
1278:                                                                                                                        0)
1279:                                                                                                                .add(
1280:                                                                                                                        layout
1281:                                                                                                                                .createParallelGroup(
1282:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1283:                                                                                                                                .add(
1284:                                                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
1285:                                                                                                                                        cbxPartnerLinkType,
1286:                                                                                                                                        0,
1287:                                                                                                                                        446,
1288:                                                                                                                                        Short.MAX_VALUE)
1289:                                                                                                                                .add(
1290:                                                                                                                                        layout
1291:                                                                                                                                                .createSequentialGroup()
1292:                                                                                                                                                .add(
1293:                                                                                                                                                        btnSwapRoles)
1294:                                                                                                                                                .addPreferredGap(
1295:                                                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED,
1296:                                                                                                                                                        335,
1297:                                                                                                                                                        Short.MAX_VALUE))
1298:                                                                                                                                .add(
1299:                                                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
1300:                                                                                                                                        fldMyRole,
1301:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1302:                                                                                                                                        446,
1303:                                                                                                                                        Short.MAX_VALUE)
1304:                                                                                                                                .add(
1305:                                                                                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
1306:                                                                                                                                        fldPartnerRole,
1307:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1308:                                                                                                                                        446,
1309:                                                                                                                                        Short.MAX_VALUE))))
1310:                                                                                .addPreferredGap(
1311:                                                                                        org.jdesktop.layout.LayoutStyle.RELATED))
1312:                                                                .add(
1313:                                                                        rbtnCreateNewPLT)
1314:                                                                .add(
1315:                                                                        org.jdesktop.layout.GroupLayout.TRAILING,
1316:                                                                        layout
1317:                                                                                .createSequentialGroup()
1318:                                                                                .add(
1319:                                                                                        17,
1320:                                                                                        17,
1321:                                                                                        17)
1322:                                                                                .add(
1323:                                                                                        layout
1324:                                                                                                .createParallelGroup(
1325:                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1326:                                                                                                .add(
1327:                                                                                                        chbxProcessWillImplement)
1328:                                                                                                .add(
1329:                                                                                                        layout
1330:                                                                                                                .createSequentialGroup()
1331:                                                                                                                .add(
1332:                                                                                                                        17,
1333:                                                                                                                        17,
1334:                                                                                                                        17)
1335:                                                                                                                .add(
1336:                                                                                                                        layout
1337:                                                                                                                                .createParallelGroup(
1338:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1339:                                                                                                                                .add(
1340:                                                                                                                                        lblProcessRoleName)
1341:                                                                                                                                .add(
1342:                                                                                                                                        lblProcessPortType))
1343:                                                                                                                .addPreferredGap(
1344:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1345:                                                                                                                .add(
1346:                                                                                                                        layout
1347:                                                                                                                                .createParallelGroup(
1348:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1349:                                                                                                                                .add(
1350:                                                                                                                                        cbxProcessPortType,
1351:                                                                                                                                        0,
1352:                                                                                                                                        462,
1353:                                                                                                                                        Short.MAX_VALUE)
1354:                                                                                                                                .add(
1355:                                                                                                                                        fldProcessRoleName,
1356:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1357:                                                                                                                                        462,
1358:                                                                                                                                        Short.MAX_VALUE)))
1359:                                                                                                .add(
1360:                                                                                                        chbxPartnerWillImpement)
1361:                                                                                                .add(
1362:                                                                                                        layout
1363:                                                                                                                .createSequentialGroup()
1364:                                                                                                                .add(
1365:                                                                                                                        17,
1366:                                                                                                                        17,
1367:                                                                                                                        17)
1368:                                                                                                                .add(
1369:                                                                                                                        layout
1370:                                                                                                                                .createParallelGroup(
1371:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1372:                                                                                                                                .add(
1373:                                                                                                                                        lblPartnerRoleName)
1374:                                                                                                                                .add(
1375:                                                                                                                                        lblPartnerPortType))
1376:                                                                                                                .addPreferredGap(
1377:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1378:                                                                                                                .add(
1379:                                                                                                                        layout
1380:                                                                                                                                .createParallelGroup(
1381:                                                                                                                                        org.jdesktop.layout.GroupLayout.LEADING)
1382:                                                                                                                                .add(
1383:                                                                                                                                        cbxPartnerPortType,
1384:                                                                                                                                        0,
1385:                                                                                                                                        462,
1386:                                                                                                                                        Short.MAX_VALUE)
1387:                                                                                                                                .add(
1388:                                                                                                                                        fldPartnerRoleName,
1389:                                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1390:                                                                                                                                        462,
1391:                                                                                                                                        Short.MAX_VALUE)))
1392:                                                                                                .add(
1393:                                                                                                        layout
1394:                                                                                                                .createSequentialGroup()
1395:                                                                                                                .add(
1396:                                                                                                                        lblNewPLTypeName)
1397:                                                                                                                .addPreferredGap(
1398:                                                                                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1399:                                                                                                                .add(
1400:                                                                                                                        fldNewPLTName,
1401:                                                                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1402:                                                                                                                        404,
1403:                                                                                                                        Short.MAX_VALUE)))))
1404:                                                .addContainerGap()));
1405:                layout
1406:                        .setVerticalGroup(layout
1407:                                .createParallelGroup(
1408:                                        org.jdesktop.layout.GroupLayout.LEADING)
1409:                                .add(
1410:                                        layout
1411:                                                .createSequentialGroup()
1412:                                                .addContainerGap()
1413:                                                .add(
1414:                                                        layout
1415:                                                                .createParallelGroup(
1416:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1417:                                                                .add(lblName)
1418:                                                                .add(
1419:                                                                        fldPartnerLinkName,
1420:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1421:                                                                        22,
1422:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1423:                                                .addPreferredGap(
1424:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1425:                                                .add(
1426:                                                        layout
1427:                                                                .createParallelGroup(
1428:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1429:                                                                .add(
1430:                                                                        lblWsdlFile)
1431:                                                                .add(
1432:                                                                        cbxWsdlFile,
1433:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1434:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1435:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1436:                                                .add(11, 11, 11)
1437:                                                .add(rbtnUseExistingPLT)
1438:                                                .addPreferredGap(
1439:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1440:                                                .add(
1441:                                                        layout
1442:                                                                .createParallelGroup(
1443:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1444:                                                                .add(
1445:                                                                        cbxPartnerLinkType,
1446:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1447:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1448:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
1449:                                                                .add(
1450:                                                                        lblPartnerLinkType))
1451:                                                .addPreferredGap(
1452:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1453:                                                .add(
1454:                                                        layout
1455:                                                                .createParallelGroup(
1456:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1457:                                                                .add(lblMyRole)
1458:                                                                .add(
1459:                                                                        fldMyRole,
1460:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1461:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1462:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1463:                                                .addPreferredGap(
1464:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1465:                                                .add(
1466:                                                        layout
1467:                                                                .createParallelGroup(
1468:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1469:                                                                .add(
1470:                                                                        lblPartnerRole)
1471:                                                                .add(
1472:                                                                        fldPartnerRole,
1473:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1474:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1475:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1476:                                                .addPreferredGap(
1477:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1478:                                                .add(btnSwapRoles)
1479:                                                .add(11, 11, 11)
1480:                                                .add(rbtnCreateNewPLT)
1481:                                                .addPreferredGap(
1482:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1483:                                                .add(
1484:                                                        layout
1485:                                                                .createParallelGroup(
1486:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1487:                                                                .add(
1488:                                                                        lblNewPLTypeName1)
1489:                                                                .add(
1490:                                                                        myBrowseButton)
1491:                                                                .add(
1492:                                                                        myWsdlWrapperName,
1493:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1494:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1495:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1496:                                                .addPreferredGap(
1497:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1498:                                                .add(
1499:                                                        layout
1500:                                                                .createParallelGroup(
1501:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1502:                                                                .add(
1503:                                                                        lblNewPLTypeName)
1504:                                                                .add(
1505:                                                                        fldNewPLTName,
1506:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1507:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1508:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1509:                                                .addPreferredGap(
1510:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1511:                                                .add(chbxProcessWillImplement)
1512:                                                .addPreferredGap(
1513:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1514:                                                .add(
1515:                                                        layout
1516:                                                                .createParallelGroup(
1517:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1518:                                                                .add(
1519:                                                                        lblProcessRoleName)
1520:                                                                .add(
1521:                                                                        fldProcessRoleName,
1522:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1523:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1524:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1525:                                                .addPreferredGap(
1526:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1527:                                                .add(
1528:                                                        layout
1529:                                                                .createParallelGroup(
1530:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1531:                                                                .add(
1532:                                                                        lblProcessPortType)
1533:                                                                .add(
1534:                                                                        cbxProcessPortType,
1535:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1536:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1537:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1538:                                                .addPreferredGap(
1539:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1540:                                                .add(chbxPartnerWillImpement)
1541:                                                .addPreferredGap(
1542:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1543:                                                .add(
1544:                                                        layout
1545:                                                                .createParallelGroup(
1546:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1547:                                                                .add(
1548:                                                                        lblPartnerRoleName)
1549:                                                                .add(
1550:                                                                        fldPartnerRoleName,
1551:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1552:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1553:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1554:                                                .addPreferredGap(
1555:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1556:                                                .add(
1557:                                                        layout
1558:                                                                .createParallelGroup(
1559:                                                                        org.jdesktop.layout.GroupLayout.BASELINE)
1560:                                                                .add(
1561:                                                                        lblPartnerPortType)
1562:                                                                .add(
1563:                                                                        cbxPartnerPortType,
1564:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
1565:                                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1566:                                                                        org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
1567:                                                .addPreferredGap(
1568:                                                        org.jdesktop.layout.LayoutStyle.RELATED)
1569:                                                .add(
1570:                                                        lblErrorMessage,
1571:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1572:                                                        org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
1573:                                                        Short.MAX_VALUE)
1574:                                                .addContainerGap()));
1575:
1576:                lblName.getAccessibleContext().setAccessibleName(
1577:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1578:                                "ACSN_LBL_Name")); // NOI18N
1579:                lblName.getAccessibleContext().setAccessibleDescription(
1580:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1581:                                "ACSD_LBL_Name")); // NOI18N
1582:                java.util.ResourceBundle bundle = java.util.ResourceBundle
1583:                        .getBundle("org/netbeans/modules/bpel/properties/editors/Bundle"); // NOI18N
1584:                fldPartnerLinkName.getAccessibleContext().setAccessibleName(
1585:                        bundle.getString("ACSN_INP_Name")); // NOI18N
1586:                fldPartnerLinkName.getAccessibleContext()
1587:                        .setAccessibleDescription(
1588:                                bundle.getString("ACSD_INP_Name")); // NOI18N
1589:                lblWsdlFile.getAccessibleContext().setAccessibleName(
1590:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1591:                                "ACSN_LBL_WsdlFile")); // NOI18N
1592:                lblWsdlFile.getAccessibleContext().setAccessibleDescription(
1593:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1594:                                "ACSD_LBL_WsdlFile")); // NOI18N
1595:                lblPartnerLinkType.getAccessibleContext().setAccessibleName(
1596:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1597:                                "ACSN_LBL_PartnerLinkType")); // NOI18N
1598:                lblPartnerLinkType.getAccessibleContext()
1599:                        .setAccessibleDescription(
1600:                                org.openide.util.NbBundle.getMessage(
1601:                                        FormBundle.class,
1602:                                        "ACSD_LBL_PartnerLinkType")); // NOI18N
1603:                lblMyRole.getAccessibleContext().setAccessibleName(
1604:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1605:                                "ACSN_LBL_MyRole")); // NOI18N
1606:                lblMyRole.getAccessibleContext().setAccessibleDescription(
1607:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1608:                                "ACSD_LBL_MyRole")); // NOI18N
1609:                lblPartnerRole.getAccessibleContext().setAccessibleName(
1610:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1611:                                "ACSN_LBL_PartnerRole")); // NOI18N
1612:                lblPartnerRole.getAccessibleContext().setAccessibleDescription(
1613:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1614:                                "ACSD_LBL_PartnerRole")); // NOI18N
1615:                cbxPartnerLinkType.getAccessibleContext().setAccessibleName(
1616:                        bundle.getString("ACSN_CMB_PartnerLinkType")); // NOI18N
1617:                cbxPartnerLinkType.getAccessibleContext()
1618:                        .setAccessibleDescription(
1619:                                bundle.getString("ACSD_CMB_PartnerLinkType")); // NOI18N
1620:                cbxWsdlFile.getAccessibleContext().setAccessibleName(
1621:                        bundle.getString("ACSN_CMB_WsdlFile")); // NOI18N
1622:                cbxWsdlFile.getAccessibleContext().setAccessibleDescription(
1623:                        bundle.getString("ACSD_CMB_WsdlFile")); // NOI18N
1624:                lblErrorMessage.getAccessibleContext().setAccessibleName(
1625:                        org.openide.util.NbBundle.getMessage(FormBundle.class,
1626:                                "ACSN_ErrorLabel")); // NOI18N
1627:                lblErrorMessage.getAccessibleContext()
1628:                        .setAccessibleDescription(
1629:                                org.openide.util.NbBundle.getMessage(
1630:                                        FormBundle.class, "ACSD_ErrorLabel")); // NOI18N
1631:                rbtnUseExistingPLT.getAccessibleContext().setAccessibleName(
1632:                        bundle.getString("ACSN_RBTN_UseExisingPLType")); // NOI18N
1633:                rbtnUseExistingPLT.getAccessibleContext()
1634:                        .setAccessibleDescription(
1635:                                bundle.getString("ACSD_RBTN_UseExisingPLType")); // NOI18N
1636:                rbtnCreateNewPLT.getAccessibleContext().setAccessibleName(
1637:                        bundle.getString("ACSN_RBTN_CreateNewPLType")); // NOI18N
1638:                rbtnCreateNewPLT.getAccessibleContext()
1639:                        .setAccessibleDescription(
1640:                                bundle.getString("ACSD_RBTN_CreateNewPLType")); // NOI18N
1641:                lblNewPLTypeName.getAccessibleContext().setAccessibleName(
1642:                        bundle.getString("ACSN_LBL_NewPLTypeName")); // NOI18N
1643:                lblNewPLTypeName.getAccessibleContext()
1644:                        .setAccessibleDescription(
1645:                                bundle.getString("ACSD_LBL_NewPLTypeName")); // NOI18N
1646:                chbxProcessWillImplement
1647:                        .getAccessibleContext()
1648:                        .setAccessibleName(
1649:                                bundle
1650:                                        .getString("ACSN_CHBX_ProcessWillImpement")); // NOI18N
1651:                chbxProcessWillImplement
1652:                        .getAccessibleContext()
1653:                        .setAccessibleDescription(
1654:                                bundle
1655:                                        .getString("ACSD_CHBX_ProcessWillImpement")); // NOI18N
1656:                lblProcessRoleName.getAccessibleContext().setAccessibleName(
1657:                        bundle.getString("ACSN_LBL_ProcessRoleName")); // NOI18N
1658:                lblProcessRoleName.getAccessibleContext()
1659:                        .setAccessibleDescription(
1660:                                bundle.getString("ACSD_LBL_ProcessRoleName")); // NOI18N
1661:                lblProcessPortType.getAccessibleContext().setAccessibleName(
1662:                        bundle.getString("ACSN_LBL_ProcessProtType")); // NOI18N
1663:                lblProcessPortType.getAccessibleContext()
1664:                        .setAccessibleDescription(
1665:                                bundle.getString("ACSD_LBL_ProcessProtType")); // NOI18N
1666:                chbxPartnerWillImpement
1667:                        .getAccessibleContext()
1668:                        .setAccessibleName(
1669:                                bundle
1670:                                        .getString("ACSN_CHBX_PartnerWillImplement")); // NOI18N
1671:                chbxPartnerWillImpement
1672:                        .getAccessibleContext()
1673:                        .setAccessibleDescription(
1674:                                bundle
1675:                                        .getString("ACSD_CHBX_PartnerWillImplement")); // NOI18N
1676:                lblPartnerRoleName.getAccessibleContext().setAccessibleName(
1677:                        bundle.getString("ACSN_LBL_PartnerRoleName")); // NOI18N
1678:                lblPartnerRoleName.getAccessibleContext()
1679:                        .setAccessibleDescription(
1680:                                bundle.getString("ACSD_LBL_PartnerRoleName")); // NOI18N
1681:                lblPartnerPortType.getAccessibleContext().setAccessibleName(
1682:                        bundle.getString("ACSN_LBL_PartnerPortType")); // NOI18N
1683:                lblPartnerPortType.getAccessibleContext()
1684:                        .setAccessibleDescription(
1685:                                bundle.getString("ACSD_LBL_PartnerPortType")); // NOI18N
1686:                fldNewPLTName.getAccessibleContext().setAccessibleName(
1687:                        bundle.getString("ACSN_INP_NewPLTypeName")); // NOI18N
1688:                fldNewPLTName.getAccessibleContext().setAccessibleDescription(
1689:                        bundle.getString("ACSD_INP_NewPLTypeName")); // NOI18N
1690:                fldProcessRoleName.getAccessibleContext().setAccessibleName(
1691:                        bundle.getString("ACSN_INP_ProcessRoleName")); // NOI18N
1692:                fldProcessRoleName.getAccessibleContext()
1693:                        .setAccessibleDescription(
1694:                                bundle.getString("ACSD_INP_ProcessRoleName")); // NOI18N
1695:                cbxProcessPortType.getAccessibleContext().setAccessibleName(
1696:                        bundle.getString("ACSN_CMB_ProcessProtType")); // NOI18N
1697:                cbxProcessPortType.getAccessibleContext()
1698:                        .setAccessibleDescription(
1699:                                bundle.getString("ACSN_CMB_ProcessProtType")); // NOI18N
1700:                fldPartnerRoleName.getAccessibleContext().setAccessibleName(
1701:                        bundle.getString("ACSN_INP_PartnerRoleName")); // NOI18N
1702:                fldPartnerRoleName.getAccessibleContext()
1703:                        .setAccessibleDescription(
1704:                                bundle.getString("ACSD_INP_PartnerRoleName")); // NOI18N
1705:                cbxPartnerPortType.getAccessibleContext().setAccessibleName(
1706:                        bundle.getString("ACSN_CMB_PartnerPortType")); // NOI18N
1707:                cbxPartnerPortType.getAccessibleContext()
1708:                        .setAccessibleDescription(
1709:                                bundle.getString("ACSD_CMB_PartnerPortType")); // NOI18N
1710:                btnSwapRoles.getAccessibleContext().setAccessibleName(
1711:                        bundle.getString("ACSN_BTN_SwapRoles")); // NOI18N
1712:                btnSwapRoles.getAccessibleContext().setAccessibleDescription(
1713:                        bundle.getString("ACSD_BTN_SwapRoles")); // NOI18N
1714:                fldMyRole.getAccessibleContext().setAccessibleName(
1715:                        bundle.getString("ACSN_INP_MyRole")); // NOI18N
1716:                fldMyRole.getAccessibleContext().setAccessibleDescription(
1717:                        bundle.getString("ACSD_INP_MyRole")); // NOI18N
1718:                fldPartnerRole.getAccessibleContext().setAccessibleName(
1719:                        bundle.getString("ACSN_INP_PartnerRole")); // NOI18N
1720:                fldPartnerRole.getAccessibleContext().setAccessibleDescription(
1721:                        bundle.getString("ACSD_INP_PartnerRole")); // NOI18N
1722:                lblNewPLTypeName1.getAccessibleContext().setAccessibleName(
1723:                        org.openide.util.NbBundle.getMessage(
1724:                                PartnerLinkMainPanel.class,
1725:                                "ACSN_LBL_CreateInFile")); // NOI18N
1726:                lblNewPLTypeName1.getAccessibleContext()
1727:                        .setAccessibleDescription(
1728:                                org.openide.util.NbBundle.getMessage(
1729:                                        PartnerLinkMainPanel.class,
1730:                                        "ACSD_LBL_CreateInFile")); // NOI18N
1731:
1732:                getAccessibleContext().setAccessibleName(
1733:                        bundle.getString("ACSN_PNL_PartnerLinkMain")); // NOI18N
1734:                getAccessibleContext().setAccessibleDescription(
1735:                        bundle.getString("ACSN_PNL_PartnerLinkMain")); // NOI18N
1736:            }// </editor-fold>//GEN-END:initComponents
1737:
1738:            // vlv
1739:            private void browseWsdlFile(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseWsdlFile
1740:                String title = NbBundle.getMessage(FormBundle.class,
1741:                        "LBL_Select_WSDL_File"); // NOI18N
1742:                WSDLFileImportDialog dialog = new WSDLFileImportDialog(
1743:                        getCurrentWsdlModel());
1744:                DialogDescriptor descriptor = UIUtilities.getCustomizerDialog(
1745:                        dialog, title, true);
1746:                descriptor.setValid(false);
1747:                Object result = DialogDisplayer.getDefault().notify(descriptor);
1748:
1749:                if (result != DialogDescriptor.OK_OPTION) {
1750:                    return;
1751:                }
1752:                FileObject file = org.netbeans.modules.bpel.editors.api.utils.Util
1753:                        .getFileObjectByModel(dialog.getModel());
1754:
1755:                String text = getRelativeName(file);
1756:                myWsdlWrapperName.setText(text);
1757:
1758:                getValidator().revalidate(true);
1759:            }//GEN-LAST:event_browseWsdlFile
1760:
1761:            // vlv
1762:            private void setWrapper(FileObject file) {
1763:                if (file != null) {
1764:                    myWsdlWrapperName
1765:                            .setText(getRelativeName(file) + "Wrapper"); // NOI18N
1766:                }
1767:            }
1768:
1769:            // vlv
1770:            private String getRelativeName(FileObject file) {
1771:                BpelModel bpelModel = myEditor.getLookup().lookup(
1772:                        BpelModel.class);
1773:                Project modelProject = ResolverUtility
1774:                        .safeGetProject(bpelModel);
1775:                String relativePath = ResolverUtility.safeGetRelativePath(file,
1776:                        modelProject);
1777:                String name = relativePath != null ? relativePath : file
1778:                        .getPath();
1779:
1780:                int k = name.lastIndexOf(".wsdl"); // NOI18N
1781:
1782:                if (k == -1) {
1783:                    return name;
1784:                }
1785:                return name.substring(0, k);
1786:            }
1787:
1788:            // vlv
1789:            private void out() {
1790:                System.out.println();
1791:            }
1792:
1793:            private void out(Object object) {
1794:                System.out.println("*** " + object); // NOI18N
1795:            }
1796:
1797:            // vlv
1798:            private List<PartnerLinkType> getPartnerLinkTypeRecursively(
1799:                    WSDLModel model) {
1800:                final List<PartnerLinkType> partners = new ArrayList<PartnerLinkType>();
1801:
1802:                WSDLUtilities.visitRecursively(model, new WSDLModelVisitor() {
1803:                    public void visit(WSDLModel model) {
1804:                        Definitions definitions = model.getDefinitions();
1805:
1806:                        if (definitions == null) {
1807:                            return;
1808:                        }
1809:                        partners
1810:                                .addAll(definitions
1811:                                        .getExtensibilityElements(PartnerLinkType.class));
1812:                    }
1813:                });
1814:
1815:                return partners;
1816:            }
1817:
1818:            private List<PortType> getPortTypeRecursively(WSDLModel model) {
1819:                final List<PortType> ports = new ArrayList<PortType>();
1820:
1821:                WSDLUtilities.visitRecursively(model, new WSDLModelVisitor() {
1822:                    public void visit(WSDLModel model) {
1823:                        Definitions definitions = model.getDefinitions();
1824:
1825:                        if (definitions == null) {
1826:                            return;
1827:                        }
1828:                        ports.addAll(definitions.getPortTypes());
1829:                    }
1830:                });
1831:
1832:                return ports;
1833:            }
1834:
1835:            // Variables declaration - do not modify//GEN-BEGIN:variables
1836:            private javax.swing.JButton btnSwapRoles;
1837:            private javax.swing.ButtonGroup btngrPLT;
1838:            private javax.swing.JComboBox cbxPartnerLinkType;
1839:            private javax.swing.JComboBox cbxPartnerPortType;
1840:            private javax.swing.JComboBox cbxProcessPortType;
1841:            private javax.swing.JComboBox cbxWsdlFile;
1842:            private javax.swing.JCheckBox chbxPartnerWillImpement;
1843:            private javax.swing.JCheckBox chbxProcessWillImplement;
1844:            private javax.swing.JTextField fldMyRole;
1845:            private javax.swing.JTextField fldNewPLTName;
1846:            private javax.swing.JTextField fldPartnerLinkName;
1847:            private javax.swing.JTextField fldPartnerRole;
1848:            private javax.swing.JTextField fldPartnerRoleName;
1849:            private javax.swing.JTextField fldProcessRoleName;
1850:            private javax.swing.JLabel lblErrorMessage;
1851:            private javax.swing.JLabel lblMyRole;
1852:            private javax.swing.JLabel lblName;
1853:            private javax.swing.JLabel lblNewPLTypeName;
1854:            private javax.swing.JLabel lblNewPLTypeName1;
1855:            private javax.swing.JLabel lblPartnerLinkType;
1856:            private javax.swing.JLabel lblPartnerPortType;
1857:            private javax.swing.JLabel lblPartnerRole;
1858:            private javax.swing.JLabel lblPartnerRoleName;
1859:            private javax.swing.JLabel lblProcessPortType;
1860:            private javax.swing.JLabel lblProcessRoleName;
1861:            private javax.swing.JLabel lblWsdlFile;
1862:            private javax.swing.JButton myBrowseButton;
1863:            private javax.swing.JTextField myWsdlWrapperName;
1864:            private javax.swing.JRadioButton rbtnCreateNewPLT;
1865:            private javax.swing.JRadioButton rbtnUseExistingPLT;
1866:            // End of variables declaration//GEN-END:variables
1867:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.