Revision 6977 trunk/extensions/extPublish/src/com/iver/cit/gvsig/publish/servers/mapserver/ServiceWMSPanel.java

View differences:

ServiceWMSPanel.java
1 1
package com.iver.cit.gvsig.publish.servers.mapserver;
2

  
3
import javax.swing.JPanel;
4

  
5
import java.awt.Dimension;
6
import java.awt.GridBagLayout;
7
import java.awt.GridBagConstraints;
8
import javax.swing.JLabel;
9
import javax.swing.JTextField;
10

  
11
import com.iver.andami.PluginServices;
12
import com.iver.cit.gvsig.publish.servers.ServicePanel;
13

  
14
import java.awt.FlowLayout;
15
import java.util.Properties;
16

  
2 17
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
3 18
 *
4
 * Copyright (C) 2004-2006 IVER T.I. and Generalitat Valenciana.
19
 * Copyright (C) tbHEIGHT04 IVER T.I. and Generalitat Valenciana.
5 20
 *
6 21
 * This program is free software; you can redistribute it and/or
7 22
 * modify it under the terms of the GNU General Public License
......
19 34
 *
20 35
 * For more information, contact:
21 36
 *
22
 *   Generalitat Valenciana
37
 *  Generalitat Valenciana
23 38
 *   Conselleria d'Infraestructures i Transport
24 39
 *   Av. Blasco Ib??ez, 50
25 40
 *   46010 VALENCIA
26 41
 *   SPAIN
27 42
 *
28
 *   +34 963862235
43
 *      +34 963862235
29 44
 *   gvsig@gva.es
30
 *   www.gvsig.gva.es
45
 *      www.gvsig.gva.es
31 46
 *
32 47
 *    or
33 48
 *
......
43 58
 *
44 59
 * $Id$
45 60
 * $Log$
46
 * Revision 1.2  2006-09-01 06:59:00  luisw2
47
 * Headers mofification
61
 * Revision 1.3  2006-09-01 13:40:49  jorpiell
62
 * Primer gran commit de la extension
48 63
 *
64
 *
49 65
 */
50
import javax.swing.JPanel;
66
/**
67
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
68
 */
