root / trunk / libraries / libJCRS / src / org / gvsig / crs / gui / panels / InfoCRSPanel.java @ 8627
History | View | Annotate | Download (10.5 KB)
1 | 8594 | dguerrero | package org.gvsig.crs.gui.panels; |
---|---|---|---|
2 | |||
3 | import java.awt.Dimension; |
||
4 | import java.awt.FlowLayout; |
||
5 | import java.awt.Font; |
||
6 | import java.awt.GridLayout; |
||
7 | import java.awt.event.ActionEvent; |
||
8 | import java.awt.event.ActionListener; |
||
9 | |||
10 | import javax.swing.JButton; |
||
11 | import javax.swing.JLabel; |
||
12 | import javax.swing.JPanel; |
||
13 | import javax.swing.JScrollPane; |
||
14 | import javax.swing.JTable; |
||
15 | import javax.swing.ListSelectionModel; |
||
16 | import javax.swing.table.DefaultTableModel; |
||
17 | |||
18 | import org.cresques.ui.DefaultDialogPanel; |
||
19 | import org.gvsig.crs.ICrs; |
||
20 | |||
21 | import com.iver.andami.PluginServices; |
||
22 | import com.iver.andami.ui.mdiManager.IWindow; |
||
23 | import com.iver.andami.ui.mdiManager.WindowInfo; |
||
24 | |||
25 | public class InfoCRSPanel extends DefaultDialogPanel implements IWindow, ActionListener{ |
||
26 | |||
27 | private static final long serialVersionUID = 1L; |
||
28 | |||
29 | private JPanel panelLabels; |
||
30 | |||
31 | private JTable jTable; |
||
32 | public DefaultTableModel dtm = null; |
||
33 | private JScrollPane jScrollPane1 = null; |
||
34 | private JPanel jPanelbuttons; |
||
35 | private JButton jButtonOk; |
||
36 | |||
37 | private ICrs proj;
|
||
38 | |||
39 | private JLabel jLabelProjcs; |
||
40 | private JLabel jLabelGeogcs; |
||
41 | private JLabel jLabelDatum; |
||
42 | private JLabel jLabelSpheroid; |
||
43 | private JLabel jLabelPrimem; |
||
44 | private JLabel jLabelProjection; |
||
45 | private JLabel jLabelUnits; |
||
46 | private JLabel jLabelUnits_p; |
||
47 | private JLabel jLabelProjcsdinamic; |
||
48 | private JLabel jLabelGeogcsdinamic; |
||
49 | private JLabel jLabelDatumdinamic; |
||
50 | private JLabel jLabelSpheroiddinamic; |
||
51 | private JLabel jLabelPrimemdinamic; |
||
52 | private JLabel jLabelProjectiondinamic; |
||
53 | private JLabel jLabelUnitsdinamic; |
||
54 | private JLabel jLabelUnits_pdinamic; |
||
55 | |||
56 | public InfoCRSPanel(ICrs p) {
|
||
57 | super(false); |
||
58 | proj = p; |
||
59 | inicializate(); |
||
60 | } |
||
61 | |||
62 | private void inicializate() { |
||
63 | this.add(getPanel(), null); |
||
64 | this.add(getJPanelButtons(),null); |
||
65 | } |
||
66 | |||
67 | private JPanel getPanel() { |
||
68 | if(panelLabels == null) { |
||
69 | panelLabels = new JPanel(); |
||
70 | panelLabels.setLayout(new GridLayout(6,4)); |
||
71 | panelLabels.setLayout(new FlowLayout(FlowLayout.LEADING,5,10)); |
||
72 | panelLabels.setPreferredSize(new Dimension(525, 300)); |
||
73 | panelLabels.add(getJLabelProjcs(),null);
|
||
74 | panelLabels.add(getJLabelProjcsDinamic(),null);
|
||
75 | panelLabels.add(getJLabelGeogcs(),null);
|
||
76 | panelLabels.add(getJLabelGeogcsDinamic(),null);
|
||
77 | panelLabels.add(getJLabelDatum(),null);
|
||
78 | panelLabels.add(getJLabelDatumDinamic(),null);
|
||
79 | panelLabels.add(getJLabelSpheroid(),null);
|
||
80 | panelLabels.add(getJLabelSpheroidDinamic(),null);
|
||
81 | panelLabels.add(getJLabelPrimen(),null);
|
||
82 | panelLabels.add(getJLabelPrimenDinamic(),null);
|
||
83 | panelLabels.add(getJLabelUnits(),null);
|
||
84 | panelLabels.add(getJLabelUnitsDinamic(),null);
|
||
85 | panelLabels.add(getJLabelProjection(),null);
|
||
86 | panelLabels.add(getJLabelProjectionDinamic(),null);
|
||
87 | panelLabels.add(getJLabelUnits_p(),null);
|
||
88 | panelLabels.add(getJLabelUnits_pDinamic(),null);
|
||
89 | panelLabels.add(getJScrollPane1(), null);
|
||
90 | } |
||
91 | return panelLabels;
|
||
92 | } |
||
93 | |||
94 | private JPanel getJPanelButtons() { |
||
95 | if(jPanelbuttons == null) { |
||
96 | jPanelbuttons = new JPanel(); |
||
97 | jPanelbuttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); |
||
98 | jPanelbuttons.setPreferredSize(new Dimension(525,50)); |
||
99 | jPanelbuttons.add(getJButtonOk(),null);
|
||
100 | } |
||
101 | return jPanelbuttons;
|
||
102 | } |
||
103 | |||
104 | private JButton getJButtonOk() { |
||
105 | if(jButtonOk == null) { |
||
106 | jButtonOk = new JButton(); |
||
107 | jButtonOk.setText(PluginServices.getText(this,"ok")); |
||
108 | jButtonOk.setPreferredSize(new Dimension(100,25)); |
||
109 | jButtonOk.setMnemonic('O');
|
||
110 | jButtonOk.setToolTipText("Accept");
|
||
111 | jButtonOk.addActionListener(this);
|
||
112 | } |
||
113 | return jButtonOk;
|
||
114 | } |
||
115 | |||
116 | private JLabel getJLabelProjcs() { |
||
117 | if(jLabelProjcs == null) { |
||
118 | jLabelProjcs = new JLabel(); |
||
119 | jLabelProjcs.setPreferredSize(new Dimension(75,20)); |
||
120 | jLabelProjcs.setFont(new Font("Projcs:",Font.BOLD,10)); |
||
121 | jLabelProjcs.setText(PluginServices.getText(this,"projcs")); |
||
122 | } |
||
123 | return jLabelProjcs;
|
||
124 | } |
||
125 | |||
126 | private JLabel getJLabelProjcsDinamic() { |
||
127 | if(jLabelProjcsdinamic == null) { |
||
128 | jLabelProjcsdinamic = new JLabel(); |
||
129 | jLabelProjcsdinamic.setPreferredSize(new Dimension(150,20)); |
||
130 | jLabelProjcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
131 | jLabelProjcsdinamic.setText(proj.getCrsWkt().getProjcs()); |
||
132 | } |
||
133 | return jLabelProjcsdinamic;
|
||
134 | } |
||
135 | |||
136 | private JLabel getJLabelGeogcs() { |
||
137 | if(jLabelGeogcs == null) { |
||
138 | jLabelGeogcs = new JLabel(); |
||
139 | jLabelGeogcs.setPreferredSize(new Dimension(75,20)); |
||
140 | jLabelGeogcs.setFont(new Font("Geogcs:",Font.BOLD,10)); |
||
141 | jLabelGeogcs.setText(PluginServices.getText(this,"geogcs")); |
||
142 | } |
||
143 | return jLabelGeogcs;
|
||
144 | } |
||
145 | |||
146 | private JLabel getJLabelGeogcsDinamic() { |
||
147 | if(jLabelGeogcsdinamic == null) { |
||
148 | jLabelGeogcsdinamic = new JLabel(); |
||
149 | jLabelGeogcsdinamic.setPreferredSize(new Dimension(150,20)); |
||
150 | jLabelGeogcsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
151 | jLabelGeogcsdinamic.setText(proj.getCrsWkt().getGeogcs()); |
||
152 | } |
||
153 | return jLabelGeogcsdinamic;
|
||
154 | } |
||
155 | |||
156 | private JLabel getJLabelDatum() { |
||
157 | if(jLabelDatum == null) { |
||
158 | jLabelDatum = new JLabel(); |
||
159 | jLabelDatum.setPreferredSize(new Dimension(75,20)); |
||
160 | jLabelDatum.setFont(new Font("Datum:",Font.BOLD,10)); |
||
161 | jLabelDatum.setText(PluginServices.getText(this,"datum")); |
||
162 | } |
||
163 | return jLabelDatum;
|
||
164 | } |
||
165 | |||
166 | private JLabel getJLabelDatumDinamic() { |
||
167 | if(jLabelDatumdinamic == null) { |
||
168 | jLabelDatumdinamic = new JLabel(); |
||
169 | jLabelDatumdinamic.setPreferredSize(new Dimension(150,20)); |
||
170 | jLabelDatumdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
171 | jLabelDatumdinamic.setText(proj.getCrsWkt().getDatumName()); |
||
172 | } |
||
173 | return jLabelDatumdinamic;
|
||
174 | } |
||
175 | |||
176 | private JLabel getJLabelSpheroid() { |
||
177 | if(jLabelSpheroid == null) { |
||
178 | jLabelSpheroid = new JLabel(); |
||
179 | jLabelSpheroid.setPreferredSize(new Dimension(75,20)); |
||
180 | jLabelSpheroid.setFont(new Font("Spheroid",Font.BOLD,10)); |
||
181 | jLabelSpheroid.setText(PluginServices.getText(this,"spheriod")); |
||
182 | } |
||
183 | return jLabelSpheroid;
|
||
184 | } |
||
185 | |||
186 | private JLabel getJLabelSpheroidDinamic() { |
||
187 | if(jLabelSpheroiddinamic == null) { |
||
188 | String[] sphe = proj.getCrsWkt().getSpheroid(); |
||
189 | jLabelSpheroiddinamic = new JLabel(); |
||
190 | jLabelSpheroiddinamic.setPreferredSize(new Dimension(200,20)); |
||
191 | jLabelSpheroiddinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
192 | jLabelSpheroiddinamic.setText(sphe[0]+" , "+sphe[1]+" , "+sphe[2]); |
||
193 | } |
||
194 | return jLabelSpheroiddinamic;
|
||
195 | } |
||
196 | |||
197 | private JLabel getJLabelPrimen() { |
||
198 | if(jLabelPrimem == null) { |
||
199 | jLabelPrimem = new JLabel(); |
||
200 | jLabelPrimem.setPreferredSize(new Dimension(75,20)); |
||
201 | jLabelPrimem.setFont(new Font("Primen:",Font.BOLD,10)); |
||
202 | jLabelPrimem.setText(PluginServices.getText(this,"primem")); |
||
203 | } |
||
204 | return jLabelPrimem;
|
||
205 | } |
||
206 | |||
207 | private JLabel getJLabelPrimenDinamic() { |
||
208 | if(jLabelPrimemdinamic == null) { |
||
209 | String pri[] = proj.getCrsWkt().getPrimen(); |
||
210 | jLabelPrimemdinamic = new JLabel(); |
||
211 | jLabelPrimemdinamic.setPreferredSize(new Dimension(150,20)); |
||
212 | jLabelPrimemdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
213 | jLabelPrimemdinamic.setText(pri[0]+" , "+pri[1]); |
||
214 | } |
||
215 | return jLabelPrimemdinamic;
|
||
216 | } |
||
217 | |||
218 | private JLabel getJLabelProjection() { |
||
219 | if(jLabelProjection == null) { |
||
220 | jLabelProjection = new JLabel(); |
||
221 | jLabelProjection.setPreferredSize(new Dimension(75,20)); |
||
222 | jLabelProjection.setFont(new Font("Projection",Font.BOLD,10)); |
||
223 | jLabelProjection.setText(PluginServices.getText(this,"projection")); |
||
224 | } |
||
225 | return jLabelProjection;
|
||
226 | } |
||
227 | |||
228 | private JLabel getJLabelProjectionDinamic() { |
||
229 | if(jLabelProjectiondinamic == null) { |
||
230 | jLabelProjectiondinamic = new JLabel(); |
||
231 | jLabelProjectiondinamic.setPreferredSize(new Dimension(150,20)); |
||
232 | jLabelProjectiondinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
233 | jLabelProjectiondinamic.setText(proj.getCrsWkt().getProjection()); |
||
234 | } |
||
235 | return jLabelProjectiondinamic;
|
||
236 | } |
||
237 | |||
238 | private JLabel getJLabelUnits() { |
||
239 | if(jLabelUnits == null) { |
||
240 | jLabelUnits = new JLabel(); |
||
241 | jLabelUnits.setPreferredSize(new Dimension(75,20)); |
||
242 | jLabelUnits.setFont(new Font("Units",Font.BOLD,10)); |
||
243 | jLabelUnits.setText(PluginServices.getText(this,"units")); |
||
244 | } |
||
245 | return jLabelUnits;
|
||
246 | } |
||
247 | |||
248 | private JLabel getJLabelUnitsDinamic() { |
||
249 | if(jLabelUnitsdinamic == null) { |
||
250 | String[] units = proj.getCrsWkt().getUnit(); |
||
251 | jLabelUnitsdinamic = new JLabel(); |
||
252 | jLabelUnitsdinamic.setPreferredSize(new Dimension(200,20)); |
||
253 | jLabelUnitsdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
254 | jLabelUnitsdinamic.setText(units[0]+" , "+units[1]); |
||
255 | } |
||
256 | return jLabelUnitsdinamic;
|
||
257 | } |
||
258 | |||
259 | private JLabel getJLabelUnits_p() { |
||
260 | if(jLabelUnits_p == null) { |
||
261 | jLabelUnits_p = new JLabel(); |
||
262 | jLabelUnits_p.setPreferredSize(new Dimension(75,20)); |
||
263 | jLabelUnits_p.setFont(new Font("",Font.BOLD,10)); |
||
264 | jLabelUnits_p.setText(PluginServices.getText(this,"units_p")); |
||
265 | } |
||
266 | return jLabelUnits_p;
|
||
267 | } |
||
268 | |||
269 | private JLabel getJLabelUnits_pDinamic() { |
||
270 | if(jLabelUnits_pdinamic == null) { |
||
271 | String[] uni_p = proj.getCrsWkt().getUnit_p(); |
||
272 | jLabelUnits_pdinamic = new JLabel(); |
||
273 | jLabelUnits_pdinamic.setPreferredSize(new Dimension(150,20)); |
||
274 | jLabelUnits_pdinamic.setFont(new Font("",Font.ROMAN_BASELINE,10)); |
||
275 | jLabelUnits_pdinamic.setText(uni_p[0]+" , "+uni_p[1]); |
||
276 | |||
277 | } |
||
278 | return jLabelUnits_pdinamic;
|
||
279 | } |
||
280 | |||
281 | private JScrollPane getJScrollPane1() { |
||
282 | if(jScrollPane1 == null) { |
||
283 | jScrollPane1 = new JScrollPane(); |
||
284 | jScrollPane1.setPreferredSize(new Dimension(400,150)); |
||
285 | /* jScrollPane1.setBorder(
|
||
286 | BorderFactory.createCompoundBorder(
|
||
287 | BorderFactory.createCompoundBorder(
|
||
288 | BorderFactory.createTitledBorder("Transformations"),
|
||
289 | BorderFactory.createEmptyBorder(5,5,5,5)),
|
||
290 | jScrollPane1.getBorder()));*/
|
||
291 | jScrollPane1.setViewportView(getJTable()); |
||
292 | } |
||
293 | return jScrollPane1;
|
||
294 | } |
||
295 | |||
296 | private JTable getJTable() { |
||
297 | if(jTable == null) { |
||
298 | String[] columnNames = {PluginServices.getText(this,"nombre") |
||
299 | ,PluginServices.getText(this,"valor")}; |
||
300 | String[] param_n = proj.getCrsWkt().getParam_name(); |
||
301 | String[] param_v = proj.getCrsWkt().getParam_value(); |
||
302 | Object[][]data; |
||
303 | if(param_v != null) { |
||
304 | data = new Object[param_v.length][2]; |
||
305 | for(int i = 0 ; i < 2 ; i++ ) |
||
306 | for(int j = 0 ; j < param_n.length ; j++) { |
||
307 | if(i == 0) |
||
308 | data[j][i] = param_n[j]; |
||
309 | else
|
||
310 | data[j][i] = param_v[j]; |
||
311 | } |
||
312 | } else
|
||
313 | data = new Object[1][1]; |
||
314 | dtm = new DefaultTableModel(data, columnNames); |
||
315 | jTable = new JTable(dtm); |
||
316 | jTable.setCellSelectionEnabled(false);
|
||
317 | jTable.setRowSelectionAllowed(true);
|
||
318 | jTable.setColumnSelectionAllowed(false);
|
||
319 | jTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||
320 | |||
321 | } |
||
322 | return jTable;
|
||
323 | } |
||
324 | |||
325 | public WindowInfo getWindowInfo() {
|
||
326 | WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
|
||
327 | m_viewinfo.setTitle(PluginServices.getText(this,proj.getCrsWkt().getName()));
|
||
328 | return m_viewinfo;
|
||
329 | } |
||
330 | |||
331 | public void actionPerformed(ActionEvent e) { |
||
332 | if (e.getSource() == getJButtonOk()){
|
||
333 | PluginServices.getMDIManager().closeWindow(this);
|
||
334 | } |
||
335 | } |
||
336 | } |