Revision 39597 branches/v2_0_0_prep/extensions/extGeoDB/src/org/gvsig/geodb/vectorialdb/wizard/UserTableSettingsVectorialPanel.java

View differences:

UserTableSettingsVectorialPanel.java
29 29

  
30 30
import java.awt.Insets;
31 31
import java.awt.event.ActionEvent;
32
import java.awt.event.ActionListener;
32 33

  
33 34
import javax.swing.ImageIcon;
34 35
import javax.swing.JButton;
35 36
import javax.swing.JCheckBox;
36 37
import javax.swing.JComboBox;
37 38
import javax.swing.JLabel;
39
import javax.swing.JPanel;
38 40
import javax.swing.JTextField;
39 41

  
40 42
import org.cresques.cts.IProjection;
......
75 77
	private JCheckBox activateWACheckBox = null;
76 78
    private MapControl mControl = null;
77 79
	private CRSSelectPanel panelProj;
78
	private IProjection currentProj;
80
	
81
    private IProjection proposedProjection = null;
82
    // private IProjection currentProj;
83
	
84
	private JPanel this_panel = null;
79 85

  
80 86
    public UserTableSettingsVectorialPanel(FieldComboItem[] idComboItems,
81 87
			FieldComboItem[] geoComboItems, String initialLayerName,
82 88
			MapControl mapc, boolean empty, WizardVectorialDB _p,
83 89
			DBStoreParameters parameters,
84
			IProjection curProjection) {
90
			IProjection proposed_proj) {
85 91
    	super();
92
    	
93
    	this_panel = this;
86 94
		setInitValues(idComboItems, initialLayerName, empty, _p, parameters);
87 95

  
88 96
        mControl = mapc;
89 97
		geos = geoComboItems;
90
		currentProj = curProjection;
98
		proposedProjection = proposed_proj;
91 99
		initialize(empty);
92 100
	}
93 101

  
......
140 148
		loadValues(_empty);
141 149
	}
142 150

  
143
    private CRSSelectPanel getJPanelProj() {
151
    private CRSSelectPanel getJPanelProj(IProjection pro) {
144 152
		if (panelProj == null) {
145
			panelProj = CRSSelectPanel.getPanel(currentProj);
153
			panelProj = CRSSelectPanel.getPanel(pro);
146 154

  
147 155
			panelProj.setTransPanelActive(true);
148 156
			panelProj.setBounds(70, 165, 350, 21);
......
176 184
			geomComboBox = new JComboBox();
177 185
			// geomComboBox.setBounds(new java.awt.Rectangle(355, 55, 131, 21));
178 186
			geomComboBox.setBounds(new java.awt.Rectangle(243, 140, 174, 21));
187
			geomComboBox.addActionListener(new ActionListener() {
188
                public void actionPerformed(ActionEvent e) {
189
                    
190
                    if (panelProj == null) {
191
                        return;
192
                    }
193
                    /*
194
                     * Set the proj of the field in the 
195
                     * SRS chooser
196
                     */
197
                    FieldComboItem fci = (FieldComboItem) geomComboBox.getSelectedItem();
198
                    
199
                    if (fci == null) {
200
                        return;
201
                    }
202
                    
203
                    IProjection iproj = fci.getProjection();
204
                    if (iproj != null) {
205
                        /*
206
                         * Remove and recreate crs selection panel
207
                         */
208
                        this_panel.remove(panelProj);
209
                        panelProj = null;
210
                        add(getJPanelProj(iproj), null);
211
                    }
212
                }
213
			});
179 214
		}
180 215

  
181 216
		return geomComboBox;
......
256 291
		return activateWACheckBox;
257 292
	}
258 293

  
259
    protected void loadValues(boolean is_empty) {
294
    protected void loadValues(boolean is_empty) { 
260 295
		super.loadValues(is_empty);
261 296
		if (is_empty) {
262 297
			enableAlphaControls(false);
......
271 306
			for (int i = 0; i < geos.length; i++) {
272 307
				getGeomComboBox().addItem(geos[i]);
273 308
			}
274

  
275
			add(getJPanelProj(), null);
276

  
309
			add(getJPanelProj(proposedProjection), null);
277 310
		}
278 311
	}
279 312

  

Also available in: Unified diff