Revision 36894

View differences:

tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/ExtDB_Spatial.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43
package org.gvsig.geodb;
44

  
45
import org.gvsig.about.AboutManager;
46
import org.gvsig.about.AboutParticipant;
47
import org.gvsig.andami.plugins.Extension;
48
import org.gvsig.app.ApplicationLocator;
49
import org.gvsig.app.ApplicationManager;
50
import org.gvsig.app.extension.AddLayer;
51
import org.gvsig.geodb.vectorialdb.wizard.WizardDB;
52
import org.gvsig.geodb.vectorialdb.wizard.WizardVectorialDB;
53

  
54

  
55

  
56
/**
57
 * This extension adds the export-to-oracle button.
58
 *
59
 * @author jldominguez
60
 *
61
 */
62
public class ExtDB_Spatial extends Extension {
63

  
64
	public void initialize() {
65
	    //do nothing
66
    }
67

  
68
    public void execute(String actionCommand) {
69
        //do nothing
70
    }
71

  
72
    public boolean isEnabled() {
73
        return isVisible();
74

  
75
        // return true;
76
    }
77

  
78
    /**
79
     * Is visible when there is one vector layer selected
80
     */
81
    public boolean isVisible() {
82
        return false;
83
    }
84

  
85
	@Override
86
	public void postInitialize() {
87
		super.postInitialize();
88
	      addAboutInfo();
89

  
90
		ApplicationLocator.getManager().registerAddTableWizard("DB",
91
				"DB Tables", WizardDB.class);
92
    	AddLayer.addWizard(WizardVectorialDB.class);
93
	}
94
	
95
	   private void addAboutInfo() {
96
	        ApplicationManager application = ApplicationLocator.getManager();
97
	        
98
	        AboutManager about = application.getAbout();
99
	        about.addDeveloper("PRODEVELOP", getClass().getClassLoader()
100
	            .getResource("prodevelop.html"), 2);
101

  
102
	        AboutParticipant participant = about.getDeveloper("PRODEVELOP");
103
	        participant.addContribution(
104
	            "GeoDB",
105
	            "Soporte para pool de conexiones con BBDD", 
106
	            2006,1,1, 
107
	            2007,12,31
108
	        );      
109
	    }
110

  
111
}
tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/ConnectionPanel.java
1
package org.gvsig.geodb.vectorialdb;
2

  
3
import java.awt.BorderLayout;
4
import java.awt.Dimension;
5
import java.awt.FlowLayout;
6
import java.awt.Rectangle;
7
import java.awt.event.ActionEvent;
8
import java.awt.event.ActionListener;
9
import java.util.HashMap;
10
import java.util.Iterator;
11

  
12
import javax.swing.DefaultComboBoxModel;
13
import javax.swing.JLabel;
14
import javax.swing.JPanel;
15
import javax.swing.JPasswordField;
16
import javax.swing.JTextField;
17
import javax.swing.SwingConstants;
18

  
19
import org.gvsig.andami.PluginServices;
20
import org.gvsig.fmap.dal.DALLocator;
21
import org.gvsig.fmap.dal.DataManager;
22
import org.gvsig.fmap.dal.exception.InitializeException;
23
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
24
import org.gvsig.fmap.dal.resource.db.DBParameters;
25
import org.gvsig.utils.NotExistInXMLEntity;
26
import org.gvsig.utils.XMLEntity;
27
import org.gvsig.utils.swing.JComboBox;
28
import org.gvsig.utils.swing.wizard.Step;
29
import org.gvsig.utils.swing.wizard.WizardControl;
30

  
31

  
32

  
33
/**
34
 * DOCUMENT ME!
35
 *
36
 * @author Fernando Gonz?lez Cort?s
37
 */
