KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > ws7 > ui > WS70ConnectionTabVisualPanel


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 /*
21  * WS70ConnectionTabVisualPanel.java
22  */

23
24 package org.netbeans.modules.j2ee.sun.ws7.ui;
25 import org.netbeans.modules.j2ee.sun.ws7.dm.WS70SunDeploymentManager;
26 import javax.swing.*;
27 import java.awt.event.*;
28 /**
29  *
30  * @author Mukesh Garg
31  */

32 public class WS70ConnectionTabVisualPanel extends javax.swing.JPanel JavaDoc {
33
34     private WS70SunDeploymentManager manager;
35     /** Creates new form WS70ConnectionTabVisualPanel */
36     public WS70ConnectionTabVisualPanel(WS70SunDeploymentManager dm) {
37         manager = dm;
38         initComponents();
39
40         jAdminUrlTxt.setText(manager.getHost()+":"+manager.getPort());
41         jAdminUserTxt.setText(manager.getUserName());
42         jPasswordTxt.setText(manager.getPassword());
43         jLocationTxt.setText(manager.getServerLocation());
44
45     }
46     
47     /** This method is called from within the constructor to
48      * initialize the form.
49      * WARNING: Do NOT modify this code. The content of this method is
50      * always regenerated by the Form Editor.
51      */

52     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
53
private void initComponents() {
54         jAdminUrlLbl = new javax.swing.JLabel JavaDoc();
55         jAdminUrlTxt = new javax.swing.JTextField JavaDoc();
56         jLocationLbl = new javax.swing.JLabel JavaDoc();
57         jLocationTxt = new javax.swing.JTextField JavaDoc();
58         jAdminUserLbl = new javax.swing.JLabel JavaDoc();
59         jAdminUserTxt = new javax.swing.JTextField JavaDoc();
60         jPasswordLbl = new javax.swing.JLabel JavaDoc();
61         jPasswordTxt = new javax.swing.JPasswordField JavaDoc();
62
63         addPropertyChangeListener(new java.beans.PropertyChangeListener JavaDoc() {
64             public void propertyChange(java.beans.PropertyChangeEvent JavaDoc evt) {
65                 formPropertyChange(evt);
66             }
67         });
68         addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
69             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
70                 formFocusLost(evt);
71             }
72         });
73
74         jAdminUrlLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Url_Mnem").charAt(0));
75         jAdminUrlLbl.setLabelFor(jAdminUrlTxt);
76         jAdminUrlLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionAdminUrl"));
77         jAdminUrlLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionAdminUrl"));
78         jAdminUrlLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionAdminUrl"));
79         jAdminUrlLbl.getAccessibleContext().setAccessibleParent(this);
80
81         jAdminUrlTxt.setEditable(false);
82
83         jLocationLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Location_Mnem").charAt(0));
84         jLocationLbl.setLabelFor(jLocationTxt);
85         jLocationLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionLocation"));
86         jLocationLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionLocation"));
87         jLocationLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionLocation"));
88         jLocationLbl.getAccessibleContext().setAccessibleParent(this);
89
90         jLocationTxt.setEditable(false);
91
92         jAdminUserLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_User_Mnem").charAt(0));
93         jAdminUserLbl.setLabelFor(jAdminUserTxt);
94         jAdminUserLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionAdminUser"));
95         jAdminUserLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionAdminUser"));
96         jAdminUserLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionAdminUser"));
97         jAdminUserLbl.getAccessibleContext().setAccessibleParent(this);
98
99         jAdminUserTxt.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
100             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
101                 jAdminUserTxtKeyReleased(evt);
102             }
103         });
104
105         jPasswordLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Connection_Password_Mnem").charAt(0));
106         jPasswordLbl.setLabelFor(jPasswordTxt);
107         jPasswordLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_ConnectionPassword"));
108         jPasswordLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_ConnectionPassword"));
109         jPasswordLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_ConnectionPassword"));
110         jPasswordLbl.getAccessibleContext().setAccessibleParent(this);
111
112         jPasswordTxt.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
113             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
114                 jPasswordTxtFocusLost(evt);
115             }
116         });
117         jPasswordTxt.addKeyListener(new java.awt.event.KeyAdapter JavaDoc() {
118             public void keyReleased(java.awt.event.KeyEvent JavaDoc evt) {
119                 jPasswordTxtKeyReleased(evt);
120             }
121         });
122
123         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
124         this.setLayout(layout);
125         layout.setHorizontalGroup(
126             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
127             .add(layout.createSequentialGroup()
128                 .add(22, 22, 22)
129                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
130                     .add(jAdminUrlLbl)
131                     .add(jLocationLbl)
132                     .add(jAdminUserLbl)
133                     .add(jPasswordLbl))
134                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
135                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
136                     .add(layout.createSequentialGroup()
137                         .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 248, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
138                         .addContainerGap())
139                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
140                         .add(layout.createSequentialGroup()
141                             .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
142                                 .add(jAdminUrlTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE)
143                                 .add(jLocationTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE))
144                             .add(96, 96, 96))
145                         .add(layout.createSequentialGroup()
146                             .add(jAdminUserTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 248, Short.MAX_VALUE)
147                             .addContainerGap()))))
148         );
149
150         layout.linkSize(new java.awt.Component JavaDoc[] {jAdminUrlTxt, jAdminUserTxt, jLocationTxt, jPasswordTxt}, org.jdesktop.layout.GroupLayout.HORIZONTAL);
151
152         layout.setVerticalGroup(
153             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
154             .add(layout.createSequentialGroup()
155                 .add(28, 28, 28)
156                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
157                     .add(jAdminUrlLbl)
158                     .add(jAdminUrlTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
159                 .add(18, 18, 18)
160                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
161                     .add(jLocationLbl)
162                     .add(jLocationTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
163                 .add(19, 19, 19)
164                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
165                     .add(jAdminUserLbl)
166                     .add(jAdminUserTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
167                 .add(17, 17, 17)
168                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
169                     .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
170                     .add(jPasswordLbl))
171                 .addContainerGap(138, Short.MAX_VALUE))
172         );
173
174         layout.linkSize(new java.awt.Component JavaDoc[] {jAdminUrlTxt, jAdminUserTxt, jLocationTxt, jPasswordTxt}, org.jdesktop.layout.GroupLayout.VERTICAL);
175
176         layout.linkSize(new java.awt.Component JavaDoc[] {jAdminUrlLbl, jAdminUserLbl, jLocationLbl, jPasswordLbl}, org.jdesktop.layout.GroupLayout.VERTICAL);
177
178     }// </editor-fold>//GEN-END:initComponents
179

180     private void formPropertyChange(java.beans.PropertyChangeEvent JavaDoc evt) {//GEN-FIRST:event_formPropertyChange
181

182         String JavaDoc propertyname = evt.getPropertyName();
183         Object JavaDoc oldValue = evt.getOldValue();
184         Object JavaDoc newValue = evt.getNewValue();
185         
186         // when server customizer gets closed, this panel is removed from the
187
// Server customizer WS70Customizer tab panel
188
if(propertyname!=null && propertyname.equals("ancestor")){
189             if(oldValue!=null && newValue==null){
190                 String JavaDoc uname = jAdminUserTxt.getText();
191                 char[] passWd = jPasswordTxt.getPassword();
192                 String JavaDoc password = new String JavaDoc(passWd);
193                 manager.refreshInnerDM(uname, password);
194             }
195         }
196     }//GEN-LAST:event_formPropertyChange
197

198     private void formFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_formFocusLost
199
}//GEN-LAST:event_formFocusLost
200

