Lines 53-58
Link Here
|
53 |
import java.util.HashSet; |
53 |
import java.util.HashSet; |
54 |
import java.util.LinkedHashMap; |
54 |
import java.util.LinkedHashMap; |
55 |
import java.util.Map.Entry; |
55 |
import java.util.Map.Entry; |
|
|
56 |
import java.util.Properties; |
56 |
import java.util.Set; |
57 |
import java.util.Set; |
57 |
import java.util.logging.Level; |
58 |
import java.util.logging.Level; |
58 |
import java.util.logging.Logger; |
59 |
import java.util.logging.Logger; |
Lines 75-80
Link Here
|
75 |
import org.netbeans.modules.db.explorer.ConnectionList; |
76 |
import org.netbeans.modules.db.explorer.ConnectionList; |
76 |
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs; |
77 |
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs; |
77 |
import org.netbeans.modules.db.util.JdbcUrl; |
78 |
import org.netbeans.modules.db.util.JdbcUrl; |
|
|
79 |
import org.netbeans.modules.db.util.PropertyEditorPanel; |
80 |
import org.openide.DialogDescriptor; |
81 |
import org.openide.DialogDisplayer; |
82 |
import org.openide.NotifyDescriptor; |
78 |
import org.openide.WizardValidationException; |
83 |
import org.openide.WizardValidationException; |
79 |
import org.openide.util.NbBundle; |
84 |
import org.openide.util.NbBundle; |
80 |
import org.openide.util.RequestProcessor; |
85 |
import org.openide.util.RequestProcessor; |
Lines 93-98
Link Here
|
93 |
private Set<String> knownConnectionNames = new HashSet<String>(); |
98 |
private Set<String> knownConnectionNames = new HashSet<String>(); |
94 |
private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName()); |
99 |
private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName()); |
95 |
private final ConnectionPanel wp; |
100 |
private final ConnectionPanel wp; |
|
|
101 |
private Properties connectionProperties = new Properties(); |
96 |
|
102 |
|
97 |
private void initFieldMap() { |
103 |
private void initFieldMap() { |
98 |
// These should be in the order of display on the form, so that we correctly |
104 |
// These should be in the order of display on the form, so that we correctly |
Lines 211-216
Link Here
|
211 |
setUrlField(); |
217 |
setUrlField(); |
212 |
updateFieldsFromUrl(); |
218 |
updateFieldsFromUrl(); |
213 |
setUpFields(); |
219 |
setUpFields(); |
|
|
220 |
connectionProperties = connection.getConnectionProperties(); |
214 |
|
221 |
|
215 |
DocumentListener docListener = new DocumentListener() { |
222 |
DocumentListener docListener = new DocumentListener() { |
216 |
|
223 |
|
Lines 312-317
Link Here
|
312 |
passwordCheckBox = new javax.swing.JCheckBox(); |
319 |
passwordCheckBox = new javax.swing.JCheckBox(); |
313 |
directUrlLabel = new javax.swing.JLabel(); |
320 |
directUrlLabel = new javax.swing.JLabel(); |
314 |
bTestConnection = new javax.swing.JButton(); |
321 |
bTestConnection = new javax.swing.JButton(); |
|
|
322 |
bConnectionProperties = new javax.swing.JButton(); |
315 |
|
323 |
|
316 |
FormListener formListener = new FormListener(); |
324 |
FormListener formListener = new FormListener(); |
317 |
|
325 |
|
Lines 392-397
Link Here
|
392 |
org.openide.awt.Mnemonics.setLocalizedText(bTestConnection, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.bTestConnection")); // NOI18N |
400 |
org.openide.awt.Mnemonics.setLocalizedText(bTestConnection, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.bTestConnection")); // NOI18N |
393 |
bTestConnection.addActionListener(formListener); |
401 |
bTestConnection.addActionListener(formListener); |
394 |
|
402 |
|
|
|
403 |
org.openide.awt.Mnemonics.setLocalizedText(bConnectionProperties, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.bConnectionProperties")); // NOI18N |
404 |
bConnectionProperties.addActionListener(formListener); |
405 |
|
395 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
406 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
396 |
this.setLayout(layout); |
407 |
this.setLayout(layout); |
397 |
layout.setHorizontalGroup( |
408 |
layout.setHorizontalGroup( |
Lines 399-405
Link Here
|
399 |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() |
410 |
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() |
400 |
.addContainerGap() |
411 |
.addContainerGap() |
401 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) |
412 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) |
402 |
.addGroup(layout.createSequentialGroup() |
413 |
.addComponent(directUrlLabel, javax.swing.GroupLayout.Alignment.LEADING) |
|
|
414 |
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() |
403 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
415 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
404 |
.addComponent(hostLabel) |
416 |
.addComponent(hostLabel) |
405 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) |
417 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) |
Lines 416-441
Link Here
|
416 |
.addComponent(userLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
428 |
.addComponent(userLabel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
417 |
.addGap(8, 8, 8) |
429 |
.addGap(8, 8, 8) |
418 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
430 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
419 |
.addComponent(userField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
|
|
420 |
.addComponent(sidField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
421 |
.addComponent(serviceField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
422 |
.addComponent(tnsField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
423 |
.addComponent(dsnField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
424 |
.addComponent(serverNameField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
425 |
.addComponent(instanceField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
426 |
.addGroup(layout.createSequentialGroup() |
431 |
.addGroup(layout.createSequentialGroup() |
427 |
.addComponent(hostField, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE) |
432 |
.addComponent(bConnectionProperties) |
428 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
433 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
|
|
434 |
.addComponent(bTestConnection) |
435 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 100, Short.MAX_VALUE)) |
436 |
.addComponent(userField, javax.swing.GroupLayout.Alignment.TRAILING) |
437 |
.addComponent(sidField) |
438 |
.addComponent(serviceField) |
439 |
.addComponent(tnsField) |
440 |
.addComponent(dsnField) |
441 |
.addComponent(serverNameField) |
442 |
.addComponent(instanceField) |
443 |
.addGroup(layout.createSequentialGroup() |
444 |
.addComponent(hostField) |
445 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
429 |
.addComponent(portLabel) |
446 |
.addComponent(portLabel) |
430 |
.addGap(2, 2, 2) |
447 |
.addGap(2, 2, 2) |
431 |
.addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)) |
448 |
.addComponent(portField, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE)) |
432 |
.addComponent(databaseField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
449 |
.addComponent(databaseField, javax.swing.GroupLayout.Alignment.TRAILING) |
433 |
.addComponent(passwordField, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
450 |
.addComponent(passwordField) |
434 |
.addComponent(bTestConnection) |
451 |
.addComponent(urlField, javax.swing.GroupLayout.Alignment.TRAILING) |
|
|
452 |
.addComponent(templateComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
453 |
.addGroup(layout.createSequentialGroup() |
435 |
.addComponent(passwordCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE) |
454 |
.addComponent(passwordCheckBox, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE) |
436 |
.addComponent(urlField, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE) |
455 |
.addGap(0, 0, Short.MAX_VALUE))))) |
437 |
.addComponent(templateComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, 383, Short.MAX_VALUE))) |
|
|
438 |
.addComponent(directUrlLabel, javax.swing.GroupLayout.Alignment.LEADING)) |
439 |
.addContainerGap()) |
456 |
.addContainerGap()) |
440 |
); |
457 |
); |
441 |
layout.setVerticalGroup( |
458 |
layout.setVerticalGroup( |
Lines 492-498
Link Here
|
492 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
509 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
493 |
.addComponent(passwordCheckBox) |
510 |
.addComponent(passwordCheckBox) |
494 |
.addGap(26, 26, 26) |
511 |
.addGap(26, 26, 26) |
|
|
512 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
495 |
.addComponent(bTestConnection) |
513 |
.addComponent(bTestConnection) |
|
|
514 |
.addComponent(bConnectionProperties)) |
496 |
.addGap(18, 18, 18) |
515 |
.addGap(18, 18, 18) |
497 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
516 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) |
498 |
.addComponent(urlField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
517 |
.addComponent(urlField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
Lines 519-525
Link Here
|
519 |
else if (evt.getSource() == bTestConnection) { |
538 |
else if (evt.getSource() == bTestConnection) { |
520 |
NewConnectionPanel.this.bTestConnectionActionPerformed(evt); |
539 |
NewConnectionPanel.this.bTestConnectionActionPerformed(evt); |
521 |
} |
540 |
} |
|
|
541 |
else if (evt.getSource() == bConnectionProperties) { |
542 |
NewConnectionPanel.this.bConnectionPropertiesActionPerformed(evt); |
522 |
} |
543 |
} |
|
|
544 |
} |
523 |
|
545 |
|
524 |
public void focusGained(java.awt.event.FocusEvent evt) { |
546 |
public void focusGained(java.awt.event.FocusEvent evt) { |
525 |
} |
547 |
} |
Lines 590-596
Link Here
|
590 |
private void bTestConnectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bTestConnectionActionPerformed |
612 |
private void bTestConnectionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bTestConnectionActionPerformed |
591 |
tryConnection(); |
613 |
tryConnection(); |
592 |
}//GEN-LAST:event_bTestConnectionActionPerformed |
614 |
}//GEN-LAST:event_bTestConnectionActionPerformed |
|
|
615 |
|
616 |
private void bConnectionPropertiesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bConnectionPropertiesActionPerformed |
617 |
PropertyEditorPanel pep = new PropertyEditorPanel(connectionProperties, true); |
618 |
DialogDescriptor dd = new DialogDescriptor( |
619 |
pep, |
620 |
NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionPanel.dlgConnectionProperties"), |
621 |
true, |
622 |
null); |
623 |
Object result = DialogDisplayer.getDefault().notify(dd); |
624 |
if(result == NotifyDescriptor.OK_OPTION) { |
625 |
connectionProperties = pep.getValue(); |
626 |
} |
627 |
}//GEN-LAST:event_bConnectionPropertiesActionPerformed |
628 |
|
593 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
629 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
|
|
630 |
private javax.swing.JButton bConnectionProperties; |
594 |
private javax.swing.JButton bTestConnection; |
631 |
private javax.swing.JButton bTestConnection; |
595 |
private javax.swing.JTextField databaseField; |
632 |
private javax.swing.JTextField databaseField; |
596 |
private javax.swing.JLabel databaseLabel; |
633 |
private javax.swing.JLabel databaseLabel; |
Lines 632-641
Link Here
|
632 |
} |
669 |
} |
633 |
|
670 |
|
634 |
connection.setDatabase(urlField.getText()); |
671 |
connection.setDatabase(urlField.getText()); |
635 |
|
|
|
636 |
connection.setUser(userField.getText()); |
672 |
connection.setUser(userField.getText()); |
637 |
connection.setPassword(getPassword()); |
673 |
connection.setPassword(getPassword()); |
638 |
connection.setRememberPassword(passwordCheckBox.isSelected()); |
674 |
connection.setRememberPassword(passwordCheckBox.isSelected()); |
|
|
675 |
connection.setConnectionProperties(connectionProperties); |
639 |
} |
676 |
} |
640 |
|
677 |
|
641 |
private void resize() { |
678 |
private void resize() { |
Lines 816-821
Link Here
|
816 |
passwordCheckBox.setEnabled(enable); |
853 |
passwordCheckBox.setEnabled(enable); |
817 |
urlField.setEnabled(enable); |
854 |
urlField.setEnabled(enable); |
818 |
bTestConnection.setEnabled(enable); |
855 |
bTestConnection.setEnabled(enable); |
|
|
856 |
bConnectionProperties.setEnabled(enable); |
819 |
|
857 |
|
820 |
for (Entry<String, UrlField> entry : urlFields.entrySet()) { |
858 |
for (Entry<String, UrlField> entry : urlFields.entrySet()) { |
821 |
entry.getValue().getField().setEnabled(enable); |
859 |
entry.getValue().getField().setEnabled(enable); |