38
public class ConnectionPanel extends JPanel implements Step {
39
    private static String passw = null;
40

  
41
    private JPanel jPanelLabels = null;
42
    private JLabel jLabel = null;
43
    private JTextField txtHost = null;
44
    private JPanel jPanelTexts = null;
45
    private JTextField txtPort = null;
46
    private JLabel jLabel1 = null;
47
    private JLabel jLabel2 = null;
48
    private JTextField txtUser = null;
49
    private JLabel jLabel3 = null;
50
    private JPasswordField txtPassword = null;
51
    private JLabel jLabel4 = null;
52
    private JTextField txtBD = null;
53
    private JLabel jLabel5 = null;
54
    private JComboBox cmbDriver = null;
55
    private JLabel jLabel6 = null;
56
    private org.gvsig.utils.swing.JComboBox cmbName = null;
57
    private HashMap cs = new HashMap();
58

  
59
    private JPanel jPanel = null;
60

  
61
	private JLabel jLabelSchema = null;
62

  
63
	private ConnectionPanel XYZ = null;
64

  
65
	private JPanel jPanel1 = null;
66

  
67
	private JPanel jPanelLabels1 = null;
68

  
69
	private JLabel jLabel61 = null;
70

  
71
	private JLabel jLabel7 = null;
72

  
73
	private JLabel jLabel11 = null;
74

  
75
	private JLabel jLabel21 = null;
76

  
77
	private JLabel jLabel31 = null;
78

  
79
	private JLabel jLabel51 = null;
80

  
81
	private JPanel jPanelTexts1 = null;
82

  
83
	private JComboBox cmbName1 = null;
84

  
85
	private JTextField txtHost1 = null;
86

  
87
	private JTextField txtPort1 = null;
88

  
89
	private JTextField txtUser1 = null;
90

  
91
	private JPasswordField txtPassword1 = null;
92

  
93
	private JTextField txtBD1 = null;
94

  
95
	private JComboBox cmbDriver1 = null;
96

  
97
	private JTextField txtSchema = null;
98

  
99

  
100

  
101
    /**
102
     * This is the default constructor
103
     */
104
    public ConnectionPanel() {
105
        super();
106
        initialize();
107
    }
108

  
109
    /**
110
     * This method initializes this
111
     */
112
    private void initialize() {
113
        this.setLayout(null);
114
        this.setSize(335, 240);
115
        this.add(getJPanel(), null);
116

  
117
        if (passw != null) {
118
			txtPassword.setText(passw);
119
		}
120

  
121
    }
122

  
123
    /**
124
     * This method initializes jPanel
125
     *
126
     * @return javax.swing.JPanel
127
     */
128
    private JPanel getJPanelLabels() {
129
        if (jPanelLabels == null) {
130
            String string = PluginServices.getText(this, "schema") + ":";
131
            jLabelSchema = new JLabel();
132
            jLabelSchema.setName("jLabel4");
133
            jLabelSchema.setHorizontalAlignment(SwingConstants.RIGHT);
134
            jLabelSchema.setHorizontalTextPosition(SwingConstants.RIGHT);
135
            jLabelSchema.setText(string);
136
            jLabelSchema.setPreferredSize(new Dimension(140, 19));
137
            FlowLayout flowLayout3 = new FlowLayout();
138
            flowLayout3.setVgap(15);
139
            jLabel5 = new JLabel();
140
            jLabel4 = new JLabel();
141
            jLabel3 = new JLabel();
142
            jLabel2 = new JLabel();
143
            jLabel1 = new JLabel();
144
            jLabel = new JLabel();
145
            jPanelLabels = new JPanel();
146
            jPanelLabels.setLayout(flowLayout3);
147
            jPanelLabels.setName("jPanelLabels");
148
            jPanelLabels.setPreferredSize(new java.awt.Dimension(150,400));
149
            jLabel.setText(PluginServices.getText(this, "host") + ":");
150
            jLabel.setPreferredSize(new java.awt.Dimension(140,19));
151
            jLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
152
            jLabel.setName("jLabel");
153
            jLabel1.setText(PluginServices.getText(this, "puerto")+":");
154
            jLabel1.setPreferredSize(new java.awt.Dimension(140,19));
155
            jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
156
            jLabel1.setName("jLabel1");
157
            jLabel2.setText(PluginServices.getText(this, "usuario")+":");
158
            jLabel2.setName("jLabel2");
159
            jLabel2.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
160
            jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
161
            jLabel2.setPreferredSize(new java.awt.Dimension(140,19));
162
            jLabel3.setText(PluginServices.getText(this, "password")+":");
163
            jLabel3.setName("jLabel3");
164
            jLabel3.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
165
            jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
166
            jLabel3.setPreferredSize(new java.awt.Dimension(140,19));
167
            jLabel4.setText(PluginServices.getText(this, "bd")+":");
168
            jLabel4.setName("jLabel4");
169
            jLabel4.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
170
            jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
171
            jLabel4.setPreferredSize(new java.awt.Dimension(140,19));
172
            jLabel5.setText(PluginServices.getText(this, "driver")+":");
173
            jLabel5.setName("jLabel5");
174
            jLabel5.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
175
            jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
176
            jLabel5.setPreferredSize(new java.awt.Dimension(140,19));
177
            jPanelLabels.add(getJLabel6(), null);
178
            jPanelLabels.add(jLabel, null);
179
            jPanelLabels.add(jLabel1, null);
180
            jPanelLabels.add(jLabel2, null);
181
            jPanelLabels.add(jLabel3, null);
182
            jPanelLabels.add(jLabel4, null);
183
            jPanelLabels.add(jLabelSchema, null);
184
            jPanelLabels.add(jLabel5, null);
185

  
186
        }
187

  
188
        return jPanelLabels;
189
    }
190

  
191
    /**
192
     * This method initializes txtHost
193
     *
194
     * @return javax.swing.JTextField
195
     */
196
    private JTextField getTxtHost() {
197
        if (txtHost == null) {
198
            txtHost = new JTextField();
199
            txtHost.setPreferredSize(new java.awt.Dimension(170, 19));
200
            txtHost.setName("txtHost");
201
        }
202

  
203
        return txtHost;
204
    }
205

  
206
    /**
207
     * This method initializes jPanel1
208
     *
209
     * @return javax.swing.JPanel
210
     */
211
    private JPanel getJPanelTexts() {
212
        if (jPanelTexts == null) {
213
            FlowLayout flowLayout2 = new FlowLayout(FlowLayout.LEFT);
214
            flowLayout2.setVgap(15);
215
            jPanelTexts = new JPanel();
216
            jPanelTexts.setLayout(flowLayout2);
217
            jPanelTexts.setPreferredSize(new Dimension(200, 300));
218

  
219
            jPanelTexts.setName("jPanelText");
220
            jPanelTexts.add(getCmbName(), null);
221
            jPanelTexts.add(getTxtHost(), null);
222
            jPanelTexts.add(getTxtPort(), null);
223
            jPanelTexts.add(getTxtUser(), null);
224
            jPanelTexts.add(getTxtPassword(), null);
225
            jPanelTexts.add(getTxtBD(), null);
226
            jPanelTexts.add(getTxtSchema(), null);
227
            jPanelTexts.add(getCmbDriver(), null);
228
        }
229

  
230
        return jPanelTexts;
231
    }
232

  
233
    /**
234
     * This method initializes txtPort
235
     *
236
     * @return javax.swing.JTextField
237
     */
238
    private JTextField getTxtPort() {
239
        if (txtPort == null) {
240
            txtPort = new JTextField();
241
            txtPort.setPreferredSize(new java.awt.Dimension(40, 19));
242
            txtPort.setName("txtPort");
243
            txtPort.setText("");
244
            txtPort.setHorizontalAlignment(javax.swing.JTextField.LEFT);
245
        }
246

  
247
        return txtPort;
248
    }
249

  
250
    /**
251
     * This method initializes txtUser
252
     *
253
     * @return javax.swing.JTextField
254
     */
255
    private JTextField getTxtUser() {
256
        if (txtUser == null) {
257
            txtUser = new JTextField();
258
            txtUser.setPreferredSize(new java.awt.Dimension(170, 19));
259
            txtUser.setName("txtUser");
260
        }
261

  
262
        return txtUser;
263
    }
264

  
265
    /**
266
     * This method initializes txtPassword
267
     *
268
     * @return javax.swing.JTextField
269
     */
270
    private JPasswordField getTxtPassword() {
271
        if (txtPassword == null) {
272
            txtPassword = new JPasswordField();
273
            txtPassword.setPreferredSize(new java.awt.Dimension(170, 19));
274
            txtPassword.setName("txtPassword");
275
        }
276

  
277
        return txtPassword;
278
    }
279

  
280
    /**
281
     * This method initializes txtBD
282
     *
283
     * @return javax.swing.JTextField
284
     */
285
    private JTextField getTxtBD() {
286
        if (txtBD == null) {
287
            txtBD = new JTextField();
288
            txtBD.setPreferredSize(new java.awt.Dimension(170, 19));
289
            txtBD.setName("txtBD");
290
        }
291

  
292
        return txtBD;
293
    }
294

  
295
    /**
296
     * DOCUMENT ME!
297
     *
298
     * @return DOCUMENT ME!
299
     */
300
    public String getHost() {
301
        return getTxtHost().getText();
302
    }
303

  
304
    /**
305
     * DOCUMENT ME!
306
     *
307
     * @return DOCUMENT ME!
308
     */
309
    public String getPort() {
310
        return getTxtPort().getText();
311
    }
312

  
313
    /**
314
     * DOCUMENT ME!
315
     *
316
     * @return DOCUMENT ME!
317
     */
318
    public String getUser() {
319
        return getTxtUser().getText();
320
    }
321

  
322
    /**
323
     * DOCUMENT ME!
324
     *
325
     * @return DOCUMENT ME!
326
     */
327
    public String getSettingsName() {
328
        if (getCmbName().getSelectedItem() == null){
329
            return null;
330
        }        
331
        return getCmbName().getSelectedItem().toString();
332
    }
333

  
334
    /**
335
     * DOCUMENT ME!
336
     *
337
     * @return DOCUMENT ME!
338
     */
339
    public String getPassword() {
340
        passw = String.copyValueOf(getTxtPassword().getPassword());
341
        return passw;
342
    }
343

  
344
    /**
345
     * DOCUMENT ME!
346
     *
347
     * @return DOCUMENT ME!
348
     */
349
    public String getDBName() {
350
        return getTxtBD().getText();
351
    }
352

  
353
    /**
354
     * DOCUMENT ME!
355
     *
356
     * @param drivers DOCUMENT ME!
357
     */
358
    public void setDrivers(String[] drivers) {
359
        DefaultComboBoxModel model = new DefaultComboBoxModel();
360

  
361
        for (int i = 0; i < drivers.length; i++) {
362
            model.addElement(drivers[i]);
363
        }
364

  
365
        getCmbDriver().setModel(model);
366

  
367
        //Para que refresque el textbox del puerto
368
        if (drivers.length > 0) {
369
			cmbDriver.setSelectedIndex(0);
370
		}
371

  
372
    }
373

  
374

  
375
    /**
376
     * @return ConnectionSettings based on values in this panel
377
     */
378
    public ConnectionSettings getConnectionSettings()
379
    {
380
        ConnectionSettings cs = new ConnectionSettings();
381
        cs.setDb(getDBName());
382
        cs.setSchema(getSchema());
383
        cs.setDriver(getDriver());
384
        cs.setHost(getHost());
385
        cs.setPort(getPort());
386
        cs.setUser(getUser());
387
        cs.setPassw(getPassword());
388
        cs.setName(getSettingsName());
389
        return cs;
390
    }
391

  
392
    public String getSchema() {
393
		return txtSchema.getText();
394
	}
395

  
396
    /**
397
     * Makes persistent the connection settings of this panel.
398
     */
399
    public void saveConnectionSettings()
400
    {
401
    	ConnectionSettings cs = new ConnectionSettings();
402
        cs.setDb(getDBName());
403
        cs.setSchema(getSchema());
404
        cs.setDriver(getDriver());
405
        cs.setHost(getHost());
406
        cs.setPort(getPort());
407
        cs.setUser(getUser());
408
        cs.setPassw(getPassword());
409
        cs.setName(getSettingsName());
410

  
411
        PluginServices ps = PluginServices.getPluginServices(this);
412
        XMLEntity xml = ps.getPersistentXML();
413

  
414
        try {
415
            String[] connections = xml.getStringArrayProperty("jdbc-connections");
416
            String[] newConnections = new String[connections.length + 1];
417
            System.arraycopy(connections, 0, newConnections, 0, connections.length);
418
            newConnections[connections.length] = cs.toString();
419
            xml.putProperty("jdbc-connections", newConnections);
420
        } catch (NotExistInXMLEntity e) {
421
            xml.putProperty("jdbc-connections", new String[] { cs.toString() });
422
        }
423

  
424

  
425
    }
426

  
427
    /**
428
     * DOCUMENT ME!
429
     *
430
     * @return DOCUMENT ME!
431
     */
432
    public String getDriver() {
433
        return cmbDriver.getSelectedItem().toString();
434
    }
435

  
436
    /**
437
     * DOCUMENT ME!
438
     *
439
     * @param cs DOCUMENT ME!
440
     */
441
    public void setSettings(HashMap cs) {
442
        this.cs = cs;
443
        ((DefaultComboBoxModel) getCmbName().getModel()).removeAllElements();
444

  
445
        Iterator i = cs.keySet().iterator();
446

  
447
        while (i.hasNext()) {
448
            String item = (String) i.next();
449
            ((DefaultComboBoxModel) getCmbName().getModel()).addElement(item);
450
        }
451
    }
452

  
453
    /**
454
     * @see org.gvsig.utils.swing.wizard.Step#init(org.gvsig.utils.swing.wizard.WizardControl)
455
     */
456
    public void init(WizardControl w) {
457
    }
458

  
459
    /**
460
     * This method initializes cmbDriver
461
     *
462
     * @return com.iver.utiles.swing.JComboBox
463
     */
464
    private JComboBox getCmbDriver() {
465
        if (cmbDriver == null) {
466
            cmbDriver = new JComboBox();
467
            cmbDriver.setPreferredSize(new java.awt.Dimension(170, 19));
468
            cmbDriver.setName("cmbDriver");
469
            cmbDriver.addActionListener(new ActionListener() {
470
                public void actionPerformed(ActionEvent e) {
471
                    String driverName = cmbDriver.getSelectedItem().toString();
472
                    DataManager dm = DALLocator.getDataManager();
473
                    DBParameters dsp=null;
474
					try {
475
						dsp = (DBParameters) dm
476
								.createServerExplorerParameters(driverName);
477
					} catch (InitializeException e1) {
478
						// TODO Auto-generated catch block
479
						e1.printStackTrace();
480
					} catch (ProviderNotRegisteredException e1) {
481
						// TODO Auto-generated catch block
482
						e1.printStackTrace();
483
					}
484

  
485
					// String port = dsp.getPort() + "";
486
					// getTxtPort().setText(port);
487
                }
488
            });
489
        }
490

  
491
        return cmbDriver;
492
    }
493

  
494
    /**
495
     * DOCUMENT ME!
496
     *
497
     * @return
498
     */
499
    public boolean done() {
500
        return (getTxtBD().getText().length() > 0) &&
501
        (getTxtHost().getText().length() > 0) &&
502
        (getCmbName().getSelectedItem() != null) &&
503
        (getCmbName().getSelectedItem().toString().length() > 0);
504
    }
505

  
506
    /**
507
     * This method initializes jLabel6
508
     *
509
     * @return javax.swing.JLabel
510
     */
511
    private JLabel getJLabel6() {
512
        if (jLabel6 == null) {
513
            jLabel6 = new JLabel();
514
            jLabel6.setText(PluginServices.getText(this, "connection_name")+":");
515
            jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
516
            jLabel6.setPreferredSize(new java.awt.Dimension(140,19));
517
        }
518

  
519
        return jLabel6;
520
    }
521

  
522
    /**
523
     * This method initializes jComboBox
524
     *
525
     * @return com.iver.utiles.swing.JComboBox
526
     */
527
    private org.gvsig.utils.swing.JComboBox getCmbName() {
528
        if (cmbName == null) {
529
            cmbName = new org.gvsig.utils.swing.JComboBox();
530
            cmbName.setEditable(true);
531
            cmbName.setPreferredSize(new java.awt.Dimension(170, 19));
532
            cmbName.setModel(new DefaultComboBoxModel());
533
            cmbName.addActionListener(new ActionListener() {
534
                    public void actionPerformed(ActionEvent e) {
535
                        Object item = cmbName.getSelectedItem();
536

  
537
                        if (item == null) {
538
                            return;
539
                        }
540

  
541
                        ConnectionSettings c = (ConnectionSettings) cs.get(item.toString());
542

  
543
                        if (c != null) {
544
                            getTxtHost().setText(c.getHost());
545
                            getTxtPort().setText(c.getPort());
546
                            getTxtBD().setText(c.getDb());
547
                            getTxtUser().setText(c.getUser());
548
                            if (c.getPassw() != null) {
549
								getTxtPassword().setText(c.getPassw());
550
							}
551
                            getCmbDriver().setSelectedItem(c.getDriver());
552
                        }
553
                    }
554
                });
555
        }
556

  
557
        return cmbName;
558
    }
559

  
560
    /**
561
     * This method initializes jPanel
562
     *
563
     * @return javax.swing.JPanel
564
     */
565
    private JPanel getJPanel() {
566
    	if (jPanel == null) {
567
    		jPanel = new JPanel();
568
    		jPanel.setLayout(new BorderLayout());
569
    		jPanel.setBounds(0, 0, 363, 240);
570
    		jPanel.add(getJPanelLabels(), java.awt.BorderLayout.WEST);
571
    		jPanel.add(getJPanelTexts(), java.awt.BorderLayout.EAST);
572
    	}
573
    	return jPanel;
574
    }
575

  
576
	/**
577
	 * This method initializes XYZ
578
	 *
579
	 * @return com.iver.cit.gvsig.jdbc_spatial.gui.jdbcwizard.ConnectionPanel
580
	 */
581
	private ConnectionPanel getXYZ() {
582
		if (XYZ == null) {
583
			XYZ = new ConnectionPanel();
584
			XYZ.setLayout(null);
585
			XYZ.setSize(new java.awt.Dimension(335,240));
586
			XYZ.add(getJPanel1(), null);
587
		}
588
		return XYZ;
589
	}
590

  
591
	/**
592
	 * This method initializes jPanel1
593
	 *
594
	 * @return javax.swing.JPanel
595
	 */
596
	private JPanel getJPanel1() {
597
		if (jPanel1 == null) {
598
			jPanel1 = new JPanel();
599
			jPanel1.setLayout(new BorderLayout());
600
			jPanel1.setBounds(new Rectangle(0, 0, 363, 240));
601
			jPanel1.add(getJPanelLabels1(), java.awt.BorderLayout.WEST);
602
			jPanel1.add(getJPanelTexts1(), java.awt.BorderLayout.EAST);
603
		}
604
		return jPanel1;
605
	}
606

  
607
	/**
608
	 * This method initializes jPanelLabels1
609
	 *
610
	 * @return javax.swing.JPanel
611
	 */
612
	private JPanel getJPanelLabels1() {
613
		if (jPanelLabels1 == null) {
614
			jLabel51 = new JLabel();
615
			jLabel51.setName("jLabel5");
616
			jLabel51.setHorizontalAlignment(SwingConstants.RIGHT);
617
			jLabel51.setHorizontalTextPosition(SwingConstants.RIGHT);
618
			jLabel51.setText(PluginServices.getText(getXYZ(), "driver") + ":");
619
			jLabel51.setPreferredSize(new Dimension(140, 19));
620
			jLabel31 = new JLabel();
621
			jLabel31.setName("jLabel3");
622
			jLabel31.setHorizontalAlignment(SwingConstants.RIGHT);
623
			jLabel31.setHorizontalTextPosition(SwingConstants.RIGHT);
624
			jLabel31.setText(PluginServices.getText(getXYZ(), "password") + ":");
625
			jLabel31.setPreferredSize(new Dimension(140, 19));
626
			jLabel21 = new JLabel();
627
			jLabel21.setName("jLabel2");
628
			jLabel21.setHorizontalAlignment(SwingConstants.RIGHT);
629
			jLabel21.setHorizontalTextPosition(SwingConstants.RIGHT);
630
			jLabel21.setText(PluginServices.getText(getXYZ(), "usuario") + ":");
631
			jLabel21.setPreferredSize(new Dimension(140, 19));
632
			jLabel11 = new JLabel();
633
			jLabel11.setName("jLabel1");
634
			jLabel11.setHorizontalAlignment(SwingConstants.TRAILING);
635
			jLabel11.setText(PluginServices.getText(getXYZ(), "puerto") + ":");
636
			jLabel11.setPreferredSize(new Dimension(140, 19));
637
			jLabel7 = new JLabel();
638
			jLabel7.setName("jLabel");
639
			jLabel7.setHorizontalAlignment(SwingConstants.RIGHT);
640
			jLabel7.setText(PluginServices.getText(getXYZ(), "host") + ":");
641
			jLabel7.setPreferredSize(new Dimension(140, 19));
642
			jLabel61 = new JLabel();
643
			jLabel61.setPreferredSize(new Dimension(140, 19));
644
			jLabel61.setText(PluginServices.getText(getXYZ(), "connection_name") + ":");
645
			jLabel61.setHorizontalAlignment(SwingConstants.RIGHT);
646
			FlowLayout flowLayout31 = new FlowLayout();
647
			flowLayout31.setVgap(15);
648
			jPanelLabels1 = new JPanel();
649
			jPanelLabels1.setPreferredSize(new Dimension(150, 400));
650
			jPanelLabels1.setLayout(flowLayout31);
651
			jPanelLabels1.setName("jPanelLabels");
652
			jPanelLabels1.add(jLabel61, null);
653
			jPanelLabels1.add(jLabel7, null);
654
			jPanelLabels1.add(jLabel11, null);
655
			jPanelLabels1.add(jLabel21, null);
656
			jPanelLabels1.add(jLabel31, null);
657
			jPanelLabels1.add(jLabelSchema, jLabelSchema.getName());
658
			jPanelLabels1.add(jLabel51, null);
659
		}
660
		return jPanelLabels1;
661
	}
662

  
663
	/**
664
	 * This method initializes jPanelTexts1
665
	 *
666
	 * @return javax.swing.JPanel
667
	 */
668
	private JPanel getJPanelTexts1() {
669
		if (jPanelTexts1 == null) {
670
			FlowLayout flowLayout21 = new FlowLayout(FlowLayout.LEFT);
671
			flowLayout21.setVgap(15);
672
			jPanelTexts1 = new JPanel();
673
			jPanelTexts1.setPreferredSize(new Dimension(200, 300));
674
			jPanelTexts1.setLayout(flowLayout21);
675
			jPanelTexts1.setName("jPanelText");
676
			jPanelTexts1.add(getCmbName1(), null);
677
			jPanelTexts1.add(getTxtHost1(), null);
678
			jPanelTexts1.add(getTxtPort1(), null);
679
			jPanelTexts1.add(getTxtUser1(), null);
680
			jPanelTexts1.add(getTxtPassword1(), null);
681
			jPanelTexts1.add(getTxtBD1(), null);
682
			jPanelTexts1.add(getCmbDriver1(), null);
683
		}
684
		return jPanelTexts1;
685
	}
686

  
687
	/**
688
	 * This method initializes cmbName1
689
	 *
690
	 * @return com.iver.utiles.swing.JComboBox
691
	 */
692
	private JComboBox getCmbName1() {
693
		if (cmbName1 == null) {
694
			cmbName1 = new JComboBox();
695
			cmbName1.setPreferredSize(new Dimension(170, 19));
696
			cmbName1.setModel(new DefaultComboBoxModel());
697
			cmbName1.setEditable(true);
698
		}
699
		return cmbName1;
700
	}
701

  
702
	/**
703
	 * This method initializes txtHost1
704
	 *
705
	 * @return javax.swing.JTextField
706
	 */
707
	private JTextField getTxtHost1() {
708
		if (txtHost1 == null) {
709
			txtHost1 = new JTextField();
710
			txtHost1.setName("txtHost");
711
			txtHost1.setPreferredSize(new Dimension(170, 19));
712
		}
713
		return txtHost1;
714
	}
715

  
716
	/**
717
	 * This method initializes txtPort1
718
	 *
719
	 * @return javax.swing.JTextField
720
	 */
721
	private JTextField getTxtPort1() {
722
		if (txtPort1 == null) {
723
			txtPort1 = new JTextField();
724
			txtPort1.setName("txtPort");
725
			txtPort1.setText("");
726
			txtPort1.setHorizontalAlignment(JTextField.LEFT);
727
			txtPort1.setPreferredSize(new Dimension(40, 19));
728
		}
729
		return txtPort1;
730
	}
731

  
732
	/**
733
	 * This method initializes txtUser1
734
	 *
735
	 * @return javax.swing.JTextField
736
	 */
737
	private JTextField getTxtUser1() {
738
		if (txtUser1 == null) {
739
			txtUser1 = new JTextField();
740
			txtUser1.setName("txtUser");
741
			txtUser1.setPreferredSize(new Dimension(170, 19));
742
		}
743
		return txtUser1;
744
	}
745

  
746
	/**
747
	 * This method initializes txtPassword1
748
	 *
749
	 * @return javax.swing.JPasswordField
750
	 */
751
	private JPasswordField getTxtPassword1() {
752
		if (txtPassword1 == null) {
753
			txtPassword1 = new JPasswordField();
754
			txtPassword1.setName("txtPassword");
755
			txtPassword1.setPreferredSize(new Dimension(170, 19));
756
		}
757
		return txtPassword1;
758
	}
759

  
760
	/**
761
	 * This method initializes txtBD1
762
	 *
763
	 * @return javax.swing.JTextField
764
	 */
765
	private JTextField getTxtBD1() {
766
		if (txtBD1 == null) {
767
			txtBD1 = new JTextField();
768
			txtBD1.setName("txtBD");
769
			txtBD1.setPreferredSize(new Dimension(170, 19));
770
		}
771
		return txtBD1;
772
	}
773

  
774
	/**
775
	 * This method initializes cmbDriver1
776
	 *
777
	 * @return com.iver.utiles.swing.JComboBox
778
	 */
779
	private JComboBox getCmbDriver1() {
780
		if (cmbDriver1 == null) {
781
			cmbDriver1 = new JComboBox();
782
			cmbDriver1.setName("cmbDriver");
783
			cmbDriver1.setPreferredSize(new Dimension(170, 19));
784
		}
785
		return cmbDriver1;
786
	}
787

  
788
	/**
789
	 * This method initializes txtSchema
790
	 *
791
	 * @return javax.swing.JTextField
792
	 */
793
	private JTextField getTxtSchema() {
794
		if (txtSchema == null) {
795
			txtSchema = new JTextField();
796
			txtSchema.setName("txtBD");
797
			txtSchema.setPreferredSize(new Dimension(170, 19));
798
		}
799
		return txtSchema;
800
	}
801
} //  @jve:decl-index=0:visual-constraint="7,3"
0 802

  
tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/ConnectionSettings.java
1
package org.gvsig.geodb.vectorialdb;
2

  
3
import org.gvsig.fmap.dal.DALLocator;
4
import org.gvsig.fmap.dal.DataManager;
5
import org.gvsig.fmap.dal.exception.InitializeException;
6
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
7
import org.gvsig.fmap.dal.resource.db.DBParameters;
8

  
9

  
10
/**
11
 * @author Fernando Gonz?lez Cort?s
12
 */