69
public class ServiceWMSPanel extends ServicePanel{
70
	private static final int tbWIDTH = 375;
71
	private static final int tbHEIGHT = 20;
72
	private static final int lbWIDTH = 125;
73
	private static final int lbHEIGHT = 20;
74
	
75
	private JPanel labelsPanel = null;
76
	private JPanel textsPanel = null;
77
	private JPanel mapFileLabelPanel = null;
78
	private JPanel symbolsLabelPanel = null;
79
	private JPanel fontsLabelPanel = null;
80
	private JPanel shapePathLabelPanel = null;
81
	private JPanel onlineResourceLabelPanel = null;
82
	private JPanel mapFileTextPanel = null;
83
	private JPanel symbolsTextPanel = null;
84
	private JPanel fontsTextPanel = null;
85
	private JPanel shapePathTextPanel = null;
86
	private JPanel onlineResourceTextPanel = null;
87
	private JLabel lbMapFile = null;
88
	private JLabel lbSymbols = null;
89
	private JLabel lbFonts = null;
90
	private JLabel lbShapePath = null;
91
	private JLabel lbOnlineResource = null;
92
	private JTextField tbMapFile = null;
93
	private JTextField tbSymbols = null;
94
	private JTextField tbFonts = null;
95
	private JTextField tbShapePath = null;
96
	private JTextField tbOnlineResource = null;
51 97

  
52
public class ServiceWMSPanel extends JPanel {
98
	/**
99
	 * This method initializes 
100
	 * 
101
	 */
102
	public ServiceWMSPanel() {
103
		super();
104
		initialize();
105
	}
53 106

  
107
	/**
108
	 * This method initializes this
109
	 * 
110
	 */
111
	private void initialize() {
112
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
113
        gridBagConstraints1.gridy = 0;
114
        gridBagConstraints1.gridx = 1;
115
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
116
        gridBagConstraints.gridy = 0;
117
        gridBagConstraints.gridheight = 3;
118
        gridBagConstraints.gridx = 0;
119
        this.setLayout(new GridBagLayout());
120
        this.setPreferredSize(new java.awt.Dimension(500,150));
121
        this.add(getJPanel(), gridBagConstraints);
122
        this.add(getTextsPanel(), gridBagConstraints1);
123
			
124
	}
125

  
126
	/**
127
	 * This method initializes jPanel	
128
	 * 	
129
	 * @return javax.swing.JPanel	
130
	 */
131
	private JPanel getJPanel() {
132
		if (labelsPanel == null) {
133
			labelsPanel = new JPanel();
134
			labelsPanel.setPreferredSize(new java.awt.Dimension(125,150));
135
			labelsPanel.add(getMapFileLabelPanel(), null);
136
			labelsPanel.add(getSymbolsLabelPanel(), null);
137
			labelsPanel.add(getFontsLabelPanel(), null);
138
			labelsPanel.add(getShapePathLabelPanel(), null);
139
			labelsPanel.add(getOnlineResourceLabelPanel(), null);
140
		}
141
		return labelsPanel;
142
	}
143

  
144
	/**
145
	 * This method initializes textsPanel	
146
	 * 	
147
	 * @return javax.swing.JPanel	
148
	 */
149
	private JPanel getTextsPanel() {
150
		if (textsPanel == null) {
151
			textsPanel = new JPanel();
152
			textsPanel.setPreferredSize(new java.awt.Dimension(375,150));
153
			textsPanel.add(getMapFileTextPanel(), null);
154
			textsPanel.add(getSymbolsTextPanel(), null);
155
			textsPanel.add(getFontsTextPanel(), null);
156
			textsPanel.add(getShapePathTextPanel(), null);
157
			textsPanel.add(getOnlineResourceTextPanel(), null);
158
		}
159
		return textsPanel;
160
	}
161

  
162
	/**
163
	 * This method initializes mapFileLabelPanel	
164
	 * 	
165
	 * @return javax.swing.JPanel	
166
	 */
167
	private JPanel getMapFileLabelPanel() {
168
		if (mapFileLabelPanel == null) {
169
			FlowLayout flowLayout = new FlowLayout();
170
			flowLayout.setAlignment(java.awt.FlowLayout.LEFT);
171
			lbMapFile = new JLabel();
172
			lbMapFile.setText(PluginServices.getText(this, "mapFile"));			
173
			mapFileLabelPanel = new JPanel();
174
			mapFileLabelPanel.setLayout(flowLayout);
175
			mapFileLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
176
			mapFileLabelPanel.add(lbMapFile, null);
177
		}
178
		return mapFileLabelPanel;
179
	}
180

  
181
	/**
182
	 * This method initializes symbolsLabelPanel	
183
	 * 	
184
	 * @return javax.swing.JPanel	
185
	 */
186
	private JPanel getSymbolsLabelPanel() {
187
		if (symbolsLabelPanel == null) {
188
			FlowLayout flowLayout1 = new FlowLayout();
189
			flowLayout1.setAlignment(java.awt.FlowLayout.LEFT);
190
			lbSymbols = new JLabel();
191
			lbSymbols.setText(PluginServices.getText(this, "symbols"));
192
			symbolsLabelPanel = new JPanel();
193
			symbolsLabelPanel.setLayout(flowLayout1);
194
			symbolsLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
195
			symbolsLabelPanel.add(lbSymbols, null);
196
		}
197
		return symbolsLabelPanel;
198
	}
199

  
200
	/**
201
	 * This method initializes fontsLabelPanel	
202
	 * 	
203
	 * @return javax.swing.JPanel	
204
	 */
205
	private JPanel getFontsLabelPanel() {
206
		if (fontsLabelPanel == null) {
207
			FlowLayout flowLayout2 = new FlowLayout();
208
			flowLayout2.setAlignment(java.awt.FlowLayout.LEFT);
209
			lbFonts = new JLabel();
210
			lbFonts.setText(PluginServices.getText(this, "fonts"));
211
			fontsLabelPanel = new JPanel();
212
			fontsLabelPanel.setLayout(flowLayout2);
213
			fontsLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
214
			fontsLabelPanel.add(lbFonts, null);
215
		}
216
		return fontsLabelPanel;
217
	}
218

  
219
	/**
220
	 * This method initializes shapePathLabelPanel	
221
	 * 	
222
	 * @return javax.swing.JPanel	
223
	 */
224
	private JPanel getShapePathLabelPanel() {
225
		if (shapePathLabelPanel == null) {
226
			FlowLayout flowLayout3 = new FlowLayout();
227
			flowLayout3.setAlignment(java.awt.FlowLayout.LEFT);
228
			lbShapePath = new JLabel();
229
			lbShapePath.setText(PluginServices.getText(this, "shapePath"));
230
			shapePathLabelPanel = new JPanel();
231
			shapePathLabelPanel.setLayout(flowLayout3);
232
			shapePathLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
233
			shapePathLabelPanel.add(lbShapePath, null);
234
		}
235
		return shapePathLabelPanel;
236
	}
237

  
238
	/**
239
	 * This method initializes onlineResourceLabelPanel	
240
	 * 	
241
	 * @return javax.swing.JPanel	
242
	 */
243
	private JPanel getOnlineResourceLabelPanel() {
244
		if (onlineResourceLabelPanel == null) {
245
			FlowLayout flowLayout4 = new FlowLayout();
246
			flowLayout4.setAlignment(java.awt.FlowLayout.LEFT);
247
			lbOnlineResource = new JLabel();
248
			lbOnlineResource.setText(PluginServices.getText(this, "onlineResource"));
249
			onlineResourceLabelPanel = new JPanel();
250
			onlineResourceLabelPanel.setLayout(flowLayout4);
251
			onlineResourceLabelPanel.setPreferredSize(new Dimension(lbWIDTH,lbHEIGHT + 5));
252
			onlineResourceLabelPanel.add(lbOnlineResource, null);
253
		}
254
		return onlineResourceLabelPanel;
255
	}
256

  
257
	/**
258
	 * This method initializes mapFileTextPanel	
259
	 * 	
260
	 * @return javax.swing.JPanel	
261
	 */
262
	private JPanel getMapFileTextPanel() {
263
		if (mapFileTextPanel == null) {
264
			mapFileTextPanel = new JPanel();
265
			mapFileTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
266
			mapFileTextPanel.add(getTbMapFile(), null);
267
		}
268
		return mapFileTextPanel;
269
	}
270

  
271
	/**
272
	 * This method initializes symbolsTextPanel	
273
	 * 	
274
	 * @return javax.swing.JPanel	
275
	 */
276
	private JPanel getSymbolsTextPanel() {
277
		if (symbolsTextPanel == null) {
278
			symbolsTextPanel = new JPanel();
279
			symbolsTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
280
			symbolsTextPanel.add(getTbSymbols(), null);
281
		}
282
		return symbolsTextPanel;
283
	}
284

  
285
	/**
286
	 * This method initializes fontsTextPanel	
287
	 * 	
288
	 * @return javax.swing.JPanel	
289
	 */
290
	private JPanel getFontsTextPanel() {
291
		if (fontsTextPanel == null) {
292
			fontsTextPanel = new JPanel();
293
			fontsTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
294
			fontsTextPanel.add(getTbFonts(), null);
295
		}
296
		return fontsTextPanel;
297
	}
298

  
299
	/**
300
	 * This method initializes shapePathTextPanel	
301
	 * 	
302
	 * @return javax.swing.JPanel	
303
	 */
304
	private JPanel getShapePathTextPanel() {
305
		if (shapePathTextPanel == null) {
306
			shapePathTextPanel = new JPanel();
307
			shapePathTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
308
			shapePathTextPanel.add(getTbShapePath(), null);
309
		}
310
		return shapePathTextPanel;
311
	}
312

  
313
	/**
314
	 * This method initializes onlineResourceTextPanel	
315
	 * 	
316
	 * @return javax.swing.JPanel	
317
	 */
318
	private JPanel getOnlineResourceTextPanel() {
319
		if (onlineResourceTextPanel == null) {
320
			onlineResourceTextPanel = new JPanel();
321
			onlineResourceTextPanel.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT + 5));
322
			onlineResourceTextPanel.add(getTbOnlineResource(), null);
323
		}
324
		return onlineResourceTextPanel;
325
	}
