root / branches / F2 / extensions / extJCRS / src / org / gvsig / crs / gui / CRSSelectionDialog.java @ 10786
History | View | Annotate | Download (5.24 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2006 Instituto de Desarrollo Regional and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* Instituto de Desarrollo Regional (Universidad de Castilla La-Mancha)
|
34 |
* Campus Universitario s/n
|
35 |
* 02071 Alabacete
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 967 599 200
|
39 |
*/
|
40 |
|
41 |
package org.gvsig.crs.gui; |
42 |
|
43 |
import javax.swing.JPanel; |
44 |
import javax.swing.ListSelectionModel; |
45 |
import org.cresques.cts.IProjection; |
46 |
import org.gvsig.crs.ICrs; |
47 |
import org.gvsig.crs.gui.listeners.CRSSelectionDialogListener; |
48 |
import org.gvsig.crs.persistence.CrsData; |
49 |
import org.gvsig.crs.persistence.RecentCRSsPersistence; |
50 |
|
51 |
import com.iver.andami.PluginServices; |
52 |
import com.iver.andami.ui.mdiManager.IWindow; |
53 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
54 |
|
55 |
/**
|
56 |
* Di?logo contenedor del panel para la selecci?n de CRS.
|
57 |
* (para el CRS de la vista)
|
58 |
*
|
59 |
* @author Jos? Luis G?mez Mart?nez (jolugomar@gmail.com)
|
60 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es)
|
61 |
*/
|
62 |
public class CRSSelectionDialog extends JPanel implements IWindow { |
63 |
|
64 |
private static final long serialVersionUID = 1L; |
65 |
|
66 |
JPanel contentPane = null; |
67 |
private CRSMainPanel crsMainPanel = null; |
68 |
private IProjection lastProj = null; |
69 |
int code = 0; |
70 |
String dataSource = ""; |
71 |
|
72 |
private boolean okPressed = false; |
73 |
|
74 |
public CRSSelectionDialog(){
|
75 |
super();
|
76 |
initialize(); |
77 |
} |
78 |
|
79 |
public void initialize(){ |
80 |
crsMainPanel = new CRSMainPanel();
|
81 |
this.add(getContentPanel(), null); |
82 |
setListeners(); |
83 |
|
84 |
} |
85 |
|
86 |
public void initRecents(ICrs proj) { |
87 |
CrsData crsData = new CrsData(proj.getCrsWkt().getAuthority()[0], proj.getCode(),proj.getCrsWkt().getName()); |
88 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence(RecentCRSsPersistence.pluginClassInstance);
|
89 |
persistence.addCrsData(crsData); |
90 |
|
91 |
crsMainPanel.getRecentsPanel().loadRecents(); |
92 |
} |
93 |
|
94 |
public boolean isOkPressed() { return okPressed; } |
95 |
|
96 |
public CRSMainPanel getProjPanel() {
|
97 |
return (CRSMainPanel) getContentPanel();
|
98 |
} |
99 |
|
100 |
public JPanel getContentPanel() { |
101 |
if (contentPane == null) { |
102 |
contentPane = crsMainPanel; |
103 |
|
104 |
} |
105 |
return contentPane;
|
106 |
} |
107 |
|
108 |
public void setListeners(){ |
109 |
|
110 |
CRSSelectionDialogListener listener = new CRSSelectionDialogListener(this); |
111 |
|
112 |
ListSelectionModel rowSM = crsMainPanel.getEpsgPanel().getJTable().getSelectionModel();
|
113 |
rowSM.addListSelectionListener(listener); |
114 |
|
115 |
ListSelectionModel rowSMiau = crsMainPanel.getIauPanel().getJTable().getSelectionModel();
|
116 |
rowSMiau.addListSelectionListener(listener); |
117 |
|
118 |
ListSelectionModel rowSMrecents = crsMainPanel.getRecentsPanel().getJTable().getSelectionModel();
|
119 |
rowSMrecents.addListSelectionListener(listener); |
120 |
|
121 |
ListSelectionModel rowSMesri = crsMainPanel.getEsriPanel().getJTable().getSelectionModel();
|
122 |
rowSMesri.addListSelectionListener(listener); |
123 |
|
124 |
crsMainPanel.getJComboOptions().addItemListener(listener); |
125 |
crsMainPanel.getJButtonAccept().addActionListener(listener); |
126 |
crsMainPanel.getJButtonCancel().addActionListener(listener); |
127 |
crsMainPanel.getEsriPanel().getJTable().addMouseListener(listener); |
128 |
crsMainPanel.getEpsgPanel().getJTable().addMouseListener(listener); |
129 |
crsMainPanel.getRecentsPanel().getJTable().addMouseListener(listener); |
130 |
crsMainPanel.getIauPanel().getJTable().addMouseListener(listener); |
131 |
} |
132 |
|
133 |
public void setCode(int cod){ |
134 |
code = cod; |
135 |
} |
136 |
|
137 |
public int getCode(){ |
138 |
return code;
|
139 |
} |
140 |
|
141 |
public IProjection getProjection() {
|
142 |
return (IProjection) getProjPanel().getProjection();
|
143 |
} |
144 |
/**
|
145 |
* @param proj
|
146 |
*/
|
147 |
public void setProjection(IProjection proj) { |
148 |
lastProj = proj; |
149 |
getProjPanel().setProjection(proj); |
150 |
} |
151 |
|
152 |
public String getProjectionAbrev(){ |
153 |
return (String) getProjPanel().getProjection().getAbrev(); |
154 |
} |
155 |
|
156 |
|
157 |
|
158 |
public void setDataSource(String sour){ |
159 |
dataSource = sour; |
160 |
} |
161 |
|
162 |
public String getDataSource(){ |
163 |
return dataSource;
|
164 |
} |
165 |
|
166 |
public WindowInfo getWindowInfo() {
|
167 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
168 |
m_viewinfo.setTitle(PluginServices.getText(this, "nuevo_crs")); |
169 |
return m_viewinfo;
|
170 |
} |
171 |
|
172 |
public IProjection getLastProj() {
|
173 |
return lastProj;
|
174 |
} |
175 |
|
176 |
public void setLastProj(IProjection lastProj) { |
177 |
this.lastProj = lastProj;
|
178 |
} |
179 |
|
180 |
public void setOkPressed(boolean okPressed) { |
181 |
this.okPressed = okPressed;
|
182 |
} |
183 |
|
184 |
public CRSMainPanel getCrsMainPanel() {
|
185 |
return crsMainPanel;
|
186 |
} |
187 |
} |