13
public class ConnectionSettings {
14
    private String host;
15
    private String port;
16
    private String db;
17
    private String schema;
18
    private String driver;
19
    private String user;
20
    private String name;
21
    private String passw;
22

  
23
    public String getDb() {
24
        return db;
25
    }
26
    public void setDb(String db) {
27
        this.db = db;
28
    }
29
    public String getDriver() {
30
        return driver;
31
    }
32
    public void setDriver(String driver) {
33
        this.driver = driver;
34
    }
35
    public String getHost() {
36
        return host;
37
    }
38
    public void setHost(String host) {
39
        this.host = host;
40
    }
41
    public String getPort() {
42
        return port;
43
    }
44
    public void setPort(String port) {
45
        this.port = port;
46
    }
47
    public String getUser() {
48
        return user;
49
    }
50
    public void setUser(String user) {
51
        this.user = user;
52
    }
53
    public void setName(String name) {
54
        this.name = name;
55
    }
56
    public String getName() {
57
        return name;
58
    }
59

  
60
    public String toString(){
61
        return host+","+port+","+db+","+driver+","+user+","+name;
62
    }
63

  
64
    public void setFromString(String str) {
65
        String[] values = str.split(",");
66
        host = values[0];
67
        port = values[1];
68
        db = values[2];
69
        driver = values[3];
70
        user = values[4];
71
        name = values[5];
72
        if (values.length == 7) {
73
			passw = values[6];
74
		}
75
    }
76
    public String getPassw() {
77
        return passw;
78
    }
79
    public void setPassw(String passw) {
80
        this.passw = passw;
81
    }
82
    public String getConnectionString(){
83
    	DataManager dm=DALLocator.getDataManager();
84
    	try {
85
			DBParameters dsp=(DBParameters)dm.createStoreParameters(getDriver());
86
		} catch (InitializeException e) {
87
			// TODO Auto-generated catch block
88
			e.printStackTrace();
89
		} catch (ProviderNotRegisteredException e) {
90
			// TODO Auto-generated catch block
91
			e.printStackTrace();
92
		}
93

  
94
        String connectionString = "";//vecDriver.getConnectionStringBeginning() + "//" + getHost();
95

  
96
        connectionString += (":" + getPort());
97

  
98
        connectionString += ("/" + getDb());
99

  
100
        return connectionString;
101
    }
102
	public String getSchema() {
103
		return schema;
104
	}
105
	public void setSchema(String schema) {
106
		this.schema = schema;
107
	}
108
}
0 109

  
tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/wizard/FieldsListItem.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43
package org.gvsig.geodb.vectorialdb.wizard;
44

  
45
import javax.swing.JCheckBox;
46

  
47
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
48

  
49

  
50
/**
51
 * Used to instantiate field list items. Shows the database dependent type name.
52
 *
53
 * @author jldominguez
54
 *
55
 */
56
public class FieldsListItem extends JCheckBox {
57
    private String name = "[No name]";
58
    private String type = "[No type]";
59

  
60
    public FieldsListItem(FeatureAttributeDescriptor descriptor) {
61

  
62
    	name = descriptor.getName();
63
        type = descriptor.getDataTypeName();
64
        setText(toString());
65
        setSelected(true);
66
    }
67

  
68
    public String toString() {
69
        return name + " [" + type + "]";
70
    }
71

  
72
    public String getName() {
73
        return name;
74
    }
75
}
0 76

  
tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/wizard/FieldComboItem.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43
package org.gvsig.geodb.vectorialdb.wizard;
44

  
45

  
46
/**
47
 * Utility class to deal with combo boxes.
48
 *
49
 * @author jldominguez
50
 *
51
 */
52
public class FieldComboItem {
53
    private String name = "";
54

  
55
    public FieldComboItem(String _name) {
56
        name = _name;
57
    }
58

  
59
    public String toString() {
60
        return name;
61
    }
62
}
0 63

  
tags/v2_0_0_Build_2038/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/wizard/VectorialDBConnectionParamsDialog.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2006 Prodevelop and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 *
19
 * For more information, contact:
20
 *
21
 *   Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *   +34 963862235
28
 *   gvsig@gva.es
29
 *   www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   Prodevelop Integraci?n de Tecnolog?as SL
34
 *   Conde Salvatierra de ?lava , 34-10
35
 *   46004 Valencia
36
 *   Spain
37
 *
38
 *   +34 963 510 612
39
 *   +34 963 510 968
40
 *   gis@prodevelop.es
41
 *   http://www.prodevelop.es
42
 */
43
package org.gvsig.geodb.vectorialdb.wizard;
44

  
45
import java.awt.Color;
46
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionListener;
48
import java.awt.event.KeyEvent;
49
import java.awt.event.KeyListener;
50
import java.util.Iterator;
51
import java.util.List;
52

  
53
import javax.swing.JButton;
54
import javax.swing.JCheckBox;
55
import javax.swing.JComboBox;
56
import javax.swing.JLabel;
57
import javax.swing.JOptionPane;
58
import javax.swing.JPanel;
59
import javax.swing.JPasswordField;
60
import javax.swing.JTextField;
61

  
62
import org.slf4j.Logger;
63
import org.slf4j.LoggerFactory;
64

  
65
import org.gvsig.andami.PluginServices;
66
import org.gvsig.andami.messages.NotificationManager;
67
import org.gvsig.andami.ui.mdiManager.IWindow;
68
import org.gvsig.andami.ui.mdiManager.WindowInfo;
69
import org.gvsig.fmap.dal.DALLocator;
70
import org.gvsig.fmap.dal.DataManager;
71
import org.gvsig.fmap.dal.DataServerExplorerParameters;
72
import org.gvsig.fmap.dal.exception.DataException;
73
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
74
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters;
75
import org.gvsig.fmap.mapcontrol.swing.dynobject.DynObjectEditor;
76
import org.gvsig.gui.beans.Messages;
77
import org.gvsig.tools.service.ServiceException;
78

  
79

  
80

  
81
/**
82
 * Lets the user input the connection parameters.
83
 *
84
 * @author jldominguez
85
 *
86
 */
