KickJava   Java API By Example, From Geeks To Geeks.

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


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

23
24 package org.netbeans.modules.j2ee.sun.ws7.ui;
25
26 import javax.swing.JFileChooser JavaDoc;
27 import java.io.File JavaDoc;
28 import java.io.FileNotFoundException JavaDoc;
29 import java.io.FileFilter JavaDoc;
30 import javax.swing.event.ChangeEvent JavaDoc;
31 import javax.swing.event.ChangeListener JavaDoc;
32 import java.util.ArrayList JavaDoc;
33 import java.util.List JavaDoc;
34 import java.util.Iterator JavaDoc;
35
36 import org.openide.util.NbBundle;
37 import org.openide.WizardDescriptor;
38 /**
39  *
40  * @author Administrator
41  */

42 public class WS70AddServerChoiceVisualPanel extends javax.swing.JPanel JavaDoc {
43     private static final String JavaDoc LOCALHOST="localhost";//NOI18N
44
private String JavaDoc installDirName;
45     private String JavaDoc hostName=LOCALHOST;
46     private String JavaDoc portNumber;
47     private String JavaDoc userName;
48     private String JavaDoc password;
49     private final List JavaDoc listeners = new ArrayList JavaDoc();
50     
51     /**
52      * Creates new form WS70AddServerChoiceVisualPanel
53      */

54     public WS70AddServerChoiceVisualPanel() {
55         initComponents();
56     }
57     public String JavaDoc getAdminUserName(){
58         return jUserNameTxt.getText().trim();
59     }
60     public String JavaDoc getAdminPassword(){
61         char[] password = jPasswordTxt.getPassword();
62         return String.valueOf(password);
63     }
64     
65     public String JavaDoc getAdminHost(){
66         return jAdminHostTxt.getText().trim();
67     }
68     public String JavaDoc getAdminPort(){
69         return jAdminPortTxt.getText().trim();
70     }
71     
72
73     public String JavaDoc getServerLocation(){
74         return jLocationTxt.getText().trim();
75     }
76     public boolean isLocalServer(){
77         return !jCBRemote.isSelected();
78     }
79     public boolean isAdminOnSSL(){
80         return jCBSSLPort.isSelected();
81     }
82     public boolean isValid(WizardDescriptor wizard){
83         if(!validateDirctory()){
84             jLocationTxt.setFocusable(true);
85             wizard.putProperty(WS70ServerUIWizardIterator.PROP_ERROR_MESSAGE
86                     , NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_INVALID_SERVER_DIRECTORY"));
87             return false;
88         }
89         if(!validateAdminHost()){
90             wizard.putProperty(WS70ServerUIWizardIterator.PROP_ERROR_MESSAGE
91                     , NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_ENTER_HOSTNAME"));
92             jAdminHostTxt.setFocusable(true);
93             return false;
94         }
95         if(!validateAdminPort()){
96             jUserNameTxt.setFocusable(true);
97             wizard.putProperty(WS70ServerUIWizardIterator.PROP_ERROR_MESSAGE
98                     , NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_ENTER_VALID_PORT"));
99             return false;
100         }
101         if(!validateUserName()){
102             jUserNameTxt.setFocusable(true);
103             wizard.putProperty(WS70ServerUIWizardIterator.PROP_ERROR_MESSAGE
104                     , NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_ENTER_USERNAME"));
105             return false;
106         }
107         wizard.putProperty(WS70ServerUIWizardIterator.PROP_ERROR_MESSAGE, null);
108         return true;
109     }
110     private boolean validateAdminHost(){
111         if(hostName==null || hostName.length()<=0){
112             return false;
113         }
114         return true;
115     }
116     private boolean validateAdminPort(){
117         if(portNumber==null || portNumber.length()<=0){
118             return false;
119         }
120         int port;
121         try{
122             port = Integer.parseInt(portNumber);
123         }catch(NumberFormatException JavaDoc e){
124             port = -1;
125         }
126         if(port<=0 || port>65535){
127             return false;
128         }
129         return true;
130     }
131     private boolean validateUserName(){
132         if(userName==null || userName.length()<=0){
133             return false;
134         }
135         return true;
136     }
137     private boolean validateDirctory() {
138         if(installDirName==null){
139             return false;
140         }
141         if(installDirName.equals("")){
142             return false;
143         }
144         
145         if(!isValidServer(new File JavaDoc(installDirName))){
146             
147             // Bug# 84607 Just show the error at the bottom of the panel.
148
// Message box is only needed when user has selected a wrong
149
// directory name using the FileChooser
150

151             //Util.showError(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_INVALID_SERVER_DIRECTORY"));
152
jLocationTxt.requestFocusInWindow();
153             jLocationTxt.selectAll();
154             return false;
155         }
156         return true;
157     }
158     
159     private boolean isValidServer(File JavaDoc dir){
160         FileFilter JavaDoc filter = new FileFilter JavaDoc() {
161             public boolean accept(File JavaDoc pathname) {
162                 return pathname.isDirectory() && pathname.getName().equals("admin-server"); //NO I18N
163
}
164         };
165         File JavaDoc[] adminFolders = dir.listFiles( filter );
166         if ( adminFolders == null || adminFolders.length == 0 ){
167             return false;
168         }
169         
170         File JavaDoc[] configFolders = adminFolders[0].listFiles( new FileFilter JavaDoc() {
171             public boolean accept(File JavaDoc pathname) {
172                 return pathname.isDirectory() && pathname.getName().equals("config");//NO I18N
173
}
174         } );
175
176         if ( configFolders == null || configFolders.length == 0 ){
177             return false;
178         }
179         
180         File JavaDoc[] serverFiles = configFolders[0].listFiles( new FileFilter JavaDoc() {
181             public boolean accept(File JavaDoc pathname) {
182                 return pathname.getName().equals("server.xml");//NO I18N
183
}
184         } );
185         if ( serverFiles == null || serverFiles.length == 0 ){
186             return false;
187         }
188         return true;
189     }
190     public void addChangeListener(ChangeListener JavaDoc l) {
191         synchronized (listeners) {
192             listeners.add(l);
193         }
194     }
195     public String JavaDoc getName(){
196         return NbBundle.getMessage(WS70AddServerChoiceVisualPanel.class, "LBL_AddServerWizardTitle");
197     }
198     public void removeChangeListener(ChangeListener JavaDoc l) {
199         synchronized (listeners) {
200             listeners.remove(l);
201         }
202     }
203     private void fireChange() {
204         ChangeEvent JavaDoc event = new ChangeEvent JavaDoc(this);
205         ArrayList JavaDoc tempList;
206
207         synchronized(listeners) {
208             tempList = new ArrayList JavaDoc(listeners);
209         }
210
211         Iterator JavaDoc iter = tempList.iterator();
212         while (iter.hasNext())
213             ((ChangeListener JavaDoc)iter.next()).stateChanged(event);
214     }
215
216     
217     /** This method is called from within the constructor to
218      * initialize the form.
219      * WARNING: Do NOT modify this code. The content of this method is
220      * always regenerated by the Form Editor.
221      */

222     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
223
private void initComponents() {
224         buttonGroup1 = new javax.swing.ButtonGroup JavaDoc();
225         buttonGroup2 = new javax.swing.ButtonGroup JavaDoc();
226         jServerInstructionsLbl = new javax.swing.JLabel JavaDoc();
227         jLabel2 = new javax.swing.JLabel JavaDoc();
228         jDirectoryLbl = new javax.swing.JLabel JavaDoc();
229         jLocationTxt = new javax.swing.JTextField JavaDoc();
230         jBrowseBtn = new javax.swing.JButton JavaDoc();
231         jAdminHostLbl = new javax.swing.JLabel JavaDoc();
232         jAdminHostTxt = new javax.swing.JTextField JavaDoc();
233         jAdminPortLbl = new javax.swing.JLabel JavaDoc();
234         jAdminPortTxt = new javax.swing.JTextField JavaDoc();
235         jUserNameLbl = new javax.swing.JLabel JavaDoc();
236         jUserNameTxt = new javax.swing.JTextField JavaDoc();
237         jPasswordLbl = new javax.swing.JLabel JavaDoc();
238         jPasswordTxt = new javax.swing.JPasswordField JavaDoc();
239         jAdminInstructionsLbl = new javax.swing.JLabel JavaDoc();
240         jCBRemote = new javax.swing.JCheckBox JavaDoc();
241         jSeparator1 = new javax.swing.JSeparator JavaDoc();
242         jCBSSLPort = new javax.swing.JCheckBox JavaDoc();
243
244         jServerInstructionsLbl.setText(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("LBL_AddServerVisualPanelTitle"));
245         jServerInstructionsLbl.getAccessibleContext().setAccessibleName(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("A11Y_NAME_AddServerVisualPanelTitle"));
246         jServerInstructionsLbl.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("A11Y_DESC_AddServerVisualPanelTitle"));
247
248         jDirectoryLbl.setDisplayedMnemonic(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("A11Y_Inst_Dir_Mnem").charAt(0));
249         jDirectoryLbl.setLabelFor(jLocationTxt);
250         jDirectoryLbl.setText(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("LBL_AddServerVisualPanel_Directory"));
251         jDirectoryLbl.getAccessibleContext().setAccessibleName(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("A11Y_NAME_AddServerVisualPanel_Directory"));
252         jDirectoryLbl.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("A11Y_DESC_AddServerVisualPanel_Directory"));
253         jDirectoryLbl.getAccessibleContext().setAccessibleParent(this);
254
255         jLocationTxt.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
256             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
257                 jLocationTxtFocusGained(evt);
258             }
259             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
260                 jLocationTxtFocusLost(evt);
261             }
262         });
263
264         jBrowseBtn.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Browse_Mnem").charAt(0));
265         jBrowseBtn.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanel_Browse"));
266         jBrowseBtn.addActionListener(new java.awt.event.ActionListener JavaDoc() {
267             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
268                 jBrowseBtnActionPerformed(evt);
269             }
270         });
271
272         jBrowseBtn.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanel_Browse"));
273         jBrowseBtn.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanel_Browse"));
274         jBrowseBtn.getAccessibleContext().setAccessibleParent(this);
275
276         jAdminHostLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Host_Mnem").charAt(0));
277         jAdminHostLbl.setLabelFor(jAdminHostTxt);
278         jAdminHostLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelHost"));
279         jAdminHostLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelHost"));
280         jAdminHostLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelHost"));
281         jAdminHostLbl.getAccessibleContext().setAccessibleParent(this);
282
283         jAdminHostTxt.setEditable(false);
284         jAdminHostTxt.setText(LOCALHOST);
285         jAdminHostTxt.addCaretListener(new javax.swing.event.CaretListener JavaDoc() {
286             public void caretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {
287                 jAdminHostTxtCaretUpdate(evt);
288             }
289         });
290
291         jAdminPortLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Port_Mnem").charAt(0));
292         jAdminPortLbl.setLabelFor(jAdminPortTxt);
293         jAdminPortLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelPort"));
294         jAdminPortLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelPort"));
295         jAdminPortLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelPort"));
296         jAdminPortLbl.getAccessibleContext().setAccessibleParent(this);
297
298         jAdminPortTxt.addCaretListener(new javax.swing.event.CaretListener JavaDoc() {
299             public void caretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {
300                 jAdminPortTxtCaretUpdate(evt);
301             }
302         });
303
304         jUserNameLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_UserName_Mnem").charAt(0));
305         jUserNameLbl.setLabelFor(jUserNameTxt);
306         jUserNameLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelUserName"));
307         jUserNameLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelUserName"));
308         jUserNameLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelUserName"));
309         jUserNameLbl.getAccessibleContext().setAccessibleParent(this);
310
311         jUserNameTxt.addCaretListener(new javax.swing.event.CaretListener JavaDoc() {
312             public void caretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {
313                 jUserNameTxtCaretUpdate(evt);
314             }
315         });
316
317         jPasswordLbl.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Password_Mnem").charAt(0));
318         jPasswordLbl.setLabelFor(jPasswordTxt);
319         jPasswordLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelPassword"));
320         jPasswordLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelPassword"));
321         jPasswordLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelPassword"));
322         jPasswordLbl.getAccessibleContext().setAccessibleParent(this);
323
324         jPasswordTxt.addFocusListener(new java.awt.event.FocusAdapter JavaDoc() {
325             public void focusGained(java.awt.event.FocusEvent JavaDoc evt) {
326                 jPasswordTxtFocusGained(evt);
327             }
328             public void focusLost(java.awt.event.FocusEvent JavaDoc evt) {
329                 jPasswordTxtFocusLost(evt);
330             }
331         });
332
333         jAdminInstructionsLbl.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelAdmin"));
334         jAdminInstructionsLbl.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelAdmin"));
335         jAdminInstructionsLbl.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelAdmin"));
336         jAdminInstructionsLbl.getAccessibleContext().setAccessibleParent(this);
337
338         jCBRemote.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_Remote_Mnem").charAt(0));
339         jCBRemote.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_RegisterRemoteServer"));
340         jCBRemote.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("ToolTip_RegisterRemoteServer"));
341         jCBRemote.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
342         jCBRemote.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
343         jCBRemote.addActionListener(new java.awt.event.ActionListener JavaDoc() {
344             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
345                 jCBRemoteActionPerformed(evt);
346             }
347         });
348         jCBRemote.addChangeListener(new javax.swing.event.ChangeListener JavaDoc() {
349             public void stateChanged(javax.swing.event.ChangeEvent JavaDoc evt) {
350                 jCBRemoteStateChanged(evt);
351             }
352         });
353
354         jCBSSLPort.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_SSL_Mnem").charAt(0));
355         jCBSSLPort.setSelected(true);
356         jCBSSLPort.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("LBL_AddServerVisualPanelSSLPort"));
357         jCBSSLPort.setToolTipText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("Tooltip_AddServerVisualPanelSSLPort"));
358         jCBSSLPort.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
359         jCBSSLPort.setMargin(new java.awt.Insets JavaDoc(0, 0, 0, 0));
360         jCBSSLPort.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_NAME_AddServerVisualPanelSSLPort"));
361         jCBSSLPort.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/sun/ws7/ui/Bundle").getString("A11Y_DESC_AddServerVisualPanelSSLPort"));
362         jCBSSLPort.getAccessibleContext().setAccessibleParent(this);
363
364         org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
365         this.setLayout(layout);
366         layout.setHorizontalGroup(
367             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
368             .add(layout.createSequentialGroup()
369                 .add(36, 36, 36)
370                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
371                     .add(jCBRemote)
372                     .add(layout.createSequentialGroup()
373                         .add(jAdminInstructionsLbl)
374                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 283, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
375                     .add(layout.createSequentialGroup()
376                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
377                             .add(jPasswordLbl)
378                             .add(jAdminHostLbl)
379                             .add(jAdminPortLbl)
380                             .add(jUserNameLbl))
381                         .add(31, 31, 31)
382                         .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
383                             .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
384                             .add(jUserNameTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
385                             .add(jAdminHostTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE)
386                             .add(layout.createSequentialGroup()
387                                 .add(jAdminPortTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
388                                 .add(25, 25, 25)
389                                 .add(jCBSSLPort, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
390                                 .add(84, 84, 84))))
391                     .add(layout.createSequentialGroup()
392                         .add(jDirectoryLbl)
393                         .add(16, 16, 16)
394                         .add(jLocationTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 176, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
395                         .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
396                         .add(jBrowseBtn))
397                     .add(jServerInstructionsLbl, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 350, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
398                     .add(jLabel2)
399                     .add(org.jdesktop.layout.GroupLayout.TRAILING, jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE))
400                 .addContainerGap())
401         );
402         layout.setVerticalGroup(
403             layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
404             .add(layout.createSequentialGroup()
405                 .add(25, 25, 25)
406                 .add(jServerInstructionsLbl)
407                 .add(16, 16, 16)
408                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
409                     .add(jLabel2)
410                     .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
411                         .add(jLocationTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
412                         .add(jDirectoryLbl)
413                         .add(jBrowseBtn)))
414                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
415                 .add(jCBRemote)
416                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
417                 .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
418                 .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
419                 .add(jAdminInstructionsLbl)
420                 .add(16, 16, 16)
421                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
422                     .add(jAdminHostTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
423                     .add(jAdminHostLbl))
424                 .add(15, 15, 15)
425                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
426                     .add(jAdminPortLbl)
427                     .add(jAdminPortTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
428                     .add(jCBSSLPort))
429                 .add(15, 15, 15)
430                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
431                     .add(jUserNameTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
432                     .add(jUserNameLbl))
433                 .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
434                     .add(layout.createSequentialGroup()
435                         .add(15, 15, 15)
436                         .add(jPasswordLbl))
437                     .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
438                         .add(15, 15, 15)
439                         .add(jPasswordTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 20, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
440                 .add(20, 20, 20))
441         );
442     }// </editor-fold>//GEN-END:initComponents
443

444     private void jCBRemoteStateChanged(javax.swing.event.ChangeEvent JavaDoc evt) {//GEN-FIRST:event_jCBRemoteStateChanged
445
if(!jCBRemote.isSelected()){
446             jAdminHostTxt.setText(LOCALHOST);
447             jAdminHostTxt.setEditable(false);
448         }else{
449             if(!jAdminHostTxt.isEditable()){
450                 jAdminHostTxt.setEditable(true);
451             }
452         }
453     }//GEN-LAST:event_jCBRemoteStateChanged
454

455     private void jCBRemoteActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jCBRemoteActionPerformed
456
// TODO add your handling code here:
457
}//GEN-LAST:event_jCBRemoteActionPerformed
458

459     private void jLocationTxtFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_jLocationTxtFocusLost
460
String JavaDoc dirName = jLocationTxt.getText().trim();
461         if (dirName.equals(this.installDirName) ) {
462             return;
463         }
464         installDirName = dirName;
465         fireChange();
466     }//GEN-LAST:event_jLocationTxtFocusLost
467

