Revision 10786 branches/F2/extensions/extJCRS/src/org/gvsig/crs/gui/panels/IAU2000panel.java

View differences:

IAU2000panel.java
40 40

  
41 41
package org.gvsig.crs.gui.panels;
42 42

  
43
import java.awt.BorderLayout;
43 44
import java.awt.Color;
44 45
import java.awt.Dimension;
45 46
import java.awt.FlowLayout;
......
52 53
import java.sql.SQLException;
53 54

  
54 55
import javax.swing.BorderFactory;
56
import javax.swing.ButtonGroup;
55 57
import javax.swing.JButton;
56 58
import javax.swing.JLabel;
57 59
import javax.swing.JOptionPane;
......
80 82
 * de la IAU2000
81 83
 * 
82 84
 * @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com)
85
 * @author Luisa Marina Fern?ndez (luisam.fernandez@uclm.es)
83 86
 *
84 87
 */
85 88
public class IAU2000panel extends JPanel implements KeyListener, ActionListener {
86 89

  
87
	/**
88
	 * 
89
	 */
90 90
	private static final long serialVersionUID = 1L;
91 91
	public JPanel IAU2000panel = null;
92 92
	
......
95 95
	private JPanel groupRadioButton = null;
96 96
	
97 97
	JLabel jLabel = null;
98
	private JLabel lblCriterio=null;
98 99
	JTextField crsTextFld = null;	
99 100
	
100 101
	String cadWKT = "";
......
106 107
	int datum_code = 0;
107 108
	int projection_conv_code = 0;
108 109
	public String crs_kind = null;
109
	
110

  
110 111
	public TableSorter sorter = null;
111 112
	
112 113
	public EpsgConnection connect = null;
113 114
	
115

  
114 116
	private JButton searchButton = null;
115 117
	private JTextField searchTextField = null;
116 118
	public JTable jTable = null;
117 119
	private JScrollPane jScrollPane = null;
118 120
	public DefaultTableModel dtm = null;
121
	
119 122
	public String key;
120 123
	public int selectedRowTable = -1;	
121
	
122 124
	private int codeCRS = -1;	
123 125
	
124 126
	public IAU2000panel() {		
125 127
		initialize();
126 128
	}
127
	
129
	/*
130
	 * Establece las propiedades y los componentes del panel de la IAU2000
131
	 */
128 132
	private void initialize(){
129
		this.setLayout(new GridLayout(2,3));
130
		this.setLayout(new FlowLayout(FlowLayout.LEFT,10,10));
131
		this.add(getGroupRadioButton(), null);
132
		this.add(getSearchButton(), null);
133
		this.add(getSearchTextField(), null);		
134
		this.add(getJScrollPane(), null);	
133
		this.setLayout(new BorderLayout());
134
		JPanel pNorth=new JPanel();
135
		JPanel pInNorth=new JPanel();
136
		//Agregar las opciones de b?squeda
137
		pInNorth.setLayout(new FlowLayout(FlowLayout.CENTER,10,1));
138
		pInNorth.add(getSearchButton());
139
		pInNorth.add(getSearchTextField());
140
		
141
		pNorth.setLayout(new GridLayout(0,1));
142
		pNorth.add(getGroupRadioButton());
143
		pNorth.add(pInNorth);
144
		//Agregar estos elementos al panel principal
145
		this.add(pNorth,BorderLayout.NORTH);
146
		this.add(getJScrollPane(),BorderLayout.CENTER);
135 147
	}
136 148
	
137 149
	public void connection(){
......
139 151
		connect.setConnectionIAU2000();
140 152
		
141 153
	}
142
	
154
	/**
155
	 * Inicializa el Radio Button 'C?digo' 
156
	 * @return
157
	 */
143 158
	private JRadioButton getCodeRadioButton() {
144 159
		if (codeRadioButton == null) {
145 160
			codeRadioButton = new JRadioButton();
......
149 164
		}
150 165
		return codeRadioButton;
151 166
	}
152
		  
167
	/**
168
	 * Inicializa el Radio Button  'Nombre'
169
	 * @return
170
	 */
153 171
	private JRadioButton getNameRadioButton() {
154 172
		if (nameRadioButton == null) {
155 173
			nameRadioButton = new JRadioButton();
......
158 176
		}
159 177
		return nameRadioButton;
160 178
	}
161
		 
179
	/**
180
	 * Agrega todos los Radio Buttons a un panel
181
	 * @return
182
	 */
162 183
	private JPanel getGroupRadioButton() {
163 184
		if (groupRadioButton == null) {
164 185
			groupRadioButton = new JPanel();
165 186
			groupRadioButton.setLayout(new GridLayout(1,0));
166 187
			groupRadioButton.setPreferredSize(new Dimension(500,30));
167
			groupRadioButton.add(getLabel());
188
			groupRadioButton.add(getLblCriterio());
168 189
			groupRadioButton.add(getCodeRadioButton());
169
			groupRadioButton.add(getNameRadioButton());			
190
			groupRadioButton.add(getNameRadioButton());	
191
			//Agrupar los Radio Buttons
192
			ButtonGroup group=new ButtonGroup();
193
			group.add(getCodeRadioButton());
194
			group.add(getNameRadioButton());
170 195
		}
171 196
		return groupRadioButton;
172 197
	}
173
	
174
	private JLabel getLabel(){
175
		JLabel criterio = new JLabel();
176
		criterio.setPreferredSize(new Dimension(100, 20));
177
		criterio.setText(PluginServices.getText(this, "criterio_busqueda"));
178
		return criterio;
198
	/**
199
	 * Inicializa el Label que nombra el Criterio de B?squeda
200
	 * @return
201
	 */
202
	private JLabel getLblCriterio(){
203
		if(lblCriterio==null){
204
			lblCriterio = new JLabel();
205
			lblCriterio.setPreferredSize(new Dimension(100, 20));
206
			lblCriterio.setText(PluginServices.getText(this, "criterio_busqueda"));
207
		}
208
		return lblCriterio;
179 209
	}
180 210
	
181 211
	/**
......
329 359
			Object[][]data = {};			
330 360
			dtm = new DefaultTableModel(data, columnNames)
331 361
			 {
362
				private static final long serialVersionUID = 1L;
332 363
				public boolean isCellEditable(int row, int column) {
333 364
					return false;
334 365
				}
......
380 411
		if (jScrollPane == null) {
381 412
			jScrollPane = new JScrollPane();
382 413
			jScrollPane.setPreferredSize(new Dimension(500,150));
383
			jScrollPane.setBorder(
414
			/*jScrollPane.setBorder(
384 415
				    BorderFactory.createCompoundBorder(
385 416
					BorderFactory.createCompoundBorder(
386 417
							BorderFactory.createTitledBorder(PluginServices.getText(this,"IAU2000")),
387 418
							BorderFactory.createEmptyBorder(5,5,5,5)),
388
							jScrollPane.getBorder()));
419
							jScrollPane.getBorder()));*/
420
			jScrollPane.setBorder(
421
				    BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(3,3,3,3),jScrollPane.getBorder()));
422
			
389 423
			jScrollPane.setViewportView(getJTable());
390 424
		}
