This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 197408
Collapse All | Expand All

(-)db/libsrc/org/netbeans/lib/ddl/DBConnection.java (+4 lines)
Lines 45-50 Link Here
45
package org.netbeans.lib.ddl;
45
package org.netbeans.lib.ddl;
46
46
47
import java.sql.Connection;
47
import java.sql.Connection;
48
import java.util.Properties;
48
49
49
/**
50
/**
50
* Connection information.
51
* Connection information.
Lines 143-146 Link Here
143
    * driver or database does not exist or is inaccessible.
144
    * driver or database does not exist or is inaccessible.
144
    */
145
    */
145
    public Connection createJDBCConnection() throws DDLException;
146
    public Connection createJDBCConnection() throws DDLException;
147
148
    public void setConnectionProperties(Properties connectionProperties);
149
    public Properties getConnectionProperties();
146
}
150
}
(-)db/src/org/netbeans/api/db/explorer/DatabaseConnection.java (+10 lines)
Lines 45-50 Link Here
45
package org.netbeans.api.db.explorer;
45
package org.netbeans.api.db.explorer;
46
46
47
import java.sql.Connection;
47
import java.sql.Connection;
48
import java.util.Properties;
48
import javax.swing.SwingUtilities;
49
import javax.swing.SwingUtilities;
49
import org.netbeans.modules.db.explorer.ConnectionList;
50
import org.netbeans.modules.db.explorer.ConnectionList;
50
import org.netbeans.modules.db.explorer.DatabaseConnectionAccessor;
51
import org.netbeans.modules.db.explorer.DatabaseConnectionAccessor;
Lines 237-242 Link Here
237
    }
238
    }
238
    
239
    
239
    /**
240
    /**
241
     * Returns the connection properties for the connection
242
     * 
243
     * @return the connection properties (maybe null)
244
     */
245
    public Properties getConnectionProperties() {
246
        return delegate.getConnectionProperties();
247
    }
248
    
249
    /**
240
     * Returns the {@link java.sql.Connection} instance which encapsulates 
250
     * Returns the {@link java.sql.Connection} instance which encapsulates 
241
     * the physical connection to the database if this database connection
251
     * the physical connection to the database if this database connection
242
     * is connected. Note that "connected" here means "connected using the
252
     * is connected. Note that "connected" here means "connected using the
(-)db/src/org/netbeans/api/db/explorer/node/Bundle.properties (+2 lines)
Lines 142-147 Link Here
142
ForeignColumnDescription=Column
142
ForeignColumnDescription=Column
143
KeySeq=Keyseq
143
KeySeq=Keyseq
144
KeySeqDescription=Keyseq
144
KeySeqDescription=Keyseq
145
ConnectionProperties=Connection properties
146
ConnectionPropertiesDescription=Connection properties
145
147
146
# Booleans
148
# Booleans
147
149
(-)db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java (-10 / +70 lines)
Lines 156-161 Link Here
156
     */
156
     */
157
    private MetadataModel metadataModel = null;
157
    private MetadataModel metadataModel = null;
158
158
159
    /** Properties for connection
160
     */
161
    private Properties connectionProperties = new Properties();
162
159
    /**
163
    /**
160
     * The API DatabaseConnection (delegates to this instance)
164
     * The API DatabaseConnection (delegates to this instance)
161
     */
165
     */
Lines 173-178 Link Here
173
    public static final String PROP_DRIVERNAME = "drivername"; //NOI18N
177
    public static final String PROP_DRIVERNAME = "drivername"; //NOI18N
174
    public static final String PROP_NAME = "name"; //NOI18N
178
    public static final String PROP_NAME = "name"; //NOI18N
175
    public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N
179
    public static final String PROP_DISPLAY_NAME = "displayName"; //NOI18N
180
    public static final String PROP_CONNECTIONPROPERTIES = "connectionProperties";
176
    public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N
181
    public static final String DRIVER_CLASS_NET = "org.apache.derby.jdbc.ClientDriver"; // NOI18N
177
    public static final int DERBY_UNICODE_ERROR_CODE = 20000;
182
    public static final int DERBY_UNICODE_ERROR_CODE = 20000;
178
    private OpenConnectionInterface openConnection = null;
183
    private OpenConnectionInterface openConnection = null;
Lines 210-231 Link Here
210
     * @param password User password
215
     * @param password User password
211
     */
216
     */
212
    public DatabaseConnection(String driver, String database, String user, String password) {
217
    public DatabaseConnection(String driver, String database, String user, String password) {
213
        this(driver, null, database, null, user, password, null);
218
        this(driver, null, database, null, user, password, null, null);
214
    }
219
    }
215
220
216
    public DatabaseConnection(String driver, String driverName, String database,
221
    public DatabaseConnection(String driver, String driverName, String database,
217
            String theschema, String user, String password) {
222
            String theschema, String user, String password) {
218
        this(driver, driverName, database, theschema, user, password, null);
223
        this(driver, driverName, database, theschema, user, password, null, null);
219
    }
224
    }
220
225
221
    public DatabaseConnection(String driver, String driverName, String database, 
226
    public DatabaseConnection(String driver, String driverName, String database, 
222
            String theschema, String user) {
227
            String theschema, String user) {
223
        this(driver, driverName, database, theschema, user, null, null);
228
        this(driver, driverName, database, theschema, user, null, null, null);
224
    }
229
    }
225
230
226
    public DatabaseConnection(String driver, String driverName, String database,
231
    public DatabaseConnection(String driver, String driverName, String database,
232
            String theschema, String user, Properties connectionProperties) {
233
        this(driver, driverName, database, theschema, user, null, null, connectionProperties);
234
    }
235
236
    public DatabaseConnection(String driver, String driverName, String database,
227
            String theschema, String user, String password,
237
            String theschema, String user, String password,
228
            Boolean rememberPassword) {
238
            Boolean rememberPassword) {
239
        this(driver, driverName, database, theschema, user, password,
240
                rememberPassword, null);
241
    }
242
243
    public DatabaseConnection(String driver, String driverName, String database,
244
            String theschema, String user, String password,
245
            Boolean rememberPassword, Properties connectionProperties) {
229
        this();
246
        this();
230
        drv = driver;
247
        drv = driver;
231
        drvname = driverName;
248
        drvname = driverName;
Lines 235-240 Link Here
235
        rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword);
252
        rpwd = rememberPassword == null ? null : Boolean.valueOf(rememberPassword);
236
        schema = theschema;
253
        schema = theschema;
237
        name = getName();
254
        name = getName();
255
        setConnectionProperties(connectionProperties);
238
    }