468     private void jLocationTxtFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_jLocationTxtFocusGained
469
String JavaDoc dirName = jLocationTxt.getText().trim();
470         if (dirName.equals(this.installDirName) ) {
471             return;
472         }
473         installDirName = dirName;
474         fireChange();
475     }//GEN-LAST:event_jLocationTxtFocusGained
476

477     private void jAdminHostTxtCaretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {//GEN-FIRST:event_jAdminHostTxtCaretUpdate
478
String JavaDoc host = jAdminHostTxt.getText().trim();
479         if (host.equals(this.hostName) ) {
480             return;
481         }
482         hostName = host;
483         fireChange();
484     }//GEN-LAST:event_jAdminHostTxtCaretUpdate
485

486     private void jAdminPortTxtCaretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {//GEN-FIRST:event_jAdminPortTxtCaretUpdate
487
String JavaDoc port = jAdminPortTxt.getText().trim();
488         if (port.equals(this.portNumber)) {
489             return;
490         }
491         portNumber = port;
492         fireChange();
493     }//GEN-LAST:event_jAdminPortTxtCaretUpdate
494

495     private void jUserNameTxtCaretUpdate(javax.swing.event.CaretEvent JavaDoc evt) {//GEN-FIRST:event_jUserNameTxtCaretUpdate
496
String JavaDoc uname = jUserNameTxt.getText().trim();
497         if (uname.equals(this.userName) ) {
498             return;
499         }
500         userName = uname;
501         fireChange();
502     }//GEN-LAST:event_jUserNameTxtCaretUpdate
503

