svn-gvsig-desktop / trunk / extensions / extWMS / src / com / iver / cit / gvsig / gui / panels / WebMapContextSettingsPanel.java @ 6880
History | View | Annotate | Download (38.5 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2005 IVER T.I. 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 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
|
42 |
/* CVS MESSAGES:
|
43 |
*
|
44 |
* $Id: WebMapContextSettingsPanel.java 6880 2006-08-29 07:56:34Z cesar $
|
45 |
* $Log$
|
46 |
* Revision 1.14 2006-08-29 07:56:15 cesar
|
47 |
* Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
|
48 |
*
|
49 |
* Revision 1.13 2006/08/29 07:21:03 cesar
|
50 |
* Rename com.iver.cit.gvsig.fmap.Fmap class to com.iver.cit.gvsig.fmap.MapContext
|
51 |
*
|
52 |
* Revision 1.12 2006/08/23 09:42:32 jaume
|
53 |
* *** empty log message ***
|
54 |
*
|
55 |
* Revision 1.11 2006/08/23 09:40:03 jaume
|
56 |
* *** empty log message ***
|
57 |
*
|
58 |
* Revision 1.10 2006/07/21 11:51:13 jaume
|
59 |
* improved appearance in wms panel and a wmc bug fixed
|
60 |
*
|
61 |
* Revision 1.9 2006/06/30 08:02:57 jaume
|
62 |
* added a normative-sized button
|
63 |
*
|
64 |
* Revision 1.8 2006/05/25 10:28:12 jaume
|
65 |
* *** empty log message ***
|
66 |
*
|
67 |
* Revision 1.7 2006/05/25 07:42:55 jaume
|
68 |
* *** empty log message ***
|
69 |
*
|
70 |
* Revision 1.6 2006/05/12 07:47:39 jaume
|
71 |
* removed unnecessary imports
|
72 |
*
|
73 |
* Revision 1.5 2006/05/03 07:51:21 jaume
|
74 |
* *** empty log message ***
|
75 |
*
|
76 |
* Revision 1.4 2006/04/25 11:40:55 jaume
|
77 |
* *** empty log message ***
|
78 |
*
|
79 |
* Revision 1.3 2006/04/21 10:27:32 jaume
|
80 |
* exporting now supported
|
81 |
*
|
82 |
* Revision 1.2 2006/04/20 17:11:54 jaume
|
83 |
* Attempting to export
|
84 |
*
|
85 |
* Revision 1.1 2006/04/19 07:57:29 jaume
|
86 |
* *** empty log message ***
|
87 |
*
|
88 |
* Revision 1.1 2006/04/07 12:10:37 jaume
|
89 |
* *** empty log message ***
|
90 |
*
|
91 |
*
|
92 |
*/
|
93 |
package com.iver.cit.gvsig.gui.panels; |
94 |
|
95 |
import java.awt.Component; |
96 |
import java.awt.Dimension; |
97 |
import java.io.File; |
98 |
import java.util.ArrayList; |
99 |
import java.util.prefs.Preferences; |
100 |
|
101 |
import javax.swing.ButtonGroup; |
102 |
import org.gvsig.gui.beans.swing.JButton; |
103 |
import javax.swing.JComboBox; |
104 |
import javax.swing.JFileChooser; |
105 |
import javax.swing.JLabel; |
106 |
import javax.swing.JOptionPane; |
107 |
import javax.swing.JPanel; |
108 |
import javax.swing.JRadioButton; |
109 |
import javax.swing.JScrollPane; |
110 |
import javax.swing.JTextArea; |
111 |
import javax.swing.JTextField; |
112 |
import javax.swing.SwingConstants; |
113 |
import javax.swing.filechooser.FileFilter; |
114 |
|
115 |
import com.iver.andami.PluginServices; |
116 |
import com.iver.andami.messages.NotificationManager; |
117 |
import com.iver.andami.ui.mdiManager.SingletonWindow; |
118 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
119 |
import com.iver.cit.gvsig.fmap.DriverException; |
120 |
import com.iver.cit.gvsig.fmap.MapContext; |
121 |
import com.iver.cit.gvsig.project.ProjectView; |
122 |
import com.iver.cit.gvsig.wmc.ExportWebMapContextExtension; |
123 |
import com.iver.cit.gvsig.wmc.WebMapContext; |
124 |
import com.iver.cit.gvsig.wmc.WebMapContextTags; |
125 |
import java.awt.FlowLayout; |
126 |
/**
|
127 |
* A graphical form to fill up the customizable information of a destinantion
|
128 |
* Web Map Context file.
|
129 |
*
|
130 |
* @author jaume dominguez faus - jaume.dominguez@iver.es
|
131 |
*
|
132 |
*/
|
133 |
public class WebMapContextSettingsPanel extends JPanel implements SingletonWindow { |
134 |
public static Preferences fPrefs = Preferences.userRoot().node( "gvsig.mapcontext-settingspanel" ); |
135 |
private JPanel simplePanel = null; |
136 |
private JPanel advancedPanel = null; |
137 |
private JPanel buttonsPanel = null; |
138 |
private JComboBox cmbVersion = null; |
139 |
private JLabel lblTitle = null; |
140 |
private JButton btnBrowseFileSystem = null; |
141 |
private JTextField txtTitle = null; |
142 |
private JLabel lblVersion = null; |
143 |
private JLabel lblId = null; |
144 |
private JTextField txtId = null; |
145 |
private JLabel lblFile = null; |
146 |
private JTextField txtFile = null; |
147 |
private JButton btnAdvanced = null; |
148 |
private JButton btnOk = null; |
149 |
private JButton btnCancel = null; |
150 |
private JLabel lblAbstract = null; |
151 |
private JLabel lblLogoURL = null; |
152 |
private JLabel lblDescriptionURL = null; |
153 |
private JTextArea txtAbstract = null; |
154 |
private JScrollPane scrlAbstract = null; |
155 |
private JTextField txtLogoURL = null; |
156 |
private JTextField txtDescriptionURL = null; |
157 |
private JPanel pnlMapSize = null; |
158 |
private JRadioButton rdBtnUseViewSize = null; |
159 |
private JRadioButton rdBtnCustomSize = null; |
160 |
private JLabel lblWidth = null; |
161 |
private JLabel lblHeight = null; |
162 |
private JTextField txtWidth = null; |
163 |
private JTextField txtHeight = null; |
164 |
private JPanel pnlContactInfo = null; |
165 |
private JTextField txtKeyWords = null; |
166 |
private JLabel lblKeyWords = null; |
167 |
private JLabel lblContactPerson = null; |
168 |
private JTextField txtContactPerson = null; |
169 |
private JLabel lblContactOrganization = null; |
170 |
private JTextField txtOrganization = null; |
171 |
private JLabel lblContactPosition = null; |
172 |
private JTextField txtContactPosition = null; |
173 |
private JLabel lblAddress = null; |
174 |
private JTextField txtAddress = null; |
175 |
private JLabel lblCity = null; |
176 |
private JTextField txtCity = null; |
177 |
private JLabel lblStateProvince = null; |
178 |
private JTextField txtStateOrProvince = null; |
179 |
private JLabel lblPostCode = null; |
180 |
private JTextField txtPostCode = null; |
181 |
private JLabel lblCountry = null; |
182 |
private JComboBox cmbCountries = null; |
183 |
private JLabel lblPhone = null; |
184 |
private JTextField txtTelephone = null; |
185 |
private JLabel lblFax = null; |
186 |
private JTextField txtFax = null; |
187 |
private JLabel lblEMail = null; |
188 |
private JTextField txtEMail = null; |
189 |
private boolean first = true; |
190 |
private boolean advanced = fPrefs.getBoolean("advanced-panel", false); |
191 |
private WindowInfo m_viewInfo;
|
192 |
private String strAdvanced = PluginServices.getText(this, "advanced"); |
193 |
private File targetFile; |
194 |
private WebMapContext wmc;
|
195 |
private ProjectView[] exportableViews; |
196 |
private JLabel lblView = null; |
197 |
private JComboBox cmbViews = null; |
198 |
private String lastWidth, lastHeight; |
199 |
private int defaultWidth = 500; |
200 |
private int defaultHeight = 450; |
201 |
private JLabel lblExtent = null; |
202 |
private JRadioButton rdBtnCurrentViewExtent = null; |
203 |
private JRadioButton rdBtnFullExtent = null; |
204 |
protected boolean useFullExtent = fPrefs.getBoolean("use_full_extent", false); |
205 |
|
206 |
public WebMapContextSettingsPanel(ProjectView[] views) { |
207 |
super();
|
208 |
exportableViews = views; |
209 |
initialize(); |
210 |
} |
211 |
|
212 |
/**
|
213 |
* This method initializes this
|
214 |
*
|
215 |
* @return void
|
216 |
*/
|
217 |
private void initialize() { |
218 |
this.setLayout(null); |
219 |
|
220 |
switchPanels(); |
221 |
} |
222 |
|
223 |
private void switchPanels() { |
224 |
this.removeAll();
|
225 |
Dimension sz;
|
226 |
this.add(getSimplePanel(), java.awt.BorderLayout.NORTH);
|
227 |
if (advanced) {
|
228 |
this.add(getAdvancedPanel(), java.awt.BorderLayout.CENTER);
|
229 |
sz = new Dimension(535, 640); |
230 |
btnAdvanced.setText(strAdvanced+" <<");
|
231 |
|
232 |
} else {
|
233 |
sz = new Dimension(535, 260); |
234 |
btnAdvanced.setText(strAdvanced+" >>");
|
235 |
|
236 |
} |
237 |
|
238 |
this.setSize(sz);
|
239 |
|
240 |
|
241 |
this.add(getButtonsPanel(), java.awt.BorderLayout.SOUTH);
|
242 |
fPrefs.putBoolean("advanced-panel", advanced);
|
243 |
if (!first) {
|
244 |
PluginServices.getMDIManager().changeWindowInfo(this, getWindowInfo());
|
245 |
|
246 |
PluginServices.getMDIManager().closeWindow(this);
|
247 |
PluginServices.getMDIManager().addWindow(this);
|
248 |
} |
249 |
first = false;
|
250 |
} |
251 |
|
252 |
public WindowInfo getWindowInfo() {
|
253 |
|
254 |
m_viewInfo = new WindowInfo(WindowInfo.ICONIFIABLE);
|
255 |
m_viewInfo.setTitle(PluginServices.getText(this, "web_map_context_settings")); |
256 |
m_viewInfo.setWidth(this.getWidth()+8); |
257 |
m_viewInfo.setHeight(getHeight()); |
258 |
return m_viewInfo;
|
259 |
} |
260 |
|
261 |
/**
|
262 |
* This method initializes simplePanel
|
263 |
*
|
264 |
* @return javax.swing.JPanel
|
265 |
*/
|
266 |
private JPanel getSimplePanel() { |
267 |
if (simplePanel == null) { |
268 |
ButtonGroup group = new ButtonGroup(); |
269 |
lblExtent = new JLabel(); |
270 |
lblExtent.setBounds(9, 146, 79, 20); |
271 |
lblExtent.setHorizontalTextPosition(SwingConstants.RIGHT);
|
272 |
lblExtent.setHorizontalAlignment(SwingConstants.RIGHT);
|
273 |
lblExtent.setText(PluginServices.getText(this, "map_extent")+":"); |
274 |
lblView = new JLabel(); |
275 |
lblView.setBounds(9, 24, 79, 20); |
276 |
lblView.setHorizontalTextPosition(SwingConstants.RIGHT);
|
277 |
lblView.setHorizontalAlignment(SwingConstants.RIGHT);
|
278 |
lblView.setText(PluginServices.getText(this, "view")+":"); |
279 |
lblTitle = new JLabel(); |
280 |
lblTitle.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
281 |
lblTitle.setBounds(9, 48, 79, 20); |
282 |
lblTitle.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
283 |
lblTitle.setText(PluginServices.getText(this, "title")+":"); |
284 |
lblId = new JLabel(); |
285 |
lblId.setBounds(9, 72, 79, 20); |
286 |
lblId.setHorizontalTextPosition(SwingConstants.RIGHT);
|
287 |
lblId.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
288 |
lblId.setText(PluginServices.getText(this, "id")+":"); |
289 |
lblVersion = new JLabel(); |
290 |
lblVersion.setBounds(9, 120, 79, 20); |
291 |
lblVersion.setHorizontalTextPosition(SwingConstants.RIGHT);
|
292 |
lblVersion.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
293 |
lblVersion.setText(PluginServices.getText(this, "version")+":"); |
294 |
lblFile = new JLabel(); |
295 |
lblFile.setBounds(9, 96, 79, 20); |
296 |
lblFile.setHorizontalTextPosition(SwingConstants.RIGHT);
|
297 |
lblFile.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
298 |
lblFile.setText(PluginServices.getText(this, "file_name")+":"); |
299 |
simplePanel = new JPanel(); |
300 |
simplePanel.setLayout(null);
|
301 |
simplePanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
302 |
null, PluginServices.getText(this, "options"), |
303 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
304 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
305 |
simplePanel.setBounds(new java.awt.Rectangle(0,0,535,196)); |
306 |
simplePanel.add(lblView, null);
|
307 |
simplePanel.add(getCmbViews(), null);
|
308 |
simplePanel.add(getTxtTitle(), null);
|
309 |
simplePanel.add(lblTitle, null);
|
310 |
simplePanel.add(getBtnBrowseFileSystem(), null);
|
311 |
simplePanel.add(lblVersion, null);
|
312 |
simplePanel.add(lblId, null);
|
313 |
simplePanel.add(getTxtId(), null);
|
314 |
simplePanel.add(lblFile, null);
|
315 |
simplePanel.add(getTxtFile(), null);
|
316 |
simplePanel.add(getBtnAdvanced(), null);
|
317 |
simplePanel.add(getCmbVersion(), null);
|
318 |
simplePanel.add(lblExtent, null);
|
319 |
simplePanel.add(getRdBtnCurrentViewExtent(), null);
|
320 |
simplePanel.add(getRdBtnFullExtent(), null);
|
321 |
group.add(getRdBtnCurrentViewExtent()); |
322 |
group.add(getRdBtnFullExtent()); |
323 |
} |
324 |
return simplePanel;
|
325 |
} |
326 |
|
327 |
/**
|
328 |
* This method initializes advancedPanel
|
329 |
*
|
330 |
* @return javax.swing.JPanel
|
331 |
*/
|
332 |
private JPanel getAdvancedPanel() { |
333 |
if (advancedPanel == null) { |
334 |
lblKeyWords = new JLabel(); |
335 |
lblKeyWords.setBounds(10, 79, 99, 20); |
336 |
lblKeyWords.setHorizontalTextPosition(SwingConstants.RIGHT);
|
337 |
lblKeyWords.setHorizontalAlignment(SwingConstants.RIGHT);
|
338 |
lblKeyWords.setText(PluginServices.getText(this, "keywords")+":"); |
339 |
lblDescriptionURL = new JLabel(); |
340 |
lblDescriptionURL.setBounds(10, 104, 99, 20); |
341 |
lblDescriptionURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
342 |
lblDescriptionURL.setText(PluginServices.getText(this, "description_URL")+":"); |
343 |
lblDescriptionURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
344 |
lblLogoURL = new JLabel(); |
345 |
lblLogoURL.setBounds(10, 130, 99, 20); |
346 |
lblLogoURL.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
347 |
lblLogoURL.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
348 |
lblLogoURL.setText(PluginServices.getText(this, "logo_URL")+":"); |
349 |
lblAbstract = new JLabel(); |
350 |
lblAbstract.setText(PluginServices.getText(this, "abstract")+":"); |
351 |
lblAbstract.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
352 |
lblAbstract.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
353 |
lblAbstract.setBounds(10, 27, 99, 20); |
354 |
advancedPanel = new JPanel(); |
355 |
advancedPanel.setLayout(null);
|
356 |
advancedPanel.setBounds(0, 194, 535, 386); |
357 |
advancedPanel.setBorder(javax.swing.BorderFactory.createTitledBorder( |
358 |
null, PluginServices.getText(this, "advanced_settings"), |
359 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
360 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
361 |
advancedPanel.add(lblAbstract, null);
|
362 |
advancedPanel.add(lblKeyWords, null);
|
363 |
advancedPanel.add(lblLogoURL, null);
|
364 |
advancedPanel.add(lblDescriptionURL, null);
|
365 |
advancedPanel.add(getScrlAbstract(), null);
|
366 |
advancedPanel.add(getTxtLogoURL(), null);
|
367 |
advancedPanel.add(getTxtDescriptionURL(), null);
|
368 |
advancedPanel.add(getPnlMapSize(), null);
|
369 |
advancedPanel.add(getPnlContactInfo(), null);
|
370 |
advancedPanel.add(getTxtKeyWords(), null);
|
371 |
} |
372 |
return advancedPanel;
|
373 |
} |
374 |
|
375 |
/**
|
376 |
* This method initializes buttonsPanel
|
377 |
*
|
378 |
* @return javax.swing.JPanel
|
379 |
*/
|
380 |
private JPanel getButtonsPanel() { |
381 |
if (buttonsPanel == null) { |
382 |
FlowLayout flowLayout = new FlowLayout(); |
383 |
flowLayout.setAlignment(java.awt.FlowLayout.RIGHT); |
384 |
buttonsPanel = new JPanel(); |
385 |
buttonsPanel.setLayout(flowLayout); |
386 |
buttonsPanel.add(getBtnOk(), null);
|
387 |
buttonsPanel.add(getBtnCancel(), null);
|
388 |
} |
389 |
buttonsPanel.setBounds(0, this.getHeight()-60, 535, 38); |
390 |
|
391 |
return buttonsPanel;
|
392 |
} |
393 |
|
394 |
/**
|
395 |
* This method initializes cmbVersion
|
396 |
*
|
397 |
* @return javax.swing.JComboBox
|
398 |
*/
|
399 |
private JComboBox getCmbVersion() { |
400 |
if (cmbVersion == null) { |
401 |
cmbVersion = new JComboBox(); |
402 |
cmbVersion.setSize(89, 20); |
403 |
cmbVersion.setLocation(91, 120); |
404 |
for (int i = 0; i < WebMapContext.exportVersions.size(); i++) { |
405 |
cmbVersion.addItem(WebMapContext.exportVersions.get(i)); |
406 |
} |
407 |
|
408 |
} |
409 |
return cmbVersion;
|
410 |
} |
411 |
|
412 |
|
413 |
|
414 |
/**
|
415 |
* This method initializes btnBrowseFileSystem
|
416 |
*
|
417 |
* @return javax.swing.JButton
|
418 |
*/
|
419 |
private JButton getBtnBrowseFileSystem() { |
420 |
if (btnBrowseFileSystem == null) { |
421 |
btnBrowseFileSystem = new JButton(); |
422 |
btnBrowseFileSystem.setBounds(403, 95, 120, 22); |
423 |
btnBrowseFileSystem.addActionListener(new java.awt.event.ActionListener() {
|
424 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
425 |
JFileChooser fc = new JFileChooser(); |
426 |
fc.setFileFilter(new FileFilter() { |
427 |
public boolean accept(File f) { |
428 |
return f.isDirectory() || f.getAbsolutePath().toLowerCase().endsWith(WebMapContext.FILE_EXTENSION);
|
429 |
} |
430 |
|
431 |
public String getDescription() { |
432 |
return PluginServices.getText(this, "ogc_mapcontext_file")+" (*.cml)"; |
433 |
} |
434 |
}); |
435 |
if (fc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION){ |
436 |
|
437 |
String fileName = fc.getSelectedFile().getAbsolutePath();
|
438 |
if (!fileName.toLowerCase().endsWith(WebMapContext.FILE_EXTENSION))
|
439 |
fileName += WebMapContext.FILE_EXTENSION; |
440 |
targetFile = new File(fileName); |
441 |
getTxtFile().setText(fileName); |
442 |
} |
443 |
fc = null;
|
444 |
} |
445 |
}); |
446 |
btnBrowseFileSystem.setText(PluginServices.getText(this, "browse")); |
447 |
} |
448 |
return btnBrowseFileSystem;
|
449 |
} |
450 |
|
451 |
/**
|
452 |
* This method initializes txtTitle
|
453 |
*
|
454 |
* @return javax.swing.JTextField
|
455 |
*/
|
456 |
private JTextField getTxtTitle() { |
457 |
if (txtTitle == null) { |
458 |
txtTitle = new JTextField(); |
459 |
txtTitle.setBounds(91, 48, 432, 20); |
460 |
txtTitle.setName(PluginServices.getText(this, "title")); |
461 |
} |
462 |
return txtTitle;
|
463 |
} |
464 |
|
465 |
/**
|
466 |
* This method initializes jTextField
|
467 |
*
|
468 |
* @return javax.swing.JTextField
|
469 |
*/
|
470 |
private JTextField getTxtId() { |
471 |
if (txtId == null) { |
472 |
txtId = new JTextField(); |
473 |
txtId.setBounds(91, 72, 432, 20); |
474 |
txtId.setName(PluginServices.getText(this, "id")); |
475 |
} |
476 |
return txtId;
|
477 |
} |
478 |
|
479 |
/**
|
480 |
* This method initializes txtFile
|
481 |
*
|
482 |
* @return javax.swing.JTextField
|
483 |
*/
|
484 |
private JTextField getTxtFile() { |
485 |
if (txtFile == null) { |
486 |
txtFile = new JTextField(); |
487 |
txtFile.setBounds(91, 96, 308, 20); |
488 |
} |
489 |
return txtFile;
|
490 |
} |
491 |
|
492 |
/**
|
493 |
* This method initializes btnAdvanced
|
494 |
*
|
495 |
* @return javax.swing.JButton
|
496 |
*/
|
497 |
private JButton getBtnAdvanced() { |
498 |
if (btnAdvanced == null) { |
499 |
btnAdvanced = new JButton(); |
500 |
// btnAdvanced.setBounds(403, 160, 120, 25);
|
501 |
btnAdvanced.setLocation(403, 160); |
502 |
btnAdvanced.addActionListener(new java.awt.event.ActionListener() {
|
503 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
504 |
advanced = !advanced; |
505 |
switchPanels(); |
506 |
} |
507 |
}); |
508 |
} |
509 |
return btnAdvanced;
|
510 |
} |
511 |
|
512 |
/**
|
513 |
* This method initializes btnAceptar
|
514 |
*
|
515 |
* @return javax.swing.JButton
|
516 |
*/
|
517 |
private JButton getBtnOk() { |
518 |
if (btnOk == null) { |
519 |
btnOk = new JButton(); |
520 |
btnOk.setText(PluginServices.getText(this, "Ok")); |
521 |
btnOk.addActionListener(new java.awt.event.ActionListener() {
|
522 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
523 |
execute("OK");
|
524 |
} |
525 |
}); |
526 |
} |
527 |
return btnOk;
|
528 |
} |
529 |
|
530 |
/**
|
531 |
* This method initializes btnCancel
|
532 |
*
|
533 |
* @return javax.swing.JButton
|
534 |
*/
|
535 |
private JButton getBtnCancel() { |
536 |
if (btnCancel == null) { |
537 |
btnCancel = new JButton(); |
538 |
btnCancel.setText(PluginServices.getText(this, "cancel")); |
539 |
btnCancel.addActionListener(new java.awt.event.ActionListener() {
|
540 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
541 |
execute("CANCEL");
|
542 |
} |
543 |
}); |
544 |
} |
545 |
return btnCancel;
|
546 |
} |
547 |
|
548 |
/**
|
549 |
* This method initializes txtAbstract
|
550 |
*
|
551 |
* @return javax.swing.JTextArea
|
552 |
*/
|
553 |
private JTextArea getTxtAbstract() { |
554 |
if (txtAbstract == null) { |
555 |
txtAbstract = new JTextArea(); |
556 |
} |
557 |
return txtAbstract;
|
558 |
} |
559 |
|
560 |
/**
|
561 |
* This method initializes scrlAbstract
|
562 |
*
|
563 |
* @return javax.swing.JScrollPane
|
564 |
*/
|
565 |
private JScrollPane getScrlAbstract() { |
566 |
if (scrlAbstract == null) { |
567 |
scrlAbstract = new JScrollPane(); |
568 |
scrlAbstract.setBounds(115, 27, 232, 48); |
569 |
scrlAbstract.setViewportView(getTxtAbstract()); |
570 |
} |
571 |
return scrlAbstract;
|
572 |
} |
573 |
|
574 |
/**
|
575 |
* This method initializes txtLogoURL
|
576 |
*
|
577 |
* @return javax.swing.JTextField
|
578 |
*/
|
579 |
private JTextField getTxtLogoURL() { |
580 |
if (txtLogoURL == null) { |
581 |
txtLogoURL = new JTextField(); |
582 |
txtLogoURL.setBounds(115, 130, 407, 20); |
583 |
} |
584 |
return txtLogoURL;
|
585 |
} |
586 |
|
587 |
/**
|
588 |
* This method initializes jTextField
|
589 |
*
|
590 |
* @return javax.swing.JTextField
|
591 |
*/
|
592 |
private JTextField getTxtDescriptionURL() { |
593 |
if (txtDescriptionURL == null) { |
594 |
txtDescriptionURL = new JTextField(); |
595 |
txtDescriptionURL.setBounds(115, 104, 232, 20); |
596 |
} |
597 |
return txtDescriptionURL;
|
598 |
} |
599 |
|
600 |
/**
|
601 |
* This method initializes pnlMapSize
|
602 |
*
|
603 |
* @return javax.swing.JPanel
|
604 |
*/
|
605 |
private JPanel getPnlMapSize() { |
606 |
if (pnlMapSize == null) { |
607 |
ButtonGroup group = new ButtonGroup(); |
608 |
lblHeight = new JLabel(); |
609 |
lblHeight.setText(PluginServices.getText(this, "height")); |
610 |
lblHeight.setBounds(11, 79, 52, 20); |
611 |
lblHeight.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
612 |
lblHeight.setEnabled(false);
|
613 |
lblHeight.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
614 |
lblWidth = new JLabel(); |
615 |
lblWidth.setText(PluginServices.getText(this, "width")); |
616 |
lblWidth.setBounds(11, 56, 52, 20); |
617 |
lblWidth.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
618 |
lblWidth.setEnabled(false);
|
619 |
lblWidth.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
620 |
pnlMapSize = new JPanel(); |
621 |
pnlMapSize.setLayout(null);
|
622 |
pnlMapSize.setBounds(351, 19, 179, 108); |
623 |
pnlMapSize.setBorder(javax.swing.BorderFactory.createTitledBorder( |
624 |
null, PluginServices.getText(this, "map_size_in_pixels"), |
625 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
626 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
627 |
pnlMapSize.add(getRdBtnUseViewSize(), null);
|
628 |
pnlMapSize.add(getRdBtnCustomSize(), null);
|
629 |
pnlMapSize.add(lblWidth, null);
|
630 |
pnlMapSize.add(lblHeight, null);
|
631 |
pnlMapSize.add(getTxtWidth(), null);
|
632 |
pnlMapSize.add(getTxtHeight(), null);
|
633 |
group.add(getRdBtnUseViewSize()); |
634 |
group.add(getRdBtnCustomSize()); |
635 |
|
636 |
} |
637 |
return pnlMapSize;
|
638 |
} |
639 |
|
640 |
/**
|
641 |
* This method initializes rdBtnUseViewSize
|
642 |
*
|
643 |
* @return javax.swing.JRadioButton
|
644 |
*/
|
645 |
private JRadioButton getRdBtnUseViewSize() { |
646 |
if (rdBtnUseViewSize == null) { |
647 |
rdBtnUseViewSize = new JRadioButton(); |
648 |
rdBtnUseViewSize.setBounds(8, 16, 142, 20); |
649 |
rdBtnUseViewSize.setText(PluginServices.getText(this, "use_view_size")); |
650 |
rdBtnUseViewSize.addItemListener(new java.awt.event.ItemListener() {
|
651 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
652 |
boolean b = !getRdBtnUseViewSize().isSelected();
|
653 |
|
654 |
getTxtWidth().setEnabled(b); |
655 |
getTxtHeight().setEnabled(b); |
656 |
} |
657 |
}); |
658 |
rdBtnUseViewSize.setSelected(true);
|
659 |
} |
660 |
return rdBtnUseViewSize;
|
661 |
} |
662 |
|
663 |
/**
|
664 |
* This method initializes jRadioButton
|
665 |
*
|
666 |
* @return javax.swing.JRadioButton
|
667 |
*/
|
668 |
private JRadioButton getRdBtnCustomSize() { |
669 |
if (rdBtnCustomSize == null) { |
670 |
rdBtnCustomSize = new JRadioButton(); |
671 |
rdBtnCustomSize.setBounds(8, 34, 142, 20); |
672 |
rdBtnCustomSize.setText(PluginServices.getText(this, "use_custom_size")); |
673 |
} |
674 |
return rdBtnCustomSize;
|
675 |
} |
676 |
|
677 |
/**
|
678 |
* This method initializes txtWidth
|
679 |
*
|
680 |
* @return javax.swing.JTextField
|
681 |
*/
|
682 |
private JTextField getTxtWidth() { |
683 |
if (txtWidth == null) { |
684 |
txtWidth = new JTextField(); |
685 |
txtWidth.setBounds(66, 56, 105, 20); |
686 |
txtWidth.setEnabled(false);
|
687 |
txtWidth.addKeyListener(new java.awt.event.KeyAdapter() {
|
688 |
public void keyTyped(java.awt.event.KeyEvent e) { |
689 |
try {
|
690 |
String text = getTxtWidth().getText();
|
691 |
Integer.parseInt(text);
|
692 |
lastWidth = text; |
693 |
} catch (Exception ex) { |
694 |
getTxtWidth().setText(lastWidth); |
695 |
} |
696 |
} |
697 |
}); |
698 |
Dimension sz = exportableViews[getCmbViews()
|
699 |
.getSelectedIndex()] |
700 |
.getMapContext() |
701 |
.getViewPort() |
702 |
.getImageSize(); |
703 |
lastWidth = (sz != null)? (int) sz.getWidth()+"": defaultWidth+""; |
704 |
|
705 |
txtWidth.setText(lastWidth); |
706 |
} |
707 |
return txtWidth;
|
708 |
} |
709 |
|
710 |
/**
|
711 |
* This method initializes jTextField
|
712 |
*
|
713 |
* @return javax.swing.JTextField
|
714 |
*/
|
715 |
private JTextField getTxtHeight() { |
716 |
if (txtHeight == null) { |
717 |
txtHeight = new JTextField(); |
718 |
txtHeight.setBounds(66, 79, 105, 20); |
719 |
txtHeight.setEnabled(false);
|
720 |
txtHeight.addKeyListener(new java.awt.event.KeyAdapter() {
|
721 |
public void keyTyped(java.awt.event.KeyEvent e) { |
722 |
try {
|
723 |
String text = getTxtHeight().getText();
|
724 |
Integer.parseInt(text);
|
725 |
lastHeight = text; |
726 |
} catch (Exception ex) { |
727 |
getTxtHeight().setText(lastHeight); |
728 |
} |
729 |
} |
730 |
}); |
731 |
Dimension sz = exportableViews[getCmbViews()
|
732 |
.getSelectedIndex()] |
733 |
.getMapContext() |
734 |
.getViewPort() |
735 |
.getImageSize(); |
736 |
lastHeight = (sz != null)? (int) sz.getHeight()+"": defaultHeight+""; |
737 |
txtHeight.setText(lastHeight); |
738 |
} |
739 |
return txtHeight;
|
740 |
} |
741 |
|
742 |
/**
|
743 |
* This method initializes pnlContactInfo
|
744 |
*
|
745 |
* @return javax.swing.JPanel
|
746 |
*/
|
747 |
private JPanel getPnlContactInfo() { |
748 |
if (pnlContactInfo == null) { |
749 |
lblEMail = new JLabel(); |
750 |
lblEMail.setBounds(7, 193, 98, 20); |
751 |
lblEMail.setHorizontalTextPosition(SwingConstants.RIGHT);
|
752 |
lblEMail.setHorizontalAlignment(SwingConstants.RIGHT);
|
753 |
lblEMail.setText(PluginServices.getText(this, "e-mail")+":"); |
754 |
lblFax = new JLabel(); |
755 |
lblFax.setBounds(274, 168, 57, 20); |
756 |
lblFax.setHorizontalTextPosition(SwingConstants.RIGHT);
|
757 |
lblFax.setHorizontalAlignment(SwingConstants.RIGHT);
|
758 |
lblFax.setText(PluginServices.getText(this, "fax")+":"); |
759 |
lblPostCode = new JLabel(); |
760 |
lblPostCode.setBounds(7, 143, 98, 20); |
761 |
lblPostCode.setHorizontalTextPosition(SwingConstants.RIGHT);
|
762 |
lblPostCode.setHorizontalAlignment(SwingConstants.RIGHT);
|
763 |
lblPostCode.setText(PluginServices.getText(this, "postcode")+":"); |
764 |
lblPhone = new JLabel(); |
765 |
lblPhone.setBounds(7, 168, 98, 20); |
766 |
lblPhone.setHorizontalTextPosition(SwingConstants.RIGHT);
|
767 |
lblPhone.setHorizontalAlignment(SwingConstants.RIGHT);
|
768 |
lblPhone.setText(PluginServices.getText(this, "telephone")+":"); |
769 |
lblCountry = new JLabel(); |
770 |
lblCountry.setBounds(274, 143, 57, 20); |
771 |
lblCountry.setText(PluginServices.getText(this, "country")+":"); |
772 |
lblCountry.setHorizontalTextPosition(SwingConstants.RIGHT);
|
773 |
lblCountry.setHorizontalAlignment(SwingConstants.RIGHT);
|
774 |
lblStateProvince = new JLabel(); |
775 |
lblStateProvince.setBounds(252, 119, 111, 20); |
776 |
lblStateProvince.setText(PluginServices.getText(this, "state_or_province")+":"); |
777 |
lblStateProvince.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
778 |
lblStateProvince.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
779 |
|
780 |
lblCity = new JLabel(); |
781 |
lblCity.setBounds(7, 119, 98, 20); |
782 |
lblCity.setText(PluginServices.getText(this, "city")+":"); |
783 |
lblCity.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
784 |
lblCity.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
785 |
lblContactPosition = new JLabel(); |
786 |
lblContactPosition.setBounds(6, 69, 99, 20); |
787 |
lblContactPosition.setHorizontalTextPosition(SwingConstants.RIGHT);
|
788 |
lblContactPosition.setHorizontalAlignment(SwingConstants.RIGHT);
|
789 |
lblContactPosition.setText(PluginServices.getText(this, "contact_position")); |
790 |
lblContactOrganization = new JLabel(); |
791 |
lblContactOrganization.setBounds(6, 44, 99, 20); |
792 |
lblContactOrganization.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
793 |
lblContactOrganization.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
794 |
lblContactOrganization.setText(PluginServices.getText(this, "contact_organization")+":"); |
795 |
lblAddress = new JLabel(); |
796 |
lblAddress.setBounds(6, 94, 99, 20); |
797 |
lblAddress.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
798 |
lblAddress.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
799 |
lblAddress.setText(PluginServices.getText(this, "address")); |
800 |
|
801 |
lblContactPerson = new JLabel(); |
802 |
lblContactPerson.setText(PluginServices.getText(this, "contact_person")+":"); |
803 |
lblContactPerson.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT); |
804 |
lblContactPerson.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); |
805 |
lblContactPerson.setBounds(6, 19, 99, 20); |
806 |
pnlContactInfo = new JPanel(); |
807 |
pnlContactInfo.setLayout(null);
|
808 |
pnlContactInfo.setBorder(javax.swing.BorderFactory.createTitledBorder( |
809 |
null, PluginServices.getText(this, "contact_info"), |
810 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
811 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
812 |
pnlContactInfo.setLocation(4, 158); |
813 |
pnlContactInfo.setSize(527, 223); |
814 |
pnlContactInfo.add(lblContactPerson, null);
|
815 |
pnlContactInfo.add(getTxtContactPerson(), null);
|
816 |
pnlContactInfo.add(lblContactOrganization, null);
|
817 |
pnlContactInfo.add(getTxtOrganization(), null);
|
818 |
pnlContactInfo.add(lblContactPosition, null);
|
819 |
pnlContactInfo.add(getTxtContactPosition(), null);
|
820 |
pnlContactInfo.add(lblAddress, null);
|
821 |
pnlContactInfo.add(getTxtAddress(), null);
|
822 |
pnlContactInfo.add(lblCity, null);
|
823 |
pnlContactInfo.add(getTxtCity(), null);
|
824 |
pnlContactInfo.add(lblStateProvince, null);
|
825 |
pnlContactInfo.add(getCmbCountries(), null);
|
826 |
pnlContactInfo.add(getTxtStateOrProvince(), null);
|
827 |
pnlContactInfo.add(lblPostCode, null);
|
828 |
pnlContactInfo.add(getTxtPostCode(), null);
|
829 |
pnlContactInfo.add(lblCountry, null);
|
830 |
pnlContactInfo.add(lblPhone, null);
|
831 |
pnlContactInfo.add(getTxtTelephone(), null);
|
832 |
pnlContactInfo.add(lblFax, null);
|
833 |
pnlContactInfo.add(getTxtFax(), null);
|
834 |
pnlContactInfo.add(lblEMail, null);
|
835 |
pnlContactInfo.add(getTxtEMail(), null);
|
836 |
} |
837 |
return pnlContactInfo;
|
838 |
} |
839 |
|
840 |
/**
|
841 |
* This method initializes jTextField1
|
842 |
*
|
843 |
* @return javax.swing.JTextField
|
844 |
*/
|
845 |
private JTextField getTxtKeyWords() { |
846 |
if (txtKeyWords == null) { |
847 |
txtKeyWords = new JTextField(); |
848 |
txtKeyWords.setBounds(115, 79, 232, 20); |
849 |
} |
850 |
return txtKeyWords;
|
851 |
} |
852 |
|
853 |
/**
|
854 |
* This method initializes jTextField1
|
855 |
*
|
856 |
* @return javax.swing.JTextField
|
857 |
*/
|
858 |
private JTextField getTxtContactPerson() { |
859 |
if (txtContactPerson == null) { |
860 |
txtContactPerson = new JTextField(); |
861 |
txtContactPerson.setBounds(111, 19, 407, 20); |
862 |
} |
863 |
return txtContactPerson;
|
864 |
} |
865 |
|
866 |
/**
|
867 |
* This method initializes jTextField2
|
868 |
*
|
869 |
* @return javax.swing.JTextField
|
870 |
*/
|
871 |
private JTextField getTxtOrganization() { |
872 |
if (txtOrganization == null) { |
873 |
txtOrganization = new JTextField(); |
874 |
txtOrganization.setBounds(111, 44, 407, 20); |
875 |
} |
876 |
return txtOrganization;
|
877 |
} |
878 |
|
879 |
/**
|
880 |
* This method initializes jTextField
|
881 |
*
|
882 |
* @return javax.swing.JTextField
|
883 |
*/
|
884 |
private JTextField getTxtContactPosition() { |
885 |
if (txtContactPosition == null) { |
886 |
txtContactPosition = new JTextField(); |
887 |
txtContactPosition.setBounds(111, 69, 407, 20); |
888 |
} |
889 |
return txtContactPosition;
|
890 |
} |
891 |
|
892 |
/**
|
893 |
* This method initializes txtAddress
|
894 |
*
|
895 |
* @return javax.swing.JTextField
|
896 |
*/
|
897 |
private JTextField getTxtAddress() { |
898 |
if (txtAddress == null) { |
899 |
txtAddress = new JTextField(); |
900 |
txtAddress.setBounds(111, 94, 407, 20); |
901 |
} |
902 |
return txtAddress;
|
903 |
} |
904 |
|
905 |
/**
|
906 |
* This method initializes txtCity
|
907 |
*
|
908 |
* @return javax.swing.JTextField
|
909 |
*/
|
910 |
private JTextField getTxtCity() { |
911 |
if (txtCity == null) { |
912 |
txtCity = new JTextField(); |
913 |
txtCity.setBounds(111, 119, 135, 20); |
914 |
} |
915 |
return txtCity;
|
916 |
} |
917 |
|
918 |
/**
|
919 |
* This method initializes txtStateOrProvince
|
920 |
*
|
921 |
* @return javax.swing.JTextField
|
922 |
*/
|
923 |
private JTextField getTxtStateOrProvince() { |
924 |
if (txtStateOrProvince == null) { |
925 |
txtStateOrProvince = new JTextField(); |
926 |
txtStateOrProvince.setBounds(368, 119, 150, 20); |
927 |
} |
928 |
return txtStateOrProvince;
|
929 |
} |
930 |
|
931 |
/**
|
932 |
* This method initializes txtPostCode
|
933 |
*
|
934 |
* @return javax.swing.JTextField
|
935 |
*/
|
936 |
private JTextField getTxtPostCode() { |
937 |
if (txtPostCode == null) { |
938 |
txtPostCode = new JTextField(); |
939 |
txtPostCode.setBounds(111, 143, 159, 20); |
940 |
} |
941 |
return txtPostCode;
|
942 |
} |
943 |
|
944 |
/**
|
945 |
* This method initializes cmbCountries
|
946 |
*
|
947 |
* @return javax.swing.JComboBox
|
948 |
*/
|
949 |
private JComboBox getCmbCountries() { |
950 |
if (cmbCountries == null) { |
951 |
cmbCountries = new JComboBox(); |
952 |
cmbCountries.setBounds(336, 143, 182, 20); |
953 |
String[] countries = PluginServices.getText(this, "countries_of_the_world").split(";"); |
954 |
for (int i = 0; i < countries.length; i++) { |
955 |
cmbCountries.addItem(countries[i]); |
956 |
} |
957 |
} |
958 |
return cmbCountries;
|
959 |
} |
960 |
|
961 |
/**
|
962 |
* This method initializes txtTelephone
|
963 |
*
|
964 |
* @return javax.swing.JTextField
|
965 |
*/
|
966 |
private JTextField getTxtTelephone() { |
967 |
if (txtTelephone == null) { |
968 |
txtTelephone = new JTextField(); |
969 |
txtTelephone.setBounds(111, 168, 159, 20); |
970 |
} |
971 |
return txtTelephone;
|
972 |
} |
973 |
|
974 |
/**
|
975 |
* This method initializes txtFax
|
976 |
*
|
977 |
* @return javax.swing.JTextField
|
978 |
*/
|
979 |
private JTextField getTxtFax() { |
980 |
if (txtFax == null) { |
981 |
txtFax = new JTextField(); |
982 |
txtFax.setBounds(336, 168, 182, 20); |
983 |
} |
984 |
return txtFax;
|
985 |
} |
986 |
|
987 |
/**
|
988 |
* This method initializes txtEMail
|
989 |
*
|
990 |
* @return javax.swing.JTextField
|
991 |
*/
|
992 |
private JTextField getTxtEMail() { |
993 |
if (txtEMail == null) { |
994 |
txtEMail = new JTextField(); |
995 |
txtEMail.setBounds(111, 193, 407, 20); |
996 |
} |
997 |
return txtEMail;
|
998 |
} |
999 |
|
1000 |
public Object getWindowModel() { |
1001 |
return PluginServices.getText(this, "web_map_context_settings"); |
1002 |
} |
1003 |
|
1004 |
private void execute(String actionCommand) { |
1005 |
if ("OK".equals(actionCommand)) { |
1006 |
String str = getTxtFile().getText();
|
1007 |
if (str==null || str.equals("")) { |
1008 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "must_specify_a_file"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
1009 |
return;
|
1010 |
} |
1011 |
ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()]; |
1012 |
MapContext mc = theView.getMapContext(); |
1013 |
wmc = new WebMapContext();
|
1014 |
|
1015 |
// Version
|
1016 |
wmc.fileVersion = (String) getCmbVersion().getSelectedItem();
|
1017 |
|
1018 |
// Web Map Context size
|
1019 |
if (advanced) {
|
1020 |
if (getRdBtnUseViewSize().isSelected()) {
|
1021 |
// View's size
|
1022 |
Dimension sz = null; |
1023 |
if (mc.getViewPort().getImageSize()!=null) |
1024 |
sz = new Dimension(mc.getViewPort().getImageSize()); |
1025 |
if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0) |
1026 |
// View's size is not initialized, will use default size.
|
1027 |
sz = new Dimension(defaultWidth, defaultHeight); |
1028 |
wmc.windowSize = sz; |
1029 |
} else {
|
1030 |
// User defined size
|
1031 |
try {
|
1032 |
wmc.windowSize = new Dimension(Integer.parseInt(getTxtWidth().getText()), |
1033 |
Integer.parseInt(getTxtHeight().getText()));
|
1034 |
} catch (Exception e) { |
1035 |
JOptionPane.showMessageDialog(this, PluginServices.getText(this, "invalid_dimension_values"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
1036 |
return;
|
1037 |
} |
1038 |
} |
1039 |
} |
1040 |
// SRS
|
1041 |
wmc.srs = mc.getProjection().getAbrev(); |
1042 |
|
1043 |
// Bounding Box
|
1044 |
if (useFullExtent)
|
1045 |
try {
|
1046 |
wmc.bBox = mc.getFullExtent(); |
1047 |
} catch (DriverException dEx) {
|
1048 |
NotificationManager.addError(dEx); |
1049 |
return;
|
1050 |
} |
1051 |
else
|
1052 |
wmc.bBox = mc.getViewPort().getAdjustedExtent(); |
1053 |
|
1054 |
// Title
|
1055 |
str = getTxtTitle().getText(); |
1056 |
if (str!=null && !str.equals("")) |
1057 |
wmc.title = str; |
1058 |
else {
|
1059 |
JOptionPane.showMessageDialog(this, getTxtTitle().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
1060 |
return;
|
1061 |
} |
1062 |
|
1063 |
// ID
|
1064 |
str = getTxtId().getText(); |
1065 |
if (str!=null && !str.equals("")) |
1066 |
wmc.id = str; |
1067 |
else {
|
1068 |
JOptionPane.showMessageDialog(this, getTxtId().getName()+" "+PluginServices.getText(this, "is_required"), PluginServices.getText(this, "error"), JOptionPane.ERROR_MESSAGE); |
1069 |
return;
|
1070 |
} |
1071 |
|
1072 |
wmc.xmlns = WebMapContextTags.XMLNS_VALUE; |
1073 |
wmc.xmlns_xlink = WebMapContextTags.XMLNS_XLINK_VALUE; |
1074 |
wmc.xmlns_xsi = WebMapContextTags.XMLNS_XSI_VALUE; |
1075 |
wmc.xsi_schemaLocation = WebMapContextTags.XSI_SCHEMA_LOCATION_VALUE; |
1076 |
|
1077 |
// Abstract
|
1078 |
str = getTxtAbstract().getText(); |
1079 |
if (str!=null && !str.equals("")) |
1080 |
wmc._abstract = str; |
1081 |
|
1082 |
// Keyword list
|
1083 |
str = getTxtKeyWords().getText(); |
1084 |
if (str!=null && !str.equals("")) { |
1085 |
String[] ss = str.split("[, ;:]+"); // sequence of spaces, commas, colons or semicolons will be treated as word separator |
1086 |
for (int i = 0; i < ss.length; i++) { |
1087 |
if (wmc.keywordList==null) wmc.keywordList = new ArrayList(); |
1088 |
wmc.keywordList.add(ss[i]); |
1089 |
} |
1090 |
} |
1091 |
|
1092 |
// Logo URL
|
1093 |
str = getTxtLogoURL().getText(); |
1094 |
if (str!=null && !str.equals("")) |
1095 |
wmc.logoURL = str; |
1096 |
|
1097 |
wmc.logoURLSize = null; // yet skiped |
1098 |
wmc.logoURLFormat = null; // yet skiped |
1099 |
wmc.descriptionURLFormat = null;// yet skiped |
1100 |
|
1101 |
// Description URL
|
1102 |
str = getTxtLogoURL().getText(); |
1103 |
if (str!=null && !str.equals("")) |
1104 |
wmc.descriptionURL = str; |
1105 |
|
1106 |
// Contact Person
|
1107 |
str = getTxtContactPerson().getText(); |
1108 |
if (str!=null && !str.equals("")) { |
1109 |
wmc.contactPerson = str; |
1110 |
wmc.contactInfo = true;
|
1111 |
} |
1112 |
|
1113 |
// Contact Organization
|
1114 |
str = getTxtOrganization().getText(); |
1115 |
if (str!=null && !str.equals("")) { |
1116 |
wmc.contactOrganization = str; |
1117 |
wmc.contactInfo = true;
|
1118 |
} |
1119 |
|
1120 |
// Contact Position
|
1121 |
str = getTxtContactPosition().getText(); |
1122 |
if (str!=null && !str.equals("")) { |
1123 |
wmc.contactPosition = str; |
1124 |
wmc.contactInfo = true;
|
1125 |
} |
1126 |
|
1127 |
// Address
|
1128 |
str = getTxtAddress().getText(); |
1129 |
if (str!=null && !str.equals("")) { |
1130 |
wmc.address = str; |
1131 |
wmc.contactInfo = true;
|
1132 |
} |
1133 |
|
1134 |
// City
|
1135 |
str = getTxtCity().getText(); |
1136 |
if (str!=null && !str.equals("")) { |
1137 |
wmc.city = str; |
1138 |
wmc.contactInfo = true;
|
1139 |
} |
1140 |
|
1141 |
// State/Province
|
1142 |
str = getTxtStateOrProvince().getText(); |
1143 |
if (str!=null && !str.equals("")) { |
1144 |
wmc.stateOrProvince = str; |
1145 |
wmc.contactInfo = true;
|
1146 |
} |
1147 |
|
1148 |
// Postcode
|
1149 |
str = getTxtPostCode().getText(); |
1150 |
if (str!=null && !str.equals("")) { |
1151 |
wmc.postCode = str; |
1152 |
} |
1153 |
|
1154 |
// Country
|
1155 |
str = (String) getCmbCountries().getSelectedItem();
|
1156 |
if (str!=null && !str.equals("")) { |
1157 |
wmc.country = str; |
1158 |
} |
1159 |
|
1160 |
// Telephone
|
1161 |
str = getTxtTelephone().getText(); |
1162 |
if (str!=null && !str.equals("")) { |
1163 |
wmc.telephone = str; |
1164 |
wmc.contactInfo = true;
|
1165 |
} |
1166 |
|
1167 |
// Fax
|
1168 |
str = getTxtFax().getText(); |
1169 |
if (str!=null && !str.equals("")) { |
1170 |
wmc.fax = str; |
1171 |
wmc.contactInfo = true;
|
1172 |
} |
1173 |
|
1174 |
// e-mail
|
1175 |
str = getTxtEMail().getText(); |
1176 |
if (str!=null && !str.equals("")) { |
1177 |
wmc.email = str; |
1178 |
wmc.contactInfo = true;
|
1179 |
} |
1180 |
|
1181 |
ExportWebMapContextExtension exp = (ExportWebMapContextExtension) |
1182 |
PluginServices. |
1183 |
getExtension(ExportWebMapContextExtension.class); |
1184 |
exp.execute("DO_EXPORT");
|
1185 |
PluginServices.getMDIManager().closeWindow(this);
|
1186 |
} else if ("CANCEL".equals(actionCommand)) { |
1187 |
PluginServices.getMDIManager().closeWindow(this);
|
1188 |
} |
1189 |
} |
1190 |
|
1191 |
public String getXML() { |
1192 |
return wmc.toXML(exportableViews[getCmbViews().getSelectedIndex()]);
|
1193 |
} |
1194 |
|
1195 |
public File getTargetFile() { |
1196 |
if (targetFile == null) { |
1197 |
String fileName = getTxtFile().getText();
|
1198 |
if (fileName != null) |
1199 |
targetFile = new File(fileName); |
1200 |
} |
1201 |
return targetFile;
|
1202 |
} |
1203 |
|
1204 |
/**
|
1205 |
* This method initializes cmbViews
|
1206 |
*
|
1207 |
* @return javax.swing.JComboBox
|
1208 |
*/
|
1209 |
private JComboBox getCmbViews() { |
1210 |
if (cmbViews == null) { |
1211 |
cmbViews = new JComboBox(); |
1212 |
cmbViews.setBounds(91, 24, 432, 21); |
1213 |
cmbViews.addItemListener(new java.awt.event.ItemListener() {
|
1214 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
1215 |
ProjectView theView = exportableViews[getCmbViews().getSelectedIndex()]; |
1216 |
Dimension sz = theView.getMapContext().
|
1217 |
getViewPort(). |
1218 |
getImageSize(); |
1219 |
if (sz == null || (int) sz.getHeight()==0 || (int) sz.getWidth()==0) |
1220 |
sz = new Dimension(defaultWidth, defaultHeight); |
1221 |
|
1222 |
getTxtWidth().setText((int) sz.getWidth()+""); |
1223 |
getTxtHeight().setText((int) sz.getHeight()+""); |
1224 |
getTxtTitle().setText(theView.getName()); |
1225 |
} |
1226 |
}); |
1227 |
for (int i = 0; i < exportableViews.length; i++) { |
1228 |
cmbViews.addItem(exportableViews[i].getName()); |
1229 |
} |
1230 |
} |
1231 |
return cmbViews;
|
1232 |
} |
1233 |
|
1234 |
/**
|
1235 |
* This method initializes rdCurrentViewExtent
|
1236 |
*
|
1237 |
* @return javax.swing.JRadioButton
|
1238 |
*/
|
1239 |
private JRadioButton getRdBtnCurrentViewExtent() { |
1240 |
if (rdBtnCurrentViewExtent == null) { |
1241 |
rdBtnCurrentViewExtent = new JRadioButton(); |
1242 |
rdBtnCurrentViewExtent.setBounds(91, 146, 270, 20); |
1243 |
rdBtnCurrentViewExtent.setText(PluginServices.getText(this, "defined_by_view_extent")); |
1244 |
rdBtnCurrentViewExtent.addItemListener(new java.awt.event.ItemListener() {
|
1245 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
1246 |
fPrefs.putBoolean("use_full_extent", !getRdBtnFullExtent().isEnabled());
|
1247 |
} |
1248 |
}); |
1249 |
rdBtnCurrentViewExtent.setEnabled(!useFullExtent); |
1250 |
} |
1251 |
return rdBtnCurrentViewExtent;
|
1252 |
} |
1253 |
|
1254 |
/**
|
1255 |
* This method initializes rdBtnFullExtent
|
1256 |
*
|
1257 |
* @return javax.swing.JRadioButton
|
1258 |
*/
|
1259 |
private JRadioButton getRdBtnFullExtent() { |
1260 |
if (rdBtnFullExtent == null) { |
1261 |
rdBtnFullExtent = new JRadioButton(); |
1262 |
rdBtnFullExtent.setBounds(91, 164, 270, 20); |
1263 |
rdBtnFullExtent.setText(PluginServices.getText(this, "use_full_extent")); |
1264 |
rdBtnFullExtent.addItemListener(new java.awt.event.ItemListener() {
|
1265 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
1266 |
boolean b = getRdBtnFullExtent().isEnabled();
|
1267 |
fPrefs.putBoolean("use_full_extent", getRdBtnFullExtent().isEnabled());
|
1268 |
useFullExtent = b; |
1269 |
} |
1270 |
}); |
1271 |
rdBtnFullExtent.setSelected(useFullExtent); |
1272 |
} |
1273 |
return rdBtnFullExtent;
|
1274 |
} |
1275 |
} |