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