201     private void jPasswordTxtFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_jPasswordTxtFocusLost
202
}//GEN-LAST:event_jPasswordTxtFocusLost
203

204     private void jPasswordTxtKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_jPasswordTxtKeyReleased
205
}//GEN-LAST:event_jPasswordTxtKeyReleased
206

207     private void jAdminUserTxtKeyReleased(java.awt.event.KeyEvent JavaDoc evt) {//GEN-FIRST:event_jAdminUserTxtKeyReleased
208
}//GEN-LAST:event_jAdminUserTxtKeyReleased
209

210     public boolean isValid(){
211         if(jAdminUserTxt.getText()==null || jAdminUserTxt.getText().trim().length()==0){
212             return false;
213             //LOG ERROR
214
}
215         return true;
216     }
217     // Variables declaration - do not modify//GEN-BEGIN:variables
218
private javax.swing.JLabel JavaDoc jAdminUrlLbl;
219     private javax.swing.JTextField JavaDoc jAdminUrlTxt;
220     private javax.swing.JLabel JavaDoc jAdminUserLbl;
221     private javax.swing.JTextField JavaDoc jAdminUserTxt;
222     private javax.swing.JLabel JavaDoc jLocationLbl;
223     private javax.swing.JTextField JavaDoc jLocationTxt;
224     private javax.swing.JLabel JavaDoc jPasswordLbl;
225     private javax.swing.JPasswordField JavaDoc jPasswordTxt;
226     // End of variables declaration//GEN-END:variables
227

228 }
229
Popular Tags