Revision 8146

View differences:

trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/TransformationEpsgPanel.java
141 141
				public boolean isCellEditable(int row, int column) {
142 142
					return false;
143 143
				}
144
				/*
145
				 * metodo necesario para cuando utilizamos tablas ordenadas
146
				 * ya que sino al ordenar por algun campo no se queda con el orden
147
				 * actual al seleccionar una fila (non-Javadoc)
148
				 * @see javax.swing.table.TableModel#getColumnClass(int)
149
				 */
150
				public Class getColumnClass(int column)
151
				{
152
					return getValueAt(0, column).getClass();
153
				}
144 154
			};
145 155
			TableSorter sorter = new TableSorter(dtm);			
146 156

  
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/CrsRecentsPanel.java
10 10
import javax.swing.JScrollPane;
11 11
import javax.swing.JTable;
12 12
import javax.swing.ListSelectionModel;
13
import javax.swing.event.TableModelListener;
13 14
import javax.swing.table.DefaultTableModel;
14 15
import javax.swing.table.TableColumn;
15 16

  
......
33 34
	public JTable jTable = null;
34 35
	private JScrollPane jScrollPane = null;
35 36
	public DefaultTableModel dtm = null;
37
	public TableSorter sorter = null;
36 38
	private CrsData crsDataArray[] = null;
37 39
	
38 40
	public int selectedRowTable = -1;
......
100 102
				public boolean isCellEditable(int row, int column) {
101 103
					return false;
102 104
				}
105
				/*
106
				 * metodo necesario para cuando utilizamos tablas ordenadas
107
				 * ya que sino al ordenar por algun campo no se queda con el orden
108
				 * actual al seleccionar una fila (non-Javadoc)
109
				 * @see javax.swing.table.TableModel#getColumnClass(int)
110
				 */
111
				public Class getColumnClass(int column)
112
				{
113
					return getValueAt(0, column).getClass();
114
				}
103 115
				};
104
			TableSorter sorter = new TableSorter(dtm);			
116
			sorter = new TableSorter(dtm);			
105 117

  
106 118
			jTable = new JTable(sorter);
107
			sorter.setTableHeader(jTable.getTableHeader());			
119
			sorter.setTableHeader(jTable.getTableHeader());
108 120
			jTable.setCellSelectionEnabled(false);
109 121
			jTable.setRowSelectionAllowed(true);
110 122
			jTable.setColumnSelectionAllowed(false);
......
121 133
			        column.setPreferredWidth(160);
122 134
			    }
123 135
			}	
124
	}
136
		}
125 137
		return jTable;		
126 138
	}
127 139
	
trunk/libraries/libJCRS/src/org/gvsig/crs/gui/panels/EPSGpanel.java
43 43
	 */
44 44
	private static final long serialVersionUID = 1L;
45 45
	public JPanel EPSGpanel = null;
46
	
47
	JLabel jLabel = null;
48
	JTextField crsTextFld = null;	
49
	
46
		
50 47
	String cadWKT = "";
51 48
	
52 49
	int transf = 0;
......
59 56
	public String crs_kind = null;
60 57
	int[] valid_method_code = {9800, 9801, 9802, 9803, 9804, 9805, 9806, 9807, 9808, 9809, 9810, 
61 58
			9811, 9812, 9813, 9814, 9815, 9816, 9817, 9602, 9659};
62
	boolean select = false;
63 59
	
64 60
	String[] soported_crs = {"projected","geographic 2D","geographic 3D", "engineering", "vertical", "compound", "geocentric"};
65 61
	String[] not_soported_crs = {};
......
69 65
	private JRadioButton areaRadioButton = null;
70 66
	private JPanel groupRadioButton = null;
71 67
	
72
	boolean inAnApplet = true;
73
	
74 68
	public EpsgConnection connect = null;
75 69
	
76 70
	private JButton infoCrs = null;
......
78 72
	private JTextField searchTextField = null;
79 73
	public JTable jTable = null;
80 74
	private JScrollPane jScrollPane = null;
81
	public DefaultTableModel dtm = null;
82
	public DefaultTableModel dtm2 = null;
75
	public DefaultTableModel dtm = null;	
83 76
	public String key;
84 77
	public int selectedRowTable = -1;
85
	public int selectedRowTable2 = -1;	
86
	
78
		
87 79
	private int codeCRS = -1;	
88
	
89
	TransformationManualPanel manual = null;
90
	
80
		
91 81
	public EPSGpanel(){
92 82
		initialize();
93 83
	}
......
105 95
	