326

  
327
	/**
328
	 * This method initializes tbMapFile	
329
	 * 	
330
	 * @return javax.swing.JTextField	
331
	 */
332
	private JTextField getTbMapFile() {
333
		if (tbMapFile == null) {
334
			tbMapFile = new JTextField();
335
			tbMapFile.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
336
		}
337
		return tbMapFile;
338
	}
339

  
340
	/**
341
	 * This method initializes tbSymbols	
342
	 * 	
343
	 * @return javax.swing.JTextField	
344
	 */
345
	private JTextField getTbSymbols() {
346
		if (tbSymbols == null) {
347
			tbSymbols = new JTextField();
348
			tbSymbols.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
349
		}
350
		return tbSymbols;
351
	}
352

  
353
	/**
354
	 * This method initializes tbFonts	
355
	 * 	
356
	 * @return javax.swing.JTextField	
357
	 */
358
	private JTextField getTbFonts() {
359
		if (tbFonts == null) {
360
			tbFonts = new JTextField();
361
			tbFonts.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
362
		}
363
		return tbFonts;
364
	}
365

  
366
	/**
367
	 * This method initializes tbShapePath	
368
	 * 	
369
	 * @return javax.swing.JTextField	
370
	 */
371
	private JTextField getTbShapePath() {
372
		if (tbShapePath == null) {
373
			tbShapePath = new JTextField();
374
			tbShapePath.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
375
		}
376
		return tbShapePath;
377
	}
378

  
379
	/**
380
	 * This method initializes tbOnlineResource	
381
	 * 	
382
	 * @return javax.swing.JTextField	
383
	 */
384
	private JTextField getTbOnlineResource() {
385
		if (tbOnlineResource == null) {
386
			tbOnlineResource = new JTextField();
387
			tbOnlineResource.setPreferredSize(new Dimension(tbWIDTH,tbHEIGHT));
388
		}
389
		return tbOnlineResource;
390
	}
391

  
392
	/*
393
	 *  (non-Javadoc)
394
	 * @see com.iver.cit.gvsig.publish.servers.ServicePanel#getProperties()
395
	 */
396
	public Properties getProperties() {
397
		Properties properties = new Properties();
398
		properties.put(MapServer.WMS_MAPFILE,getTbMapFile().getText());
399
		properties.put(MapServer.WMS_SYMBOLS,getTbSymbols().getText());
400
		properties.put(MapServer.WMS_FONTS,getTbFonts().getText());
401
		properties.put(MapServer.WMS_SHAPEPATH,getTbShapePath().getText());
402
		properties.put(MapServer.WMS_ONLINERESOURCE,getTbOnlineResource().getText());
403
		return properties;
404
	}
405

  
54 406
}

Also available in: Unified diff