Revision 8127

View differences:

trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/FiltroNadgrids.java
1
package org.gvsig.crs.gui.panels;
2

  
3
import java.io.File;
4
import javax.swing.*;
5
import javax.swing.filechooser.*;
6

  
7
public class FiltroNadgrids extends FileFilter {
8

  
9
	 final static String gsb = "gsb";
10
	
11
	public boolean accept(File f) {
12
		if (f.isDirectory()) {
13
            return true;
14
        }
15

  
16
        String s = f.getName();
17
        int i = s.lastIndexOf('.');
18

  
19
        if (i > 0 &&  i < s.length() - 1) {
20
            String extension = s.substring(i+1).toLowerCase();
21
            if (gsb.equals(extension)){
22
                    return true;
23
            } else {
24
                return false;
25
            }
26
        }
27

  
28
        return false;
29
	}
30

  
31
	public String getDescription() {
32
		 return "Archivos .gsb";
33
	}
34

  
35
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/FiltroESRI.java
1
package org.gvsig.crs.gui.panels;
2

  
3
import java.io.File;
4
import javax.swing.*;
5
import javax.swing.filechooser.*;
6

  
7
public class FiltroESRI extends FileFilter {
8

  
9
	 final static String prj = "prj";
10
	
11
	public boolean accept(File f) {
12
		if (f.isDirectory()) {
13
            return true;
14
        }
15

  
16
        String s = f.getName();
17
        int i = s.lastIndexOf('.');
18

  
19
        if (i > 0 &&  i < s.length() - 1) {
20
            String extension = s.substring(i+1).toLowerCase();
21
            if (prj.equals(extension)){
22
                    return true;
23
            } else {
24
                return false;
25
            }
26
        }
27

  
28
        return false;
29
	}
30

  
31
	public String getDescription() {
32
		 return "Archivos .prj";
33
	}
34

  
35
}
36

  
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/EPSGpanel.java
4 4
import java.awt.FlowLayout;
5 5
import java.awt.GridLayout;
6 6
import java.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
7 8
import java.awt.event.KeyEvent;
8 9
import java.awt.event.KeyListener;
9 10
import java.sql.ResultSet;
......
35 36
import com.iver.andami.PluginServices;
36 37
import com.iver.cit.gvsig.gui.TableSorter;
37 38

  
38
public class EPSGpanel extends JPanel{
39
public class EPSGpanel extends JPanel implements KeyListener, ActionListener{
39 40

  
40 41
	/**
41 42
	 * 
......
66 67
	private JRadioButton codeRadioButton = null;
67 68
	private JRadioButton nameRadioButton = null;
68 69
	private JRadioButton areaRadioButton = null;
69
	private JPanel groupRadioButton = null;	
70
	private JPanel groupRadioButton = null;
70 71
	
71 72
	boolean inAnApplet = true;
72 73
	
......
99 100
		this.add(getSearchButton(), null);
100 101
		this.add(getSearchTextField(), null);
101 102
		this.add(getInfoCrs(), null);
102
		this.add(getJScrollPane(), null);	
103
		
103
		this.add(getJScrollPane(), null);		
104 104
	}
105 105
	
106 106
	public void connection(){
107 107
		connect = new EpsgConnection();
108
		connect.setConnectionEPSG();
108
		connect.setConnectionEPSG();		
109 109
	}
110 110
	
111 111
/*	public JPanel getJPanelEPSG() {	 //TODO Eliminar esta funci?n.
......
123 123
		return EPSGpanel;
124 124
	}*/
125 125
	
126
	private void codeRadioButton_actionPerformed(ActionEvent e) {
127
		searchTextField.setText("");
128
		codeRadioButton.setSelected(true);
129
		nameRadioButton.setSelected(false);
130
		areaRadioButton.setSelected(false);
131
	}
126
	
132 127
	    
133 128
	private JRadioButton getCodeRadioButton() {
134 129
		if (codeRadioButton == null) {
135 130
			codeRadioButton = new JRadioButton();
136 131
			codeRadioButton.setText(PluginServices.getText(this,"Por c?digo"));//setText("By Code EPSG");
137 132
			codeRadioButton.setSelected(true);
138
			codeRadioButton.addActionListener(new java.awt.event.ActionListener() { 
139
				public void actionPerformed(java.awt.event.ActionEvent e) {    
140
					codeRadioButton_actionPerformed(e);
141
				}
142
			});
133
			codeRadioButton.addActionListener(this);
143 134
		}
144 135
		return codeRadioButton;
145 136
	}
146
	
147
	private void nameRadioButton_actionPerformed(ActionEvent e) {
148
		searchTextField.setText("");
149
		nameRadioButton.setSelected(true);
150
		codeRadioButton.setSelected(false);
151
		areaRadioButton.setSelected(false);
152
	}
153
	  
137
		  
154 138
	private JRadioButton getNameRadioButton() {
155 139
		if (nameRadioButton == null) {
156 140
			nameRadioButton = new JRadioButton();
157 141
			nameRadioButton.setText(PluginServices.getText(this,"Por nombre"));
158
			nameRadioButton.addActionListener(new java.awt.event.ActionListener() { 
159
				public void actionPerformed(java.awt.event.ActionEvent e) {    
160
					nameRadioButton_actionPerformed(e);
161
				}
162
			});
142
			nameRadioButton.addActionListener(this);
163 143
		}
164 144
		return nameRadioButton;
165 145
	}
166 146
	
167
	private void areaRadioButton_actionPerformed(ActionEvent e) {
168
		searchTextField.setText("");
169
		areaRadioButton.setSelected(true);
170
		codeRadioButton.setSelected(false);
171
		nameRadioButton.setSelected(false);
172
	}
173
  
174 147
	private JRadioButton getAreaRadioButton() {
175 148
		if (areaRadioButton == null) {
176 149
			areaRadioButton = new JRadioButton();
177 150
			areaRadioButton.setText(PluginServices.getText(this,"Por ?rea"));
178
			areaRadioButton.addActionListener(new java.awt.event.ActionListener() { 
179
				public void actionPerformed(java.awt.event.ActionEvent e) {    
180
					areaRadioButton_actionPerformed(e);
181
				}
182
			});
151
			areaRadioButton.addActionListener(this);
183 152
		}
184 153
		return areaRadioButton;
185 154
	}
......
204 173
		return criterio;
205 174
	}
206 175

  
207
	private void searchButton_actionPerformed(ActionEvent e) {
176
	private void searchButton() {
208 177
		boolean not_valid = false;
209 178
		searchTextField.setBackground(Color.white);
210 179
		
......
419 388
			searchButton.setText(PluginServices.getText(this,"Buscar"));
420 389
			searchButton.setMnemonic('S');
421 390
			searchButton.setToolTipText("Search of a CRS by selected criterion");
422
			searchButton.addActionListener(new java.awt.event.ActionListener() { 
423
				public void actionPerformed(java.awt.event.ActionEvent e) {    
424
					searchTextField.setBackground(Color.white);
425
					if (searchTextField.getText().equals("")) {
426
						searchTextField.setBackground(new Color(255,204,204));
427
						JOptionPane.showMessageDialog(EPSGpanel.this, 
428
								"Fill the key-word of the search.", 
429
								"Warning...", JOptionPane.WARNING_MESSAGE);
430
					}
431
					else {
432
						searchButton_actionPerformed(e);
433
					}
434
				}
435
			});			
391
			searchButton.addActionListener(this);			
436 392
		}
437 393
		return searchButton;
438 394
	}	
......
441 397
		if (searchTextField == null) {
442 398
			searchTextField = new JTextField();
443 399
			searchTextField.setPreferredSize(new Dimension(300,20));
400
			searchTextField.addKeyListener(this);
444 401
		}
445
		searchTextField.addKeyListener(new KeyListener() {
446
			public void keyPressed(KeyEvent e) {				
447
				if (e.getKeyCode() == 10) {
448
					searchButton_actionPerformed(null);
449
				}
450
				if (codeRadioButton.isSelected()){
451
					if ((e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
452
							(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
453
					}
454
					else {
455
						JOptionPane.showMessageDialog(EPSGpanel.this, 
456
								"Only number format.", 
457
								"Warning...", JOptionPane.WARNING_MESSAGE);
458
						String aux = searchTextField.getText();
459
						if (aux.length() == 1){
460
							searchTextField.setText("");
461
						}
462
						else {
463
							searchTextField.setText(aux.substring(0, aux.length()-1));
464
						}
465
					}
466
				}
467
			}
468

  
469
			public void keyReleased(KeyEvent arg0) {				
470
			}
471

  
472
			public void keyTyped(KeyEvent arg0) {
473
			}
474
		});
402
		
475 403
		return searchTextField;
476 404
	}
477 405
	
......
541 469
			infoCrs.setMnemonic('I');
542 470
			infoCrs.setEnabled(false);
543 471
			infoCrs.setToolTipText("Mostrar la informacion del Crs selecionado");
544
			infoCrs.addActionListener(new java.awt.event.ActionListener() { 
545
				public void actionPerformed(java.awt.event.ActionEvent e) {    
546
					infoCrs_actionPerformed(e);		
547
				}	
548
			});
472
			infoCrs.addActionListener(this);
549 473
		}
550 474
		return infoCrs;
551 475
	}
552 476
	
553
	private void infoCrs_actionPerformed(ActionEvent e) {
554
		InfoCRSPanel info = new InfoCRSPanel(getProjection());
555
		info.setSize(new Dimension(550,350));
556
		info.setLayout(new GridLayout(0,1));
557
		info.setLayout(new FlowLayout(FlowLayout.LEFT,10,5));
558
		PluginServices.getMDIManager().addWindow(info);
559
	}
560 477
	
561 478
	public ICrs getProjection() {
562 479
		try {
......
676 593
		}
677 594
	}
678 595

  
596
	public void keyPressed(KeyEvent e) {
597
		// TODO Auto-generated method stub
598
		if (e.getSource() == this.getSearchTextField()) {
599
			if (e.getKeyCode() == 10) {
600
				searchButton();
601
			}
602
			if (codeRadioButton.isSelected()){
603
				if ((e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
604
						(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
605
				}
606
				else {
607
					JOptionPane.showMessageDialog(EPSGpanel.this, 
608
							"Only number format.", 
609
							"Warning...", JOptionPane.WARNING_MESSAGE);
610
					String aux = searchTextField.getText();
611
					if (aux.length() == 1 || aux.length() == 0){
612
						searchTextField.setText("");
613
					}
614
					else {
615
						searchTextField.setText(aux.substring(0, aux.length()-1));
616
					}
617
				}
618
			}
619
		}
620
		
621
	}
622

  
623
	public void keyReleased(KeyEvent e) {
624
		// TODO Auto-generated method stub
625
		
626
	}
627

  
628
	public void keyTyped(KeyEvent e) {
629
		// TODO Auto-generated method stub
630
		
631
	}
632

  
633
	public void actionPerformed(ActionEvent e) {
634
		// TODO Auto-generated method stub
635
		if (e.getSource() == this.getCodeRadioButton()) {
636
			searchTextField.setText("");
637
			codeRadioButton.setSelected(true);
638
			nameRadioButton.setSelected(false);
639
			areaRadioButton.setSelected(false);
640
		}
641
		
642
		if (e.getSource() == this.getNameRadioButton()) {
643
			searchTextField.setText("");
644
			nameRadioButton.setSelected(true);
645
			codeRadioButton.setSelected(false);
646
			areaRadioButton.setSelected(false);
647
		}
648

  
649
		if (e.getSource() == this.getAreaRadioButton()) {
650
			searchTextField.setText("");
651
			areaRadioButton.setSelected(true);
652
			codeRadioButton.setSelected(false);
653
			nameRadioButton.setSelected(false);
654
		}
655
		
656
		if (e.getSource() == this.getSearchButton()) {
657
			searchTextField.setBackground(Color.white);
658
			if (searchTextField.getText().equals("")) {
659
				searchTextField.setBackground(new Color(255,204,204));
660
				JOptionPane.showMessageDialog(EPSGpanel.this, 
661
						"Fill the key-word of the search.", 
662
						"Warning...", JOptionPane.WARNING_MESSAGE);
663
			}
664
			else {
665
				searchButton();
666
			}
667
		}
668
		
669
		if (e.getSource() == this.getInfoCrs()) {
670
			InfoCRSPanel info = new InfoCRSPanel(getProjection());
671
			info.setSize(new Dimension(550,350));
672
			info.setLayout(new GridLayout(0,1));
673
			info.setLayout(new FlowLayout(FlowLayout.LEFT,10,5));
674
			PluginServices.getMDIManager().addWindow(info);
675
		}
676
	}
677

  
679 678
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/IAU2000panel.java
5 5
import java.awt.FlowLayout;
6 6
import java.awt.GridLayout;
7 7
import java.awt.event.ActionEvent;
8
import java.awt.event.ActionListener;
8 9
import java.awt.event.KeyEvent;
9 10
import java.awt.event.KeyListener;
10 11
import java.sql.ResultSet;
......
32 33
import com.iver.andami.PluginServices;
33 34
import com.iver.cit.gvsig.gui.TableSorter;
34 35

  
35
public class IAU2000panel extends JPanel {
36
public class IAU2000panel extends JPanel implements KeyListener, ActionListener {
36 37

  
37 38
	/**
38 39
	 * 
......
92 93
		connect.setConnectionIAU2000();		
93 94
	}
94 95
	
95
	private void searchButton_actionPerformed(ActionEvent e) {		
96
	private void searchButton() {		
96 97
		searchTextField.setBackground(Color.white);
97 98
		
98 99
		if (searchTextField.getText().equals("")) {
......
147 148
			searchButton.setPreferredSize(new Dimension(75,20));
148 149
			searchButton.setText(PluginServices.getText(this,"Buscar"));
149 150
			searchButton.setMnemonic('S');			
150
			searchButton.addActionListener(new java.awt.event.ActionListener() { 
151
				public void actionPerformed(java.awt.event.ActionEvent e) {    
152
					searchTextField.setBackground(Color.white);
153
					if (searchTextField.getText().equals("")) {
154
						searchTextField.setBackground(new Color(255,204,204));
155
						JOptionPane.showMessageDialog(IAU2000panel.this, 
156
								"Fill the key-word of the search.", 
157
								"Warning...", JOptionPane.WARNING_MESSAGE);
158
					}
159
					else {
160
						searchButton_actionPerformed(e);
161
					}
162
				}
163
			});			
151
			searchButton.addActionListener(this);			
164 152
		}
165 153
		return searchButton;
166 154
	}	
......
169 157
		if (searchTextField == null) {
170 158
			searchTextField = new JTextField();
171 159
			searchTextField.setPreferredSize(new Dimension(300,20));
172
		}
173
		searchTextField.addKeyListener(new KeyListener() {
174
			public void keyPressed(KeyEvent e) {				
175
				if (e.getKeyCode() == 10) {
176
					searchButton_actionPerformed(null);
177
				}
178
			}
179

  
180
			public void keyReleased(KeyEvent arg0) {				
181
			}
182

  
183
			public void keyTyped(KeyEvent arg0) {
184
			}
185
		});
160
			searchTextField.addKeyListener(this);
161
		}		
186 162
		return searchTextField;
187 163
	}
188 164
	
......
285 261
		}
286 262
	}
287 263

  
264
	public void keyPressed(KeyEvent e) {
265
		if (e.getSource() == this.getSearchTextField()){
266
			if (e.getKeyCode() == 10) {
267
				searchButton();
268
			}
269
			
270
			if ((e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
271
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
272
			}
273
			else {
274
				JOptionPane.showMessageDialog(IAU2000panel.this, 
275
						"Only number format.", 
276
						"Warning...", JOptionPane.WARNING_MESSAGE);
277
				String aux = searchTextField.getText();
278
				if (aux.length() == 1 || aux.length() == 0){
279
					searchTextField.setText("");
280
				}
281
				else {
282
					searchTextField.setText(aux.substring(0, aux.length()-1));
283
				}
284
			}
285
		}
286
		
287
	}
288

  
289
	public void keyReleased(KeyEvent arg0) {
290
		// TODO Auto-generated method stub
291
		
292
	}
293

  
294
	public void keyTyped(KeyEvent arg0) {
295
		// TODO Auto-generated method stub
296
		
297
	}
298

  
299
	public void actionPerformed(ActionEvent e) {
300
		// TODO Auto-generated method stub
301
		if (e.getSource() == this.getSearchButton()){
302
			searchTextField.setBackground(Color.white);
303
			if (searchTextField.getText().equals("")) {
304
				searchTextField.setBackground(new Color(255,204,204));
305
				JOptionPane.showMessageDialog(IAU2000panel.this, 
306
						"Fill the key-word of the search.", 
307
						"Warning...", JOptionPane.WARNING_MESSAGE);
308
			}
309
			else {
310
				searchButton();
311
			}
312
		}
313
	}
314

  
288 315
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/ESRIpanel.java
3 3
import java.awt.FlowLayout;
4 4
import java.awt.GridLayout;
5 5
import java.awt.event.ActionEvent;
6
import java.awt.event.ActionListener;
6 7
import java.io.File;
7 8

  
8 9
import javax.swing.JButton;
......
11 12
import javax.swing.JLabel;
12 13
import javax.swing.JPanel;
13 14
import javax.swing.JTextField;
15
import javax.swing.filechooser.FileFilter;
14 16

  
15 17
import com.iver.andami.PluginServices;
16 18

  
17
public class ESRIpanel extends JPanel {
19
public class ESRIpanel extends JPanel implements ActionListener {
18 20
	
19 21
	/**
20 22
	 * 
......
71 73
			jButtonOpen = new JButton();
72 74
			jButtonOpen.setText("");
73 75
			jButtonOpen.setPreferredSize(new Dimension(20,20));
74
			jButtonOpen.addActionListener(new java.awt.event.ActionListener() { 
75
				public void actionPerformed(java.awt.event.ActionEvent e) {    
76
					Open_actionPerformed(e);
77
				}
78
			});
76
			jButtonOpen.addActionListener(this);
79 77
		}
80 78
		return jButtonOpen;
81 79
	}
82 80
	
83
	private void Open_actionPerformed(ActionEvent e){
84
		add(getOpen(), null);
85
		openChooser.setCurrentDirectory(f);
86
		int returnVal = openChooser.showOpenDialog(ESRIpanel.this);
87
        if (returnVal == JFileChooser.APPROVE_OPTION) {
88
            File file = openChooser.getSelectedFile();
89
            jTextOpen.setText(file.getAbsolutePath());
90
        }
91
    }
81
	public void actionPerformed(ActionEvent e) {
82
		// TODO Auto-generated method stub
83
		if (e.getSource() == this.getButtonOpen()){
84
			add(getOpen(), null);
85
			openChooser.setCurrentDirectory(f);
86
			int returnVal = openChooser.showOpenDialog(ESRIpanel.this);
87
	        if (returnVal == JFileChooser.APPROVE_OPTION) {
88
	            File file = openChooser.getSelectedFile();
89
	            jTextOpen.setText(file.getAbsolutePath());
90
	        }
91
		}
92
	}	
93
}
94

  
95
class FiltroESRI extends FileFilter{	
92 96
	
93
	
97
	 final static String prj = "prj";
98
		
99
		public boolean accept(File f) {
100
			if (f.isDirectory()) {
101
	            return true;
102
	        }
94 103

  
104
	        String s = f.getName();
105
	        int i = s.lastIndexOf('.');
106

  
107
	        if (i > 0 &&  i < s.length() - 1) {
108
	            String extension = s.substring(i+1).toLowerCase();
109
	            if (prj.equals(extension)){
110
	                    return true;
111
	            } else {
112
	                return false;
113
	            }
114
	        }
115

  
116
	        return false;
117
		}
118

  
119
		public String getDescription() {
120
			 return "Archivos .prj";
121
		}
95 122
}
123

  
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/TransformationNadgridsPanel.java
6 6
import java.awt.FlowLayout;
7 7
import java.awt.GridLayout;
8 8
import java.awt.event.ActionEvent;
9
import java.awt.event.ActionListener;
9 10
import java.io.File;
10 11

  
11 12
import javax.swing.BorderFactory;
......
29 30
import com.iver.andami.ui.mdiManager.IWindow;
30 31
import com.iver.andami.ui.mdiManager.WindowInfo;
31 32

  
32
public class TransformationNadgridsPanel extends DefaultDialogPanel implements IWindow {
33
public class TransformationNadgridsPanel extends DefaultDialogPanel implements IWindow, ActionListener {
33 34
	
34 35
	private static final long serialVersionUID = 1L;
35 36
	
......
98 99
			sourceRadioButton = new JRadioButton();
99 100
			sourceRadioButton.setText(PluginServices.getText(this,"Aplicar a fuente"));//setText("By Code EPSG");
100 101
			sourceRadioButton.setSelected(true);
101
			sourceRadioButton.addActionListener(new java.awt.event.ActionListener() { 
102
				public void actionPerformed(java.awt.event.ActionEvent e) {    
103
					sourceRadioButton_actionPerformed(e);
104
				}
105
			});
102
			sourceRadioButton.addActionListener(this);
106 103
		}
107 104
		return sourceRadioButton;
108 105
	}
109 106
	
110
	private void sourceRadioButton_actionPerformed(ActionEvent e) {		
111
		sourceRadioButton.setSelected(true);
112
		targetRadioButton.setSelected(false);
113
	}
114 107
	
115 108
	private JRadioButton getNadgridsTarget() {		
116 109
		if (targetRadioButton == null) {
117 110
			targetRadioButton = new JRadioButton();
118 111
			targetRadioButton.setText(PluginServices.getText(this,"Aplicar a destino"));//setText("By Code EPSG");
119 112
			targetRadioButton.setSelected(false);
120
			targetRadioButton.addActionListener(new java.awt.event.ActionListener() { 
121
				public void actionPerformed(java.awt.event.ActionEvent e) {    
122
					targetRadioButton_actionPerformed(e);
123
				}
124
			});
113
			targetRadioButton.addActionListener(this);
125 114
		}
126 115
		return targetRadioButton;
127
	}
116
	}	
128 117
	
129
	private void targetRadioButton_actionPerformed(ActionEvent e) {		
130
		targetRadioButton.setSelected(true);
131
		sourceRadioButton.setSelected(false);
132
	}
133
	
134 118
	private JLabel getJLabel(){
135 119
		chooserLabel = new JLabel();
136 120
		chooserLabel.setPreferredSize(new Dimension(400, 20));
......
221 205
			jButtonOpen = new JButton();
222 206
			jButtonOpen.setText("");
223 207
			jButtonOpen.setPreferredSize(new Dimension(20,20));
224
			jButtonOpen.addActionListener(new java.awt.event.ActionListener() { 
225
				public void actionPerformed(java.awt.event.ActionEvent e) {    
226
					Open_actionPerformed(e);
227
				}
228
			});
208
			jButtonOpen.addActionListener(this);
229 209
		}
230 210
		return jButtonOpen;
231 211
	}
232 212
	
233
	private void Open_actionPerformed(ActionEvent e){
234
		jPaneOpen.add(getOpen(), null);
235
		openChooser.setCurrentDirectory(f);
236
		int returnVal = openChooser.showOpenDialog(TransformationNadgridsPanel.this);
237
        if (returnVal == JFileChooser.APPROVE_OPTION) {
238
            File file = openChooser.getSelectedFile();
239
            jTextOpen.setText(file.getAbsolutePath());
240
        }
241
    }
242
	
243 213
	public ICrs getProjection() {
244 214
		ICrs crs;
245 215
		if (sourceRadioButton.isSelected()){
......
302 272
   		m_viewinfo.setTitle(PluginServices.getText(this,"Nadgrids"));
303 273
		return m_viewinfo;
304 274
	}
275

  
276
	public void actionPerformed(ActionEvent e) {
277
		// TODO Auto-generated method stub
278
		if (e.getSource() == this.getNadgridsSource()){
279
			sourceRadioButton.setSelected(true);
280
			targetRadioButton.setSelected(false);
281
		}
282
		
283
		if (e.getSource() == this.getNadgridsTarget()){
284
			targetRadioButton.setSelected(true);
285
			sourceRadioButton.setSelected(false);
286
		}
287
		
288
		if (e.getSource() == this.getButtonOpen()){
289
			jPaneOpen.add(getOpen(), null);
290
			openChooser.setCurrentDirectory(f);
291
			int returnVal = openChooser.showOpenDialog(TransformationNadgridsPanel.this);
292
	        if (returnVal == JFileChooser.APPROVE_OPTION) {
293
	            File file = openChooser.getSelectedFile();
294
	            jTextOpen.setText(file.getAbsolutePath());
295
	        }
296
		}
297
	}
305 298
}
299

  
300
class FiltroNadgrids extends FileFilter {
301

  
302
	 final static String gsb = "gsb";
303
	
304
	public boolean accept(File f) {
305
		if (f.isDirectory()) {
306
           return true;
307
       }
308

  
309
       String s = f.getName();
310
       int i = s.lastIndexOf('.');
311

  
312
       if (i > 0 &&  i < s.length() - 1) {
313
           String extension = s.substring(i+1).toLowerCase();
314
           if (gsb.equals(extension)){
315
                   return true;
316
           } else {
317
               return false;
318
           }
319
       }
320

  
321
       return false;
322
	}
323

  
324
	public String getDescription() {
325
		 return "Archivos .gsb";
326
	}
327

  
328
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/TransformationManualPanel.java
8 8
import java.awt.Font;
9 9
import java.awt.GridLayout;
10 10
import java.awt.event.ActionEvent;
11
import java.awt.event.KeyEvent;
12
import java.awt.event.KeyListener;
11 13

  
12 14
import javax.swing.BorderFactory;
13 15
import javax.swing.JButton;
14 16
import javax.swing.JLabel;
17
import javax.swing.JOptionPane;
15 18
import javax.swing.JPanel;
16 19
import javax.swing.JScrollPane;
17 20
import javax.swing.JTextArea;
......
25 28
import com.iver.andami.ui.mdiManager.IWindow;
26 29
import com.iver.andami.ui.mdiManager.WindowInfo;
27 30

  
28
public class TransformationManualPanel extends JPanel{
31
public class TransformationManualPanel extends JPanel implements KeyListener{
29 32
	
30 33
	private static final long serialVersionUID = 1L;
31 34
	
......
106 109
			x_Translation.setPreferredSize(new Dimension(120,20));
107 110
			//x_Translation.setFont(new Font("x_Translation:",Font.BOLD,15));
108 111
			x_Translation.setText(PluginServices.getText(this,"x_Translation:"));
112
			
109 113
		}
110 114
		return x_Translation;
111 115
	}
......
116 120
			y_Translation.setPreferredSize(new Dimension(120,20));
117 121
			//y_Translation.setFont(new Font("y_Translation:",Font.BOLD,15));
118 122
			y_Translation.setText(PluginServices.getText(this,"y_Translation:"));
123
			
119 124
		}
120 125
		return y_Translation;
121 126
	}
......
126 131
			z_Translation.setPreferredSize(new Dimension(120,20));
127 132
			//z_Translation.setFont(new Font("z_Translation:",Font.BOLD,15));
128 133
			z_Translation.setText(PluginServices.getText(this,"z_Translation:"));
134
			
129 135
		}
130 136
		return z_Translation;
131 137
	}
......
136 142
			x_Rotation.setPreferredSize(new Dimension(120,20));
137 143
			//x_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
138 144
			x_Rotation.setText(PluginServices.getText(this,"x_Rotation:"));
145
			
139 146
		}
140 147
		return x_Rotation;
141 148
	}
......
146 153
			y_Rotation.setPreferredSize(new Dimension(120,20));
147 154
			//y_Rotation.setFont(new Font("x_Rotation:",Font.BOLD,15));
148 155
			y_Rotation.setText(PluginServices.getText(this,"y_Rotation:"));
156
			
149 157
		}
150 158
		return y_Rotation;
151 159
	}
......
156 164
			z_Rotation.setPreferredSize(new Dimension(120,20));
157 165
			//z_Rotation.setFont(new Font("x_Translation:",Font.BOLD,15));
158 166
			z_Rotation.setText(PluginServices.getText(this,"z_Rotation:"));
167
			
159 168
		}
160 169
		return z_Rotation;
161 170
	}
......
166 175
			scale.setPreferredSize(new Dimension(120,20));
167 176
			//scale.setFont(new Font("scale:",Font.BOLD,15));
168 177
			scale.setText(PluginServices.getText(this,"scale:"));
178
			
169 179
		}
170 180
		return scale;
171 181
	}
......
177 187
			//tx_Translation.setFont(new Font("",Font.ITALIC,10));
178 188
			tx_Translation.setText("0");
179 189
			tx_Translation.setEditable(true);
190
			tx_Translation.addKeyListener(this);
180 191
		}
181 192
		return tx_Translation;
182 193
	}
......
188 199
			//ty_Translation.setFont(new Font("",Font.ITALIC,10));
189 200
			ty_Translation.setText("0");
190 201
			ty_Translation.setEditable(true);
202
			ty_Translation.addKeyListener(this);
191 203
		}
192 204
		return ty_Translation;
193 205
	}
......
199 211
			//tz_Translation.setFont(new Font("",Font.ITALIC,10));
200 212
			tz_Translation.setText("0");
201 213
			tz_Translation.setEditable(true);
214
			tz_Translation.addKeyListener(this);
202 215
		}
203 216
		return tz_Translation;
204 217
	}
......
210 223
			//tx_Rotation.setFont(new Font("",Font.ITALIC,10));
211 224
			tx_Rotation.setText("0");
212 225
			tx_Rotation.setEditable(true);
226
			tx_Rotation.addKeyListener(this);
213 227
		}
214 228
		return tx_Rotation;
215 229
	}
......
221 235
			//ty_Rotation.setFont(new Font("",Font.ITALIC,10));
222 236
			ty_Rotation.setText("0");
223 237
			ty_Rotation.setEditable(true);
238
			ty_Rotation.addKeyListener(this);
224 239
		}
225 240
		return ty_Rotation;
226 241
	}
......
232 247
			//tz_Rotation.setFont(new Font("",Font.ITALIC,10));
233 248
			tz_Rotation.setText("0");
234 249
			tz_Rotation.setEditable(true);
250
			tz_Rotation.addKeyListener(this);
235 251
		}
236 252
		return tz_Rotation;
237 253
	}
......
243 259
			//tScale.setFont(new Font("",Font.ITALIC,10));
244 260
			tScale.setText("0");
245 261
			tScale.setEditable(true);
262
			tScale.addKeyListener(this);
246 263
		}
247 264
		return tScale;
248 265
	}
......
323 340
		
324 341
	public static boolean isPressed() { return pressed; }
325 342
	
343
	public void keyPressed(KeyEvent e) {
344
		// TODO Auto-generated method stub
345
		if (e.getSource() == this.getTx_Translation()) {
346
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
347
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
348
			}
349
			else {
350
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
351
						"Only number format.", 
352
						"Warning...", JOptionPane.WARNING_MESSAGE);
353
				String aux = tx_Translation.getText();
354
				if (aux.length() == 1 || aux.length() == 0){
355
					tx_Translation.setText("");
356
				}
357
				else {
358
					tx_Translation.setText(aux.substring(0, aux.length()-1));
359
				}
360
			}
361
		}
362
		
363
		if (e.getSource() == this.getTx_Rotation()) {
364
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
365
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
366
			}
367
			else {
368
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
369
						"Only number format.", 
370
						"Warning...", JOptionPane.WARNING_MESSAGE);
371
				String aux = tx_Rotation.getText();
372
				if (aux.length() == 1 || aux.length() == 0){
373
					tx_Rotation.setText("");
374
				}
375
				else {
376
					tx_Rotation.setText(aux.substring(0, aux.length()-1));
377
				}
378
			}
379
		}
380
		
381
		if (e.getSource() == this.getTy_Translation()) {
382
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
383
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
384
			}
385
			else {
386
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
387
						"Only number format.", 
388
						"Warning...", JOptionPane.WARNING_MESSAGE);
389
				String aux = ty_Translation.getText();
390
				if (aux.length() == 1 || aux.length() == 0){
391
					ty_Translation.setText("");
392
				}
393
				else {
394
					ty_Translation.setText(aux.substring(0, aux.length()-1));
395
				}
396
			}
397
		}
398
		
399
		if (e.getSource() == this.getTy_Rotation()) {
400
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
401
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
402
			}
403
			else {
404
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
405
						"Only number format.", 
406
						"Warning...", JOptionPane.WARNING_MESSAGE);
407
				String aux = ty_Rotation.getText();
408
				if (aux.length() == 1 || aux.length() == 0){
409
					ty_Rotation.setText("");
410
				}
411
				else {
412
					ty_Rotation.setText(aux.substring(0, aux.length()-1));
413
				}
414
			}
415
		}
416
		
417
		if (e.getSource() == this.getTz_Translation()) {
418
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
419
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
420
			}
421
			else {
422
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
423
						"Only number format.", 
424
						"Warning...", JOptionPane.WARNING_MESSAGE);
425
				String aux = tz_Translation.getText();
426
				if (aux.length() == 1 || aux.length() == 0){
427
					tz_Translation.setText("");
428
				}
429
				else {
430
					tz_Translation.setText(aux.substring(0, aux.length()-1));
431
				}
432
			}
433
		}
434
		
435
		if (e.getSource() == this.getTz_Rotation()) {
436
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
437
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
438
			}
439
			else {
440
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
441
						"Only number format.", 
442
						"Warning...", JOptionPane.WARNING_MESSAGE);
443
				String aux = tz_Rotation.getText();
444
				if (aux.length() == 1 || aux.length() == 0){
445
					tz_Rotation.setText("");
446
				}
447
				else {
448
					tz_Rotation.setText(aux.substring(0, aux.length()-1));
449
				}
450
			}
451
		}
452
		
453
		if (e.getSource() == this.getTscale()) {
454
			if (e.getKeyCode() == 46 || (e.getKeyCode() >= 48 && e.getKeyCode() <= 57) || e.getKeyCode() >= 96 && e.getKeyCode() <= 105 || 
455
					(e.getKeyCode() >= 0 && e.getKeyCode()<= 31) || e.getKeyCode() == 127){						
456
			}
457
			else {
458
				JOptionPane.showMessageDialog(TransformationManualPanel.this, 
459
						"Only number format.", 
460
						"Warning...", JOptionPane.WARNING_MESSAGE);
461
				String aux = tScale.getText();
462
				if (aux.length() == 1 || aux.length() == 0){
463
					tScale.setText("");
464
				}
465
				else {
466
					tScale.setText(aux.substring(0, aux.length()-1));
467
				}
468
			}
469
		}
470
	}
326 471

  
472
	public void keyReleased(KeyEvent e) {
473
		// TODO Auto-generated method stub
474
		
475
	}
476

  
477
	public void keyTyped(KeyEvent e) {
478
		// TODO Auto-generated method stub
479
		
480
	}
481
	
482

  
327 483
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/TransformationEpsgPanel.java
32 32
import com.iver.andami.ui.mdiManager.WindowInfo;
33 33
import com.iver.cit.gvsig.gui.TableSorter;
34 34

  
35
public class TransformationEpsgPanel extends JPanel {
35
public class TransformationEpsgPanel extends JPanel implements ListSelectionListener {
36 36

  
37 37
	
38 38
	/**
......
165 165
			ListSelectionModel rowSM2 = transformationTable.getSelectionModel();
166 166
			rowSM2.addListSelectionListener(new ListSelectionListener() {
167 167
			    public void valueChanged(ListSelectionEvent e) {
168
			        lsm2 = (ListSelectionModel)e.getSource();
169
			        if (lsm2.isSelectionEmpty()) {
170
			        	selectedRowTable = -1;
171
			        	tra = false;
172
			        } 
173
			        else {
174
			            selectedRowTable = lsm2.getMinSelectionIndex();
175
			            setTrasformation_code(Integer.parseInt((String)dtm.getValueAt(selectedRowTable,0)));
176
			            String sentence = "SELECT source_crs_code " +
177
										"FROM epsg_coordoperation " +                        
178
										"WHERE coord_op_code = " + getTransformation_code() ;
179
			            ResultSet result = Query.select(sentence,connect.getConnection());
180
			            try {
181
							result.next();
182
							int source = result.getInt("source_crs_code");
183
							if (source == getSource()) {
184
								inverseTranformation = false;
185
							}
186
							else inverseTranformation = true;
187
						} catch (SQLException e1) {							
188
							e1.printStackTrace();
189
						}
190
			        }
191
			    }
168
			    }       
192 169
			});
193 170
		}
194 171
		return transformationTable;
......
454 431
		return m_viewinfo;
455 432
	}
456 433

  
434
	public void valueChanged(ListSelectionEvent e) {
435
		// TODO Auto-generated method stub
436
		if (e.getSource() == this.getJTable()){
437
			lsm2 = (ListSelectionModel)e.getSource();
438
	        if (lsm2.isSelectionEmpty()) {
439
	        	selectedRowTable = -1;
440
	        	tra = false;
441
	        } 
442
	        else {
443
	            selectedRowTable = lsm2.getMinSelectionIndex();
444
	            setTrasformation_code(Integer.parseInt((String)dtm.getValueAt(selectedRowTable,0)));
445
	            String sentence = "SELECT source_crs_code " +
446
								"FROM epsg_coordoperation " +                        
447
								"WHERE coord_op_code = " + getTransformation_code() ;
448
	            ResultSet result = Query.select(sentence,connect.getConnection());
449
	            try {
450
					result.next();
451
					int source = result.getInt("source_crs_code");
452
					if (source == getSource()) {
453
						inverseTranformation = false;
454
					}
455
					else inverseTranformation = true;
456
				} catch (SQLException e1) {							
457
					e1.printStackTrace();
458
				}
459
	        }
460
		}
461
	}
462

  
457 463
}
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/ProjChooserPanel.java
173 173
		if (jBtnChangeProj == null) {
174 174
			jBtnChangeProj = new JButton();			
175 175
			jBtnChangeProj.setText("..."); //$NON-NLS-1$
176
			jBtnChangeProj.setPreferredSize(new Dimension(34, 16));
176
			jBtnChangeProj.setPreferredSize(new Dimension(50, 23));
177 177
		}
178 178
		return jBtnChangeProj;
179 179
	}

Also available in: Unified diff