106 96
	public void connection(){
107 97
		connect = new EpsgConnection();
108
		connect.setConnectionEPSG();		
98
		connect.setConnectionEPSG();
109 99
	}
110 100
	
111 101
/*	public JPanel getJPanelEPSG() {	 //TODO Eliminar esta funci?n.
......
207 197
								  "source_geogcrs_code, projection_conv_code  " +
208 198
								  "FROM epsg_coordinatereferencesystem " +	                              
209 199
	                              "WHERE coord_ref_sys_code = " + code;
200
								
210 201
				result = Query.select(sentence,connect.getConnection());	
202
				
211 203
			}
212 204
			
213 205
			else if (nameRadioButton.isSelected()) {
......
312 304
					e1.printStackTrace();
313 305
				}
314 306
			}
315
			int numr = dtm.getRowCount();
307
			int numr = dtm.getRowCount();			
316 308
			if (not_valid){
317 309
				JOptionPane.showMessageDialog(this, "CRS no soportado.", "Warning...",
318 310
						JOptionPane.WARNING_MESSAGE);
......
412 404
				public boolean isCellEditable(int row, int column) {
413 405
					return false;
414 406
				}
407
				/*
408
				 * metodo necesario para cuando utilizamos tablas ordenadas
409
				 * ya que sino al ordenar por algun campo no se queda con el orden
410
				 * actual al seleccionar una fila (non-Javadoc)
411
				 * @see javax.swing.table.TableModel#getColumnClass(int)
412
				 */
413
				public Class getColumnClass(int column)
414
				{
415
					return getValueAt(0, column).getClass();
416
				}
415 417
				};
416 418
			TableSorter sorter = new TableSorter(dtm);			
417 419

  
trunk/libraries/libJCRS/src/org/gvsig/crs/Query.java
4 4
import java.io.Serializable;
5 5
import java.sql.Connection;
6 6
import java.sql.ResultSet;
7
import java.sql.ResultSetMetaData;
7 8
import java.sql.SQLException;
8 9
import java.sql.Statement;
9 10

  
10 11
public class Query implements Serializable{
11 12
	
13
	/**
14
	 * 
15
	 */
16
	private static final long serialVersionUID = 1L;
17

  
12 18
	public static synchronized ResultSet select(String sentence, Connection conn){
13 19
		Statement st = null;
14 20
		ResultSet rs = null;
15
		
16
		
21
				
17 22
		try {
18 23
			st = conn.createStatement();
19 24
			rs = st.executeQuery(sentence);
25
			st.close();
20 26
		} catch (SQLException e) {
21 27
			e.printStackTrace();
22
		}
23
		 
28
		}		
24 29
		return rs;
25
	}
26
	
27
	/*public static synchronized ResultSet query(String expression, Connection conn) throws SQLException {
28

  
29
        Statement st = null;
30
        ResultSet rs = null;
31

  
32
        st = conn.createStatement();         // statement objects can be reused with
33

  
34
        // repeated calls to execute but we
35
        // choose to make a new one each time
36
        rs = st.executeQuery(expression);    // run the query
37
        
38
        return rs;
39
	}*/
40

  
30
	}	
41 31
}
42 32

  
trunk/libraries/libJCRS/src/org/gvsig/crs/EpsgConnection.java
3 3
import java.sql.Connection;
4 4
import java.sql.DriverManager;
5 5
import java.sql.SQLException;
6
import java.sql.Statement;
6 7

  
7 8
public class EpsgConnection {
8 9
	
......
10 11

  
11 12
	public EpsgConnection() {	
12 13
		try {
13
			Class.forName("org.hsqldb.jdbcDriver");
14
			Class.forName("org.hsqldb.jdbcDriver");			
14 15
		} catch (ClassNotFoundException e) {
15 16
			e.printStackTrace();
16 17
		}
......
26 27
	
27 28
	public void setConnectionIAU2000() {
28 29
		try {			
29
			connect =  DriverManager.getConnection("jdbc:hsqldb:db_iau2000", "sa", "");
30
			connect =  DriverManager.getConnection("jdbc:hsqldb:db_iau2000", "sa", "");			
30 31
		} catch (SQLException e1) {
31 32
			e1.printStackTrace();
32 33
		}
......
35 36
	public Connection getConnection(){
36 37
		return connect;
37 38
	}
39
	
40
	public void shutdown() throws SQLException {
38 41

  
42
        Statement st = connect.createStatement();
43

  
44
        // db writes out to files and performs clean shuts down
45
        // otherwise there will be an unclean shutdown
46
        // when program ends
47
        st.execute("SHUTDOWN");
48
        connect.close();    // if there are no other open connection
49
    }
39 50
}

Also available in: Unified diff