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