391 425
		return jScrollPane;
......
483 517
	}
484 518

  
485 519
	public void keyReleased(KeyEvent arg0) {
486
		// TODO Auto-generated method stub
487
		
520
	
488 521
	}
489 522

  
490 523
	public void keyTyped(KeyEvent arg0) {
491
		// TODO Auto-generated method stub
492
		
524
	
493 525
	}
494 526

  
495 527
	/**
......
497 529
	 * del repositorio IAU2000.
498 530
	 */
499 531
	public void actionPerformed(ActionEvent e) {
500
		// TODO Auto-generated method stub
501 532
		if (e.getSource() == this.getSearchButton()){
502 533
			searchTextField.setBackground(Color.white);
503 534
			if (searchTextField.getText().equals("")) {
......
512 543
		}
513 544
		if (e.getSource() == this.getCodeRadioButton()) {
514 545
			searchTextField.setText("");
515
			codeRadioButton.setSelected(true);
516
			nameRadioButton.setSelected(false);
517 546
		}
518 547
		
519 548
		if (e.getSource() == this.getNameRadioButton()) {
520 549
			searchTextField.setText("");
521
			nameRadioButton.setSelected(true);
522
			codeRadioButton.setSelected(false);
550
		
523 551
		}		
524 552
	}
525 553

  

Also available in: Unified diff