svn-gvsig-desktop / branches / F2 / extensions / extJCRS / src / org / gvsig / crs / gui / CRSSelectionDialog.java @ 11570
History | View | Annotate | Download (5.5 KB)
1 |
/* gvSIG. Sistema de Informacin Geogrfica 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 Ibez, 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 |
* Dilogo contenedor del panel para la seleccin de CRS.
|
57 |
* (para el CRS de la vista)
|
58 |
*
|
59 |
* @author Jos Luis Gmez Martnez (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(ICrs curProj){
|
75 |
super();
|
76 |
lastProj = curProj; |
77 |
initialize(); |
78 |
} |
79 |
|
80 |
public void initialize(){ |
81 |
crsMainPanel = new CRSMainPanel((ICrs)lastProj);
|
82 |
this.add(getContentPanel(), null); |
83 |
setListeners(); |
84 |
|
85 |
} |
86 |
|
87 |
public void initRecents(ICrs proj) { |
88 |
CrsData crsData = new CrsData(proj.getCrsWkt().getAuthority()[0], proj.getCode(),proj.getCrsWkt().getName()); |
89 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence(RecentCRSsPersistence.pluginClassInstance);
|
90 |
persistence.addCrsData(crsData); |
91 |
|
92 |
crsMainPanel.getRecentsPanel().loadRecents(); |
93 |
} |
94 |
|
95 |
public boolean isOkPressed() { return okPressed; } |
96 |
|
97 |
public CRSMainPanel getProjPanel() {
|
98 |
return (CRSMainPanel) getContentPanel();
|
99 |
} |
100 |
|
101 |
public JPanel getContentPanel() { |
102 |
if (contentPane == null) { |
103 |
contentPane = crsMainPanel; |
104 |
|
105 |
} |
106 |
return contentPane;
|
107 |
} |
108 |
|
109 |
public void setListeners(){ |
110 |
|
111 |
CRSSelectionDialogListener listener = new CRSSelectionDialogListener(this); |
112 |
|
113 |
ListSelectionModel rowSM = crsMainPanel.getEpsgPanel().getJTable().getSelectionModel();
|
114 |
rowSM.addListSelectionListener(listener); |
115 |
|
116 |
ListSelectionModel rowSMiau = crsMainPanel.getIauPanel().getJTable().getSelectionModel();
|
117 |
rowSMiau.addListSelectionListener(listener); |
118 |
|
119 |
ListSelectionModel rowSMrecents = crsMainPanel.getRecentsPanel().getJTable().getSelectionModel();
|
120 |
rowSMrecents.addListSelectionListener(listener); |
121 |
|
122 |
ListSelectionModel rowSMesri = crsMainPanel.getEsriPanel().getJTable().getSelectionModel();
|
123 |
rowSMesri.addListSelectionListener(listener); |
124 |
|
125 |
ListSelectionModel rowSMusr = crsMainPanel.getNewCrsPanel().getJTable().getSelectionModel();
|
126 |
rowSMusr.addListSelectionListener(listener); |
127 |
|
128 |
crsMainPanel.getJComboOptions().addItemListener(listener); |
129 |
crsMainPanel.getJButtonAccept().addActionListener(listener); |
130 |
crsMainPanel.getJButtonCancel().addActionListener(listener); |
131 |
crsMainPanel.getEsriPanel().getJTable().addMouseListener(listener); |
132 |
crsMainPanel.getEpsgPanel().getJTable().addMouseListener(listener); |
133 |
crsMainPanel.getRecentsPanel().getJTable().addMouseListener(listener); |
134 |
crsMainPanel.getIauPanel().getJTable().addMouseListener(listener); |
135 |
crsMainPanel.getNewCrsPanel().getJTable().addMouseListener(listener); |
136 |
} |
137 |
|
138 |
public void setCode(int cod){ |
139 |
code = cod; |
140 |
} |
141 |
|
142 |
public int getCode(){ |
143 |
return code;
|
144 |
} |
145 |
|
146 |
public IProjection getProjection() {
|
147 |
return (IProjection) getProjPanel().getProjection();
|
148 |
} |
149 |
/**
|
150 |
* @param proj
|
151 |
*/
|
152 |
public void setProjection(IProjection proj) { |
153 |
lastProj = proj; |
154 |
getProjPanel().setProjection(proj); |
155 |
} |
156 |
|
157 |
public String getProjectionAbrev(){ |
158 |
return (String) getProjPanel().getProjection().getAbrev(); |
159 |
} |
160 |
|
161 |
|
162 |
|
163 |
public void setDataSource(String sour){ |
164 |
dataSource = sour; |
165 |
} |
166 |
|
167 |
public String getDataSource(){ |
168 |
return dataSource;
|
169 |
} |
170 |
|
171 |
public WindowInfo getWindowInfo() {
|
172 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
173 |
m_viewinfo.setTitle(PluginServices.getText(this, "nuevo_crs")); |
174 |
return m_viewinfo;
|
175 |
} |
176 |
|
177 |
public IProjection getLastProj() {
|
178 |
return lastProj;
|
179 |
} |
180 |
|
181 |
public void setLastProj(IProjection lastProj) { |
182 |
this.lastProj = lastProj;
|
183 |
} |
184 |
|
185 |
public void setOkPressed(boolean okPressed) { |
186 |
this.okPressed = okPressed;
|
187 |
} |
188 |
|
189 |
public CRSMainPanel getCrsMainPanel() {
|
190 |
return crsMainPanel;
|
191 |
} |
192 |
} |