256
    }
239
257
240
    public JDBCDriver findJDBCDriver() {
258
    public JDBCDriver findJDBCDriver() {
Lines 548-553 Link Here
548
        }
566
        }
549
    }
567
    }
550
568
569
    @Override
570
    public Properties getConnectionProperties() {
571
        return (Properties) connectionProperties.clone();
572
    }
573
574
    @Override
575
    public void setConnectionProperties(Properties connectionProperties) {
576
        Properties old = this.connectionProperties;
577
        if (connectionProperties == null) {
578
            this.connectionProperties = new Properties();
579
        } else {
580
            this.connectionProperties = (Properties) connectionProperties.clone();
581
        }
582
        propertySupport.firePropertyChange(PROP_CONNECTIONPROPERTIES, old, connectionProperties);
583
    }
584
551
    /** Returns user schema name */
585
    /** Returns user schema name */
552
    @Override
586
    @Override
553
    public String getSchema() {
587
    public String getSchema() {
Lines 732-740 Link Here
732
            throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N
766
            throw new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")); // NOI18N
733
        }
767
        }
734
768
735
        Properties dbprops = new Properties();
769
        Properties dbprops;
770
        if (connectionProperties != null) {
771
            dbprops = getConnectionProperties();
772
        } else {
773
            dbprops = new Properties();
774
        }
736
        if ((usr != null) && (usr.length() > 0)) {
775
        if ((usr != null) && (usr.length() > 0)) {
737
            dbprops.put("user", usr); //NOI18N
776
            dbprops.put("user", usr); //NOI18N
777
        }
778
        if ((pwd != null) && (pwd.length() > 0)) {
738
            dbprops.put("password", pwd); //NOI18N
779
            dbprops.put("password", pwd); //NOI18N
739
        }
780
        }
740
781
Lines 812-822 Link Here
812
            sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")));
853
            sendException(new DDLException(NbBundle.getMessage(DatabaseConnection.class, "EXC_InsufficientConnInfo")));
813
        }
854
        }
814
855
815
        Properties dbprops = new Properties();
856
        Properties dbprops;
816
        if ( usr.length() > 0 ) {
857
        if (connectionProperties != null) {
858
            dbprops = getConnectionProperties();
859
        } else {
860
            dbprops = new Properties();
861
        }
862
        if ((usr != null) && (usr.length() > 0)) {
817
            dbprops.put("user", usr); //NOI18N
863
            dbprops.put("user", usr); //NOI18N
818
        }
864
        }
819
        if ((pwd != null && pwd.length() > 0)) {
865
        if ((pwd != null) && (pwd.length() > 0)) {
820
            dbprops.put("password", pwd); //NOI18N
866
            dbprops.put("password", pwd); //NOI18N
821
        }
867
        }
822
868
Lines 1005-1014 Link Here
1005
     */
1051
     */
1006
    @Override
1052
    @Override
1007
    public boolean equals(Object obj) {
1053
    public boolean equals(Object obj) {
1008
        if (obj instanceof DBConnection) {
1054
        if (obj instanceof DatabaseConnection) {
1009
            DBConnection conn = (DBConnection) obj;
1055
            DatabaseConnection conn = (DatabaseConnection) obj;
1010
            return toString().equals(conn.toString());
1056
            if (toString().equals(conn.toString())) {
1057
                if ((connectionProperties == null
1058
                        && conn.getConnectionProperties() == null)) {
1059
                    return true;
1060
                } else if (connectionProperties != null) {
1061
                    return connectionProperties.equals(
1062
                            conn.getConnectionProperties());
1011
        }
1063
        }
1064
            }
1065
        }
1012
1066
1013
        return false;
1067
        return false;
1014
    }
1068
    }
Lines 1029-1034 Link Here
1029
            //IGNORE - drvname not stored in 3.6 and earlier
1083
            //IGNORE - drvname not stored in 3.6 and earlier
1030
            //IGNORE - displayName not stored in 6.7 and earlier
1084
            //IGNORE - displayName not stored in 6.7 and earlier
1031
        }
1085
        }
1086
        try {
1087
            connectionProperties = (Properties) in.readObject();
1088
        } catch (Exception ex) {
1089
            //IGNORE - connectionProperties not stored in 7.3 and earlier
1090
        }
1032
1091
1033
        // boston setting/pilsen setting?
1092
        // boston setting/pilsen setting?
1034
        if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) {
1093
        if ((name != null) && (name.equals(DatabaseConnection.SUPPORT))) {
Lines 1052-1057 Link Here
1052
        out.writeObject(DatabaseConnection.SUPPORT);
1111
        out.writeObject(DatabaseConnection.SUPPORT);
1053
        out.writeObject(drvname);
1112
        out.writeObject(drvname);
1054
        out.writeObject(displayName);
1113
        out.writeObject(displayName);
1114
        out.writeObject(connectionProperties);
1055
    }
1115
    }
1056
1116
1057
    @Override
1117
    @Override
(-)db/src/org/netbeans/modules/db/explorer/DatabaseConnectionConvertor.java (-1 / +63 lines)
Lines 60-65 Link Here
60
import java.nio.charset.CoderResult;
60
import java.nio.charset.CoderResult;
61
import java.util.LinkedList;
61
import java.util.LinkedList;
62
import java.util.Map;
62
import java.util.Map;
63
import java.util.Properties;
63
import java.util.WeakHashMap;
64
import java.util.WeakHashMap;
64
import java.util.concurrent.ConcurrentHashMap;
65
import java.util.concurrent.ConcurrentHashMap;
65
import java.util.logging.Level;
66
import java.util.logging.Level;
Lines 237-243 Link Here
237
                handler.driverName,
238
                handler.driverName,
238
                handler.connectionUrl,
239
                handler.connectionUrl,
239
                handler.schema,
240
                handler.schema,
240
                handler.user);
241
                handler.user,
242
                handler.connectionProperties);
241
        dbconn.setConnectionFileName(handler.connectionFileName);
243
        dbconn.setConnectionFileName(handler.connectionFileName);
242
        if (handler.displayName != null) {
244
        if (handler.displayName != null) {
243
            dbconn.setDisplayName(handler.displayName);
245
            dbconn.setDisplayName(handler.displayName);
Lines 402-407 Link Here
402
            } else {
404
            } else {
403
                DatabaseConnection.deletePassword(name);
405
                DatabaseConnection.deletePassword(name);
404
            }
406
            }
