Revision 8561 trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/IAU2000panel.java
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 { |
Also available in: Unified diff