svn-gvsig-desktop / trunk / libraries / libJCRS / src / org / gvsig / crs / ui / CRSSelectionDialogPanel.java @ 7020
History | View | Annotate | Download (1.73 KB)
1 |
package org.gvsig.crs.ui; |
---|---|
2 |
|
3 |
import java.awt.Dimension; |
4 |
import java.awt.FlowLayout; |
5 |
import java.awt.GridLayout; |
6 |
|
7 |
import javax.swing.JPanel; |
8 |
import javax.swing.ListSelectionModel; |
9 |
import javax.swing.event.ListSelectionEvent; |
10 |
import javax.swing.event.ListSelectionListener; |
11 |
|
12 |
import org.cresques.ui.DefaultDialogPanel; |
13 |
|
14 |
public class CRSSelectionDialogPanel extends DefaultDialogPanel implements ListSelectionListener{ |
15 |
|
16 |
private static final long serialVersionUID = 1L; |
17 |
private CRSSelectionPanel CRSPanel;
|
18 |
|
19 |
public CRSSelectionDialogPanel(){
|
20 |
super();
|
21 |
inicializate(); |
22 |
} |
23 |
|
24 |
public void inicializate(){ |
25 |
CRSPanel = (CRSSelectionPanel)getContentPanel(); |
26 |
ListSelectionModel rowSM = CRSPanel.getJTable().getSelectionModel();
|
27 |
rowSM.addListSelectionListener(this);
|
28 |
} |
29 |
|
30 |
public CRSSelectionPanel getProjPanel() {
|
31 |
return (CRSSelectionPanel) getContentPanel();
|
32 |
} |
33 |
|
34 |
public JPanel getContentPanel() { |
35 |
if (contentPane == null) { |
36 |
contentPane = new CRSSelectionPanel();
|
37 |
contentPane.setLayout(new GridLayout(3,3)); |
38 |
contentPane.setLayout(new FlowLayout(FlowLayout.LEFT,10,10)); |
39 |
contentPane.setPreferredSize(new Dimension(650,550)); |
40 |
|
41 |
} |
42 |
return contentPane;
|
43 |
} |
44 |
|
45 |
public void valueChanged(ListSelectionEvent e) { |
46 |
ListSelectionModel lsm = (ListSelectionModel)e.getSource(); |
47 |
if (lsm.isSelectionEmpty()) {
|
48 |
CRSPanel.selectedRowTable = -1;
|
49 |
CRSPanel.setCodeCRS(-1);
|
50 |
} |
51 |
else {
|
52 |
CRSPanel.selectedRowTable = lsm.getMinSelectionIndex(); |
53 |
CRSPanel.setCodeCRS(Integer.parseInt((String)CRSPanel.dtm.getValueAt(CRSPanel.selectedRowTable,0))); |
54 |
CRSPanel.setWKT(); |
55 |
} |
56 |
CRSPanel.getInfoCrs().setEnabled(true);
|
57 |
|
58 |
} |
59 |
} |