504     private void jPasswordTxtFocusLost(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_jPasswordTxtFocusLost
505
String JavaDoc passwd = String.copyValueOf(jPasswordTxt.getPassword());
506         if (passwd.equals(this.password) ) {
507             return;
508         }
509         password = passwd;
510         fireChange();
511     }//GEN-LAST:event_jPasswordTxtFocusLost
512

513     private void jPasswordTxtFocusGained(java.awt.event.FocusEvent JavaDoc evt) {//GEN-FIRST:event_jPasswordTxtFocusGained
514
String JavaDoc passwd = String.copyValueOf(jPasswordTxt.getPassword());
515         if (passwd.equals(this.password) ) {
516             return;
517         }
518         password = passwd;
519         fireChange();
520     }//GEN-LAST:event_jPasswordTxtFocusGained
521

522     private void jBrowseBtnActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jBrowseBtnActionPerformed
523
JFileChooser JavaDoc chooser = new JFileChooser JavaDoc();
524         chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
525         File JavaDoc installDir = null;
526         if (installDir != null )
527             chooser.setSelectedFile(installDir);
528         boolean repeatchooser = true;
529         while ( repeatchooser ) {
530             repeatchooser = false;
531             if ( chooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION ) {
532                 installDir = chooser.getSelectedFile();
533                 if (isValidServer(installDir)){
534                     jLocationTxt.setText(installDir.getAbsolutePath());
535                     installDirName = installDir.getAbsolutePath();
536                 } else {
537                     Util.showError(NbBundle.getBundle(WS70AddServerChoiceVisualPanel.class).getString("MSG_INVALID_SERVER_DIRECTORY"));
538                     jLocationTxt.setText( "" ); // NOI18N
539
installDir = null;
540                     repeatchooser = true;
541                 }
542             }
543         }
544     }//GEN-LAST:event_jBrowseBtnActionPerformed
545

