svn-gvsig-desktop / trunk / extensions / extJCRS / src / org / gvsig / crs / gui / CRSSelectionDialog.java @ 28832
History | View | Annotate | Download (5.61 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 |
|
46 |
import org.cresques.cts.IProjection; |
47 |
import org.gvsig.crs.ICrs; |
48 |
import org.gvsig.crs.gui.listeners.CRSSelectionDialogListener; |
49 |
import org.gvsig.crs.persistence.CrsData; |
50 |
import org.gvsig.crs.persistence.RecentCRSsPersistence; |
51 |
|
52 |
import com.iver.andami.PluginServices; |
53 |
import com.iver.andami.ui.mdiManager.IWindow; |
54 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
55 |
import com.iver.cit.gvsig.gui.panels.crs.ISelectCrsPanel; |
56 |
|
57 |
/**
|
58 |
* Dilogo contenedor del panel para la seleccin de CRS.
|
59 |
* (para el CRS de la vista)
|
60 |
*
|
61 |
* @author Jos Luis Gmez Martnez (jolugomar@gmail.com)
|
62 |
* @author Diego Guerrero Sevilla (diego.guerrero@uclm.es)
|
63 |
*/
|
64 |
public class CRSSelectionDialog extends JPanel |
65 |
implements IWindow, ISelectCrsPanel{
|
66 |
|
67 |
private static final long serialVersionUID = 1L; |
68 |
|
69 |
JPanel contentPane = null; |
70 |
private CRSMainPanel crsMainPanel = null; |
71 |
private IProjection lastProj = null; |
72 |
int code = 0; |
73 |
String dataSource = ""; |
74 |
|
75 |
private boolean okPressed = false; |
76 |
|
77 |
public CRSSelectionDialog(ICrs curProj){
|
78 |
super();
|
79 |
lastProj = curProj; |
80 |
initialize(); |
81 |
} |
82 |
|
83 |
public void initialize(){ |
84 |
crsMainPanel = new CRSMainPanel((ICrs)lastProj);
|
85 |
this.add(getContentPanel(), null); |
86 |
setListeners(); |
87 |
|
88 |
} |
89 |
|
90 |
public void initRecents(ICrs proj) { |
91 |
CrsData crsData = new CrsData(proj.getCrsWkt().getAuthority()[0], proj.getCode(),proj.getCrsWkt().getName()); |
92 |
RecentCRSsPersistence persistence = new RecentCRSsPersistence();
|
93 |
persistence.addCrsData(crsData); |
94 |
|
95 |
crsMainPanel.getRecentsPanel().loadRecents(); |
96 |
} |
97 |
|
98 |
public boolean isOkPressed() { return okPressed; } |
99 |
|
100 |
public CRSMainPanel getProjPanel() {
|
101 |
return (CRSMainPanel) getContentPanel();
|
102 |
} |
103 |
|
104 |
public JPanel getContentPanel() { |
105 |
if (contentPane == null) { |
106 |
contentPane = crsMainPanel; |
107 |
|
108 |
} |
109 |
return contentPane;
|
110 |
} |
111 |
|
112 |
public void setListeners(){ |
113 |
|
114 |
CRSSelectionDialogListener listener = new CRSSelectionDialogListener(this); |
115 |
|
116 |
ListSelectionModel rowSM = crsMainPanel.getEpsgPanel().getJTable().getSelectionModel();
|
117 |
rowSM.addListSelectionListener(listener); |
118 |
|
119 |
ListSelectionModel rowSMiau = crsMainPanel.getIauPanel().getJTable().getSelectionModel();
|
120 |
rowSMiau.addListSelectionListener(listener); |
121 |
|
122 |
ListSelectionModel rowSMrecents = crsMainPanel.getRecentsPanel().getJTable().getSelectionModel();
|
123 |
rowSMrecents.addListSelectionListener(listener); |
124 |
|
125 |
ListSelectionModel rowSMesri = crsMainPanel.getEsriPanel().getJTable().getSelectionModel();
|
126 |
rowSMesri.addListSelectionListener(listener); |
127 |
|
128 |
ListSelectionModel rowSMusr = crsMainPanel.getNewCrsPanel().getJTable().getSelectionModel();
|
129 |
rowSMusr.addListSelectionListener(listener); |
130 |
|
131 |
crsMainPanel.getJComboOptions().addItemListener(listener); |
132 |
crsMainPanel.getJButtonAccept().addActionListener(listener); |
133 |
crsMainPanel.getJButtonCancel().addActionListener(listener); |
134 |
crsMainPanel.getEsriPanel().getJTable().addMouseListener(listener); |
135 |
crsMainPanel.getEpsgPanel().getJTable().addMouseListener(listener); |
136 |
crsMainPanel.getRecentsPanel().getJTable().addMouseListener(listener); |
137 |
crsMainPanel.getIauPanel().getJTable().addMouseListener(listener); |
138 |
crsMainPanel.getNewCrsPanel().getJTable().addMouseListener(listener); |
139 |
} |
140 |
|
141 |
public void setCode(int cod){ |
142 |
code = cod; |
143 |
} |
144 |
|
145 |
public int getCode(){ |
146 |
return code;
|
147 |
} |
148 |
|
149 |
public IProjection getProjection() {
|
150 |
return (IProjection) getProjPanel().getProjection();
|
151 |
} |
152 |
/**
|
153 |
* @param proj
|
154 |
*/
|
155 |
public void setProjection(IProjection proj) { |
156 |
lastProj = proj; |
157 |
getProjPanel().setProjection(proj); |
158 |
} |
159 |
|
160 |
public String getProjectionAbrev(){ |
161 |
return (String) getProjPanel().getProjection().getAbrev(); |
162 |
} |
163 |
|
164 |
|
165 |
|
166 |
public void setDataSource(String sour){ |
167 |
dataSource = sour; |
168 |
} |
169 |
|
170 |
public String getDataSource(){ |
171 |
return dataSource;
|
172 |
} |
173 |
|
174 |
public WindowInfo getWindowInfo() {
|
175 |
WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
176 |
m_viewinfo.setTitle(PluginServices.getText(this, "nuevo_crs")); |
177 |
return m_viewinfo;
|
178 |
} |
179 |
|
180 |
public IProjection getLastProj() {
|
181 |
return lastProj;
|
182 |
} |
183 |
|
184 |
public void setLastProj(IProjection lastProj) { |
185 |
this.lastProj = lastProj;
|
186 |
} |
187 |
|
188 |
public void setOkPressed(boolean okPressed) { |
189 |
this.okPressed = okPressed;
|
190 |
} |
191 |
|
192 |
public CRSMainPanel getCrsMainPanel() {
|
193 |
return crsMainPanel;
|
194 |
} |
195 |
|
196 |
public Object getWindowProfile() { |
197 |
return WindowInfo.DIALOG_PROFILE;
|
198 |
} |
199 |
} |