407
            if (instance.getConnectionProperties() != null) {
408
                Properties p = instance.getConnectionProperties();
409
                for (String key : p.stringPropertyNames()) {
410
                    pw.println("  <connection-property>");              //NOI18N
411
                    pw.print("    <name>");                             //NOI18N
412
                    pw.print(XMLUtil.toElementContent(key));
413
                    pw.println("</name>");                              //NOI18N
414
                    pw.print("    <value>");                            //NOI18N
415
                    pw.print(XMLUtil.toElementContent(p.getProperty(key)));
416
                    pw.println("</value>");                             //NOI18N
417
                    pw.println("  </connection-property>");             //NOI18N
418
                }
419
            }
405
            pw.println("</connection>"); //NOI18N
420
            pw.println("</connection>"); //NOI18N
406
        }        
421
        }        
407
    }
422
    }
Lines 418-436 Link Here
418
        private static final String ELEMENT_USER = "user"; // NOI18N
433
        private static final String ELEMENT_USER = "user"; // NOI18N
419
        private static final String ELEMENT_PASSWORD = "password"; // NOI18N
434
        private static final String ELEMENT_PASSWORD = "password"; // NOI18N
420
        private static final String ELEMENT_DISPLAY_NAME = "display-name"; // NOI18N
435
        private static final String ELEMENT_DISPLAY_NAME = "display-name"; // NOI18N
436
        private static final String ELEMENT_CONNECTION_PROPERTY = "connection-property"; // NOI18N
437
        private static final String ELEMENT_CONNECTION_PROPERTY_NAME = "name"; // NOI18N
438
        private static final String ELEMENT_CONNECTION_PROPERTY_VALUE = "value"; // NOI18N
421
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
439
        private static final String ATTR_PROPERTY_VALUE = "value"; // NOI18N
422
        
440
        
423
        final String connectionFileName;
441
        final String connectionFileName;
424
        
442
        
443
        private boolean readingProperty = false;
444
        private String propertyName;
445
        private String propertyValue;
446
        private StringBuilder buffer = new StringBuilder();
447
425
        String driverClass;
448
        String driverClass;
426
        String driverName;
449
        String driverName;
427
        String connectionUrl;
450
        String connectionUrl;
428
        String schema;
451
        String schema;
429
        String user;
452
        String user;
430
        String displayName;
453
        String displayName;
454
        Properties connectionProperties;
431
        
455
        
432
        public Handler(String connectionFileName) {
456
        public Handler(String connectionFileName) {
433
            this.connectionFileName = connectionFileName;
457
            this.connectionFileName = connectionFileName;
458
            this.connectionProperties = new Properties();
434
        }
459
        }
435
460
436
        @Override
461
        @Override
Lines 457-462 Link Here
457
                user = value;
482
                user = value;
458
            } else if (ELEMENT_DISPLAY_NAME.equals(qName)) {
483
            } else if (ELEMENT_DISPLAY_NAME.equals(qName)) {
459
                displayName = value;
484
                displayName = value;
485
            } else if (ELEMENT_CONNECTION_PROPERTY.equals(qName)) {
486
                readingProperty = true;
487
                propertyName = "";                                      //NOI18N
488
                propertyValue = "";                                     //NOI18N
489
            } else if (readingProperty && ELEMENT_CONNECTION_PROPERTY_NAME.equals(qName)) {
490
                buffer.setLength(0);
491
            } else if (readingProperty && ELEMENT_CONNECTION_PROPERTY_VALUE.equals(qName)) {
492
                buffer.setLength(0);
460
            } else if (ELEMENT_PASSWORD.equals(qName)) {
493
            } else if (ELEMENT_PASSWORD.equals(qName)) {
461
                // reading old settings
494
                // reading old settings
462
                byte[] bytes = null;
495
                byte[] bytes = null;
Lines 482-489 Link Here
482
                }
515
                }
483
            }
516
            }
484
        }
517
        }
518
519
        @Override
520
        public void ignorableWhitespace(char[] chars, int start, int length) throws SAXException {
521
            if (readingProperty) {
522
                buffer.append(chars, start, length);
485
    }
523
    }
524
        }
486
    
525
    
526
        @Override
527
        public void characters(char[] chars, int start, int length) throws SAXException {
528
            if (readingProperty) {
529
                buffer.append(chars, start, length);
530
            }
531
        }
532
533
        @Override
534
        public void endElement(String uri, String localName, String qName) throws SAXException {
535
            if (readingProperty && ELEMENT_CONNECTION_PROPERTY.equals(qName)) {
536
                connectionProperties.put(propertyName, propertyValue);
537
                readingProperty = false;
538
                propertyName = "";
539
                propertyValue = "";
540
                buffer.setLength(0);
541
            } else if (readingProperty && ELEMENT_CONNECTION_PROPERTY_NAME.equals(qName)) {
542
                propertyName = buffer.toString();
543
            } else if (readingProperty && ELEMENT_CONNECTION_PROPERTY_VALUE.equals(qName)) {
544
                propertyValue = buffer.toString();
545
            }
546
        }
547
    }
548
    
