Revision 7327

View differences:

trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CrsView.java
113 113
	private JRadioButton getWithOutTrans() {
114 114
		if(withOutTrans == null) {
115 115
			withOutTrans = new JRadioButton();
116
			withOutTrans.setText("Sin transformacion");
116
			withOutTrans.setText(PluginServices.getText(this,"Sin transformacion"));
117 117
			withOutTrans.setSelected(true);
118 118
			withOutTrans.setEnabled(false);
119 119
			withOutTrans.setPreferredSize(new Dimension(175,20));
......
137 137
	private JRadioButton getNadgrids() {
138 138
		if(nadgrids == null) {
139 139
			nadgrids = new JRadioButton();
140
			nadgrids.setText("+nadgrids");
140
			nadgrids.setText(PluginServices.getText(this,"+nadgrids"));
141 141
			nadgrids.setSelected(false);
142 142
			nadgrids.setEnabled(false);
143 143
			nadgrids.setPreferredSize(new Dimension(175,20));
......
162 162
	private JRadioButton getEpsgTrans() {
163 163
		if(epsgTrans == null) {
164 164
			epsgTrans = new JRadioButton();
165
			epsgTrans.setText("Transformacion epsg");
165
			epsgTrans.setText(PluginServices.getText(this,"Transformacion epsg"));
166 166
			epsgTrans.setSelected(false);
167 167
			epsgTrans.setEnabled(false);
168 168
			epsgTrans.setPreferredSize(new Dimension(175,20));
......
186 186
	private JRadioButton getManualTrans() {
187 187
		if(manualTrans == null) {
188 188
			manualTrans = new JRadioButton();
189
			manualTrans.setText("Transformacion manual");
189
			manualTrans.setText(PluginServices.getText(this,"Transformacion manual"));
190 190
			manualTrans.setSelected(false);
191 191
			manualTrans.setEnabled(false);
192 192
			manualTrans.setPreferredSize(new Dimension(175,20));
......
224 224
	private JButton getAccept() {
225 225
		if(accept == null) {
226 226
			accept = new JButton();
227
			accept.setText("Ok");
227
			accept.setText(PluginServices.getText(this,"Ok"));
228 228
			accept.setMnemonic('O');
229 229
			accept.setPreferredSize(new Dimension(100,25));
230 230
			accept.addActionListener(new java.awt.event.ActionListener() { 
......
245 245
	private JButton getNext() {
246 246
		if(next == null) {
247 247
			next = new JButton();
248
			next.setText("Siguiente");
248
			next.setText(PluginServices.getText(this,"Siguiente"));
249 249
			next.setMnemonic('S');
250 250
			next.setVisible(false);
251 251
			next.setPreferredSize(new Dimension(100,25));
......
298 298
	private JButton getCancel() {
299 299
		if(cancel == null) {
300 300
			cancel = new JButton();
301
			cancel.setText("Cancelar");
301
			cancel.setText(PluginServices.getText(this,"Cancelar"));
302 302
			cancel.setMnemonic('C');
303 303
			cancel.setPreferredSize(new Dimension(100,25));
304 304
			cancel.addActionListener(new java.awt.event.ActionListener() { 
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/TransformationNadgridsPanel.java
103 103
		if (wkt == null){
104 104
			wkt = new JLabel();
105 105
			wkt.setPreferredSize(new Dimension(90, 80));
106
			wkt.setText("Cadena WKT: ");
106
			wkt.setText(PluginServices.getText(this,"Cadena WKT: "));
107 107
		}		
108 108
		return wkt;
109 109
	}
......
134 134
	private JButton getButtonCancel() {
135 135
		if(cancel == null) {
136 136
			cancel = new JButton();
137
			cancel.setText("Cancelar");
137
			cancel.setText(PluginServices.getText(this,"Cancelar"));
138 138
			cancel.setPreferredSize(new Dimension(100,25));
139 139
			cancel.setMnemonic('C');
140 140
			cancel.setToolTipText("Cancel");
......
154 154
	private JButton getButtonAccept() {
155 155
		if(accept == null) {
156 156
			accept = new JButton();
157
			accept.setText("Aceptar");
157
			accept.setText(PluginServices.getText(this,"Aceptar"));
158 158
			accept.setPreferredSize(new Dimension(100,25));
159 159
			accept.setMnemonic('A');
160 160
			accept.setToolTipText("Accept");
......
190 190
		if(open_gsb == null) {
191 191
			open_gsb = new JLabel();
192 192
			open_gsb.setPreferredSize(new Dimension(80,20));
193
			open_gsb.setText("Open .gsb:");
193
			open_gsb.setText(PluginServices.getText(this,"Abrir .gsb:"));
194 194
		}
195 195
		return open_gsb;
196 196
	}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/InfoCrs.java
103 103
	private JButton getButtonOk() {
104 104
		if(ok == null) {
105 105
			ok = new JButton();
106
			ok.setText("OK");
106
			ok.setText(PluginServices.getText(this,"OK"));
107 107
			ok.setPreferredSize(new Dimension(50,25));
108 108
			ok.setMnemonic('O');
109 109
			ok.setToolTipText("Accept");
......
125 125
			projcs = new JLabel();
126 126
			projcs.setPreferredSize(new Dimension(75,20));
127 127
			projcs.setFont(new Font("Projcs:",Font.BOLD,10));
128
			projcs.setText("Projcs:");
128
			projcs.setText(PluginServices.getText(this,"Projcs:"));
129 129
		}
130 130
		return projcs;
131 131
	}
......
145 145
			geogcs = new JLabel();
146 146
			geogcs.setPreferredSize(new Dimension(75,20));
147 147
			geogcs.setFont(new Font("Geogcs:",Font.BOLD,10));
148
			geogcs.setText("Geogcs:");
148
			geogcs.setText(PluginServices.getText(this,"Geogcs:"));
149 149
		}
150 150
		return geogcs;
151 151
	}
......
165 165
			datum = new JLabel();
166 166
			datum.setPreferredSize(new Dimension(75,20));
167 167
			datum.setFont(new Font("Datum:",Font.BOLD,10));
168
			datum.setText("Datum:");
168
			datum.setText(PluginServices.getText(this,"Datum:"));
169 169
		}
170 170
		return datum;
171 171
	}
......
185 185
			spheroid = new JLabel();
186 186
			spheroid.setPreferredSize(new Dimension(75,20));
187 187
			spheroid.setFont(new Font("Spheroid",Font.BOLD,10));
188
			spheroid.setText("Spheriod:");
188
			spheroid.setText(PluginServices.getText(this,"Spheriod:"));
189 189
		}
190 190
		return spheroid;
191 191
	}
......
206 206
			primem = new JLabel();
207 207
			primem.setPreferredSize(new Dimension(75,20));
208 208
			primem.setFont(new Font("Primen:",Font.BOLD,10));
209
			primem.setText("Primem:");
209
			primem.setText(PluginServices.getText(this,"Primem:"));
210 210
		}
211 211
		return primem;
212 212
	}
......
227 227
			projection = new JLabel();
228 228
			projection.setPreferredSize(new Dimension(75,20));
229 229
			projection.setFont(new Font("Projection",Font.BOLD,10));
230
			projection.setText("Projection:");
230
			projection.setText(PluginServices.getText(this,"Projection:"));
231 231
		}
232 232
		return projection;
233 233
	}
......
247 247
			units = new JLabel();
248 248
			units.setPreferredSize(new Dimension(75,20));
249 249
			units.setFont(new Font("Units",Font.BOLD,10));
250
			units.setText("Units:");
250
			units.setText(PluginServices.getText(this,"Units:"));
251 251
		}
252 252
		return units;
253 253
	}
......
268 268
			units_p = new JLabel();
269 269
			units_p.setPreferredSize(new Dimension(75,20));
270 270
			units_p.setFont(new Font("",Font.BOLD,10));
271
			units_p.setText("Units_p:");
271
			units_p.setText(PluginServices.getText(this,"Units_p:"));
272 272
		}
273 273
		return units_p;
274 274
	}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/TransformationManualPanel.java
101 101
			x_Translation = new JLabel();
102 102
			x_Translation.setPreferredSize(new Dimension(80,20));
103 103
			x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15));
104
			x_Translation.setText("x_Translation:");
104
			x_Translation.setText(PluginServices.getText(this,"x_Translation:"));
105 105
		}
106 106
		return x_Translation;
107 107
	}
......
111 111
			y_Translation = new JLabel();
112 112
			y_Translation.setPreferredSize(new Dimension(80,20));
113 113
			y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15));