87
public class VectorialDBConnectionParamsDialog extends JPanel implements IWindow,
88
    ActionListener, KeyListener {
89

  
90
    private static final long serialVersionUID = -5493563028200403559L;
91

  
92
    private static final Logger LOG = LoggerFactory
93
        .getLogger(VectorialDBConnectionParamsDialog.class);
94

  
95
    private WindowInfo winfo = new WindowInfo(8); // MODAL only
96
    private JButton cancelButton = null;
97
    private JButton okButton = null;
98
    private JButton advancedButton = null;
99
    private JPanel paramsPanel = null;
100
    private JComboBox driverComboBox = null;
101
    private JTextField portTextField = null;
102
    private JTextField dbTextField = null;
103
    private JTextField userTextField = null;
104
    private JPasswordField passwordField = null;
105
    private JLabel driverLabel = null;
106
    private JLabel portLabel = null;
107
    private JLabel dbLabel = null;
108
    private JLabel dbLabelWarning = null;
109
    private JLabel userLabel = null;
110
    private JLabel pwLabel = null;
111
    private boolean okPressed = false;
112
    private JTextField urlTextField = null;
113
    private JLabel urlLabel = null;
114
    private JCheckBox connectedCheckBox = null;
115
    private JLabel connectedLabel = null;
116
    private JLabel connNameLabel = null;
117
    private JTextField connNameTextField = null;
118

  
119
    private DBServerExplorerParameters params = null;
120

  
121
    /**
122
     * This method initializes
123
     *
124
     */
125
    public VectorialDBConnectionParamsDialog() {
126
        super();
127
        initialize();
128
    }
129

  
130
    public void showDialog() {
131
        PluginServices.getMDIManager().addWindow(this);
132
    }
133

  
134
    /**
135
     * This method initializes this
136
     *
137
     */
138
    private void initialize() {
139
        winfo.setWidth(370);
140
        winfo.setHeight(317 - 25);
141
        winfo.setTitle(PluginServices.getText(this, "connection_parameters"));
142

  
143
        this.setSize(new java.awt.Dimension(360, 329));
144
        this.setLayout(null);
145
        this.add(getCancelButton(), null);
146
        this.add(getOkButton(), null);
147
        this.add(getAdvancedButton(), null);
148
        this.add(getParamsPanel(), null);
149
    }
150

  
151
    public WindowInfo getWindowInfo() {
152
        return winfo;
153
    }
154

  
155
    /**
156
     * This method initializes cancelButton
157
     *
158
     * @return javax.swing.JButton
159
     */
160
    private JButton getCancelButton() {
161
        if (cancelButton == null) {
162
            cancelButton = new JButton();
163
            cancelButton.setText(PluginServices.getText(this, "cancel"));
164
            cancelButton.addActionListener(this);
165
            cancelButton.setBounds(new java.awt.Rectangle(124, 292, 90, 26));
166
        }
167

  
168
        return cancelButton;
169
    }
170

  
171
    /**
172
     * This method initializes okButton
173
     *
174
     * @return javax.swing.JButton
175
     */
176
    private JButton getOkButton() {
177
        if (okButton == null) {
178
            okButton = new JButton();
179
            okButton.setText(PluginServices.getText(this, "ok"));
180
            okButton.addActionListener(this);
181
            okButton.setBounds(new java.awt.Rectangle(30, 292, 90, 26));
182
        }
183

  
184
        return okButton;
185
    }
186

  
187
	/**
188
	 * This method initializes okButton
189
	 *
190
	 * @return javax.swing.JButton
191
	 */
192
	private JButton getAdvancedButton() {
193
		if (advancedButton == null) {
194
			advancedButton = new JButton();
195
			advancedButton.setText(PluginServices.getText(this, "advanced"));
196
			advancedButton.addActionListener(this);
197
			advancedButton.setBounds(new java.awt.Rectangle(218, 292, 90, 26));
198
		}
199

  
200
		return advancedButton;
201
	}
202

  
203
	/**
204
	 * This method initializes paramsPanel
205
	 *
206
	 * @return javax.swing.JPanel
207
	 */
208
    private JPanel getParamsPanel() {
209
        if (paramsPanel == null) {
210
            connNameLabel = new JLabel();
211
            connNameLabel.setBounds(new java.awt.Rectangle(10, 30, 141, 21));
212
            connNameLabel.setText(PluginServices.getText(this, "connection_name") +
213
                ":");
214
            connectedLabel = new JLabel();
215
            connectedLabel.setBounds(new java.awt.Rectangle(10, 247, 141, 21));
216
            connectedLabel.setText(PluginServices.getText(this, "connected") +
217
                ":");
218
            urlLabel = new JLabel();
219
            urlLabel.setBounds(new java.awt.Rectangle(10, 80, 141, 21));
220
            urlLabel.setText(PluginServices.getText(this, "server_url") + ":");
221
            pwLabel = new JLabel();
222
            pwLabel.setBounds(new java.awt.Rectangle(10, 222, 141, 21));
223
            pwLabel.setText(PluginServices.getText(this, "password") + ":");
224
            userLabel = new JLabel();
225
            userLabel.setBounds(new java.awt.Rectangle(10, 197, 141, 21));
226
            userLabel.setText(PluginServices.getText(this, "user") + ":");
227
            dbLabel = new JLabel();
228
            dbLabel.setBounds(new java.awt.Rectangle(10, 130, 141, 21));
229
            dbLabel.setText(PluginServices.getText(this, "database_name") +
230
                ":");
231
            dbLabelWarning = new JLabel();
232
            dbLabelWarning.setBounds(new java.awt.Rectangle(10, 155, 310, 41));
233
            dbLabelWarning.setText(PluginServices.getText(this, "warning_you_must_input_the_exact_name_this_difference_between_capital_letters_and_small_letters")
234
                );
235

  
236
            portLabel = new JLabel();
237
            portLabel.setBounds(new java.awt.Rectangle(10, 105, 141, 21));
238
            portLabel.setText(PluginServices.getText(this, "port") + ":");
239
            driverLabel = new JLabel();
240
            driverLabel.setBounds(new java.awt.Rectangle(10, 55, 141, 21));
241
            driverLabel.setText(PluginServices.getText(this, "driver") + ":");
242
            paramsPanel = new JPanel();
243
            paramsPanel.setBounds(new java.awt.Rectangle(10, 10, 336, 273));
244
            paramsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
245
                    null, PluginServices.getText(this, "connection_params"),
246
                    javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
247
                    javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
248
            paramsPanel.setLayout(null);
249
            paramsPanel.add(getPortTextField(), null);
250
            paramsPanel.add(getDriverComboBox(), null);
251
            paramsPanel.add(getDbTextField(), null);
252
            paramsPanel.add(getUserTextField(), null);
253
            paramsPanel.add(getPasswordField(), null);
254
            paramsPanel.add(driverLabel, null);
255
            paramsPanel.add(portLabel, null);
256
            paramsPanel.add(dbLabel, null);
257
            paramsPanel.add(dbLabelWarning, null);
258
            paramsPanel.add(userLabel, null);
259
            paramsPanel.add(pwLabel, null);
260
            paramsPanel.add(getUrlTextArea(), null);
261
            paramsPanel.add(urlLabel, null);
262
            paramsPanel.add(getConnectedCheckBox(), null);
263
            paramsPanel.add(connectedLabel, null);
264
            paramsPanel.add(connNameLabel, null);
265
            paramsPanel.add(getConnNameTextField(), null);
266
        }
267

  
268
        return paramsPanel;
269
    }
270

  
271
    /**
272
     * This method initializes driverComboBox
273
     *
274
     * @return javax.swing.JComboBox
275
     */
276
    private JComboBox getDriverComboBox() {
277
        if (driverComboBox == null) {
278
            driverComboBox = new JComboBox();
279
            driverComboBox.addActionListener(this);
280
            DataManager dm = DALLocator.getDataManager();
281
            List<String> explorers = dm.getExplorerProviders();
282
            Iterator<String> iter = explorers.iterator();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff