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