Revision 8561

View differences:

trunk/extensions/extJCRS/config/text.properties
15 15
codigo=C?digo
16 16
coordinate_reference_systems= Coordinate Reference Systems
17 17
criterio_busqueda= Criterio de b?squeda:
18
crs_no_selected=No se ha seleccionado CRS
19
crs_not_soported=CRS no soportado
18 20
crsview=CrsView
19 21
datum=Datum:
20 22
descripcion=Descripci?n
21 23
description_area=Descripci?n del ?rea
22 24
EPSG=EPSG
23 25
ESRI=ESRI
26
fill_name=Rellenar el nombre
24 27
finalizar=Finalizar
25 28
fuente=Fuente
26 29
geogcs=Geogcs:
......
31 34
nadgrids=nadgrids
32 35
name_transformation=Nombre de la Transformaci?n
33 36
no=No
37
no_results=No se han encontrado resultados
34 38
nombre=Nombre
35 39
nuevo_crs=Nuevo CRS
40
numeric_format=Este campo solo acepta n?meros
36 41
ok=Aceptar
37 42
Ok=Aceptar
38 43
por_area=Por ?rea
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/EPSGpanel.java
42 42
import com.iver.andami.PluginServices;
43 43
import com.iver.cit.gvsig.gui.TableSorter;
44 44

  
45
public class EPSGpanel extends JPanel implements KeyListener, ActionListener, DocumentListener{
45
public class EPSGpanel extends JPanel implements KeyListener, ActionListener{
46 46

  
47 47
	/**
48 48
	 * 
......
177 177

  
178 178
	private void searchButton() {
179 179
		boolean not_valid = false;
180
		boolean not_numeric = false;
180 181
		searchTextField.setBackground(Color.white);
181 182
		
182 183
		if (searchTextField.getText().equals("")) {
183 184
			searchTextField.setBackground(new Color(255,204,204));
184
			JOptionPane.showMessageDialog(this, "Fill the name of CRS.", "Warning...", JOptionPane.WARNING_MESSAGE);
185
		}
185
			JOptionPane.showMessageDialog(this, PluginServices.getText(this,"fill_name"), "Warning...", JOptionPane.WARNING_MESSAGE);
186
		}		
186 187
		
187 188
		else {
188 189
            //Eliminar filas en cada nueva bsqueda
......
192 193
				dtm.removeRow(numRow);
193 194
			}
194 195
			
196
			if (codeRadioButton.isSelected() && (searchTextField.getText().length()!=searchTextField.getText().replaceAll("[^0-9]", "").length())){
197
				not_numeric = true;
198
			}
199
			
195 200
			//Dependiendo de la opcion se realizada una busqueda
196 201
			ResultSet result = null;
197 202
			ResultSet result2 = null;
......
201 206
			 * tablas, por lo cual hay que separar la b?squeda
202 207
			 */
203 208
			int bus = 2;  			
204
			if (codeRadioButton.isSelected()) {
209
			if (codeRadioButton.isSelected() && !not_numeric) {
205 210
				bus=0;
206 211
				key = searchTextField.getText();
207 212
				int code = Integer.parseInt(key);
......
230 235
				result = Query.select(sentence,connect.getConnection());
231 236
			}
232 237
			
233
			else {
238
			else if (areaRadioButton.isSelected()) {
234 239
				bus=1;
235 240
				key = searchTextField.getText();
236 241
				String key2 = key.substring(0,1);
......
318 323
			}
319 324
			int numr = dtm.getRowCount();			
320 325
			if (not_valid){
321
				JOptionPane.showMessageDialog(this, "CRS no soportado.", "Warning...",
326
				JOptionPane.showMessageDialog(this, PluginServices.getText(this,"crs_not_soported"), "Warning...",
322 327
						JOptionPane.WARNING_MESSAGE);
323 328
				not_valid = false;
324 329
			}
325
			else if (numr == 0 ){
326
			JOptionPane.showMessageDialog(this, "Not Results found.", "Warning...",
330
			else if (not_numeric) {
331
				JOptionPane.showMessageDialog(EPSGpanel.this, 
332
						PluginServices.getText(this,"numeric_format"), 
333
						"Warning...", JOptionPane.WARNING_MESSAGE);
334
				searchTextField.setText("");
335
			}
336
			else if (numr == 0){
337
			JOptionPane.showMessageDialog(this, PluginServices.getText(this,"no_results"), "Warning...",
327 338
					JOptionPane.WARNING_MESSAGE);
328 339
			}
329 340
			else{
......
401 412
		if (searchTextField == null) {
402 413
			searchTextField = new JTextField();
403 414
			searchTextField.setPreferredSize(new Dimension(300,20));
404
			searchTextField.addKeyListener(this);
405
			searchTextField.getDocument().addDocumentListener(this);
415
			searchTextField.addKeyListener(this);			
406 416
		}
407 417
		
408 418
		return searchTextField;
......
559 569
		}
560 570
		else {
561 571
			JOptionPane.showMessageDialog(this, 
562
					"No CRS selected.", 
572
					PluginServices.getText(this,"crs_no_selected."), 
563 573
					"Warning...", JOptionPane.WARNING_MESSAGE);
564 574
			
565 575
		}
......
623 633
	}
624 634

  
625 635
	public void keyReleased(KeyEvent e) {
626
		// TODO Auto-generated method stub	
627
		
628
			
629
				
630
		
631
		/*if ((posiciones_no_validas.size()==0) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
632
				(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127) {
633
			
634
		}
635
		else {
636
			JOptionPane.showMessageDialog(EPSGpanel.this, 
637
					"Only number format.", 
638
					"Warning...", JOptionPane.WARNING_MESSAGE);
639
			String aux = searchTextField.getText();
640
			String cadena_valida = "";
641
			int j = 0;			
642
			Integer pos = (Integer) (posiciones_no_validas.get(0));
643
			int ps = pos.intValue();
644
			cadena_valida = cadena_valida + aux.substring(j, ps) + aux.substring(ps+1, aux.length());
645
			
646
			searchTextField.setText(cadena_valida);			
647
		}*/
636
		// TODO Auto-generated method stub		
648 637
	}
649 638

  
650 639
	public void keyTyped(KeyEvent e) {
......
680 669
			if (searchTextField.getText().equals("")) {
681 670
				searchTextField.setBackground(new Color(255,204,204));
682 671
				JOptionPane.showMessageDialog(EPSGpanel.this, 
683
						"Fill the key-word of the search.", 
672
						PluginServices.getText(this,"fill_name"), 
684 673
						"Warning...", JOptionPane.WARNING_MESSAGE);
685 674
			}
686 675
			else {
......
696 685
			PluginServices.getMDIManager().addWindow(info);
697 686
		}
698 687
	}
699

  
700
	public void changedUpdate(DocumentEvent e) {
701
		// TODO Auto-generated method stub
702
		
703
	}
704

  
705
	public void insertUpdate(DocumentEvent e) {
706
		// TODO Auto-generated method stub
707
		if (codeRadioButton.isSelected()){
708
			cad_valida = "";
709
			String aux = searchTextField.getText();				
710
			int z = 0;			
711
			for (int j= 0; j<aux.length(); j++){
712
				for (int i= 0; i<10; i++){					
713
					
714
					if (aux.charAt(j)== String.valueOf(i).charAt(0)){
715
						tecla_valida = true;
716
					}
717
				}
718
				if (!tecla_valida){					
719
					z++;
720
				}
721
				else {
722
					cad_valida += aux.charAt(j);
723
					tecla_valida = false;
724
				}
725
			}
726
			if (z>0) {
727
				JOptionPane.showMessageDialog(EPSGpanel.this, 
728
						"Only number format.", 
729
						"Warning...", JOptionPane.WARNING_MESSAGE);
730
				searchTextField.setText(cad_valida);
731
			}
732
		}
733
	}
734

  
735
	public void removeUpdate(DocumentEvent e) {
736
		// TODO Auto-generated method stub		
737
	}		
738 688
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/IAU2000panel.java
133 133
	
134 134
	private void searchButton() {		
135 135
		searchTextField.setBackground(Color.white);
136
		boolean not_numeric = false;
136 137
		
137 138
		if (searchTextField.getText().equals("")) {
138 139
			searchTextField.setBackground(new Color(255,204,204));
139
			JOptionPane.showMessageDialog(this, "Fill the name of CRS.", "Warning...", JOptionPane.WARNING_MESSAGE);
140
			JOptionPane.showMessageDialog(this, PluginServices.getText(this,"fill_name"), "Warning...", JOptionPane.WARNING_MESSAGE);
140 141
		}
141 142
		
142 143
		else {
......
147 148
				dtm.removeRow(numRow);
148 149
			}
149 150
			
151
			if (codeRadioButton.isSelected() && (searchTextField.getText().length()!=searchTextField.getText().replaceAll("[^0-9]", "").length())){
152
				not_numeric = true;
153
			}
154
			
150 155
			//Dependiendo de la opcion se realizada una busqueda
151 156
			ResultSet result = null;
152 157
								  			
153
			if (codeRadioButton.isSelected()) {
158
			if (codeRadioButton.isSelected() && !not_numeric) {
154 159
					
155 160
				key = searchTextField.getText();
156 161
				int code = Integer.parseInt(key);
......
226 231
			}
227 232
						
228 233
			int numr = dtm.getRowCount();
229
			
230
			if (numr == 0 ){
231
			JOptionPane.showMessageDialog(this, "Not Results found.", "Warning...",
234
			if (not_numeric) {
235
				JOptionPane.showMessageDialog(IAU2000panel.this, 
236
						PluginServices.getText(this,"numeric_format"), 
237
						"Warning...", JOptionPane.WARNING_MESSAGE);
238
				searchTextField.setText("");
239
			}
240
			else if (numr == 0){
241
			JOptionPane.showMessageDialog(this, PluginServices.getText(this,"no_results"), "Warning...",
232 242
					JOptionPane.WARNING_MESSAGE);
233 243
			}
234 244
			else{
......
405 415
		if (e.getSource() == this.getSearchTextField()){
406 416
			if (e.getKeyCode() == 10) {
407 417
				searchButton();
408
			}
409
			if (codeRadioButton.isSelected()) {
410
								
411
				if ((e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
412
						(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
413
				}
414
				else {
415
					JOptionPane.showMessageDialog(IAU2000panel.this, 
416
							"Only number format.", 
417
							"Warning...", JOptionPane.WARNING_MESSAGE);
418
					String aux = searchTextField.getText();
419
					if (aux.length() == 1 || aux.length() == 0){
420
						searchTextField.setText("");
421
					}
422
					else {
423
						searchTextField.setText(aux.substring(0, aux.length()-1));
424
					}
425
				}
426
			}
427
		}
428
		
418
			}			
419
		}		
429 420
	}
430 421

  
431 422
	public void keyReleased(KeyEvent arg0) {
......
445 436
			if (searchTextField.getText().equals("")) {
446 437
				searchTextField.setBackground(new Color(255,204,204));
447 438
				JOptionPane.showMessageDialog(IAU2000panel.this, 
448
						"Fill the key-word of the search.", 
439
						PluginServices.getText(this,"fill_name"), 
449 440
						"Warning...", JOptionPane.WARNING_MESSAGE);
450 441
			}
451 442
			else {
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/listeners/CRSMainTrPanelListener.java
261 261
					panel.compareDatum(panel.getCrsMainPanel().getEpsgPanel().getWKT());			
262 262
	        	}
263 263
	        	else {
264
	        		JOptionPane.showMessageDialog(panel, "CRS no soportado.", "Warning...",
264
	        		JOptionPane.showMessageDialog(panel, PluginServices.getText(this,"crs_not_soported"), "Warning...",
265 265
							JOptionPane.WARNING_MESSAGE);
266 266
	        		panel.getCrsMainPanel().getEpsgPanel().setCodeCRS(-1);
267 267
	        		panel.getCrsMainPanel().getEpsgPanel().setCodeCRS(0);
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/listeners/CRSSelectionDialogListener.java
221 221
	            	
222 222
	        	}
223 223
	        	else {
224
	        		JOptionPane.showMessageDialog(dialog, "CRS no soportado.", "Warning...",
224
	        		JOptionPane.showMessageDialog(dialog, PluginServices.getText(this,"crs_not_soported"), "Warning...",
225 225
							JOptionPane.WARNING_MESSAGE);
226 226
	        		dialog.getCrsMainPanel().getEpsgPanel().setCodeCRS(-1);
227 227
	        		dialog.setCode(0);

Also available in: Unified diff