Revision 29344

View differences:

tags/tmp_build/extensions/extGeoDB/.project
1
<projectDescription>
2
  <name>extGeoDB</name>
3
  <comment>Base POM for all GvSIG extension projects. This pom knows
4
		how to build and made an extension for GvSIG. The property
5
		&quot;gvsig-path&quot; must be set up correctly.</comment>
6
  <projects>
7
    <project>org.gvsig.fmap.dal.db</project>
8
  </projects>
9
  <buildSpec>
10
    <buildCommand>
11
      <name>org.eclipse.jdt.core.javabuilder</name>
12
    </buildCommand>
13
  </buildSpec>
14
  <natures>
15
    <nature>org.eclipse.jdt.core.javanature</nature>
16
  </natures>
17
</projectDescription>
0 18

  
tags/tmp_build/extensions/extGeoDB/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="./lib"/>
4
	<depends plugin-name="com.iver.cit.gvsig"/>
5
	<resourceBundle name="text"/>
6
	<extensions>
7
		<extension class-name="com.iver.cit.gvsig.SingleVectorialDBConnectionExtension"
8
			description="Opens DB connections manager"
9
			active="true">
10
			<menu text="Ver/gestor_db" action-command="GESTOR_VECTORIALDB" key="j"
11
				tooltip="abrir_gestor_de_orig_db"
12
				position="3"/>
13
		</extension>
14

  
15
		<extension class-name="com.iver.cit.gvsig.ExtDB_Spatial"
16
			description="Support to access Spatial databases"
17
			active="true">
18
		</extension>
19
		<extension class-name="com.iver.cit.gvsig.ExportToDB"
20
			description="Exportar a diversos formatos"
21
			active="true">
22
			<menu text="Capa/export_to/postgis" action-command="POSTGIS"/>
23
			<menu text="Capa/export_to/mysql" action-command="MYSQL"/>
24
		</extension>
25
	</extensions>
26
</plugin-config>
0 27

  
tags/tmp_build/extensions/extGeoDB/build.number
1
#Build Number for ANT. Do not edit!
2
#Tue Apr 28 16:00:47 CEST 2009
3
build.number=2005
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/vectorialdb/wizard/UserTableSettingsVectorialPanel.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 IVER T.I   {{Task}}
26
*/
27

  
28
package com.prodevelop.cit.gvsig.vectorialdb.wizard;
29

  
30
import java.awt.event.ActionEvent;
31

  
32
import javax.swing.JCheckBox;
33
import javax.swing.JComboBox;
34
import javax.swing.JLabel;
35
import javax.swing.JTextField;
36

  
37
import org.cresques.cts.IProjection;
38
import org.gvsig.fmap.dal.store.db.DBStoreParameters;
39
import org.gvsig.fmap.geom.GeometryLocator;
40
import org.gvsig.fmap.geom.GeometryManager;
41
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
42
import org.gvsig.fmap.geom.exception.CreateEnvelopeException;
43
import org.gvsig.fmap.geom.primitive.Envelope;
44
import org.gvsig.fmap.mapcontrol.MapControl;
45
import org.gvsig.gui.beans.swing.JButton;
46
import org.slf4j.Logger;
47
import org.slf4j.LoggerFactory;
48

  
49
import com.iver.andami.PluginServices;
50
import com.iver.cit.gvsig.addlayer.AddLayerDialog;
51
import com.iver.cit.gvsig.gui.panels.CRSSelectPanel;
52

  
53
public class UserTableSettingsVectorialPanel extends UserTableSettingsPanel {
54
    private static Logger logger = LoggerFactory
55
			.getLogger(UserTableSettingsPanel.class.getName());
56

  
57
    private FieldComboItem[] geos;
58
	private JComboBox geomComboBox = null;
59
    private JLabel geomLabel = null;
60
	private JLabel waLabel = null;
61
	private JLabel topLabel = null;
62
	private JTextField topTextField = null;
63
	private JTextField bottomTextField = null;
64
	private JTextField rightTextField = null;
65
	private JTextField leftTextField = null;
66
	private JLabel bottomLabel = null;
67
	private JLabel rightLabel = null;
68
	private JLabel leftLabel = null;
69
	private JButton getviewButton = null;
70
	private JCheckBox activateWACheckBox = null;
71
    private MapControl mControl = null;
72
	private CRSSelectPanel panelProj;
73
	private IProjection currentProj;
74

  
75
    public UserTableSettingsVectorialPanel(FieldComboItem[] idComboItems,
76
			FieldComboItem[] geoComboItems, String initialLayerName,
77
			MapControl mapc, boolean empty, WizardVectorialDB _p,
78
			DBStoreParameters parameters,
79
			IProjection curProjection) {
80
    	super();
81
		setInitValues(idComboItems, initialLayerName, empty, _p, parameters);
82

  
83
        mControl = mapc;
84
		geos = geoComboItems;
85
		currentProj = curProjection;
86
		initialize(empty);
87
	}
88

  
89
    protected void initialize(boolean _empty) {
90
    	super.initialize(_empty);
91
        setBorder(javax.swing.BorderFactory.createTitledBorder(null,
92
				PluginServices.getText(this, "specify_table_settings"),
93
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
94
				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
95
		leftLabel = new JLabel();
96
		// leftLabel.setBounds(new java.awt.Rectangle(375, 175, 111, 16));
97
		leftLabel.setBounds(new java.awt.Rectangle(375, 200, 111, 16));
98
		leftLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
99
		leftLabel.setText(PluginServices.getText(this, "xmin"));
100
		rightLabel = new JLabel();
101
		rightLabel.setBounds(new java.awt.Rectangle(260, 200, 111, 16));
102
		rightLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
103
		rightLabel.setText(PluginServices.getText(this, "xmax"));
104
		bottomLabel = new JLabel();
105
		bottomLabel.setBounds(new java.awt.Rectangle(130, 200, 111, 16));
106
		bottomLabel
107
				.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
108
		bottomLabel.setText(PluginServices.getText(this, "ymin"));
109
		topLabel = new JLabel();
110
		topLabel.setBounds(new java.awt.Rectangle(15, 200, 111, 16));
111
		topLabel.setFont(new java.awt.Font("Dialog", java.awt.Font.BOLD, 10));
112
		topLabel.setText(PluginServices.getText(this, "ymax"));
113
		waLabel = new JLabel();
114
		// waLabel.setBounds(new java.awt.Rectangle(40, 145, 131, 21));
115
		waLabel.setBounds(new java.awt.Rectangle(30, 172, 131, 21));
116
		waLabel.setText(PluginServices.getText(this, "working_area"));
117
		geomLabel = new JLabel();
118
		// geomLabel.setBounds(new java.awt.Rectangle(240, 55, 111, 21));
119
		geomLabel.setBounds(new java.awt.Rectangle(5, 145, 111, 21));
120
		geomLabel.setText(PluginServices.getText(this, "geo_field"));
121

  
122
		add(getGeomComboBox(), null);
123
		add(geomLabel, null);
124
	    add(waLabel, null);
125
		add(topLabel, null);
126
		add(getTopTextField(), null);
127
		add(getBottomTextField(), null);
128
		add(getRightTextField(), null);
129
		add(getLeftTextField(), null);
130
		add(bottomLabel, null);
131
		add(rightLabel, null);
132
		add(leftLabel, null);
133
		add(getGetviewButton(), null);
134
		add(getActivateWACheckBox(), null);
135
		loadValues(_empty);
136
	}
137

  
138
    private CRSSelectPanel getJPanelProj() {
139
		if (panelProj == null) {
140
			panelProj = CRSSelectPanel.getPanel(currentProj);
141

  
142
			panelProj.setTransPanelActive(true);
143
			panelProj.setLocation(new java.awt.Point(-10, 110));
144
			panelProj.addActionListener(new java.awt.event.ActionListener() {
145
				public void actionPerformed(java.awt.event.ActionEvent e) {
146
					if (panelProj.isOkPressed()) {
147
						AddLayerDialog
148
								.setLastProjection(panelProj.getCurProj());
149
					}
150
				}
151
			});
152
		}
153
		return panelProj;
154
	}
155

  
156

  
157
    public boolean hasValidValues() {
158
		if (!super.hasValidValues()) {
159
			return false;
160
		}
161

  
162
		if ((activateWACheckBox.isSelected()) && (getWorkingArea() == null)) {
163
			return false;
164
		}
165

  
166
		return true;
167
	}
168

  
169
    private JComboBox getGeomComboBox() {
170
		if (geomComboBox == null) {
171
			geomComboBox = new JComboBox();
172
			// geomComboBox.setBounds(new java.awt.Rectangle(355, 55, 131, 21));
173
			geomComboBox.setBounds(new java.awt.Rectangle(120, 145, 118, 21));
174
		}
175

  
176
		return geomComboBox;
177
	}
178

  
179
	private JTextField getTopTextField() {
180
		if (topTextField == null) {
181
			topTextField = new JTextField();
182
			topTextField.addKeyListener(this);
183
			// topTextField.setBounds(new java.awt.Rectangle(15, 190, 111, 21));
184
			topTextField.setBounds(new java.awt.Rectangle(15, 215, 111, 21));
185
		}
186

  
187
		return topTextField;
188
	}
189

  
190
	private JTextField getBottomTextField() {
191
		if (bottomTextField == null) {
192
			bottomTextField = new JTextField();
193
			bottomTextField.addKeyListener(this);
194
			bottomTextField
195
					.setBounds(new java.awt.Rectangle(130, 215, 111, 21));
196
		}
197

  
198
		return bottomTextField;
199
	}
200

  
201
	private JTextField getRightTextField() {
202
		if (rightTextField == null) {
203
			rightTextField = new JTextField();
204
			rightTextField.addKeyListener(this);
205
			rightTextField.setBounds(new java.awt.Rectangle(260, 215, 111, 21));
206
		}
207

  
208
		return rightTextField;
209
	}
210

  
211
	private JTextField getLeftTextField() {
212
		if (leftTextField == null) {
213
			leftTextField = new JTextField();
214
			leftTextField.addKeyListener(this);
215
			leftTextField.setBounds(new java.awt.Rectangle(375, 215, 111, 21));
216
		}
217

  
218
		return leftTextField;
219
	}
220

  
221
	private JButton getGetviewButton() {
222
		if (getviewButton == null) {
223
			getviewButton = new JButton();
224
			getviewButton.addActionListener(this);
225
			//getviewButton.setBounds(new java.awt.Rectangle(195, 145, 111, 26));
226
			getviewButton.setBounds(new java.awt.Rectangle(160, 174, 111, 26));
227
			getviewButton.setForeground(java.awt.Color.black);
228
			getviewButton.setText(PluginServices.getText(this, "get_view"));
229
		}
230

  
231
		return getviewButton;
232
	}
233

  
234
	private JCheckBox getActivateWACheckBox() {
235
		if (activateWACheckBox == null) {
236
			activateWACheckBox = new JCheckBox();
237
			activateWACheckBox.addActionListener(this);
238
//			activateWACheckBox
239
//					.setBounds(new java.awt.Rectangle(15, 145, 21, 21));
240
			activateWACheckBox
241
					.setBounds(new java.awt.Rectangle(5, 172, 21, 21));
242

  
243
		}
244

  
245
		return activateWACheckBox;
246
	}
247

  
248
    protected void loadValues(boolean is_empty) {
249
		super.loadValues(is_empty);
250
		if (is_empty) {
251
			enableAlphaControls(false);
252
			enableSpatialControls(false);
253
			getActivateWACheckBox().setSelected(false);
254
		} else {
255
			enableAlphaControls(true);
256
			enableSpatialControls(true);
257

  
258
			getGeomComboBox().removeAllItems();
259

  
260
			for (int i = 0; i < geos.length; i++) {
261
				getGeomComboBox().addItem(geos[i]);
262
			}
263

  
264
			add(getJPanelProj(), null);
265

  
266
		}
267
	}
268

  
269
    public void enableSpatialControls(boolean enable) {
270
    	super.enableSpatialControls(enable);
271
		getGeomComboBox().setEnabled(enable);
272

  
273
		getActivateWACheckBox().setEnabled(enable);
274

  
275
		boolean there_is_view = ((mControl != null) && (mControl.getViewPort()
276
				.getAdjustedExtent() != null));
277

  
278
		getGetviewButton().setEnabled(enable && there_is_view);
279
		getTopTextField().setEnabled(enable);
280
		getBottomTextField().setEnabled(enable);
281
		getRightTextField().setEnabled(enable);
282
		getLeftTextField().setEnabled(enable);
283
	}
284

  
285
    public void actionPerformed(ActionEvent e) {
286
		super.actionPerformed(e);
287
		Object src = e.getSource();
288

  
289
        if (src == getviewButton) {
290
			getViewIntoFourBounds();
291
			parent.checkFinishable();
292
		}
293

  
294
		if (src == activateWACheckBox) {
295
			enableWASettings(activateWACheckBox.isSelected());
296
			parent.checkFinishable();
297
		}
298
	}
299

  
300
    private void enableWASettings(boolean b) {
301
		getviewButton.setEnabled(b
302
				&& (mControl.getViewPort().getAdjustedExtent() != null));
303
		rightTextField.setEnabled(b);
304
		leftTextField.setEnabled(b);
305
		topTextField.setEnabled(b);
306
		bottomTextField.setEnabled(b);
307
	}
308

  
309
    private void getViewIntoFourBounds() {
310
		Envelope rect = mControl.getViewPort().getAdjustedExtent();
311
		topTextField.setText(getFormattedDouble(rect.getMaximum(1)));
312
		bottomTextField.setText(getFormattedDouble(rect.getMinimum(1)));
313
		rightTextField.setText(getFormattedDouble(rect.getMaximum(0)));
314
		leftTextField.setText(getFormattedDouble(rect.getMinimum(0)));
315
	}
316

  
317
    public Envelope getWorkingArea() {
318
		if (!activateWACheckBox.isSelected()) {
319
			return null;
320
		}
321

  
322
		double maxx;
323
		double maxy;
324
		double minx;
325
		double miny;
326

  
327
		try {
328
			maxx = Double.parseDouble(rightTextField.getText());
329
			miny = Double.parseDouble(bottomTextField.getText());
330
			minx = Double.parseDouble(leftTextField.getText());
331
			maxy = Double.parseDouble(topTextField.getText());
332
		} catch (NumberFormatException nfe) {
333
			logger.error("Not valid value: " + nfe.getMessage());
334

  
335
			return null;
336
		}
337
		GeometryManager geoMan = GeometryLocator.getGeometryManager();
338

  
339
		try {
340
			return geoMan.createEnvelope(minx, miny, maxx, maxy,
341
					SUBTYPES.GEOM2D);
342
		} catch (CreateEnvelopeException e) {
343
			// FIXME Exception
344
			throw new RuntimeException(e);
345
		}
346
	}
347

  
348
    public boolean combosHaveItems() {
349
		if (!super.combosHaveItems()) {
350
			return false;
351
		}
352

  
353
		if (getGeomComboBox().getItemCount() == 0) {
354
			return false;
355
		}
356

  
357
		return true;
358
	}
359

  
360
    public void repaint() {
361
		super.repaint();
362
		getGeomComboBox().updateUI();
363
	}
364

  
365
    public String getGeoFieldName() {
366
		if (getGeomComboBox().getSelectedItem() == null) {
367
			return null;
368
		}
369
		return getGeomComboBox().getSelectedItem().toString();
370
	}
371
    public IProjection getProjection() {
372
		return panelProj.getCurProj();
373
	}
374

  
375
}
0 376

  
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/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 com.prodevelop.cit.gvsig.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.ArrayList;
51
import java.util.Iterator;
52
import java.util.List;
53

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

  
62
import org.apache.log4j.Logger;
63
import org.gvsig.fmap.dal.DALLocator;
64
import org.gvsig.fmap.dal.DataManager;
65
import org.gvsig.fmap.dal.DataServerExplorerParameters;
66
import org.gvsig.fmap.dal.exception.DataException;
67
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
68
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters;
69
import org.gvsig.fmap.dal.serverexplorer.filesystem.swing.DynObjectEditor;
70

  
71
import com.iver.andami.PluginServices;
72
import com.iver.andami.messages.NotificationManager;
73
import com.iver.andami.ui.mdiManager.IWindow;
74
import com.iver.andami.ui.mdiManager.WindowInfo;
75

  
76

  
77
/**
78
 * Lets the user input the connection parameters.
79
 *
80
 * @author jldominguez
81
 *
82
 */
83
public class VectorialDBConnectionParamsDialog extends JPanel implements IWindow,
84
    ActionListener, KeyListener {
85
    private static Logger logger = Logger.getLogger(VectorialDBConnectionParamsDialog.class.getName());
86
    private WindowInfo winfo = new WindowInfo(8); // MODAL only
87
    private JButton cancelButton = null;
88
    private JButton okButton = null;
89
    private JButton advancedButton = null;
90
    private JPanel paramsPanel = null;
91
    private JComboBox driverComboBox = null;
92
    private JTextField portTextField = null;
93
    private JTextField dbTextField = null;
94
    private JTextField userTextField = null;
95
    private JPasswordField passwordField = null;
96
    private JLabel driverLabel = null;
97
    private JLabel portLabel = null;
98
    private JLabel dbLabel = null;
99
    private JLabel dbLabelWarning = null;
100
    private JLabel userLabel = null;
101
    private JLabel pwLabel = null;
102
    private boolean okPressed = false;
103
    private JTextField urlTextField = null;
104
    private JLabel urlLabel = null;
105
    private JCheckBox connectedCheckBox = null;
106
    private JLabel connectedLabel = null;
107
    private JLabel connNameLabel = null;
108
    private JTextField connNameTextField = null;
109

  
110
    private DBServerExplorerParameters params = null;
111

  
112
    /**
113
     * This method initializes
114
     *
115
     */
116
    public VectorialDBConnectionParamsDialog() {
117
        super();
118
        initialize();
119
    }
120

  
121
    public void showDialog() {
122
        PluginServices.getMDIManager().addWindow(this);
123
    }
124

  
125
    /**
126
     * This method initializes this
127
     *
128
     */
129
    private void initialize() {
130
        winfo.setWidth(370);
131
        winfo.setHeight(317 - 25);
132
        winfo.setTitle(PluginServices.getText(this, "connection_parameters"));
133

  
134
        this.setSize(new java.awt.Dimension(360, 329));
135
        this.setLayout(null);
136
        this.add(getCancelButton(), null);
137
        this.add(getOkButton(), null);
138
        this.add(getAdvancedButton(), null);
139
        this.add(getParamsPanel(), null);
140
    }
141

  
142
    public WindowInfo getWindowInfo() {
143
        return winfo;
144
    }
145

  
146
    /**
147
     * This method initializes cancelButton
148
     *
149
     * @return javax.swing.JButton
150
     */
151
    private JButton getCancelButton() {
152
        if (cancelButton == null) {
153
            cancelButton = new JButton();
154
            cancelButton.setText(PluginServices.getText(this, "cancel"));
155
            cancelButton.addActionListener(this);
156
            cancelButton.setBounds(new java.awt.Rectangle(124, 292, 90, 26));
157
        }
158

  
159
        return cancelButton;
160
    }
161

  
162
    /**
163
     * This method initializes okButton
164
     *
165
     * @return javax.swing.JButton
166
     */
167
    private JButton getOkButton() {
168
        if (okButton == null) {
169
            okButton = new JButton();
170
            okButton.setText(PluginServices.getText(this, "ok"));
171
            okButton.addActionListener(this);
172
            okButton.setBounds(new java.awt.Rectangle(30, 292, 90, 26));
173
        }
174

  
175
        return okButton;
176
    }
177

  
178
	/**
179
	 * This method initializes okButton
180
	 *
181
	 * @return javax.swing.JButton
182
	 */
183
	private JButton getAdvancedButton() {
184
		if (advancedButton == null) {
185
			advancedButton = new JButton();
186
			advancedButton.setText(PluginServices.getText(this, "advanced"));
187
			advancedButton.addActionListener(this);
188
			advancedButton.setBounds(new java.awt.Rectangle(218, 292, 90, 26));
189
		}
190

  
191
		return advancedButton;
192
	}
193

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

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

  
259
        return paramsPanel;
260
    }
261

  
262
    /**
263
     * This method initializes driverComboBox
264
     *
265
     * @return javax.swing.JComboBox
266
     */
267
    private JComboBox getDriverComboBox() {
268
        if (driverComboBox == null) {
269
            driverComboBox = new JComboBox();
270
            driverComboBox.addActionListener(this);
271
            DataManager dm = DALLocator.getDataManager();
272
            List<String> explorers = dm.getExplorerProviders();
273
            Iterator<String> iter = explorers.iterator();
274
            String expName;
275

  
276
            DataServerExplorerParameters params;
277
            while (iter.hasNext()) {
278
            	expName = iter.next();
279
				try {
280
					params = dm.createServerExplorerParameters(expName);
281
				} catch (DataException e) {
282
					NotificationManager.addWarning(PluginServices.getText(null,
283
							"DataExplorer_parameters_error")
284
							+ ": " + expName, e);
285
					continue;
286
				}
287
				if (params instanceof DBServerExplorerParameters) {
288
					DBServerExplorerParameters dbParams = (DBServerExplorerParameters) params;
289
					driverComboBox.addItem(new DriverComboBoxItem(
290
							dbParams));
291
				}
292

  
293
            }
294

  
295
            driverComboBox.setBounds(new java.awt.Rectangle(155, 55, 166, 21));
296

  
297
        }
298

  
299
        return driverComboBox;
300
    }
301

  
302
    private class DriverComboBoxItem {
303
    	private DBServerExplorerParameters params;
304

  
305
    	public DriverComboBoxItem(DBServerExplorerParameters dbParams) {
306
			this.params = dbParams;
307
		}
308

  
309
		public String toString() {
310
			// FIXME
311
    		return params.getExplorerName();
312
    	}
313
    }
314

  
315
    /**
316
     * This method initializes portTextField
317
     *
318
     * @return javax.swing.JTextField
319
     */
320
    private JTextField getPortTextField() {
321
        if (portTextField == null) {
322
            portTextField = new JTextField();
323
            portTextField.addKeyListener(this);
324
            portTextField.setBounds(new java.awt.Rectangle(155, 105, 166, 21));
325
        }
326

  
327
        return portTextField;
328
    }
329

  
330
    /**
331
     * This method initializes dbTextField
332
     *
333
     * @return javax.swing.JTextField
334
     */
335
    private JTextField getDbTextField() {
336
        if (dbTextField == null) {
337
            dbTextField = new JTextField();
338
            dbTextField.addKeyListener(this);
339
            dbTextField.setBounds(new java.awt.Rectangle(155, 130, 166, 21));
340
        }
341

  
342
        return dbTextField;
343
    }
344

  
345
    /**
346
     * This method initializes userTextField
347
     *
348
     * @return javax.swing.JTextField
349
     */
350
    private JTextField getUserTextField() {
351
        if (userTextField == null) {
352
            userTextField = new JTextField();
353
            userTextField.addKeyListener(this);
354
            userTextField.setBounds(new java.awt.Rectangle(155, 197, 166, 21));
355
        }
356

  
357
        return userTextField;
358
    }
359

  
360
    /**
361
     * This method initializes passwordField
362
     *
363
     * @return javax.swing.JPasswordField
364
     */
365
    private JPasswordField getPasswordField() {
366
        if (passwordField == null) {
367
            passwordField = new JPasswordField();
368
            passwordField.addKeyListener(this);
369
            passwordField.setBounds(new java.awt.Rectangle(155, 222, 166, 21));
370
        }
371

  
372
        return passwordField;
373
    }
374

  
375
//    private String[] getDriverNames() {
376
//        Class[] classes = new Class[] { IVectorialDatabaseDriver.class };
377
//
378
//        ArrayList ret = new ArrayList();
379
//        String[] driverNames = LayerFactory.getDM().getDriverNames();
380
//
381
//        for (int i = 0; i < driverNames.length; i++) {
382
//            for (int j = 0; j < classes.length; j++) {
383
//                if (LayerFactory.getDM().isA(driverNames[i], classes[j])) {
384
//                    ret.add(driverNames[i]);
385
//                }
386
//            }
387
//        }
388
//
389
//        return (String[]) ret.toArray(new String[0]);
390
//    }
391

  
392
    public void actionPerformed(ActionEvent arg0) {
393
        Object src = arg0.getSource();
394

  
395
        if (src == connectedCheckBox) {
396
            if (connectedCheckBox.isSelected()) {
397
                passwordField.setEnabled(true);
398
                passwordField.setBackground(Color.WHITE);
399
            }
400
            else {
401
                passwordField.setText("");
402
                passwordField.setEnabled(false);
403
                passwordField.setBackground(Color.LIGHT_GRAY);
404
            }
405
        }
406

  
407
        if (src == okButton) {
408
            okPressed = true;
409
            PluginServices.getMDIManager().closeWindow(this);
410

  
411
            return;
412
        }
413

  
414
        if (src == cancelButton) {
415
            okPressed = false;
416
            PluginServices.getMDIManager().closeWindow(this);
417

  
418
            return;
419
        }
420

  
421
        if (src == advancedButton) {
422
        	List<String> toHide = new ArrayList<String>();
423
        	toHide.add(DBServerExplorerParameters.DYNFIELDNAME_PASSWORD);
424
        	toHide.add(DBServerExplorerParameters.DYNFIELDNAME_HOST);
425
			toHide.add(DBServerExplorerParameters.DYNFIELDNAME_PORT);
426
			toHide.add(DBServerExplorerParameters.DYNFIELDNAME_USER);
427
			toHide.add(DBServerExplorerParameters.DYNFIELDNAME_DBNAME);
428
			DBServerExplorerParameters myParams = getParameters();
429
			try {
430
				myParams.validate();
431
			} catch (Exception e) {
432
				// ignore... only for fill default values
433
			}
434
			DynObjectEditor editor = new DynObjectEditor(myParams,
435
					DynObjectEditor.HIDDE_THIS_PARAMS, toHide);
436
			editor.editObject(true);
437

  
438
			return;
439
		}
440

  
441
        if (src == driverComboBox) {
442
        	DBServerExplorerParameters params = ((DriverComboBoxItem) driverComboBox
443
					.getSelectedItem()).params;
444
        		try {
445
				params.validate();
446
			} catch (ValidateDataParametersException e) {
447
			}
448

  
449
//            try {
450
//            	DataManager dm=DataManager.getManager();
451
//                featureStore = (FeatureStore) dm.createDataStore()LayerFactory.getDM()
452
//                                                           .getDriver(driverName);
453
			if (params.getPort() != null) {
454
				portTextField.setText(params.getPort() + "");
455
			} else {
456
				portTextField.setText("");
457
			}
458
//            }
459
//            catch (DriverLoadException e1) {
460
//                portTextField.setText("");
461
//            }
462

  
463
            return;
464
        }
465
    }
466

  
467
    public boolean isOkPressed() {
468
        return okPressed;
469
    }
470

  
471
    public boolean hasToBeConnected() {
472
        return connectedCheckBox.isSelected();
473
    }
474

  
475
    public String getConnectionDriverName() {
476
        return ((DriverComboBoxItem) driverComboBox.getSelectedItem()).params
477
				.getExplorerName();
478
    }
479

  
480
    public String getConnectionServerUrl() {
481
        return urlTextField.getText();
482
    }
483

  
484
    public String getConnectionPort() {
485
        return portTextField.getText();
486
    }
487

  
488
    public String getConnectionDBName() {
489
        return dbTextField.getText();
490
    }
491

  
492
    public String getConnectionUser() {
493
        return userTextField.getText();
494
    }
495

  
496
    public String getConnectionPassword() {
497
        String resp = new String(passwordField.getPassword());
498

  
499
        return resp;
500
    }
501

  
502
    private JTextField getUrlTextArea() {
503
        if (urlTextField == null) {
504
            urlTextField = new JTextField();
505
            urlTextField.addKeyListener(this);
506
            urlTextField.setBounds(new java.awt.Rectangle(155, 80, 166, 21));
507
        }
508

  
509
        return urlTextField;
510
    }
511

  
512
    /**
513
     * This method initializes connectedCheckBox
514
     *
515
     * @return javax.swing.JCheckBox
516
     */
517
    private JCheckBox getConnectedCheckBox() {
518
        if (connectedCheckBox == null) {
519
            connectedCheckBox = new JCheckBox();
520
            connectedCheckBox.setSelected(true);
521
            connectedCheckBox.addActionListener(this);
522
            connectedCheckBox.setBounds(new java.awt.Rectangle(155, 247, 26, 21));
523
        }
524

  
525
        return connectedCheckBox;
526
    }
527

  
528
    public String getConnectionName() {
529
        return getConnNameTextField().getText();
530
    }
531

  
532
    /**
533
     * This method initializes connNameTextField
534
     *
535
     * @return javax.swing.JTextField
536
     */
537
    private JTextField getConnNameTextField() {
538
        if (connNameTextField == null) {
539
            connNameTextField = new JTextField();
540
            connNameTextField.addKeyListener(this);
541
            connNameTextField.setBounds(new java.awt.Rectangle(155, 30, 166, 21));
542
        }
543

  
544
        return connNameTextField;
545
    }
546

  
547
    public void keyPressed(KeyEvent e) {
548
    }
549

  
550
    public void keyReleased(KeyEvent e) {
551
        if (e.getKeyChar() != '\n') {
552
            return;
553
        }
554

  
555
        Object src = e.getSource();
556

  
557
        if (src == passwordField) {
558
            ActionEvent aevt = new ActionEvent(okButton,
559
                    ActionEvent.ACTION_PERFORMED, "");
560
            actionPerformed(aevt);
561
        }
562
        else {
563
            if (src instanceof JTextField) {
564
                ((JTextField) src).transferFocus();
565
            }
566
        }
567
    }
568

  
569
    public void keyTyped(KeyEvent e) {
570
	}
571

  
572
    public void loadValues(DBServerExplorerParameters cwp) {
573
    	if (cwp.getPort() != null){
574
    		getPortTextField().setText(cwp.getPort().toString());
575
    	} else{
576
    		getPortTextField().setText("");
577
    	}
578
        selectThisInDriverCombo(cwp.getExplorerName());
579
        getDbTextField().setText(cwp.getDBName());
580
        getUserTextField().setText(cwp.getUser());
581

  
582
        if (cwp.getPassword() == null) {
583
            getPasswordField().setText("");
584
        }
585
        else {
586
            getPasswordField().setText(cwp.getPassword());
587
        }
588

  
589
        getUrlTextArea().setText(cwp.getHost());
590

  
591
        boolean connected = false;
592

  
593
//        try {
594
//            connected = (cwp.getConnection() != null) &&
595
//                (!cwp.getConnection().isClosed());
596
//        }
597
//        catch (DBException e) {
598
//            logger.error("While checking connection: " + e.getMessage());
599
//            connected = false;
600
//        }
601

  
602
//        getConnectedCheckBox().setSelected(connected);
603
		getConnNameTextField().setText(cwp.getExplorerName());
604
    }
605

  
606
    private void selectThisInDriverCombo(String drvName) {
607
        int size = getDriverComboBox().getItemCount();
608
        int curSel = getDriverComboBox().getSelectedIndex();
609

  
610
        for (int i = 0; i < size; i++) {
611
            DriverComboBoxItem item = (DriverComboBoxItem) getDriverComboBox()
612
					.getItemAt(i);
613

  
614
            if (item.params.getExplorerName().compareToIgnoreCase(drvName) == 0) {
615
                getDriverComboBox().setSelectedIndex(i);
616
                if (curSel != i) {
617
					this.params = null;
618
				}
619

  
620
                return;
621
            }
622
        }
623
    }
624

  
625
	public Object getWindowProfile() {
626
		return WindowInfo.DIALOG_PROFILE;
627
	}
628

  
629
	public DBServerExplorerParameters getParameters(){
630
		if (params == null) {
631
			DriverComboBoxItem item = (DriverComboBoxItem) getDriverComboBox()
632
					.getItemAt(getDriverComboBox().getSelectedIndex());
633
			params = (DBServerExplorerParameters) item.params.getCopy();
634

  
635

  
636
		}
637
		String _host = getConnectionServerUrl();
638
		String _port = getConnectionPort();
639
		String _dbname = getConnectionDBName();
640
		String _user = getConnectionUser();
641
		String _pw = getConnectionPassword();
642

  
643
		params.setHost(_host);
644
		if (_port.trim().length() != 0) {
645
			try {
646
				params.setPort(Integer.parseInt(_port));
647
			} catch (NumberFormatException e) {
648
				NotificationManager.addError("Invalid port", e);
649
			}
650
		}
651
		params.setDBName(_dbname);
652
		params.setUser(_user);
653
		params.setPassword(_pw);
654

  
655
		return params;
656
	}
657

  
658
} //  @jve:decl-index=0:visual-constraint="10,10"
0 659

  
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/vectorialdb/wizard/VectorialDBConnectionTreeNode.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 com.prodevelop.cit.gvsig.vectorialdb.wizard;
44

  
45
import javax.swing.tree.DefaultMutableTreeNode;
46

  
47

  
48
/**
49
 * Utility class used to manage the connection tree.
50
 * @author jldominguez
51
 *
52
 */
53
public class VectorialDBConnectionTreeNode extends DefaultMutableTreeNode {
54
    private String label;
55

  
56
    public VectorialDBConnectionTreeNode(String drvname) {
57
        label = drvname;
58
        setAllowsChildren(true);
59
    }
60

  
61
    public String toString() {
62
        return label;
63
    }
64
}
0 65

  
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/vectorialdb/wizard/ConnectionTreeRenderer.java
1
package com.prodevelop.cit.gvsig.vectorialdb.wizard;
2

  
3
import java.awt.Component;
4

  
5
import javax.swing.ImageIcon;
6
import javax.swing.JTree;
7
import javax.swing.tree.DefaultTreeCellRenderer;
8

  
9
import com.iver.andami.PluginServices;
10

  
11
public class ConnectionTreeRenderer extends DefaultTreeCellRenderer {
12

  
13
//	private ImageIcon connImage = new ImageIcon(createResourceUrl("images/conn.png"));
14
	private ImageIcon connImage = PluginServices.getIconTheme().get("conn-image");
15
//	private ImageIcon disconnImage = new ImageIcon(createResourceUrl("images/disconn.png"));
16
	private ImageIcon disconnImage = PluginServices.getIconTheme().get("disconn-image");
17

  
18
	public Component getTreeCellRendererComponent(JTree tree, Object value,
19
			boolean selected, boolean expanded, boolean leaf, int row,
20
			boolean hasFocus) {
21

  
22
		if (value instanceof VectorialDBConnectionTreeLeaf) {
23
			VectorialDBConnectionTreeLeaf jdbc = (VectorialDBConnectionTreeLeaf) value;
24
			if (jdbc.getConnectionWithParams()!=null) {
25
				setLeafIcon(connImage);
26
			} else {
27
				setLeafIcon(disconnImage);
28
			}
29
		}
30

  
31
		return super.getTreeCellRendererComponent(
32
					tree,
33
					value,
34
					selected,
35
					expanded,
36
					leaf,
37
					row,
38
					hasFocus);
39
	}
40

  
41
    private java.net.URL createResourceUrl(String path) {
42
        return getClass().getClassLoader().getResource(path);
43
    }
44

  
45
}
0 46

  
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/vectorialdb/wizard/MyExplorer.java
1

  
2
/* gvSIG. Geographic Information System of the Valencian Government
3
*
4
* Copyright (C) 2007-2008 Infrastructures and Transports Department
5
* of the Valencian Government (CIT)
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License
9
* as published by the Free Software Foundation; either version 2
10
* of the License, or (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20
* MA  02110-1301, USA.
21
*
22
*/
23

  
24
/*
25
* AUTHORS (In addition to CIT):
26
* ${year} IVER T.I. S.A.   {{Task}}
27
*/
28

  
29
package com.prodevelop.cit.gvsig.vectorialdb.wizard;
30

  
31
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters;
32

  
33

  
34
/**
35
 * DOCUMENT ME!
36
 *
37
 * @author Vicente Caballero Navarro
38
 */
39
public class MyExplorer {
40
    private DBServerExplorerParameters dbExplorerParameters;
41
    private String name;
42

  
43
    /**
44
     * DOCUMENT ME!
45
     *
46
     * @return DOCUMENT ME!
47
     */
48
    public DBServerExplorerParameters getDbSeverExplorerParameters() {
49
        return dbExplorerParameters;
50
    }
51

  
52
    /**
53
     * DOCUMENT ME!
54
     *
55
     * @param dbExplorerParameters DOCUMENT ME!
56
     */
57
    public void setDbExplorerParameters(
58
        DBServerExplorerParameters dbExplorerParameters) {
59
        this.dbExplorerParameters = dbExplorerParameters;
60
    }
61

  
62
    /**
63
     * DOCUMENT ME!
64
     *
65
     * @return DOCUMENT ME!
66
     */
67
    public String getName() {
68
        return name;
69
    }
70

  
71
    /**
72
     * DOCUMENT ME!
73
     *
74
     * @param name DOCUMENT ME!
75
     */
76
    public void setName(String name) {
77
        this.name = name;
78
    }
79

  
80
	public String toString() {
81
		return getName();
82
	}
83

  
84
}
tags/tmp_build/extensions/extGeoDB/src/com/prodevelop/cit/gvsig/vectorialdb/wizard/WizardDB.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
*
3
* Copyright (C) 2007-2008 Infrastructures and Transports Department
4
* of the Valencian Government (CIT)
5
*
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
10
*
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
* MA  02110-1301, USA.
20
*
21
*/
22

  
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2009 IVER T.I   {{Task}}
26
*/
27

  
28
package com.prodevelop.cit.gvsig.vectorialdb.wizard;
29

  
30
import java.awt.BorderLayout;
31
import java.awt.Window;
32
import java.awt.event.ActionEvent;
33
import java.awt.event.ActionListener;
34
import java.util.ArrayList;
35
import java.util.Iterator;
36
import java.util.List;
37

  
38
import javax.swing.DefaultListModel;
39
import javax.swing.ImageIcon;
40
import javax.swing.JComboBox;
41
import javax.swing.JOptionPane;
42
import javax.swing.JPanel;
43
import javax.swing.JScrollPane;
44
import javax.swing.ListSelectionModel;
45
import javax.swing.event.ListSelectionEvent;
46
import javax.swing.event.ListSelectionListener;
47

  
48
import org.gvsig.AppGvSigLocator;
49
import org.gvsig.AppGvSigManager;
50
import org.gvsig.PrepareContext;
51
import org.gvsig.fmap.dal.DALLocator;
52
import org.gvsig.fmap.dal.DataManager;
53
import org.gvsig.fmap.dal.DataStoreParameters;
54
import org.gvsig.fmap.dal.exception.DataException;
55
import org.gvsig.fmap.dal.exception.InitializeException;
56
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
57
import org.gvsig.fmap.dal.feature.FeatureStore;
58
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorer;
59
import org.gvsig.fmap.dal.serverexplorer.db.DBServerExplorerParameters;
60
import org.gvsig.fmap.dal.store.db.DBStoreParameters;
61
import org.gvsig.fmap.mapcontext.layers.FLayer;
62
import org.gvsig.fmap.mapcontrol.MapControl;
63
import org.gvsig.gui.beans.swing.JButton;
64
import org.gvsig.project.document.table.FeatureTableDocument;
65
import org.slf4j.Logger;
66
import org.slf4j.LoggerFactory;
67

  
68
import com.iver.andami.PluginServices;
69
import com.iver.andami.messages.NotificationManager;
70
import com.iver.cit.gvsig.ProjectExtension;
71
import com.iver.cit.gvsig.SingleVectorialDBConnectionExtension;
72
import com.iver.cit.gvsig.gui.WizardPanel;
73
import com.iver.cit.gvsig.project.Project;
74
import com.iver.cit.gvsig.project.ProjectFactory;
75

  
76
public class WizardDB extends WizardPanel implements ActionListener,
77
		ListSelectionListener {
78

  
79
	private static final String WIZARD_TAB_NAME = "DB";
80
	private static Logger logger = LoggerFactory.getLogger(WizardDB.class
81
			.getName());
82

  
83
    private JPanel namePanel = null;
84
	private JPanel tablesPanel = null;
85
	private JScrollPane tablesScrollPane = null;
86
	private AvailableTablesCheckBoxList tablesList = null;
87
	private JComboBox datasourceComboBox = null;
88
	private UserSelectedFieldsPanel fieldsPanel = null;
89
	private UserSelectedFieldsPanel emptyFieldsPanel = null;
90
	private JButton dbButton = null;
91
	private DBServerExplorerParameters dbExplorerParameters;
92

  
93
    private UserTableSettingsPanel settingsPanel = null;
94
	protected UserTableSettingsPanel emptySettingsPanel = null;
95
	private PrepareContext prepareDSContext;
96

  
97
    public WizardDB() {
98
		super();
99
		initialize();
100
	}
101

  
102

  
103
	protected void initialize() {
104
		setTabName(WIZARD_TAB_NAME);
105
		setLayout(null);
106
		setSize(512, 478);
107

  
108

  
109

  
110
		emptyFieldsPanel = new UserSelectedFieldsPanel(null, true, this);
111
		add(emptyFieldsPanel);
112

  
113
        add(getNamePanel(), null);
114
		loadVectorialDBDatasourcesCombo(null);
115

  
116
		add(getTablesPanel(), null);
117

  
118
        emptySettingsPanel = createSettingsPanel(null);
119
        add(emptySettingsPanel);
120

  
121
	}
122

  
123

  
124
    private void loadVectorialDBDatasourcesCombo(MyExplorer sel) {
125
		getDatasourceComboBox().removeAllItems();
126
		DataManager dm = DALLocator.getDataManager();
127
		List names = dm.getStoreProviders();
128
		if (sel != null) {
129
			getDatasourceComboBox().addItem(sel);
130
		}
131

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff