KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > websvc > core > webservices > ui > DeleteWsDialog


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.websvc.core.webservices.ui;
21
22 import org.openide.DialogDisplayer;
23 import org.openide.NotifyDescriptor;
24 import org.openide.util.NbBundle;
25
26 /**
27  *
28  * @author Martin Adamek
29  */

30 public class DeleteWsDialog extends javax.swing.JPanel JavaDoc {
31
32     public static final String JavaDoc DELETE_NOTHING = "deleteNothing"; //NOI18N
33
public static final String JavaDoc DELETE_ALL = "deleteALL"; //NOI18N
34
public static final String JavaDoc DELETE_WS = "deleteWebService"; //NOI18N
35
public static final String JavaDoc DELETE_PACKAGE = "deletePackage"; //NOI18N
36
public static final String JavaDoc DELETE_WSDL = "deleteWsdl"; //NOI18N
37

38     private String JavaDoc wsName, packageName, wsdlName;
39     
40     private DeleteWsDialog(String JavaDoc wsName, String JavaDoc packageName, String JavaDoc wsdlName) {
41         this.wsName = wsName;
42         this.packageName=packageName;
43         this.wsdlName=wsdlName;
44         initComponents();
45         // display the delete_wsdl checkbox only if wsdl exists
46
if (wsdlName==null) deleteWsdlCheckBox.setVisible(false);
47     }
48
49     public static String JavaDoc open(String JavaDoc wsName, String JavaDoc packageName, String JavaDoc wsdlName) {
50         String JavaDoc title = NbBundle.getMessage(DeleteWsDialog.class, "MSG_ConfirmDeleteObjectTitle");
51         DeleteWsDialog delDialog = new DeleteWsDialog(wsName, packageName, wsdlName);
52         NotifyDescriptor desc = new NotifyDescriptor.Confirmation(delDialog, title, NotifyDescriptor.YES_NO_OPTION);
53         Object JavaDoc result = DialogDisplayer.getDefault().notify(desc);
54         if (result.equals(NotifyDescriptor.CLOSED_OPTION)) {
55             return DELETE_NOTHING;
56         } else if (result.equals(NotifyDescriptor.NO_OPTION)) {
57             return DELETE_NOTHING;
58         } else if (delDialog.deletePackage() && delDialog.deleteWsdl()) {
59             return DELETE_ALL;
60         } else if (delDialog.deletePackage()) {
61             return DELETE_PACKAGE;
62         } else if (delDialog.deleteWsdl()) {
63             return DELETE_WSDL;
64         } else return DELETE_WS;
65         
66     }
67     
68     private boolean deletePackage() {
69         return deletePackageCheckBox.isSelected();
70     }
71     
72     private boolean deleteWsdl() {
73         if (wsdlName==null) return false;
74         else return deleteWsdlCheckBox.isSelected();
75     }
76     
77     /** This method is called from within the constructor to
78      * initialize the form.
79      * WARNING: Do NOT modify this code. The content of this method is
80      * always regenerated by the Form Editor.
81      */

82     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
83
private void initComponents() {
84         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
85
86         jLabel1 = new javax.swing.JLabel JavaDoc();
87         deletePackageCheckBox = new javax.swing.JCheckBox JavaDoc();
88         deleteWsdlCheckBox = new javax.swing.JCheckBox JavaDoc();
89
90         setLayout(new java.awt.GridBagLayout JavaDoc());
91
92         jLabel1.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_ConfirmDeleteObject", new Object JavaDoc[] {wsName}));
93         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
94         gridBagConstraints.gridx = 0;
95         gridBagConstraints.gridy = 0;
96         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
97         gridBagConstraints.weightx = 1.0;
98         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 8, 0);
99         add(jLabel1, gridBagConstraints);
100
101         deletePackageCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeletePackage_mnem").charAt(0));
102         deletePackageCheckBox.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeletePackage", new Object JavaDoc[] {packageName}));
103         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
104         gridBagConstraints.gridx = 0;
105         gridBagConstraints.gridy = 1;
106         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
107         gridBagConstraints.weightx = 1.0;
108         add(deletePackageCheckBox, gridBagConstraints);
109
110         deleteWsdlCheckBox.setMnemonic(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeleteWsdl_mnem").charAt(0));
111         deleteWsdlCheckBox.setSelected(true);
112         deleteWsdlCheckBox.setText(org.openide.util.NbBundle.getMessage(DeleteWsDialog.class, "MSG_DeleteWsdl", new Object JavaDoc[] {wsdlName}));
113         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
114         gridBagConstraints.gridx = 0;
115         gridBagConstraints.gridy = 2;
116         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
117         gridBagConstraints.weightx = 1.0;
118         add(deleteWsdlCheckBox, gridBagConstraints);
119
120     }
121     // </editor-fold>//GEN-END:initComponents
122

123     
124     // Variables declaration - do not modify//GEN-BEGIN:variables
125
private javax.swing.JCheckBox JavaDoc deletePackageCheckBox;
126     private javax.swing.JCheckBox JavaDoc deleteWsdlCheckBox;
127     private javax.swing.JLabel JavaDoc jLabel1;
128     // End of variables declaration//GEN-END:variables
129

130 }
131
Popular Tags