546     
547     // Variables declaration - do not modify//GEN-BEGIN:variables
548
private javax.swing.ButtonGroup JavaDoc buttonGroup1;
549     private javax.swing.ButtonGroup JavaDoc buttonGroup2;
550     private javax.swing.JLabel JavaDoc jAdminHostLbl;
551     private javax.swing.JTextField JavaDoc jAdminHostTxt;
552     private javax.swing.JLabel JavaDoc jAdminInstructionsLbl;
553     private javax.swing.JLabel JavaDoc jAdminPortLbl;
554     private javax.swing.JTextField JavaDoc jAdminPortTxt;
555     private javax.swing.JButton JavaDoc jBrowseBtn;
556     private javax.swing.JCheckBox JavaDoc jCBRemote;
557     private javax.swing.JCheckBox JavaDoc jCBSSLPort;
558     private javax.swing.JLabel JavaDoc jDirectoryLbl;
559     private javax.swing.JLabel JavaDoc jLabel2;
560     private javax.swing.JTextField JavaDoc jLocationTxt;
561     private javax.swing.JLabel JavaDoc jPasswordLbl;
562     private javax.swing.JPasswordField JavaDoc jPasswordTxt;
563     private javax.swing.JSeparator JavaDoc jSeparator1;
564     private javax.swing.JLabel JavaDoc jServerInstructionsLbl;
565     private javax.swing.JLabel JavaDoc jUserNameLbl;
566     private javax.swing.JTextField JavaDoc jUserNameTxt;
567     // End of variables declaration//GEN-END:variables
568

569 }
570
Popular Tags