114
			y_Translation.setText("y_Translation:");
114
			y_Translation.setText(PluginServices.getText(this,"y_Translation:"));
115 115
		}
116 116
		return y_Translation;
117 117
	}
......
121 121
			z_Translation = new JLabel();
122 122
			z_Translation.setPreferredSize(new Dimension(80,20));
123 123
			z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15));
124
			z_Translation.setText("z_Translation:");
124
			z_Translation.setText(PluginServices.getText(this,"z_Translation:"));
125 125
		}
126 126
		return z_Translation;
127 127
	}
......
131 131
			x_Rotation = new JLabel();
132 132
			x_Rotation.setPreferredSize(new Dimension(80,20));
133 133
			x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
134
			x_Rotation.setText("x_Rotation:");
134
			x_Rotation.setText(PluginServices.getText(this,"x_Rotation:"));
135 135
		}
136 136
		return x_Translation;
137 137
	}
......
141 141
			y_Rotation = new JLabel();
142 142
			y_Rotation.setPreferredSize(new Dimension(80,20));
143 143
			y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
144
			y_Rotation.setText("y_Rotation:");
144
			y_Rotation.setText(PluginServices.getText(this,"y_Rotation:"));
145 145
		}
146 146
		return y_Translation;
147 147
	}
......
151 151
			z_Rotation = new JLabel();
152 152
			z_Rotation.setPreferredSize(new Dimension(80,20));
153 153
			z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15));
154
			z_Rotation.setText("z_Rotation:");
154
			z_Rotation.setText(PluginServices.getText(this,"z_Rotation:"));
155 155
		}
156 156
		return z_Rotation;
157 157
	}
......
161 161
			scale = new JLabel();
162 162
			scale.setPreferredSize(new Dimension(80,20));
163 163
			scale.setFont(new Font("scale:",Font.BOLD,15));
164
			scale.setText("scale:");
164
			scale.setText(PluginServices.getText(this,"scale:"));
165 165
		}
166 166
		return scale;
167 167
	}