487
    private final class PCL implements PropertyChangeListener, Runnable {
549
    private final class PCL implements PropertyChangeListener, Runnable {
488
        
550
        
489
        /**
551
        /**
(-)db/src/org/netbeans/modules/db/explorer/dlg/Bundle.properties (+2 lines)
Lines 386-388 Link Here
386
ChooseConnectionNamePanel.Name=Choose name for connection
386
ChooseConnectionNamePanel.Name=Choose name for connection
387
ConnectionNameDialogText=&Input connection name:
387
ConnectionNameDialogText=&Input connection name:
388
MSG_ConnectionNamePanelComment=Override the default name for the connection. The name should be descriptive about the connection you are creating.
388
MSG_ConnectionNamePanelComment=Override the default name for the connection. The name should be descriptive about the connection you are creating.
389
NewConnectionPanel.bConnectionProperties=Connection &Properties
390
NewConnectionPanel.dlgConnectionProperties=Connection Properties
(-)db/src/org/netbeans/modules/db/explorer/dlg/NewConnectionPanel.form (-18 / +39 lines)
Lines 27-33 Link Here
27
          <Group type="102" alignment="1" attributes="0">
27
          <Group type="102" alignment="1" attributes="0">
28
              <EmptySpace max="-2" attributes="0"/>
28
              <EmptySpace max="-2" attributes="0"/>
29
              <Group type="103" groupAlignment="1" attributes="0">
29
              <Group type="103" groupAlignment="1" attributes="0">
30
                  <Group type="102" alignment="1" attributes="0">
30
                  <Component id="directUrlLabel" alignment="0" min="-2" max="-2" attributes="1"/>
31
                  <Group type="102" alignment="0" attributes="0">
31
                      <Group type="103" groupAlignment="0" attributes="0">
32
                      <Group type="103" groupAlignment="0" attributes="0">
32
                          <Component id="hostLabel" alignment="0" min="-2" max="-2" attributes="1"/>
33
                          <Component id="hostLabel" alignment="0" min="-2" max="-2" attributes="1"/>
33
                          <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
34
                          <Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
Lines 47-76 Link Here
47
                      </Group>
48
                      </Group>
48
                      <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
49
                      <EmptySpace min="-2" pref="8" max="-2" attributes="0"/>
49
                      <Group type="103" groupAlignment="0" attributes="0">
50
                      <Group type="103" groupAlignment="0" attributes="0">
50
                          <Component id="userField" alignment="1" pref="383" max="32767" attributes="2"/>
51
                          <Group type="102" attributes="0">
51
                          <Component id="sidField" alignment="0" pref="383" max="32767" attributes="2"/>
52
                              <Component id="bConnectionProperties" min="-2" max="-2" attributes="0"/>
52
                          <Component id="serviceField" alignment="0" pref="383" max="32767" attributes="2"/>
53
                              <EmptySpace max="-2" attributes="0"/>
53
                          <Component id="tnsField" alignment="0" pref="383" max="32767" attributes="2"/>
54
                              <Component id="bTestConnection" min="-2" max="-2" attributes="0"/>
54
                          <Component id="dsnField" alignment="0" pref="383" max="32767" attributes="2"/>
55
                              <EmptySpace pref="100" max="32767" attributes="0"/>
55
                          <Component id="serverNameField" alignment="0" pref="383" max="32767" attributes="2"/>
56
                          </Group>
56
                          <Component id="instanceField" alignment="0" pref="383" max="32767" attributes="2"/>
57
                          <Component id="userField" alignment="1" max="32767" attributes="2"/>
58
                          <Component id="sidField" alignment="0" max="32767" attributes="2"/>
59
                          <Component id="serviceField" alignment="0" max="32767" attributes="2"/>
60
                          <Component id="tnsField" alignment="0" max="32767" attributes="2"/>
61
                          <Component id="dsnField" alignment="0" max="32767" attributes="2"/>
62
                          <Component id="serverNameField" alignment="0" max="32767" attributes="2"/>
63
                          <Component id="instanceField" alignment="0" max="32767" attributes="2"/>
57
                          <Group type="102" alignment="0" attributes="0">
64
                          <Group type="102" alignment="0" attributes="0">
58
                              <Component id="hostField" pref="230" max="32767" attributes="2"/>
65
                              <Component id="hostField" max="32767" attributes="2"/>
59
                              <EmptySpace max="-2" attributes="0"/>
66
                              <EmptySpace max="-2" attributes="0"/>
60
                              <Component id="portLabel" min="-2" max="-2" attributes="1"/>
67
                              <Component id="portLabel" min="-2" max="-2" attributes="1"/>
61
                              <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
68
                              <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
62
                              <Component id="portField" min="-2" pref="105" max="-2" attributes="2"/>
69
                              <Component id="portField" min="-2" pref="105" max="-2" attributes="2"/>
63
                          </Group>
70
                          </Group>
64
                          <Component id="databaseField" alignment="1" pref="383" max="32767" attributes="2"/>
71
                          <Component id="databaseField" alignment="1" max="32767" attributes="2"/>
65
                          <Component id="passwordField" alignment="0" pref="383" max="32767" attributes="2"/>
72
                          <Component id="passwordField" alignment="0" max="32767" attributes="2"/>
66
                          <Component id="bTestConnection" alignment="0" min="-2" max="-2" attributes="0"/>
73
                          <Component id="urlField" alignment="1" max="32767" attributes="2"/>
67
                          <Component id="passwordCheckBox" alignment="0" min="-2" pref="256" max="-2" attributes="0"/>
74
                          <Component id="templateComboBox" alignment="1" max="32767" attributes="2"/>
68
                          <Component id="urlField" alignment="1" pref="383" max="32767" attributes="2"/>
75
                          <Group type="102" attributes="0">
69
                          <Component id="templateComboBox" alignment="1" pref="383" max="32767" attributes="2"/>
76
                              <Component id="passwordCheckBox" min="-2" pref="256" max="-2" attributes="0"/>
77
                              <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
70
                      </Group>
78
                      </Group>
71
                  </Group>
79
                  </Group>
72
                  <Component id="directUrlLabel" alignment="0" min="-2" max="-2" attributes="1"/>
73
              </Group>
80
              </Group>
81
              </Group>
74
              <EmptySpace max="-2" attributes="0"/>
82
              <EmptySpace max="-2" attributes="0"/>
75
          </Group>
83
          </Group>
76
      </Group>
84
      </Group>
Lines 142-150 Link Here
142
              <EmptySpace min="-2" max="-2" attributes="0"/>
150
              <EmptySpace min="-2" max="-2" attributes="0"/>
143
              <Component id="passwordCheckBox" min="-2" max="-2" attributes="0"/>
151
              <Component id="passwordCheckBox" min="-2" max="-2" attributes="0"/>
144
              <EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
152
              <EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
145
              <Component id="bTestConnection" min="-2" max="-2" attributes="0"/>
146
              <EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
147
              <Group type="103" groupAlignment="3" attributes="0">
153
              <Group type="103" groupAlignment="3" attributes="0">
154
                  <Component id="bTestConnection" alignment="3" min="-2" max="-2" attributes="0"/>
155
                  <Component id="bConnectionProperties" alignment="3" min="-2" max="-2" attributes="0"/>
156
              </Group>
157
              <EmptySpace type="separate" max="-2" attributes="0"/>
158
              <Group type="103" groupAlignment="3" attributes="0">
148
                  <Component id="urlField" alignment="3" min="-2" max="-2" attributes="0"/>
159
                  <Component id="urlField" alignment="3" min="-2" max="-2" attributes="0"/>
149
                  <Component id="directUrlLabel" alignment="3" min="-2" max="-2" attributes="0"/>
160
                  <Component id="directUrlLabel" alignment="3" min="-2" max="-2" attributes="0"/>
150
              </Group>
161
              </Group>
Lines 415-419 Link Here
415
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bTestConnectionActionPerformed"/>
426
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bTestConnectionActionPerformed"/>
416
      </Events>
427
      </Events>
417
    </Component>
428
    </Component>
429
    <Component class="javax.swing.JButton" name="bConnectionProperties">
430
      <Properties>
431
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
432
          <ResourceString bundle="org/netbeans/modules/db/explorer/dlg/Bundle.properties" key="NewConnectionPanel.bConnectionProperties" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
433
        </Property>
434
      </Properties>
435
      <Events>
436
        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="bConnectionPropertiesActionPerformed"/>
437
      </Events>
438
    </Component>
418
  </SubComponents>
439
  </SubComponents>
419
</Form>
440
</Form>
(-)db/src/org/netbeans/modules/db/explorer/dlg/NewConnectionPanel.java (-16 / +54 lines)
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);
(-)db/src/org/netbeans/modules/db/explorer/node/ConnectionNode.java (+11 lines)
Lines 48-53 Link Here
48
import java.io.IOException;
48
import java.io.IOException;
49
import java.sql.Connection;
49
import java.sql.Connection;
50
import java.sql.DatabaseMetaData;
50
import java.sql.DatabaseMetaData;
51
import java.util.Properties;
51
import javax.swing.Action;
52
import javax.swing.Action;
52
import org.netbeans.api.db.explorer.DatabaseException;
53
import org.netbeans.api.db.explorer.DatabaseException;
53
import org.netbeans.api.db.explorer.DatabaseMetaDataTransfer;
54
import org.netbeans.api.db.explorer.DatabaseMetaDataTransfer;
Lines 64-71 Link Here
64
import org.netbeans.modules.db.explorer.metadata.MetadataModelManager;
65
import org.netbeans.modules.db.explorer.metadata.MetadataModelManager;
65
import org.netbeans.modules.db.metadata.model.api.MetadataModel;
66
import org.netbeans.modules.db.metadata.model.api.MetadataModel;
66
import org.netbeans.modules.db.metadata.model.api.MetadataModels;
67
import org.netbeans.modules.db.metadata.model.api.MetadataModels;
68
import org.netbeans.modules.db.util.PropertiesEditor;
67
import org.openide.DialogDisplayer;
69
import org.openide.DialogDisplayer;
68
import org.openide.NotifyDescriptor;
70
import org.openide.NotifyDescriptor;
71
import org.openide.nodes.Sheet;
69
import org.openide.util.Exceptions;
72
import org.openide.util.Exceptions;
70
import org.openide.util.HelpCtx;
73
import org.openide.util.HelpCtx;
71
import org.openide.util.NbBundle;
74
import org.openide.util.NbBundle;
Lines 81-86 Link Here
81
    
84
    
82
    private static final String CONNECTEDICONBASE = "org/netbeans/modules/db/resources/connection.gif"; // NOI18N
85
    private static final String CONNECTEDICONBASE = "org/netbeans/modules/db/resources/connection.gif"; // NOI18N
83
    private static final String DISCONNECTEDICONBASE = "org/netbeans/modules/db/resources/connectionDisconnected.gif"; // NOI18N
86
    private static final String DISCONNECTEDICONBASE = "org/netbeans/modules/db/resources/connectionDisconnected.gif"; // NOI18N
87
    private static final String CONNECTIONPROPERTIES = "ConnectionProperties"; //NOI18N
88
    private static final String CONNECTIONPROPERTIESDESC = "ConnectionPropertiesDescription"; //NOI18N
84
    private static final String FOLDER = "Connection"; // NOI18N
89
    private static final String FOLDER = "Connection"; // NOI18N
85
    private static final RequestProcessor RP = new RequestProcessor(ConnectionNode.class.getName());
90
    private static final RequestProcessor RP = new RequestProcessor(ConnectionNode.class.getName());
86
    
91
    
Lines 160-165 Link Here
160
        } else if (nps.getName().equals(DISPLAYNAME)) {
165
        } else if (nps.getName().equals(DISPLAYNAME)) {
161
            setDisplayName(val.toString());
166
            setDisplayName(val.toString());
162
            refreshNode = false;
167
            refreshNode = false;
168
        } else if (nps.getName().equals(CONNECTIONPROPERTIES)) {
169
            connection.setConnectionProperties((Properties) val);
163
        }
170
        }
164
171
165
        super.setPropertyValue(nps, val);
172
        super.setPropertyValue(nps, val);
Lines 181-186 Link Here
181
            addProperty(USER, USERDESC, String.class, !connected, connection.getUser());
188
            addProperty(USER, USERDESC, String.class, !connected, connection.getUser());
182
            addProperty(REMEMBERPW, REMEMBERPWDESC,
189
            addProperty(REMEMBERPW, REMEMBERPWDESC,
183
                    Boolean.class, !connected, connection.rememberPassword());
190
                    Boolean.class, !connected, connection.rememberPassword());
191
            addProperty(CONNECTIONPROPERTIES, CONNECTIONPROPERTIESDESC, Properties.class, !connected, connection.getConnectionProperties());
192
            Property<?> ps = getSheet().get(Sheet.PROPERTIES).get(CONNECTIONPROPERTIES);
193
            ps.setValue("canEditAsText", Boolean.FALSE);                //NOI18N
194
            ps.setValue(NodePropertySupport.CUSTOM_EDITOR, PropertiesEditor.class);
184
195
185
            if (connected) {
196
            if (connected) {
186
                Specification spec = connection.getConnector().getDatabaseSpecification();
197
                Specification spec = connection.getConnector().getDatabaseSpecification();
(-)db/src/org/netbeans/modules/db/explorer/node/NodePropertySupport.java (+37 lines)
Lines 42-47 Link Here
42
42
43
package org.netbeans.modules.db.explorer.node;
43
package org.netbeans.modules.db.explorer.node;
44
44
45
import java.beans.PropertyEditor;
45
import java.lang.reflect.InvocationTargetException;
46
import java.lang.reflect.InvocationTargetException;
46
import org.netbeans.api.db.explorer.node.BaseNode;
47
import org.netbeans.api.db.explorer.node.BaseNode;
47
import org.openide.nodes.PropertySupport;
48
import org.openide.nodes.PropertySupport;
Lines 51-56 Link Here
51
 * @author Rob Englander
52
 * @author Rob Englander
52
 */
53
 */
53
public class NodePropertySupport extends PropertySupport {
54
public class NodePropertySupport extends PropertySupport {
55
    public static final String CUSTOM_EDITOR = "NodePropertySupport.customEditor"; //NOI18N
56
    public static final String NODE = "NodePropertySupport.Node";       //NOI18N
54
57
55
    private BaseNode node;
58
    private BaseNode node;
56
    private String key;
59
    private String key;
Lines 59-64 Link Here
59
        super(name, type, displayName, shortDescription, true, writable);
62
        super(name, type, displayName, shortDescription, true, writable);
60
        key = name;
63
        key = name;
61
        this.node = node;
64
        this.node = node;
65
        setValue(NODE, node);
62
    }
66
    }
63
67
64
    @Override
68
    @Override
Lines 76-79 Link Here
76
        node.setPropertyValue(this, val);
80
        node.setPropertyValue(this, val);
77
    }
81
    }
78
82
83
    /**
84
     * PropertyEditor can be set via setValue - it can be either instanciated or
85
     * a Class, that has a Default-Constructor and results in an object, that
86
     * implements PropertyEditor
87
     *
88
     * @return
89
     */
90
    @Override
91
    public PropertyEditor getPropertyEditor() {
92
        PropertyEditor result = null;
93
        Object potentialEditor = getValue(CUSTOM_EDITOR);
94
95
        if (potentialEditor instanceof PropertyEditor) {
96
            result = (PropertyEditor) potentialEditor;
97
        } else if (potentialEditor instanceof Class) {
98
            try {
99
                potentialEditor = ((Class) potentialEditor).newInstance();
100
                if (!(potentialEditor instanceof PropertyEditor)) {
101
                    throw new IllegalArgumentException(
102
                            "Editor class does not derive from property editor"); //NOI18N
79
}
103
}
104
                return (PropertyEditor) potentialEditor;
105
            } catch (InstantiationException ex) {
106
                throw new RuntimeException(ex);
107
            } catch (IllegalAccessException ex) {
108
                throw new RuntimeException(ex);
109
            }
110
        }
111
        if (result == null) {
112
            result = super.getPropertyEditor();
113
        }
114
        return result;
115
    }
116
}
(-)db/src/org/netbeans/modules/db/util/Bundle.properties (+6 lines)
Lines 71-73 Link Here
71
<TNSNAME>=TNS Name
71
<TNSNAME>=TNS Name
72
<ADDITIONAL>=Additional Properties
72
<ADDITIONAL>=Additional Properties
73
ErrorInfoPanel.iconLabel.text=
73
ErrorInfoPanel.iconLabel.text=
74
75
NoPropertiesSet=No properties set
76
PropertyEditorPanel.propertyTable.columnModel.title1=Value
77
PropertyEditorPanel.propertyTable.columnModel.title0=Property
78
PropertyEditorPanel.addRowButton.text=Add Property
79
PropertyEditorPanel.removeRowButton.text=Remove Property
(-)db/src/org/netbeans/modules/db/util/PropertiesEditor.java (+116 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
package org.netbeans.modules.db.util;
43
44
import java.beans.FeatureDescriptor;
45
import java.beans.PropertyChangeEvent;
46
import java.beans.PropertyChangeListener;
47
import java.beans.PropertyEditorSupport;
48
import java.util.Properties;
49
import org.openide.explorer.propertysheet.ExPropertyEditor;
50
import org.openide.explorer.propertysheet.PropertyEnv;
51
import org.openide.nodes.Node;
52
import org.openide.util.NbBundle;
53
54
/**
55
 * Custom editor for properties - mainly exists to call custom editor
56
 *
57
 * @author Matthias Bläsing
58
 */
59
public class PropertiesEditor extends PropertyEditorSupport implements ExPropertyEditor {
60
61
    private boolean canWrite = true;
62
63
    @Override
64
    public String getAsText() {
65
        Properties value = (Properties) getValue();
66
        if (value == null || value.size() == 0) {
67
            return NbBundle.getMessage(PropertiesEditor.class,
68
                    "NoPropertiesSet");                                 //NOI18N
69
        } else {
70
            return value.toString();
71
        }
72
    }
73
74
    /**
75
     * Can't be called and throws IllegalArgumentException
76
     */
77
    @Override
78
    public void setAsText(String text) throws IllegalArgumentException {
79
        throw new IllegalArgumentException("Can't be set by setAsText");//NOI18N
80
    }
81
82
    @Override
83
    public String getJavaInitializationString() {
84
        return null; // does not generate any code
85
    }
86
87
    @Override
88
    public boolean supportsCustomEditor() {
89
        return true;
90
    }
91
92
    @Override
93
    public java.awt.Component getCustomEditor() {
94
        PropertyEditorPanel pep = new PropertyEditorPanel(
95
                (Properties) this.getValue(), canWrite);
96
        pep.addPropertyChangeListener(PropertyEditorPanel.PROP_VALUE, new PropertyChangeListener() {
97
            @Override
98
            public void propertyChange(PropertyChangeEvent pce) {
99
                setValue(((PropertyEditorPanel) pce.getSource()).getValue());
100
            }
101
        });
102
        return pep;
103
    }
104
105
    @Override
106
    public void attachEnv(PropertyEnv env) {
107
        FeatureDescriptor d = env.getFeatureDescriptor();
108
        if (d instanceof Node.Property) {
109
            canWrite = ((Node.Property) d).canWrite();
110
        }
111
    }
112
113
    public boolean isEditable() {
114
        return canWrite;
115
    }
116
}
(-)db/src/org/netbeans/modules/db/util/PropertyEditorPanel.form (+97 lines)
Line 0 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.5" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
5
    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
6
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
7
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
8
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
9
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
10
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
11
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
12
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
14
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
15
  </AuxValues>
16
17
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
18
  <SubComponents>
19
    <Container class="javax.swing.JPanel" name="buttonPanel">
20
      <Constraints>
21
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
22
          <BorderConstraints direction="Last"/>
23
        </Constraint>
24
      </Constraints>
25
26
      <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout">
27
        <Property name="alignment" type="int" value="2"/>
28
      </Layout>
29
      <SubComponents>
30
        <Component class="javax.swing.JButton" name="addRowButton">
31
          <Properties>
32
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
33
              <ResourceString bundle="org/netbeans/modules/db/util/Bundle.properties" key="PropertyEditorPanel.addRowButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
34
            </Property>
35
          </Properties>
36
          <Events>
37
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addRowButtonActionPerformed"/>
38
          </Events>
39
        </Component>
40
        <Component class="javax.swing.JButton" name="removeRowButton">
41
          <Properties>
42
            <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
43
              <ResourceString bundle="org/netbeans/modules/db/util/Bundle.properties" key="PropertyEditorPanel.removeRowButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
44
            </Property>
45
          </Properties>
46
          <Events>
47
            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="removeRowButtonActionPerformed"/>
48
          </Events>
49
        </Component>
50
      </SubComponents>
51
    </Container>
52
    <Container class="javax.swing.JScrollPane" name="propertyScrollPane">
53
      <AuxValues>
54
        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
55
      </AuxValues>
56
      <Constraints>
57
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
58
          <BorderConstraints direction="Center"/>
59
        </Constraint>
60
      </Constraints>
61
62
      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
63
      <SubComponents>
64
        <Component class="javax.swing.JTable" name="propertyTable">
65
          <Properties>
66
            <Property name="autoCreateRowSorter" type="boolean" value="true"/>
67
            <Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
68
              <Connection code="new javax.swing.table.DefaultTableModel(&#xa;    new Object [][] {&#xa;&#xa;    },&#xa;    new String [] {&#xa;        &quot;Property&quot;, &quot;Value&quot;&#xa;    }&#xa;) {&#xa;    Class[] types = new Class [] {&#xa;        java.lang.String.class, java.lang.String.class&#xa;    };&#xa;&#xa;    public Class getColumnClass(int columnIndex) {&#xa;        return types [columnIndex];&#xa;    }&#xa;&#xa;    public boolean isCellEditable(int rowIndex, int columnIndex) {&#xa;        return PropertyEditorPanel.this.editable;&#xa;    }&#xa;}" type="code"/>
69
            </Property>
70
            <Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
71
              <TableColumnModel selectionModel="3">
72
                <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
73
                  <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
74
                    <ResourceString bundle="org/netbeans/modules/db/util/Bundle.properties" key="PropertyEditorPanel.propertyTable.columnModel.title0" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
75
                  </Title>
76
                  <Editor/>
77
                  <Renderer/>
78
                </Column>
79
                <Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
80
                  <Title editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
81
                    <ResourceString bundle="org/netbeans/modules/db/util/Bundle.properties" key="PropertyEditorPanel.propertyTable.columnModel.title1" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
82
                  </Title>
83
                  <Editor/>
84
                  <Renderer/>
85
                </Column>
86
              </TableColumnModel>
87
            </Property>
88
            <Property name="columnSelectionAllowed" type="boolean" value="true"/>
89
            <Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
90
              <TableHeader reorderingAllowed="true" resizingAllowed="true"/>
91
            </Property>
92
          </Properties>
93
        </Component>
94
      </SubComponents>
95
    </Container>
96
  </SubComponents>
97
</Form>
(-)db/src/org/netbeans/modules/db/util/PropertyEditorPanel.java (+249 lines)
Line 0 Link Here
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 Oracle and/or its affiliates. All rights reserved.
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
8
 *
9
 * The contents of this file are subject to the terms of either the GNU
10
 * General Public License Version 2 only ("GPL") or the Common
11
 * Development and Distribution License("CDDL") (collectively, the
12
 * "License"). You may not use this file except in compliance with the
13
 * License. You can obtain a copy of the License at
14
 * http://www.netbeans.org/cddl-gplv2.html
15
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
16
 * specific language governing permissions and limitations under the
17
 * License.  When distributing the software, include this License Header
18
 * Notice in each file and include the License file at
19
 * nbbuild/licenses/CDDL-GPL-2-CP.  Oracle designates this
20
 * particular file as subject to the "Classpath" exception as provided
21
 * by Oracle in the GPL Version 2 section of the License file that
22
 * accompanied this code. If applicable, add the following below the
23
 * License Header, with the fields enclosed by brackets [] replaced by
24
 * your own identifying information:
25
 * "Portions Copyrighted [year] [name of copyright owner]"
26
 *
27
 * If you wish your version of this file to be governed by only the CDDL
28
 * or only the GPL Version 2, indicate your decision by adding
29
 * "[Contributor] elects to include this software in this distribution
30
 * under the [CDDL or GPL Version 2] license." If you do not indicate a
31
 * single choice of license, a recipient has the option to distribute
32
 * your version of this file under either the CDDL, the GPL Version 2 or
33
 * to extend the choice of license to its licensees as provided above.
34
 * However, if you add GPL Version 2 code and therefore, elected the GPL
35
 * Version 2 license, then the option applies only if the new code is
36
 * made subject to such option by the copyright holder.
37
 *
38
 * Contributor(s):
39
 *
40
 * Portions Copyrighted 2011 Sun Microsystems, Inc.
41
 */
42
43
/*
44
 * PropertyEditorPanel.java
45
 *
46
 * Created on 01.04.2011, 20:25:24
47
 */
48
package org.netbeans.modules.db.util;
49
50
import java.util.Arrays;
51
import java.util.Properties;
52
import java.util.Vector;
53
import javax.swing.event.ListSelectionEvent;
54
import javax.swing.event.ListSelectionListener;
55
import javax.swing.event.TableModelEvent;
56
import javax.swing.event.TableModelListener;
57
import javax.swing.table.DefaultTableModel;
58
import javax.swing.table.TableModel;
59
60
/**
61
 * Custom implentation for a property editor, as the build in doesn't work to
62
 * well with international characters
63
 *
64
 * @author Matthias Bläsing
65
 */
66
public class PropertyEditorPanel extends javax.swing.JPanel {
67
68
    public static final String PROP_VALUE = "value";
69
    private Properties value;
70
    private boolean editable;
71
    private boolean updateing;
72
73
    public PropertyEditorPanel(Properties initalValue, boolean editable) {
74
        initComponents();
75
        this.value = initalValue;
76
        this.editable = editable;
77
        updateTableFromEditor();
78
        final TableModel tm = propertyTable.getModel();
79
        tm.addTableModelListener(new TableModelListener() {
80
            @Override
81
            public void tableChanged(TableModelEvent tme) {
82
                synchronized (PropertyEditorPanel.this) {
83
                    if (updateing) {
84
                        return;
85
                    }
86
                    updateing = true;
87
                    Properties p = new Properties();
88
                    for (int i = 0; i < tm.getRowCount(); i++) {
89
                        p.setProperty((String) tm.getValueAt(i, 0), (String) tm.getValueAt(i, 1));
90
                    }
91
                    Properties oldValue = value;
92
                    value = p;
93
                    firePropertyChange(PROP_VALUE, oldValue, value);
94
                    updateing = false;
95
                }
96
            }
97
        });
98
        propertyTable.getSelectionModel().addListSelectionListener(
99
                new ListSelectionListener() {
100
                    @Override
101
                    public void valueChanged(ListSelectionEvent lse) {
102
                        updateRemoveButtonSensible();
103
                    }
104
                });
105
        updateAddButtonSensible();
106
        updateRemoveButtonSensible();
107
    }
108
109
    private void updateAddButtonSensible() {
110
        if (this.editable) {
111
            addRowButton.setEnabled(true);
112
        } else {
113
            addRowButton.setEnabled(false);
114
        }
115
    }
116
117
    private void updateRemoveButtonSensible() {
118
        if (this.editable && propertyTable.getSelectedRowCount() > 0) {
119
            removeRowButton.setEnabled(true);
120
        } else {
121
            removeRowButton.setEnabled(false);
122
        }
123
    }
124
125
    @SuppressWarnings("unchecked")
126
    private void updateTableFromEditor() {
127
        synchronized (this) {
128
            if (updateing) {
129
                return;
130
            }
131
            updateing = true;
132
            DefaultTableModel dtm = (DefaultTableModel) propertyTable.getModel();
133
            Vector columns = new Vector(2);
134
            Vector values = new Vector();
135
            columns.add(dtm.getColumnName(0));
136
            columns.add(dtm.getColumnName(1));
137
            if (value != null) {
138
                for (String key : value.stringPropertyNames()) {
139
                    Vector row = new Vector(2);
140
                    row.add(key);
141
                    row.add(value.getProperty(key, ""));
142
                    values.add(row);
143
                }
144
            }
145
            dtm.setDataVector(values, columns);
146
            updateing = false;
147
        }
148
    }
149
150
    public Properties getValue() {
151
        return value;
152
    }
153
154
    /**
155
     * This method is called from within the constructor to initialize the form.
156
     * WARNING: Do NOT modify this code. The content of this method is always
157
     * regenerated by the Form Editor.
158
     */
159
    @SuppressWarnings("unchecked")
160
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
161
    private void initComponents() {
162
163
        buttonPanel = new javax.swing.JPanel();
164
        addRowButton = new javax.swing.JButton();
165
        removeRowButton = new javax.swing.JButton();
166
        propertyScrollPane = new javax.swing.JScrollPane();
167
        propertyTable = new javax.swing.JTable();
168
169
        setLayout(new java.awt.BorderLayout());
170
171
        buttonPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.RIGHT));
172
173
        addRowButton.setText(org.openide.util.NbBundle.getMessage(PropertyEditorPanel.class, "PropertyEditorPanel.addRowButton.text")); // NOI18N
174
        addRowButton.addActionListener(new java.awt.event.ActionListener() {
175
            public void actionPerformed(java.awt.event.ActionEvent evt) {
176
                addRowButtonActionPerformed(evt);
177
            }
178
        });
179
        buttonPanel.add(addRowButton);
180
181
        removeRowButton.setText(org.openide.util.NbBundle.getMessage(PropertyEditorPanel.class, "PropertyEditorPanel.removeRowButton.text")); // NOI18N
182
        removeRowButton.addActionListener(new java.awt.event.ActionListener() {
183
            public void actionPerformed(java.awt.event.ActionEvent evt) {
184
                removeRowButtonActionPerformed(evt);
185
            }
186
        });
187
        buttonPanel.add(removeRowButton);
188
189
        add(buttonPanel, java.awt.BorderLayout.PAGE_END);
190
191
        propertyTable.setAutoCreateRowSorter(true);
192
        propertyTable.setModel(new javax.swing.table.DefaultTableModel(
193
            new Object [][] {
194
195
            },
196
            new String [] {
197
                "Property", "Value"
198
            }
199
        ) {
200
            Class[] types = new Class [] {
201
                java.lang.String.class, java.lang.String.class
202
            };
203
204
            public Class getColumnClass(int columnIndex) {
205
                return types [columnIndex];
206
            }
207
208
            public boolean isCellEditable(int rowIndex, int columnIndex) {
209
                return PropertyEditorPanel.this.editable;
210
            }
211
        });
212
        propertyTable.setColumnSelectionAllowed(true);
213
        propertyScrollPane.setViewportView(propertyTable);
214
        propertyTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
215
        propertyTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(PropertyEditorPanel.class, "PropertyEditorPanel.propertyTable.columnModel.title0")); // NOI18N
216
        propertyTable.getColumnModel().getColumn(1).setHeaderValue(org.openide.util.NbBundle.getMessage(PropertyEditorPanel.class, "PropertyEditorPanel.propertyTable.columnModel.title1")); // NOI18N
217
218
        add(propertyScrollPane, java.awt.BorderLayout.CENTER);
219
    }// </editor-fold>//GEN-END:initComponents
220
221
    private void addRowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addRowButtonActionPerformed
222
        DefaultTableModel dtm = (DefaultTableModel) propertyTable.getModel();
223
        dtm.addRow(new Object[]{"", ""});
224
    }//GEN-LAST:event_addRowButtonActionPerformed
225
226
    private void removeRowButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeRowButtonActionPerformed
227
        int[] viewRows = propertyTable.getSelectedRows();
228
        int[] modelRows = new int[viewRows.length];
229
230
        for (int i = 0; i < viewRows.length; i++) {
231
            modelRows[i] = propertyTable.convertRowIndexToModel(viewRows[i]);
232
        }
233
234
        Arrays.sort(modelRows);
235
236
        DefaultTableModel dtm = (DefaultTableModel) propertyTable.getModel();
237
238
        for (int i = modelRows.length - 1; i >= 0; i--) {
239
            dtm.removeRow(modelRows[i]);
240
        }
241
    }//GEN-LAST:event_removeRowButtonActionPerformed
242
    // Variables declaration - do not modify//GEN-BEGIN:variables
243
    private javax.swing.JButton addRowButton;
244
    private javax.swing.JPanel buttonPanel;
245
    private javax.swing.JScrollPane propertyScrollPane;
246
    private javax.swing.JTable propertyTable;
247
    private javax.swing.JButton removeRowButton;
248
    // End of variables declaration//GEN-END:variables
249
}
(-)db/test/unit/src/org/netbeans/modules/db/explorer/DatabaseConnectionConvertorTest.java (-1 / +1 lines)
Lines 147-153 Link Here
147
    }
147
    }
148
    
148
    
149
    public void testSaveOnPropertyChange() throws Exception {
149
    public void testSaveOnPropertyChange() throws Exception {
150
        DatabaseConnection dbconn = new DatabaseConnection("a", "b", "c", "d", "e", null);
150
        DatabaseConnection dbconn = new DatabaseConnection("a", "b", "c", "d", "e", (String) null);
151
        FileObject fo = DatabaseConnectionConvertor.create(dbconn).getPrimaryFile();
151
        FileObject fo = DatabaseConnectionConvertor.create(dbconn).getPrimaryFile();
152
        
152
        
153
        class FCL extends FileChangeAdapter {
153
        class FCL extends FileChangeAdapter {

Return to bug 197408