1 19 20 23 24 package org.netbeans.modules.j2ee.sun.ws7.ui; 25 26 import javax.swing.JFileChooser ; 27 import java.io.File ; 28 import java.io.FileNotFoundException ; 29 import java.io.FileFilter ; 30 import javax.swing.event.ChangeEvent ; 31 import javax.swing.event.ChangeListener ; 32 import java.util.ArrayList ; 33 import java.util.List ; 34 import java.util.Iterator ; 35 36 import org.openide.util.NbBundle; 37 import org.openide.WizardDescriptor; 38 42 public class WS70AddServerChoiceVisualPanel extends javax.swing.JPanel { 43 private static final String LOCALHOST="localhost"; private String installDirName; 45 private String hostName=LOCALHOST; 46 private String portNumber; 47 private String userName; 48 private String password; 49 private final List listeners = new ArrayList (); 50 51 54 public WS70AddServerChoiceVisualPanel() { 55 initComponents(); 56 } 57 public String getAdminUserName(){ 58 return jUserNameTxt.getText().trim(); 59 } 60 public String getAdminPassword(){ 61 char[] password = jPasswordTxt.getPassword(); 62 return String.valueOf(password); 63 } 64 65 public String getAdminHost(){ 66 return jAdminHostTxt.getText().trim(); 67 } 68 public String getAdminPort(){ 69 return jAdminPortTxt.getText().trim(); 70 } 71 72 73 public String 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 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 (installDirName))){ 146 147 151 jLocationTxt.requestFocusInWindow(); 153 jLocationTxt.selectAll(); 154 return false; 155 } 156 return true; 157 } 158 159 private boolean isValidServer(File dir){ 160 FileFilter filter = new FileFilter () { 161 public boolean accept(File pathname) { 162 return pathname.isDirectory() && pathname.getName().equals("admin-server"); } 164 }; 165 File [] adminFolders = dir.listFiles( filter ); 166 if ( adminFolders == null || adminFolders.length == 0 ){ 167 return false; 168 } 169 170 File [] configFolders = adminFolders[0].listFiles( new FileFilter () { 171 public boolean accept(File pathname) { 172 return pathname.isDirectory() && pathname.getName().equals("config"); } 174 } ); 175 176 if ( configFolders == null || configFolders.length == 0 ){ 177 return false; 178 } 179 180 File [] serverFiles = configFolders[0].listFiles( new FileFilter () { 181 public boolean accept(File pathname) { 182 return pathname.getName().equals("server.xml"); } 184 } ); 185 if ( serverFiles == null || serverFiles.length == 0 ){ 186 return false; 187 } 188 return true; 189 } 190 public void addChangeListener(ChangeListener l) { 191 synchronized (listeners) { 192 listeners.add(l); 193 } 194 } 195 public String getName(){ 196 return NbBundle.getMessage(WS70AddServerChoiceVisualPanel.class, "LBL_AddServerWizardTitle"); 197 } 198 public void removeChangeListener(ChangeListener l) { 199 synchronized (listeners) { 200 listeners.remove(l); 201 } 202 } 203 private void fireChange() { 204 ChangeEvent event = new ChangeEvent (this); 205 ArrayList tempList; 206 207 synchronized(listeners) { 208 tempList = new ArrayList (listeners); 209 } 210 211 Iterator iter = tempList.iterator(); 212 while (iter.hasNext()) 213 ((ChangeListener )iter.next()).stateChanged(event); 214 } 215 216 217 222 private void initComponents() { 224 buttonGroup1 = new javax.swing.ButtonGroup (); 225 buttonGroup2 = new javax.swing.ButtonGroup (); 226 jServerInstructionsLbl = new javax.swing.JLabel (); 227 jLabel2 = new javax.swing.JLabel (); 228 jDirectoryLbl = new javax.swing.JLabel (); 229 jLocationTxt = new javax.swing.JTextField (); 230 jBrowseBtn = new javax.swing.JButton (); 231 jAdminHostLbl = new javax.swing.JLabel (); 232 jAdminHostTxt = new javax.swing.JTextField (); 233 jAdminPortLbl = new javax.swing.JLabel (); 234 jAdminPortTxt = new javax.swing.JTextField (); 235 jUserNameLbl = new javax.swing.JLabel (); 236 jUserNameTxt = new javax.swing.JTextField (); 237 jPasswordLbl = new javax.swing.JLabel (); 238 jPasswordTxt = new javax.swing.JPasswordField (); 239 jAdminInstructionsLbl = new javax.swing.JLabel (); 240 jCBRemote = new javax.swing.JCheckBox (); 241 jSeparator1 = new javax.swing.JSeparator (); 242 jCBSSLPort = new javax.swing.JCheckBox (); 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 () { 256 public void focusGained(java.awt.event.FocusEvent evt) { 257 jLocationTxtFocusGained(evt); 258 } 259 public void focusLost(java.awt.event.FocusEvent 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 () { 267 public void actionPerformed(java.awt.event.ActionEvent 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 () { 286 public void caretUpdate(javax.swing.event.CaretEvent 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 () { 299 public void caretUpdate(javax.swing.event.CaretEvent 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 () { 312 public void caretUpdate(javax.swing.event.CaretEvent 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 () { 325 public void focusGained(java.awt.event.FocusEvent evt) { 326 jPasswordTxtFocusGained(evt); 327 } 328 public void focusLost(java.awt.event.FocusEvent 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 (0, 0, 0, 0)); 343 jCBRemote.addActionListener(new java.awt.event.ActionListener () { 344 public void actionPerformed(java.awt.event.ActionEvent evt) { 345 jCBRemoteActionPerformed(evt); 346 } 347 }); 348 jCBRemote.addChangeListener(new javax.swing.event.ChangeListener () { 349 public void stateChanged(javax.swing.event.ChangeEvent 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 (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 } 444 private void jCBRemoteStateChanged(javax.swing.event.ChangeEvent evt) { if(!jCBRemote.isSelected()){ 446 jAdminHostTxt.setText(LOCALHOST); 447 jAdminHostTxt.setEditable(false); 448 }else{ 449 if(!jAdminHostTxt.isEditable()){ 450 jAdminHostTxt.setEditable(true); 451 } 452 } 453 } 455 private void jCBRemoteActionPerformed(java.awt.event.ActionEvent evt) { } 459 private void jLocationTxtFocusLost(java.awt.event.FocusEvent evt) { String dirName = jLocationTxt.getText().trim(); 461 if (dirName.equals(this.installDirName) ) { 462 return; 463 } 464 installDirName = dirName; 465 fireChange(); 466 } 468 private void jLocationTxtFocusGained(java.awt.event.FocusEvent evt) { String dirName = jLocationTxt.getText().trim(); 470 if (dirName.equals(this.installDirName) ) { 471 return; 472 } 473 installDirName = dirName; 474 fireChange(); 475 } 477 private void jAdminHostTxtCaretUpdate(javax.swing.event.CaretEvent evt) { String host = jAdminHostTxt.getText().trim(); 479 if (host.equals(this.hostName) ) { 480 return; 481 } 482 hostName = host; 483 fireChange(); 484 } 486 private void jAdminPortTxtCaretUpdate(javax.swing.event.CaretEvent evt) { String port = jAdminPortTxt.getText().trim(); 488 if (port.equals(this.portNumber)) { 489 return; 490 } 491 portNumber = port; 492 fireChange(); 493 } 495 private void jUserNameTxtCaretUpdate(javax.swing.event.CaretEvent evt) { String uname = jUserNameTxt.getText().trim(); 497 if (uname.equals(this.userName) ) { 498 return; 499 } 500 userName = uname; 501 fireChange(); 502 } 504 private void jPasswordTxtFocusLost(java.awt.event.FocusEvent evt) { String passwd = String.copyValueOf(jPasswordTxt.getPassword()); 506 if (passwd.equals(this.password) ) { 507 return; 508 } 509 password = passwd; 510 fireChange(); 511 } 513 private void jPasswordTxtFocusGained(java.awt.event.FocusEvent evt) { String passwd = String.copyValueOf(jPasswordTxt.getPassword()); 515 if (passwd.equals(this.password) ) { 516 return; 517 } 518 password = passwd; 519 fireChange(); 520 } 522 private void jBrowseBtnActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser chooser = new JFileChooser (); 524 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 525 File 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( "" ); installDir = null; 540 repeatchooser = true; 541 } 542 } 543 } 544 } 546 547 private javax.swing.ButtonGroup buttonGroup1; 549 private javax.swing.ButtonGroup buttonGroup2; 550 private javax.swing.JLabel jAdminHostLbl; 551 private javax.swing.JTextField jAdminHostTxt; 552 private javax.swing.JLabel jAdminInstructionsLbl; 553 private javax.swing.JLabel jAdminPortLbl; 554 private javax.swing.JTextField jAdminPortTxt; 555 private javax.swing.JButton jBrowseBtn; 556 private javax.swing.JCheckBox jCBRemote; 557 private javax.swing.JCheckBox jCBSSLPort; 558 private javax.swing.JLabel jDirectoryLbl; 559 private javax.swing.JLabel jLabel2; 560 private javax.swing.JTextField jLocationTxt; 561 private javax.swing.JLabel jPasswordLbl; 562 private javax.swing.JPasswordField jPasswordTxt; 563 private javax.swing.JSeparator jSeparator1; 564 private javax.swing.JLabel jServerInstructionsLbl; 565 private javax.swing.JLabel jUserNameLbl; 566 private javax.swing.JTextField jUserNameTxt; 567 569 } 570 | Popular Tags |