......
307 307
	private JButton getButtonCancel() {
308 308
		if(cancel == null) {
309 309
			cancel = new JButton();
310
			cancel.setText("Cancelar");
310
			cancel.setText(PluginServices.getText(this,"Cancelar"));
311 311
			cancel.setPreferredSize(new Dimension(100,25));
312 312
			cancel.setMnemonic('C');
313 313
			cancel.setToolTipText("Cancel");
......
327 327
	private JButton getButtonAccept() {
328 328
		if(accept == null) {
329 329
			accept = new JButton();
330
			accept.setText("Aceptar");
330
			accept.setText(PluginServices.getText(this,"Aceptar"));
331 331
			accept.setPreferredSize(new Dimension(100,25));
332 332
			accept.setMnemonic('A');
333 333
			accept.setToolTipText("Accept");
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/TransformationEpsgPanel.java
105 105
		if (wkt == null){
106 106
			wkt = new JLabel();
107 107
			wkt.setPreferredSize(new Dimension(90, 80));
108
			wkt.setText("Cadena WKT: ");
108
			wkt.setText(PluginServices.getText(this,"Cadena WKT: "));
109 109
		}		
110 110
		return wkt;
111 111
	}
......
208 208
	private JButton getButtonCancel() {
209 209
		if(cancel == null) {
210 210
			cancel = new JButton();
211
			cancel.setText("Cancelar");
211
			cancel.setText(PluginServices.getText(this,"Cancelar"));
212 212
			cancel.setPreferredSize(new Dimension(100,25));
213 213
			cancel.setMnemonic('C');
214 214
			cancel.setToolTipText("Cancel");
......
228 228
	private JButton getButtonAccept() {
229 229
		if(accept == null) {
230 230
			accept = new JButton();
231
			accept.setText("Ok");
231
			accept.setText(PluginServices.getText(this,"Ok"));
232 232
			accept.setPreferredSize(new Dimension(100,25));
233 233
			accept.setMnemonic('A');
234 234
			accept.setToolTipText("Aceptar");
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/WithoutTranformation.java
81 81
		if (wkt == null){
82 82
			wkt = new JLabel();
83 83
			wkt.setPreferredSize(new Dimension(90, 80));
84
			wkt.setText("Cadena WKT: ");
84
			wkt.setText(PluginServices.getText(this,"Cadena WKT: "));
85 85
		}		
86 86
		return wkt;
87 87
	}
......
112 112
	private JButton getButtonCancel() {
113 113
		if(cancel == null) {
114 114
			cancel = new JButton();
115
			cancel.setText("Cancelar");
115
			cancel.setText(PluginServices.getText(this,"Cancelar"));
116 116
			cancel.setPreferredSize(new Dimension(100,25));
117 117
			cancel.setMnemonic('C');
118 118
			cancel.setToolTipText("Cancel");
......
132 132
	private JButton getButtonAccept() {
133 133
		if(accept == null) {
134 134
			accept = new JButton();
135
			accept.setText("Aceptar");
135
			accept.setText(PluginServices.getText(this,"Aceptar"));
136 136
			accept.setPreferredSize(new Dimension(100,25));
137 137
			accept.setMnemonic('A');
138 138
			accept.setToolTipText("Accept");
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSSelectionDialogPanel.java
1 1
package org.gvsig.crs.gui;
2 2

  
3 3
import java.awt.Dimension;
4
import java.awt.FlowLayout;
5
import java.awt.GridLayout;
6 4
import java.awt.event.ActionEvent;
7 5
import java.awt.event.ActionListener;
8 6

  
......
17 15
public class CRSSelectionDialogPanel extends DefaultDialogPanel implements ListSelectionListener {
18 16
	
19 17
	private static final long serialVersionUID = 1L;	
20
	private CRSSelectionPanel CRSPanel;
21
	//protected JPanel contentPane = null;
22
	
18
	private CRSSelectionPanel CRSPanel;	
19
		
23 20
	public CRSSelectionDialogPanel(){
24 21
		super();		
25 22
		inicializate();
......
37 34

  
38 35
	public JPanel getContentPanel() {
39 36
	    if (contentPane == null) {
40
        	contentPane = new CRSSelectionPanel();
37
        	contentPane = new CRSSelectionPanel();        	
41 38
        	//contentPane.setLayout(new GridLayout(3,2));
42
        	contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
43
	    	contentPane.setPreferredSize(new Dimension(650,550));
39
        	//contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
40
	    	//contentPane.setPreferredSize(new Dimension(650,550));
44 41
        	
45 42
       }
46 43
      return contentPane;
47
    }
44
    }	
48 45

  
49 46
	public void valueChanged(ListSelectionEvent e) {
50 47
		ListSelectionModel lsm = (ListSelectionModel)e.getSource();
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/CRSSelectionPanel.java
97 97
	}
98 98
	
99 99
	private void initialize() {		
100
		this.add(getCombopanel());
100
		//this.add(getCombopanel());
101 101
		this.add(getJPanelEPSG());
102 102
		this.add(getJPanelESRI());
103 103
		getJPanelESRI().setVisible(false);
......
107 107
	private JPanel getCombopanel(){
108 108
		if (Combopanel == null){
109 109
			Combopanel = new JPanel();
110
			Combopanel.setPreferredSize(new Dimension(630, 30));
110
			//Combopanel.setPreferredSize(new Dimension(630, 30));
111 111
			Combopanel.add(getComboCrs());
112 112
		}
113 113
		
......
117 117
	private JComboBox getComboCrs(){
118 118
		if (options == null){
119 119
			options = new JComboBox(selection);
120
			//options.setLayout(new FlowLayout(FlowLayout.CENTER));
121 120
			options.setPreferredSize(new Dimension(100,25));
122 121
			options.setEditable(false);
123 122
			options.setSelectedIndex(0);			
......
142 141
	public JPanel getJPanelEPSG() {	
143 142
		if (EPSGpanel == null){
144 143
			EPSGpanel = new JPanel();
145
			//EPSGpanel.setLayout(new GridLayout(1,1));
146
			EPSGpanel.setPreferredSize(new Dimension(630, 400));
144
			EPSGpanel.setLayout(new GridLayout(3,4));
145
			EPSGpanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
146
			EPSGpanel.setPreferredSize(new Dimension(650, 500));			
147 147
			EPSGpanel.add(getGroupRadioButton(), null);
148 148
			EPSGpanel.add(getSearchButton(), null);
149
			EPSGpanel.add(getSearchTextField(), null);
150 149
			EPSGpanel.add(getInfoCrs(), null);
150
//			EPSGpanel.add(getSearchTextField(), null);
151 151
			EPSGpanel.add(getJScrollPane(), null);
152 152
		}	
153 153
		return EPSGpanel;
......
158 158
			ESRIpanel = new JPanel();
159 159
			//EPSGpanel.setLayout(new GridLayout(1,1));
160 160
			ESRIpanel.setPreferredSize(new Dimension(630, 400));
161
			
161 162
			//EPSGpanel.add(getGroupRadioButton(), null);
162 163
			//EPSGpanel.add(getSearchButton(), null);
163 164
			//EPSGpanel.add(getSearchTextField(), null);
......
176 177
	private JRadioButton getCodeRadioButton() {
177 178
		if (codeRadioButton == null) {
178 179
			codeRadioButton = new JRadioButton();
179
			codeRadioButton.setText("By Code EPSG");
180
			codeRadioButton.setText(PluginServices.getText(this,"Por c?digo"));//setText("By Code EPSG");
180 181
			codeRadioButton.setSelected(true);
181 182
			codeRadioButton.addActionListener(new java.awt.event.ActionListener() { 
182 183
				public void actionPerformed(java.awt.event.ActionEvent e) {    
......
196 197
	private JRadioButton getNameRadioButton() {
197 198
		if (nameRadioButton == null) {
198 199
			nameRadioButton = new JRadioButton();
199
			nameRadioButton.setText("By CRS Name");
200
			nameRadioButton.setText(PluginServices.getText(this,"Por nombre"));
200 201
			nameRadioButton.addActionListener(new java.awt.event.ActionListener() { 
201 202
				public void actionPerformed(java.awt.event.ActionEvent e) {    
202 203
					nameRadioButton_actionPerformed(e);
......
215 216
	private JRadioButton getAreaRadioButton() {
216 217
		if (areaRadioButton == null) {
217 218
			areaRadioButton = new JRadioButton();
218
			areaRadioButton.setText("By Area of Use");
219
			areaRadioButton.setText(PluginServices.getText(this,"Por ?rea"));
219 220
			areaRadioButton.addActionListener(new java.awt.event.ActionListener() { 
220 221
				public void actionPerformed(java.awt.event.ActionEvent e) {    
221 222
					areaRadioButton_actionPerformed(e);
......
412 413
		if (searchButton == null) {
413 414
			searchButton = new JButton();
414 415
			searchButton.setPreferredSize(new Dimension(75,20));
415
			searchButton.setText("Search");
416
			searchButton.setText(PluginServices.getText(this,"Buscar"));
416 417
			searchButton.setMnemonic('S');
417 418
			searchButton.setToolTipText("Search of a CRS by selected criterion");
418 419
			searchButton.addActionListener(new java.awt.event.ActionListener() { 
......
611 612
			jScrollPane.setBorder(
612 613
				    BorderFactory.createCompoundBorder(
613 614
					BorderFactory.createCompoundBorder(
614
							BorderFactory.createTitledBorder("Coordinate Reference Systems"),
615
							BorderFactory.createTitledBorder(PluginServices.getText(this,"Coordinate Reference Systems")),
615 616
							BorderFactory.createEmptyBorder(5,5,5,5)),
616 617
							jScrollPane.getBorder()));
617 618
			jScrollPane.setViewportView(getJTable());
......
622 623
	public JButton getInfoCrs() {
623 624
		if(infoCrs == null) {
624 625
			infoCrs = new JButton();
625
			infoCrs.setText("InfoCrs");
626 626
			infoCrs.setPreferredSize(new Dimension(75,20));
627
			infoCrs.setText(PluginServices.getText(this,"InfoCrs"));			
627 628
			infoCrs.setMnemonic('I');
628 629
			infoCrs.setEnabled(false);
629 630
			infoCrs.setToolTipText("Mostrar la informacion del Crs selecionado");
trunk/libraries/libJCRS/test/testCRSSelectionPanel.java
1
import java.awt.BorderLayout;
2
import java.awt.CardLayout;
3
import java.awt.Color;
4
import java.awt.Container;
5
import java.awt.Dimension;
6
import java.awt.FlowLayout;
7
import java.awt.GridLayout;
8
import java.awt.event.ActionEvent;
9
import java.awt.event.ItemEvent;
10
import java.awt.event.ItemListener;
11
import java.awt.event.KeyEvent;
12
import java.awt.event.KeyListener;
13
import java.awt.event.WindowAdapter;
14
import java.awt.event.WindowEvent;
15
import java.sql.ResultSet;
16
import java.sql.SQLException;
17

  
18
import javax.swing.BorderFactory;
19
import javax.swing.JButton;
20
import javax.swing.JComboBox;
21
import javax.swing.JFrame;
22
import javax.swing.JLabel;
23
import javax.swing.JOptionPane;
24
import javax.swing.JPanel;
25
import javax.swing.JRadioButton;
26
import javax.swing.JScrollPane;
27
import javax.swing.JTable;
28
import javax.swing.JTextField;
29
import javax.swing.ListSelectionModel;
30
import javax.swing.table.DefaultTableModel;
31
import javax.swing.table.TableColumn;
32

  
33
import org.cresques.cts.IProjection;
34
import org.gvsig.crs.CrsException;
35
import org.gvsig.crs.CrsFactory;
36
import org.gvsig.crs.ICrs;
37
import org.gvsig.crs.Query;
38
import org.gvsig.crs.gui.InfoCrs;
39
import org.gvsig.crs.ogr.Epsg2wkt;
40
import org.gvsig.crs.ogr.GetCRSepsg;
41

  
42
import com.iver.andami.PluginServices;
43
import com.iver.cit.gvsig.gui.panels.ProjChooserPanel;
44

  
45
public class testCRSSelectionPanel extends JFrame implements ItemListener {
46
	
47
	/**
48
	 * 
49
	 */
50
	private static final long serialVersionUID = 1L;
51
	JLabel jLabel = null;
52
	JTextField crsTextFld = null;	
53
	
54
	ProjChooserPanel pcp;
55
	
56
	String cadWKT = "";
57
	
58
	int transf = 0;
59
	int epsg_code = 0;
60
	boolean source_yn = false;
61
	int source_cod = 0;
62
	int method_code = 0;
63
	int projection_conv_code = 0;
64
	int[] valid_method_code = {9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 
65
			9811, 9812, 9813, 9814, 9815, 9816, 9817};
66
	boolean select = false;
67
	
68
	private JRadioButton codeRadioButton = null;
69
	private JRadioButton nameRadioButton = null;
70
	private JRadioButton areaRadioButton = null;
71
	private JPanel groupRadioButton = null;
72
	private JComboBox options = null;
73
	
74
	private JPanel Combopanel = null;
75
	public JPanel EPSGpanel = null;
76
	private JPanel USGSpanel = null;
77
	private JPanel ESRIpanel = null;
78
	
79
	final static String epsg = "EPSG";
80
	final static String usgs = "USGS";
81
	final static String esri = "ESRI";
82
	
83
	String[] selection = {epsg, usgs, esri, "Nuevo CRS"};
84
	
85
	boolean inAnApplet = true;
86
	
87
	private JButton infoCrs = null;
88
	private JButton searchButton = null;
89
	private JTextField searchTextField = null;
90
	private JTable jTable = null;
91
	private JScrollPane jScrollPane = null;
92
	public DefaultTableModel dtm = null;
93
	public DefaultTableModel dtm2 = null;
94
	public String key;
95
	public int selectedRowTable = -1;
96
	public int selectedRowTable2 = -1;	
97
	
98
	private int codeCRS = -1;	
99
	
100
	public JFrame frame = new JFrame();
101
	public JPanel principal = null;	
102

  
103
	public testCRSSelectionPanel() {			
104
		Container contentPane = getContentPane();
105
		
106
		contentPane.add(getCombopanel(), BorderLayout.NORTH);
107
				
108
		principal = new JPanel();
109
		principal.setLayout(new CardLayout());
110
		
111
		principal.add(epsg, getJPanelEPSG());
112
		principal.add(esri, getJPanelESRI());
113
		principal.add(usgs, getJPanelUSGS());
114
		
115
		contentPane.add(principal, BorderLayout.CENTER);		
116
		
117
		//frame.getContentPane().add(ini());
118
		//getJPanelESRI().setVisible(false);
119
    	//getJPanelEPSG().setVisible(true);
120
    	
121
		//frame.setSize(650, 500);
122
		//frame.setVisible(true);
123
		
124
		addWindowListener(new WindowAdapter() {
125
            public void windowClosing(WindowEvent e) {
126
                if (inAnApplet) {
127
                    dispose();
128
                } else {
129
                    System.exit(0);
130
                }
131
            }
132
        });
133
	}
134
	
135
	public testCRSSelectionPanel(int i) {
136
		
137
	}
138
	
139
	private JPanel ini(){
140
		if (principal == null){
141
			principal = new JPanel();
142
			principal.setPreferredSize(new Dimension(630,480));
143
			principal.setLayout(new CardLayout());
144
			//principal.setLayout(new GridLayout(3,3));
145
			//principal.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
146
			//principal.add(getCombopanel());
147
			//principal.add(getJPanelEPSG());
148
			//principal.add(getJPanelESRI());
149
			//principal.add(getJPanelUSGS());
150
			principal.add(epsg, getJPanelEPSG());
151
			principal.add(esri, getJPanelESRI());
152
			principal.add(usgs, getJPanelUSGS());
153
			
154
		}
155
		return principal;
156
	}
157
	
158
	public JPanel getCombopanel(){
159
		if (Combopanel == null){
160
			Combopanel = new JPanel();
161
			Combopanel.setPreferredSize(new Dimension(120,50));
162
			Combopanel.setLayout(new GridLayout(0,1));
163
			Combopanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
164
			Combopanel.add(getComboCrs());
165
		}
166
		
167
		return Combopanel;
168
	}
169
	
170
	private JComboBox getComboCrs(){
171
		if (options == null){
172
			options = new JComboBox(selection);
173
			options.setPreferredSize(new Dimension(100,25));			
174
			options.setEditable(false);
175
			options.setSelectedIndex(0);			
176
			options.addItemListener(this);
177
					/*public void actionPerformed(ActionEvent e) {
178
					JComboBox cb = (JComboBox)e.getSource();
179
				    String newSelection = (String)cb.getSelectedItem();
180
				    if (newSelection.equals("EPSG")){	
181
				    	getJPanelESRI().setVisible(false);
182
				    	getJPanelUSGS().setVisible(false);
183
				    	getJPanelEPSG().setVisible(true);				    	
184
				    }
185
				    else if (newSelection.equals("ESRI")){
186
				    	getJPanelEPSG().setVisible(false);
187
				    	getJPanelUSGS().setVisible(false);
188
				    	getJPanelESRI().setVisible(true);
189
				    }
190
				    else if (newSelection.equals("USGS")){
191
				    	getJPanelESRI().setVisible(false);
192
				    	getJPanelEPSG().setVisible(false);
193
				    	getJPanelUSGS().setVisible(true);
194
				    }
195
				}*/
196
				
197
			
198
		}
199
		return options;
200
	}
201
	
202
	public void itemStateChanged(ItemEvent e) {
203
		// TODO Auto-generated method stub
204
		CardLayout cl = (CardLayout)(principal.getLayout());
205
	    cl.show(principal, (String)e.getItem());
206
	}
207
	
208
	public JPanel getJPanelEPSG() {	
209
		if (EPSGpanel == null){
210
			EPSGpanel = new JPanel();
211
			EPSGpanel.setLayout(new GridLayout(3,4));
212
			EPSGpanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
213
			EPSGpanel.setPreferredSize(new Dimension(630, 400));
214
			//EPSGpanel.add(getComboCrs());		
215
			EPSGpanel.add(getGroupRadioButton(), null);			
216
			EPSGpanel.add(getSearchButton(), null);
217
			EPSGpanel.add(getSearchTextField(), null);
218
			EPSGpanel.add(getInfoCrs(), null);
219
			EPSGpanel.add(getJScrollPane(), null);
220
			//EPSGpanel.setVisible(true);
221
		}	
222
		return EPSGpanel;
223
	}
224
	
225
	public JPanel getJPanelESRI() {	
226
		if (ESRIpanel == null){
227
			ESRIpanel = new JPanel();
228
			ESRIpanel.setLayout(new GridLayout(3,4));
229
			ESRIpanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
230
			ESRIpanel.setPreferredSize(new Dimension(630, 400));			
231
			//ESRIpanel.add(getComboCrs());	
232
			
233
			ESRIpanel.add(getSearchButton(), null);
234
			ESRIpanel.add(getSearchTextField(), null);
235
			ESRIpanel.add(getInfoCrs(), null);
236
			ESRIpanel.add(getJScrollPane(), null);
237
			//ESRIpanel.setVisible(false);
238
		}	
239
		return ESRIpanel;
240
	}
241
	
242
	public JPanel getJPanelUSGS() {	
243
		if (USGSpanel == null){
244
			USGSpanel = new JPanel();
245
			USGSpanel.setLayout(new GridLayout(3,4));
246
			USGSpanel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
247
			USGSpanel.setPreferredSize(new Dimension(630, 400));			
248
			//USGSpanel.add(getComboCrs());	
249
			USGSpanel.add(getGroupRadioButton(), null);		
250
			USGSpanel.add(getSearchButton(), null);
251
			USGSpanel.add(getSearchTextField(), null);
252
			USGSpanel.add(getInfoCrs(), null);
253
			USGSpanel.add(getJScrollPane(), null);
254
			//USGSpanel.setVisible(false);
255
		}	
256
		return USGSpanel;
257
	}
258
	
259
	private void codeRadioButton_actionPerformed(ActionEvent e) {
260
		searchTextField.setText("");
261
		nameRadioButton.setSelected(false);
262
		areaRadioButton.setSelected(false);
263
	}
264
	    
265
	private JRadioButton getCodeRadioButton() {
266
		if (codeRadioButton == null) {
267
			codeRadioButton = new JRadioButton();
268
			codeRadioButton.setText(PluginServices.getText(this,"Por c?digo"));//setText("By Code EPSG");
269
			codeRadioButton.setSelected(true);
270
			codeRadioButton.addActionListener(new java.awt.event.ActionListener() { 
271
				public void actionPerformed(java.awt.event.ActionEvent e) {    
272
					codeRadioButton_actionPerformed(e);
273
				}
274
			});
275
		}
276
		return codeRadioButton;
277
	}
278
	
279
	private void nameRadioButton_actionPerformed(ActionEvent e) {
280
		searchTextField.setText("");
281
		codeRadioButton.setSelected(false);
282
		areaRadioButton.setSelected(false);
283
	}
284
	  
285
	private JRadioButton getNameRadioButton() {
286
		if (nameRadioButton == null) {
287
			nameRadioButton = new JRadioButton();
288
			nameRadioButton.setText(PluginServices.getText(this,"Por nombre"));
289
			nameRadioButton.addActionListener(new java.awt.event.ActionListener() { 
290
				public void actionPerformed(java.awt.event.ActionEvent e) {    
291
					nameRadioButton_actionPerformed(e);
292
				}
293
			});
294
		}
295
		return nameRadioButton;
296
	}
297
	
298
	private void areaRadioButton_actionPerformed(ActionEvent e) {
299
		searchTextField.setText("");
300
		codeRadioButton.setSelected(false);
301
		nameRadioButton.setSelected(false);
302
	}
303
  
304
	private JRadioButton getAreaRadioButton() {
305
		if (areaRadioButton == null) {
306
			areaRadioButton = new JRadioButton();
307
			areaRadioButton.setText(PluginServices.getText(this,"Por ?rea"));
308
			areaRadioButton.addActionListener(new java.awt.event.ActionListener() { 
309
				public void actionPerformed(java.awt.event.ActionEvent e) {    
310
					areaRadioButton_actionPerformed(e);
311
				}
312
			});
313
		}
314
		return areaRadioButton;
315
	}
316
	 
317
	private JPanel getGroupRadioButton() {
318
		if (groupRadioButton == null) {
319
			groupRadioButton = new JPanel();
320
			groupRadioButton.setLayout(new GridLayout(1,0));
321
			groupRadioButton.setPreferredSize(new Dimension(630,50));
322
			groupRadioButton.add(getCodeRadioButton());
323
			groupRadioButton.add(getNameRadioButton());
324
			groupRadioButton.add(getAreaRadioButton());
325
		}
326
		return groupRadioButton;
327
	}
328

  
329
	private void searchButton_actionPerformed(ActionEvent e) {
330
		
331
	}	
332

  
333
	private JButton getSearchButton() {
334
		if (searchButton == null) {
335
			searchButton = new JButton();
336
			searchButton.setPreferredSize(new Dimension(75,20));
337
			searchButton.setText(PluginServices.getText(this,"Buscar"));
338
			searchButton.setMnemonic('S');
339
			searchButton.setToolTipText("Search of a CRS by selected criterion");
340
			searchButton.addActionListener(new java.awt.event.ActionListener() { 
341
				public void actionPerformed(java.awt.event.ActionEvent e) {    
342
					searchTextField.setBackground(Color.white);
343
					if (searchTextField.getText().equals("")) {
344
						searchTextField.setBackground(new Color(255,204,204));
345
						JOptionPane.showMessageDialog(testCRSSelectionPanel.this, 
346
								"Fill the key-word of the search.", 
347
								"Warning...", JOptionPane.WARNING_MESSAGE);
348
					}
349
					else {
350
						searchButton_actionPerformed(e);
351
					}
352
				}
353
			});			
354
		}
355
		return searchButton;
356
	}	
357
	
358
	private JTextField getSearchTextField() {
359
		if (searchTextField == null) {
360
			searchTextField = new JTextField();
361
			searchTextField.setPreferredSize(new Dimension(300,20));
362
		}
363
		searchTextField.addKeyListener(new KeyListener() {
364
			public void keyPressed(KeyEvent e) {				
365
				if (e.getKeyCode() == 10) {
366
					searchButton_actionPerformed(null);
367
				}
368
				if (codeRadioButton.isSelected()){
369
					if ((e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
370
							(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
371
					}
372
					else {
373
						JOptionPane.showMessageDialog(testCRSSelectionPanel.this, 
374
								"Only number format.", 
375
								"Warning...", JOptionPane.WARNING_MESSAGE);
376
						String aux = searchTextField.getText();
377
						if (aux.length() == 1){
378
							searchTextField.setText("");
379
						}
380
						else {
381
							searchTextField.setText(aux.substring(0, aux.length()-1));
382
						}
383
					}
384
				}
385
			}
386

  
387
			public void keyReleased(KeyEvent arg0) {				
388
			}
389

  
390
			public void keyTyped(KeyEvent arg0) {
391
			}
392
		});
393
		return searchTextField;
394
	}
395
	
396
	public JTable getJTable() {
397
		if (jTable == null) {
398
			String[] columnNames= {"Code of CRS","Name of CRS","Type of CRS","Name of Area","Description of Area"};
399
			Object[][]data = {};			
400
			dtm = new DefaultTableModel(data, columnNames);
401
			jTable = new JTable(dtm);
402
			jTable.setCellSelectionEnabled(false);
403
			jTable.setRowSelectionAllowed(true);
404
			jTable.setColumnSelectionAllowed(false);
405
			jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
406
			TableColumn column = null;
407
			for (int i = 0; i < 5; i++) {
408
			    column = jTable.getColumnModel().getColumn(i);
409
			    if (i == 0) {
410
			        column.setPreferredWidth(40); //code column is shorter			     	
411
			    }else if (i == 2) {
412
			    	column.setPreferredWidth(80);
413
			    }
414
			    else {			    
415
			        column.setPreferredWidth(160);
416
			    }
417
			}
418
			/*ListSelectionModel rowSM = jTable.getSelectionModel();
419
			rowSM.addListSelectionListener(new ListSelectionListener() {
420
			    public void valueChanged(ListSelectionEvent e) {
421
			    	ListSelectionModel lsm = (ListSelectionModel)e.getSource();
422
			        if (lsm.isSelectionEmpty()) {
423
			        	selectedRowTable = -1;
424
			        	setCodeCRS(-1);
425
			        	 if (transfPanel){
426
				        	si = false;
427
							CrsView.withOutTrans.setEnabled(false);
428
							CrsView.nadgrids.setEnabled(false);
429
							CrsView.epsgTrans.setEnabled(false);
430
							CrsView.manualTrans.setEnabled(false);
431
							CrsView.next.setVisible(false);
432
							CrsView.accept.setVisible(true);
433
			        	 }
434
			        } 
435
			        else {
436
			            selectedRowTable = lsm.getMinSelectionIndex();
437
			            setCodeCRS(Integer.parseInt((String)dtm.getValueAt(selectedRowTable,0)));
438
			            setWKT();
439
			            
440
			            if (transfPanel){
441
			            	compareCRS();
442
			            }
443
			        }
444
			        infoCrs.setEnabled(true);
445
			    }
446

  
447
				private void compareCRS() {
448
					int base = getCodeCRS();
449
					String datum = "";
450
					int datum_code = -1;
451
					String sentence = "SELECT source_geogcrs_code " +
452
									"FROM epsg_coordinatereferencesystem " +
453
									"WHERE coord_ref_sys_code = "+ base ;
454
					ResultSet result = Query.select(sentence,pcp.connect.getConnection());
455
					int source = 0;
456
					try {
457
						result.next();
458
						source = result.getInt("source_geogcrs_code");
459
					} catch (SQLException e1) {
460
						e1.printStackTrace();
461
					}				
462
				    
463
				    if (source != 0){
464
				    		base = source;		            	
465
				    }
466
				    
467
				    sentence = "SELECT datum_code " +
468
						"FROM epsg_coordinatereferencesystem " +
469
						"WHERE coord_ref_sys_code = "+ base ;
470
				    result = Query.select(sentence,pcp.connect.getConnection());
471
				    
472
				    try {
473
						result.next();
474
						datum_code = result.getInt("datum_code");
475
					} catch (SQLException e1) {
476
						e1.printStackTrace();
477
					}	
478
					
479
					sentence = "SELECT datum_name " +
480
								"FROM epsg_datum " +
481
								"WHERE datum_code = "+ datum_code ;
482
				    result = Query.select(sentence,pcp.connect.getConnection());
483
				    
484
				    try {
485
						result.next();
486
						datum = result.getString("datum_name");
487
					} catch (SQLException e1) {
488
						e1.printStackTrace();
489
					}	
490
					    
491
					if (!((ICrs) View.m_MapControl.getProjection()).getCrsWkt().getDatumName().equals(datum.replaceAll(" ",""))){
492
						si = true;
493
						CrsView.withOutTrans.setEnabled(true);
494
						CrsView.nadgrids.setEnabled(true);
495
						CrsView.epsgTrans.setEnabled(true);
496
						CrsView.manualTrans.setEnabled(true);
497
						CrsView.next.setVisible(true);
498
						CrsView.accept.setVisible(false);
499
						
500
						 * logica necesaria para comprobar si los crs bases son iguales
501
						 * y en ese caso deshabilitar opcion transformacion de
502
						 * TransformationEpsgPanel
503
						 
504
					}
505
					else {
506
						si = false;
507
						CrsView.withOutTrans.setEnabled(false);
508
						CrsView.nadgrids.setEnabled(false);
509
						CrsView.epsgTrans.setEnabled(false);
510
						CrsView.manualTrans.setEnabled(false);
511
						CrsView.next.setVisible(false);
512
						CrsView.accept.setVisible(true);
513
					}
514
				}
515
		});*/
516
	}
517
		return jTable;
518
		
519
	}
520
	
521
	public void setCodeCRS(int code) {
522
		codeCRS = code;
523
	}
524
	
525
	public int getCodeCRS() {
526
		return codeCRS;
527
	}	
528
	
529
	private JScrollPane getJScrollPane() {
530
		if (jScrollPane == null) {
531
			jScrollPane = new JScrollPane();
532
			jScrollPane.setPreferredSize(new Dimension(605,250));
533
			jScrollPane.setBorder(
534
				    BorderFactory.createCompoundBorder(
535
					BorderFactory.createCompoundBorder(
536
							BorderFactory.createTitledBorder(PluginServices.getText(this,"Coordinate Reference Systems")),
537
							BorderFactory.createEmptyBorder(5,5,5,5)),
538
							jScrollPane.getBorder()));
539
			jScrollPane.setViewportView(getJTable());
540
		}
541
		return jScrollPane;
542
	}
543
	
544
	public JButton getInfoCrs() {
545
		if(infoCrs == null) {
546
			infoCrs = new JButton();
547
			infoCrs.setPreferredSize(new Dimension(75,20));
548
			infoCrs.setText(PluginServices.getText(this,"InfoCrs"));			
549
			infoCrs.setMnemonic('I');
550
			infoCrs.setEnabled(false);
551
			infoCrs.setToolTipText("Mostrar la informacion del Crs selecionado");
552
			infoCrs.addActionListener(new java.awt.event.ActionListener() { 
553
				public void actionPerformed(java.awt.event.ActionEvent e) {    
554
					infoCrs_actionPerformed(e);		
555
				}	
556
			});
557
		}
558
		return infoCrs;
559
	}
560
	
561
	private void infoCrs_actionPerformed(ActionEvent e) {
562
		InfoCrs info = new InfoCrs(getCrs());
563
		info.setSize(new Dimension(550,350));
564
		info.setLayout(new GridLayout(0,1));
565
		info.setLayout(new FlowLayout(FlowLayout.LEFT,10,5));
566
		PluginServices.getMDIManager().addWindow(info);
567
	}
568
	
569
	public ICrs getProjection() {
570
		return getCrs();
571
	}
572
	public ICrs getCrs() {				
573
		try {
574
			String txt = getWKT();			
575
			ICrs crs = new CrsFactory().getCRS(epsg_code, txt); 
576
			return crs ;
577
		} catch (CrsException e) {
578
			e.printStackTrace();
579
		}
580
		return null;
581
	}
582
	
583
	public void setWKT(){
584
		Epsg2wkt wkt = null;
585
		
586
		epsg_code = getCodeCRS();
587
		if (epsg_code != -1){		
588
			/*
589
			 * ahora que he escogido, recojo toda la informacion que me va a hacer falta
590
			 */
591
			String sentence = "SELECT source_geogcrs_code, projection_conv_code " +
592
							"FROM epsg_coordinatereferencesystem " +
593
							"WHERE coord_ref_sys_code = "+ epsg_code ;
594
			ResultSet result = Query.select(sentence,pcp.connect.getConnection());
595
			
596
			try {
597
				result.next();
598
				source_cod = result.getInt("source_geogcrs_code");
599
				projection_conv_code = result.getInt("projection_conv_code");
600
			} catch (SQLException e1) {
601
				e1.printStackTrace();
602
			}
603
			
604
			if (source_cod != 0){
605
				source_yn = false;
606
			}
607
			else source_yn = true;
608
			
609
			GetCRSepsg ep = new GetCRSepsg(epsg_code, source_yn, source_cod, projection_conv_code, pcp);
610
			ep.Getepsgdata();
611
			
612
			if (source_yn){
613
				wkt = new Epsg2wkt(ep ,0);			
614
			}
615
			else {
616
				wkt = new Epsg2wkt(ep);
617
			}				
618
		}
619
		else {
620
			JOptionPane.showMessageDialog(this, 
621
					"No CRS selected.", 
622
					"Warning...", JOptionPane.WARNING_MESSAGE);
623
			
624
		}
625
		cadWKT = wkt.getWKT();
626
	}
627
	
628
	public String getWKT(){
629
		return cadWKT;
630
	}
631
	
632
	public void setProjection(IProjection crs) {
633
		//setCrs((ICrs) crs);
634
	}
635

  
636

  
637
	/**
638
	 * @param args
639
	 */
640
	public static void main(String[] args) {		
641
		testCRSSelectionPanel window = new testCRSSelectionPanel();
642
        window.inAnApplet = false;
643

  
644
        window.setTitle("CRS Selection");
645
        window.pack();
646
        window.setVisible(true);
647
	}
648
}
0 649

  
trunk/libraries/libJCRS/test/CardWindow.java
1
/*
2
 * Swing version.
3
 */
4

  
5
import java.awt.*;
6
import java.awt.event.*;
7
import javax.swing.*;
8

  
9
public class CardWindow extends JFrame
10
                        implements ItemListener {
11
    boolean inAnApplet = true;
12
     
13
    JPanel cards;
14
    final static String BUTTONPANEL = "JPanel with JButtons";
15
    final static String TEXTPANEL = "JPanel with JTextField";
16

  
17
    public CardWindow() {
18
	Container contentPane = getContentPane();
19

  
20
        //Put the JComboBox in a JPanel to get a nicer look.
21
        String comboBoxItems[] = { BUTTONPANEL, TEXTPANEL };
22
        JPanel cp = new JPanel();
23
        JComboBox c = new JComboBox(comboBoxItems);
24
        c.setEditable(false);
25
        c.addItemListener(this);
26
        cp.add(c);
27

  
28
	//Use the default layout manager, BorderLayout
29
        contentPane.add(cp, BorderLayout.NORTH);
30

  
31
        cards = new JPanel();
32
        cards.setLayout(new CardLayout());
33
   
34
        JPanel p1 = new JPanel();
35
        p1.add(new JButton("Button 1"));
36
        p1.add(new JButton("Button 2"));
37
        p1.add(new JButton("Button 3"));
38

  
39
        JPanel p2 = new JPanel();
40
        p2.add(new JTextField("TextField", 20));
41

  
42
        cards.add(BUTTONPANEL, p1);
43
        cards.add(TEXTPANEL, p2);
44
        contentPane.add(cards, BorderLayout.CENTER);
45
        
46
        addWindowListener(new WindowAdapter() {
47
            public void windowClosing(WindowEvent e) {
48
                if (inAnApplet) {
49
                    dispose();
50
                } else {
51
                    System.exit(0);
52
                }
53
            }
54
        });
55
    }
56

  
57
    public void itemStateChanged(ItemEvent evt) {
58
        CardLayout cl = (CardLayout)(cards.getLayout());
59
        cl.show(cards, (String)evt.getItem());
60
    }
61

  
62
    public static void main(String args[]) {
63
        CardWindow window = new CardWindow();
64
        window.inAnApplet = false;
65

  
66
        window.setTitle("CardLayout");
67
        window.pack();
68
        window.setVisible(true);
69
    }
70
}
0 71

  
trunk/libraries/libJCRS/test/testCRSViewPanel.java
1

  
2
import java.awt.Dimension;
3
import java.awt.FlowLayout;
4
import java.awt.GridLayout;
5
import java.awt.event.ActionEvent;
6

  
7
import javax.swing.BorderFactory;
8
import javax.swing.JButton;
9
import javax.swing.JFrame;
10
import javax.swing.JPanel;
11
import javax.swing.JRadioButton;
12

  
13
import org.cresques.cts.IProjection;
14

  
15
import org.gvsig.crs.EpsgConnection;
16
import org.gvsig.crs.gui.CRSSelectionPanel;
17
import org.gvsig.crs.gui.TransformationEpsgPanel;
18
import org.gvsig.crs.gui.TransformationManualPanel;
19
import org.gvsig.crs.gui.TransformationNadgridsPanel;
20

  
21
import com.iver.andami.PluginServices;
22
import com.iver.andami.ui.mdiManager.WindowInfo;
23
import com.iver.cit.gvsig.gui.panels.ProjChooserPanel;
24
import com.iver.cit.gvsig.gui.panels.ProjChooserPanelTransformation;
25

  
26
public class testCRSViewPanel extends JPanel {
27

  
28
private static final long serialVersionUID = 1L;
29
	
30
	boolean tra = false; //para que si tenemos seleccionada transformacion nos muestre los parametros
31
		
32
	private JButton cancel = null;
33
	public static JButton next = null;
34
	public static JButton accept = null;
35
	private JPanel jPanelButton = null;
36
	
37
	int crs_target = -1;
38
	String datum_target = "";
39
	
40
	int transformation_code = 0;
41
	private CRSSelectionPanel contentPane = null;
42
	private JPanel buttonPane = null;
43
	public JRadioButton withOutTrans = null;
44
	public JRadioButton nadgrids = null;
45
	public JRadioButton epsgTrans = null;
46
	public JRadioButton manualTrans = null;	
47
	
48
	private JPanel panel = null;
49
	testCRSSelectionPanel test = null;
50
	
51
	public JFrame frame = new JFrame();
52
	
53
	public testCRSViewPanel() {			
54
		test = new testCRSSelectionPanel(1);
55
		//frame.getContentPane().add(test.getJPanelEPSG());
56
		frame.getContentPane().add(getJPanel());
57
    	
58
		frame.setSize(650, 680);
59
		frame.setVisible(true);
60
	
61
	}		
62
	 
63
	private JPanel getJPanel() {
64
		if (panel == null){
65
			panel = new JPanel();
66
			panel.setPreferredSize(new Dimension(600,650));
67
			panel.setLayout(new GridLayout(0,2));
68
			panel.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
69
			panel.add(test.getCombopanel());
70
			panel.add(test.getJPanelEPSG());
71
			panel.add(getCheckButtonPane(), null);		
72
			panel.add(getButtons(), null);	
73
		}
74
		return panel;
75
	}	
76
	
77
	private JPanel getCheckButtonPane() {
78
		if(buttonPane == null) {
79
			buttonPane = new JPanel();
80
			buttonPane.setPreferredSize(new Dimension(400,100));
81
			buttonPane.setLayout(new GridLayout(0,2));
82
			buttonPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
83
			buttonPane.setBorder(
84
				    BorderFactory.createCompoundBorder(
85
					BorderFactory.createCompoundBorder(
86
							BorderFactory.createTitledBorder("Seleccione Transformacion"),
87
							BorderFactory.createEmptyBorder(2,2,2,2)),
88
							buttonPane.getBorder()));
89
			buttonPane.add(getWithOutTrans(), null);
90
			buttonPane.add(getNadgrids(), null);
91
			buttonPane.add(getEpsgTrans(), null);
92
			buttonPane.add(getManualTrans(), null);
93
		}
94
		return buttonPane;
95
	}
96
	
97
	private JRadioButton getWithOutTrans() {
98
		if(withOutTrans == null) {
99
			withOutTrans = new JRadioButton();
100
			withOutTrans.setText(PluginServices.getText(this,"Sin transformacion"));
101
			withOutTrans.setSelected(true);
102
			withOutTrans.setEnabled(false);
103
			withOutTrans.setPreferredSize(new Dimension(175,20));
104
			withOutTrans.addActionListener(new java.awt.event.ActionListener() { 
105
				public void actionPerformed(java.awt.event.ActionEvent e) {    
106
					withOutTrans_actionPerformed(e);					
107
				}
108
			});
109
		}
110
		return withOutTrans;
111
	}
112
	
113
	private void withOutTrans_actionPerformed(ActionEvent e) { 
114
	 	if(!withOutTrans.isSelected())
115
		  withOutTrans.setSelected(true);
116
	 	epsgTrans.setSelected(false);
117
		manualTrans.setSelected(false);
118
		nadgrids.setSelected(false);
119
	}
120
	
121
	private JRadioButton getNadgrids() {
122
		if(nadgrids == null) {
123
			nadgrids = new JRadioButton();
124
			nadgrids.setText(PluginServices.getText(this,"+nadgrids"));
125
			nadgrids.setSelected(false);
126
			nadgrids.setEnabled(false);
127
			nadgrids.setPreferredSize(new Dimension(175,20));
128
			nadgrids.addActionListener(new java.awt.event.ActionListener() { 
129
				public void actionPerformed(java.awt.event.ActionEvent e) {    
130
					nadgrids_actionPerformed(e);					
131
				}
132
			});
133
		}
134
		return nadgrids;
135
	}
136
	
137
	private void nadgrids_actionPerformed(ActionEvent e) {
138
	
139
		if(!nadgrids.isSelected())
140
			nadgrids.setSelected(true);
141
		withOutTrans.setSelected(false);
142
		epsgTrans.setSelected(false);
143
		manualTrans.setSelected(false);
144
	 }
145
	
146
	private JRadioButton getEpsgTrans() {
147
		if(epsgTrans == null) {
148
			epsgTrans = new JRadioButton();
149
			epsgTrans.setText(PluginServices.getText(this,"Transformacion epsg"));
150
			epsgTrans.setSelected(false);
151
			epsgTrans.setEnabled(false);
152
			epsgTrans.setPreferredSize(new Dimension(175,20));
153
			epsgTrans.addActionListener(new java.awt.event.ActionListener() { 
154
				public void actionPerformed(java.awt.event.ActionEvent e) {    
155
					epsgTrans_actionPerformed(e);					
156
				}
157
			});
158
		}
159
		return epsgTrans;
160
	}
161
	
162
	private void epsgTrans_actionPerformed(ActionEvent e) {
163
		if(!epsgTrans.isSelected())
164
			epsgTrans.setSelected(true);
165
		nadgrids.setSelected(false);
166
		withOutTrans.setSelected(false);
167
		manualTrans.setSelected(false);
168
	}
169
	
170
	private JRadioButton getManualTrans() {
171
		if(manualTrans == null) {
172
			manualTrans = new JRadioButton();
173
			manualTrans.setText(PluginServices.getText(this,"Transformacion manual"));
174
			manualTrans.setSelected(false);
175
			manualTrans.setEnabled(false);
176
			manualTrans.setPreferredSize(new Dimension(175,20));
177
			manualTrans.addActionListener(new java.awt.event.ActionListener() { 
178
				public void actionPerformed(java.awt.event.ActionEvent e) {    
179
					manualTrans_actionPerformed(e);					
180
				}
181
			});
182
		}
183
		return manualTrans;
184
	}
185

  
186
	private void manualTrans_actionPerformed(ActionEvent e) {
187
		if(!manualTrans.isSelected())
188
			manualTrans.setSelected(true);
189
		nadgrids.setSelected(false);
190
		epsgTrans.setSelected(false);
191
		withOutTrans.setSelected(false);
192
	}
193
	
194
	
195
	private JPanel getButtons() {
196
		if(jPanelButton == null) {
197
			jPanelButton = new JPanel();
198
			jPanelButton.setPreferredSize(new Dimension(600,50));
199
			jPanelButton.setLayout(new GridLayout(0,1));
200
			jPanelButton.setLayout(new FlowLayout(FlowLayout.RIGHT,5,5));
201
			jPanelButton.add(getCancel(), null);
202
			jPanelButton.add(getNext(), null);
203
			jPanelButton.add(getAccept(), null);
204
		}
205
		return jPanelButton;
206
	}
207
	
208
	private JButton getAccept() {
209
		if(accept == null) {
210
			accept = new JButton();
211
			accept.setText(PluginServices.getText(this,"Ok"));
212
			accept.setMnemonic('O');
213
			accept.setPreferredSize(new Dimension(100,25));
214
			accept.addActionListener(new java.awt.event.ActionListener() { 
215
				public void actionPerformed(java.awt.event.ActionEvent e) {    
216
					accept_actionPerformed(e);					
217
				}
218
			});
219
		}
220
		return accept;
221
	}
222
	
223
	private void accept_actionPerformed(ActionEvent e) {
224
		
225
	}
226
	
227
	
228
	private JButton getNext() {
229
		if(next == null) {
230
			next = new JButton();
231
			next.setText(PluginServices.getText(this,"Siguiente"));
232
			next.setMnemonic('S');
233
			next.setVisible(false);
234
			next.setPreferredSize(new Dimension(100,25));
235
			next.addActionListener(new java.awt.event.ActionListener() { 
236
				public void actionPerformed(java.awt.event.ActionEvent e) {    
237
					next_actionPerformed(e);					
238
				}
239
			});
240
		}
241
		return next;
242
	}
243
	
244
	private void next_actionPerformed(ActionEvent e) {
245
		if(epsgTrans.isSelected() == true && contentPane.getCodeCRS() != -1){
246
			//PluginServices.getMDIManager().closeWindow(this);
247
			TransformationEpsgPanel tr = new TransformationEpsgPanel(contentPane.getWKT(),contentPane.getCodeCRS(),
248
					crs_target);
249
			tr.setSize(new Dimension(550, 400));
250
			tr.setLayout(new GridLayout(2,2));
251
			tr.setLayout(new FlowLayout(FlowLayout.LEFT,5,20));
252
			PluginServices.getMDIManager().addWindow(tr);
253
		
254
			
255
		}else if(nadgrids.isSelected() == true && contentPane.getCodeCRS() != -1) {
256
			//PluginServices.getMDIManager().closeWindow(this);
257
			TransformationNadgridsPanel tn = new TransformationNadgridsPanel(contentPane.getWKT(),contentPane.getCodeCRS());
258
			tn.setSize(new Dimension(550, 275));
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff