Lines 44-52
Link Here
|
44 |
import java.awt.event.FocusEvent; |
44 |
import java.awt.event.FocusEvent; |
45 |
import java.awt.event.FocusListener; |
45 |
import java.awt.event.FocusListener; |
46 |
import java.awt.event.ItemEvent; |
46 |
import java.awt.event.ItemEvent; |
|
|
47 |
import java.io.IOException; |
47 |
import java.net.MalformedURLException; |
48 |
import java.net.MalformedURLException; |
|
|
49 |
import java.util.HashSet; |
48 |
import java.util.LinkedHashMap; |
50 |
import java.util.LinkedHashMap; |
49 |
import java.util.Map.Entry; |
51 |
import java.util.Map.Entry; |
|
|
52 |
import java.util.Set; |
50 |
import java.util.logging.Level; |
53 |
import java.util.logging.Level; |
51 |
import java.util.logging.Logger; |
54 |
import java.util.logging.Logger; |
52 |
import javax.swing.JComboBox; |
55 |
import javax.swing.JComboBox; |
Lines 65-72
Link Here
|
65 |
import org.netbeans.api.db.explorer.JDBCDriverManager; |
68 |
import org.netbeans.api.db.explorer.JDBCDriverManager; |
66 |
import org.netbeans.api.progress.ProgressHandle; |
69 |
import org.netbeans.api.progress.ProgressHandle; |
67 |
import org.netbeans.api.progress.ProgressHandleFactory; |
70 |
import org.netbeans.api.progress.ProgressHandleFactory; |
|
|
71 |
import org.netbeans.lib.ddl.DBConnection; |
72 |
import org.netbeans.modules.db.explorer.DatabaseConnectionConvertor; |
68 |
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs; |
73 |
import org.netbeans.modules.db.util.DatabaseExplorerInternalUIs; |
69 |
import org.netbeans.modules.db.util.JdbcUrl; |
74 |
import org.netbeans.modules.db.util.JdbcUrl; |
|
|
75 |
import org.openide.filesystems.FileObject; |
76 |
import org.openide.filesystems.FileUtil; |
77 |
import org.openide.loaders.DataObject; |
78 |
import org.openide.util.Exceptions; |
70 |
import org.openide.util.NbBundle; |
79 |
import org.openide.util.NbBundle; |
71 |
|
80 |
|
72 |
public class NewConnectionPanel extends ConnectionDialog.FocusablePanel { |
81 |
public class NewConnectionPanel extends ConnectionDialog.FocusablePanel { |
Lines 89-94
Link Here
|
89 |
private final LinkedHashMap<String, UrlField> urlFields = |
98 |
private final LinkedHashMap<String, UrlField> urlFields = |
90 |
new LinkedHashMap<String, UrlField>(); |
99 |
new LinkedHashMap<String, UrlField>(); |
91 |
|
100 |
|
|
|
101 |
private Set<String> knownConnectionNames = new HashSet<String>(); |
102 |
|
92 |
private static final String BUNDLE = "org.netbeans.modules.db.resources.Bundle"; //NOI18N |
103 |
private static final String BUNDLE = "org.netbeans.modules.db.resources.Bundle"; //NOI18N |
93 |
|
104 |
|
94 |
private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName()); |
105 |
private static final Logger LOGGER = Logger.getLogger(NewConnectionPanel.class.getName()); |
Lines 96-101
Link Here
|
96 |
private void initFieldMap() { |
107 |
private void initFieldMap() { |
97 |
// These should be in the order of display on the form, so that we correctly |
108 |
// These should be in the order of display on the form, so that we correctly |
98 |
// put focus on the first visible field. |
109 |
// put focus on the first visible field. |
|
|
110 |
urlFields.put(JdbcUrl.TOKEN_DISPLAY_NAME, new UrlField(displayNameField, displayNameLabel)); |
99 |
urlFields.put(JdbcUrl.TOKEN_HOST, new UrlField(hostField, hostLabel)); |
111 |
urlFields.put(JdbcUrl.TOKEN_HOST, new UrlField(hostField, hostLabel)); |
100 |
urlFields.put(JdbcUrl.TOKEN_PORT, new UrlField(portField, portLabel)); |
112 |
urlFields.put(JdbcUrl.TOKEN_PORT, new UrlField(portField, portLabel)); |
101 |
urlFields.put(JdbcUrl.TOKEN_DB, new UrlField(databaseField, databaseLabel)); |
113 |
urlFields.put(JdbcUrl.TOKEN_DB, new UrlField(databaseField, databaseLabel)); |
Lines 142-148
Link Here
|
142 |
userField.setText(connection.getUser()); |
154 |
userField.setText(connection.getUser()); |
143 |
|
155 |
|
144 |
passwordField.setText(connection.getPassword()); |
156 |
passwordField.setText(connection.getPassword()); |
145 |
|
157 |
|
|
|
158 |
if (!connection.getDisplayName().equals(connection.getName())) { |
159 |
displayNameField.setText(connection.getDisplayName()); |
160 |
} |
161 |
|
146 |
String driver = connection.getDriver(); |
162 |
String driver = connection.getDriver(); |
147 |
String driverName = connection.getDriverName(); |
163 |
String driverName = connection.getDriverName(); |
148 |
if (driver != null && driverName != null) { |
164 |
if (driver != null && driverName != null) { |
Lines 227-232
Link Here
|
227 |
|
243 |
|
228 |
userField.getDocument().addDocumentListener(docListener); |
244 |
userField.getDocument().addDocumentListener(docListener); |
229 |
passwordField.getDocument().addDocumentListener(docListener); |
245 |
passwordField.getDocument().addDocumentListener(docListener); |
|
|
246 |
|
247 |
initKnownConnectionNames(); |
248 |
} |
249 |
|
250 |
private void initKnownConnectionNames() { |
251 |
FileObject configFile = FileUtil.getConfigFile(DatabaseConnectionConvertor.CONNECTIONS_PATH); |
252 |
for (FileObject o : configFile.getChildren()) { |
253 |
if ("text/xml".equals(o.getMIMEType())) { |
254 |
try { |
255 |
DatabaseConnectionConvertor connectionWrapper = DataObject.find(o).getLookup().lookup(DatabaseConnectionConvertor.class); |
256 |
if (connectionWrapper != null) { |
257 |
DBConnection knownConnection = (DBConnection) connectionWrapper.instanceCreate(); |
258 |
String displayName = knownConnection.getDisplayName(); |
259 |
if (!displayName.equals(knownConnection.getName())) { |
260 |
knownConnectionNames.add(displayName); |
261 |
} |
262 |
} |
263 |
} catch (IOException ex) { |
264 |
Exceptions.printStackTrace(ex); |
265 |
} catch (ClassNotFoundException ex) { |
266 |
Exceptions.printStackTrace(ex); |
267 |
} |
268 |
} |
269 |
} |
230 |
} |
270 |
} |
231 |
|
271 |
|
232 |
public void setWindow(Window window) { |
272 |
public void setWindow(Window window) { |
Lines 236-241
Link Here
|
236 |
private void initAccessibility() { |
276 |
private void initAccessibility() { |
237 |
templateLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameA11yDesc")); //NOI18N |
277 |
templateLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameA11yDesc")); //NOI18N |
238 |
templateComboBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameComboBoxA11yName")); //NOI18N |
278 |
templateComboBox.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDriverNameComboBoxA11yName")); //NOI18N |
|
|
279 |
displayNameLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameA11yDesc")); //NOI18N |
280 |
displayNameField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameTextFieldA11yName")); //NOI18N |
239 |
userLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameA11yDesc")); //NOI18N |
281 |
userLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameA11yDesc")); //NOI18N |
240 |
userField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameTextFieldA11yName")); //NOI18N |
282 |
userField.getAccessibleContext().setAccessibleName(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionUserNameTextFieldA11yName")); //NOI18N |
241 |
passwordLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionPasswordA11yDesc")); //NOI18N |
283 |
passwordLabel.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionPasswordA11yDesc")); //NOI18N |
Lines 295-300
Link Here
|
295 |
serverNameField = new javax.swing.JTextField(); |
337 |
serverNameField = new javax.swing.JTextField(); |
296 |
instanceLabel = new javax.swing.JLabel(); |
338 |
instanceLabel = new javax.swing.JLabel(); |
297 |
instanceField = new javax.swing.JTextField(); |
339 |
instanceField = new javax.swing.JTextField(); |
|
|
340 |
displayNameLabel = new javax.swing.JLabel(); |
341 |
displayNameField = new javax.swing.JTextField(); |
298 |
userLabel = new javax.swing.JLabel(); |
342 |
userLabel = new javax.swing.JLabel(); |
299 |
userField = new javax.swing.JTextField(); |
343 |
userField = new javax.swing.JTextField(); |
300 |
passwordLabel = new javax.swing.JLabel(); |
344 |
passwordLabel = new javax.swing.JLabel(); |
Lines 368-373
Link Here
|
368 |
|
412 |
|
369 |
instanceField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionInstanceNameA11yDesc")); // NOI18N |
413 |
instanceField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionInstanceNameA11yDesc")); // NOI18N |
370 |
|
414 |
|
|
|
415 |
displayNameLabel.setLabelFor(displayNameField); |
416 |
org.openide.awt.Mnemonics.setLocalizedText(displayNameLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionDisplayName")); // NOI18N |
417 |
|
418 |
displayNameField.setToolTipText(org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "ACS_NewConnectionDisplayNameA11yDesc")); // NOI18N |
419 |
displayNameField.setFocusCycleRoot(true); |
420 |
|
371 |
userLabel.setLabelFor(userField); |
421 |
userLabel.setLabelFor(userField); |
372 |
org.openide.awt.Mnemonics.setLocalizedText(userLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionUserName")); // NOI18N |
422 |
org.openide.awt.Mnemonics.setLocalizedText(userLabel, org.openide.util.NbBundle.getMessage(NewConnectionPanel.class, "NewConnectionUserName")); // NOI18N |
373 |
|
423 |
|
Lines 438-472
Link Here
|
438 |
.addContainerGap() |
488 |
.addContainerGap() |
439 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
489 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
440 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
490 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
|
491 |
.add(errorInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE) |
441 |
.add(layout.createSequentialGroup() |
492 |
.add(layout.createSequentialGroup() |
442 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
493 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
443 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
494 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
444 |
.add(inputModelLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
495 |
.add(layout.createSequentialGroup() |
445 |
.add(templateLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
496 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
446 |
.add(hostLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
497 |
.add(showUrlCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
447 |
.add(portLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
498 |
.add(directUrlLabel)) |
448 |
.add(databaseLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
499 |
.add(12, 12, 12)) |
449 |
.add(passwordLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
500 |
.add(layout.createSequentialGroup() |
450 |
.add(userLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
501 |
.add(additionalPropsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE) |
451 |
.add(instanceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
502 |
.add(24, 24, 24))) |
452 |
.add(serverNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
503 |
.add(layout.createSequentialGroup() |
453 |
.add(dsnLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
504 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) |
454 |
.add(tnsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
505 |
.add(org.jdesktop.layout.GroupLayout.LEADING, displayNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
455 |
.add(serviceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
506 |
.add(org.jdesktop.layout.GroupLayout.LEADING, inputModelLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
456 |
.add(sidLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE)) |
507 |
.add(org.jdesktop.layout.GroupLayout.LEADING, templateLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
457 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
508 |
.add(org.jdesktop.layout.GroupLayout.LEADING, portLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
458 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
509 |
.add(org.jdesktop.layout.GroupLayout.LEADING, databaseLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
459 |
.add(directUrlLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
510 |
.add(org.jdesktop.layout.GroupLayout.LEADING, passwordLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
460 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, showUrlCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 132, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) |
511 |
.add(org.jdesktop.layout.GroupLayout.LEADING, userLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
461 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
512 |
.add(org.jdesktop.layout.GroupLayout.LEADING, instanceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
|
513 |
.add(org.jdesktop.layout.GroupLayout.LEADING, serverNameLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
514 |
.add(org.jdesktop.layout.GroupLayout.LEADING, dsnLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
515 |
.add(org.jdesktop.layout.GroupLayout.LEADING, tnsLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
516 |
.add(org.jdesktop.layout.GroupLayout.LEADING, serviceLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
517 |
.add(org.jdesktop.layout.GroupLayout.LEADING, sidLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE) |
518 |
.add(org.jdesktop.layout.GroupLayout.LEADING, hostLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
519 |
.add(25, 25, 25))) |
462 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
520 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
463 |
.add(urlField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
521 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, urlField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
464 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
522 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, additionalPropsField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
465 |
.add(layout.createSequentialGroup() |
523 |
.add(layout.createSequentialGroup() |
466 |
.add(fieldInputCheckBox) |
524 |
.add(fieldInputCheckBox) |
467 |
.add(18, 18, 18) |
525 |
.add(18, 18, 18) |
468 |
.add(directInputCheckBox)) |
526 |
.add(directInputCheckBox)) |
469 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, templateComboBox, 0, 532, Short.MAX_VALUE) |
527 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, templateComboBox, 0, 532, Short.MAX_VALUE) |
|
|
528 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, displayNameField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
470 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, hostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
529 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, hostField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
471 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, portField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
530 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, portField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
472 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, databaseField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
531 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, databaseField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
Lines 478-488
Link Here
|
478 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, instanceField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
537 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, instanceField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
479 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
538 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, userField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
480 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
539 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, passwordField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
481 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() |
540 |
.add(passwordCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE) |
482 |
.add(passwordCheckBox, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE) |
541 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, directUrlScroll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE)))) |
483 |
.add(139, 139, 139)) |
|
|
484 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, directUrlScroll, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 532, Short.MAX_VALUE))) |
485 |
.add(errorInfoPanel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 676, Short.MAX_VALUE)) |
486 |
.addContainerGap()) |
542 |
.addContainerGap()) |
487 |
); |
543 |
); |
488 |
layout.setVerticalGroup( |
544 |
layout.setVerticalGroup( |
Lines 499-504
Link Here
|
499 |
.add(templateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
555 |
.add(templateComboBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
500 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
556 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
501 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
557 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|
|
558 |
.add(displayNameField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
559 |
.add(displayNameLabel)) |
560 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
561 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
502 |
.add(hostLabel) |
562 |
.add(hostLabel) |
503 |
.add(hostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
563 |
.add(hostField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
504 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
564 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
Lines 541-566
Link Here
|
541 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
601 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
542 |
.add(passwordLabel) |
602 |
.add(passwordLabel) |
543 |
.add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
603 |
.add(passwordField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
544 |
.add(5, 5, 5) |
604 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
545 |
.add(passwordCheckBox) |
605 |
.add(passwordCheckBox) |
546 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
|
|
547 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
548 |
.add(additionalPropsLabel) |
549 |
.add(additionalPropsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
550 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
606 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
551 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
607 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
552 |
.add(urlField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
608 |
.add(additionalPropsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
553 |
.add(showUrlCheckBox)) |
609 |
.add(additionalPropsLabel)) |
554 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
610 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
611 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
612 |
.add(showUrlCheckBox) |
613 |
.add(urlField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
614 |
.add(5, 5, 5) |
555 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
615 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
556 |
.add(directUrlLabel) |
616 |
.add(directUrlLabel) |
557 |
.add(directUrlScroll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
617 |
.add(directUrlScroll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|
|
618 |
.add(9, 9, 9) |
619 |
.add(errorInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
558 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
620 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
559 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
621 |
.add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
560 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
622 |
.addContainerGap(138, Short.MAX_VALUE)) |
561 |
.add(errorInfoPanel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
|
|
562 |
.addContainerGap(161, Short.MAX_VALUE)) |
563 |
); |
623 |
); |
|
|
624 |
|
625 |
displayNameLabel.getAccessibleContext().setAccessibleName("Displa&y name."); |
564 |
} |
626 |
} |
565 |
|
627 |
|
566 |
// Code for dispatching events from components to event handlers. |
628 |
// Code for dispatching events from components to event handlers. |
Lines 698-703
Link Here
|
698 |
private javax.swing.JTextArea directUrlField; |
760 |
private javax.swing.JTextArea directUrlField; |
699 |
private javax.swing.JLabel directUrlLabel; |
761 |
private javax.swing.JLabel directUrlLabel; |
700 |
private javax.swing.JScrollPane directUrlScroll; |
762 |
private javax.swing.JScrollPane directUrlScroll; |
|
|
763 |
private javax.swing.JTextField displayNameField; |
764 |
private javax.swing.JLabel displayNameLabel; |
701 |
private javax.swing.JTextField dsnField; |
765 |
private javax.swing.JTextField dsnField; |
702 |
private javax.swing.JLabel dsnLabel; |
766 |
private javax.swing.JLabel dsnLabel; |
703 |
private org.netbeans.modules.db.util.ErrorInfoPanel errorInfoPanel; |
767 |
private org.netbeans.modules.db.util.ErrorInfoPanel errorInfoPanel; |
Lines 736-742
Link Here
|
736 |
JDBCDriver driver = url.getDriver(); |
800 |
JDBCDriver driver = url.getDriver(); |
737 |
assert(driver != null); |
801 |
assert(driver != null); |
738 |
connection.setDriverName(driver.getName()); |
802 |
connection.setDriverName(driver.getName()); |
739 |
connection.setDriver(driver.getClassName()); |
803 |
connection.setDriver(driver.getClassName()); |
740 |
} |
804 |
} |
741 |
|
805 |
|
742 |
if (fieldEntryMode) { |
806 |
if (fieldEntryMode) { |
Lines 748-753
Link Here
|
748 |
connection.setUser(userField.getText()); |
812 |
connection.setUser(userField.getText()); |
749 |
connection.setPassword(getPassword()); |
813 |
connection.setPassword(getPassword()); |
750 |
connection.setRememberPassword(passwordCheckBox.isSelected()); |
814 |
connection.setRememberPassword(passwordCheckBox.isSelected()); |
|
|
815 |
connection.setDisplayName(displayNameField.getText()); |
751 |
} |
816 |
} |
752 |
|
817 |
|
753 |
private void resize() { |
818 |
private void resize() { |
Lines 841-846
Link Here
|
841 |
entry.getValue().getLabel().setVisible(false); |
906 |
entry.getValue().getLabel().setVisible(false); |
842 |
} |
907 |
} |
843 |
} |
908 |
} |
|
|
909 |
displayNameField.setVisible(true); |
910 |
displayNameLabel.setVisible(true); |
844 |
|
911 |
|
845 |
setFocus(); |
912 |
setFocus(); |
846 |
checkValid(); |
913 |
checkValid(); |
Lines 947-952
Link Here
|
947 |
} |
1014 |
} |
948 |
|
1015 |
|
949 |
private void enableInput(boolean enable) { |
1016 |
private void enableInput(boolean enable) { |
|
|
1017 |
displayNameField.setEnabled(enable); |
950 |
fieldInputCheckBox.setEnabled(enable); |
1018 |
fieldInputCheckBox.setEnabled(enable); |
951 |
directInputCheckBox.setEnabled(enable); |
1019 |
directInputCheckBox.setEnabled(enable); |
952 |
templateComboBox.setEnabled(enable); |
1020 |
templateComboBox.setEnabled(enable); |
Lines 1033-1038
Link Here
|
1033 |
displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_SpecifyURL"), false); |
1101 |
displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_SpecifyURL"), false); |
1034 |
} |
1102 |
} |
1035 |
} |
1103 |
} |
|
|
1104 |
if (knownConnectionNames.contains(displayNameField.getText().trim())) { |
1105 |
displayError(NbBundle.getMessage(NewConnectionPanel.class, "NewConnection.MSG_DuplicateDisplayName"), false); |
1106 |
} |
1036 |
} |
1107 |
} |
1037 |
|
1108 |
|
1038 |
private boolean isEmpty(String str) { |
1109 |
private boolean isEmpty(String str) { |