Revision 596 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/FThemePropertiesDialog.java

View differences:

FThemePropertiesDialog.java
6 6
 */
7 7
package com.iver.cit.gvsig.gui;
8 8

  
9
import javax.swing.JPanel;
9
import com.hardcode.driverManager.DriverLoadException;
10 10

  
11
import com.hardcode.gdbms.engine.data.DataSource;
12
import com.hardcode.gdbms.engine.data.DriverException;
13

  
14
import com.iver.andami.PluginServices;
15
import com.iver.andami.Utilities;
16
import com.iver.andami.messages.NotificationManager;
17
import com.iver.andami.ui.mdiManager.View;
18
import com.iver.andami.ui.mdiManager.ViewInfo;
19

  
11 20
import com.iver.cit.gvsig.fmap.layers.FLayer;
12
import com.iver.mdiApp.App;
13
import com.iver.mdiApp.Utilities;
14
import com.iver.mdiApp.ui.MDIManager.View;
15
import com.iver.mdiApp.ui.MDIManager.ViewInfo;
21
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
16 22

  
23
import javax.swing.JPanel;
24

  
25

  
17 26
/**
18 27
 * Di?logo de propiedades del tema.
19
 * 
28
 *
20 29
 * @author Vicente Caballero Navarro
21
 *
22 30
 */
23 31
public class FThemePropertiesDialog extends JPanel implements View {
24

  
25 32
	private javax.swing.JPanel jContentPane = null;
26

  
27 33
	private javax.swing.JTabbedPane jTabbedPane = null;
28 34
	private javax.swing.JPanel phiperenlace = null;
29 35
	private javax.swing.JPanel phnorte = null;
......
37 43
	private javax.swing.JButton bcancelar = null;
38 44
	private javax.swing.JPanel pvisualizacion = null;
39 45
	private FLayer m_layer;
40
	
41 46
	private javax.swing.JPanel pvnorte = null;
42 47
	private javax.swing.JPanel pvsur = null;
43 48
	private javax.swing.JLabel jLabel2 = null;
44 49
	private javax.swing.JLabel jLabel3 = null;
45 50
	private javax.swing.JTextField jTextField = null;
46 51
	private javax.swing.JTextField jTextField1 = null;
47
	
48 52
	private com.iver.cit.gvsig.gui.View view;
49
	private ViewInfo m_viewinfo=null;
53

  
50 54
	/**
51 55
	 * This is the default constructor
56
	 *
57
	 * @param layer DOCUMENT ME!
58
	 * @param view DOCUMENT ME!
52 59
	 */
53 60
	public FThemePropertiesDialog(FLayer layer, com.iver.cit.gvsig.gui.View view) {
54 61
		super();
55 62
		this.view = view;
63

  
56 64
		//this.setTitle("Propiedades del Tema");
57 65
		//this.setModal(true);
58
		m_layer=layer;
66
		m_layer = layer;
59 67
		initialize();
60
		
61 68
	}
69

  
62 70
	/**
63 71
	 * This method initializes this
64
	 * 
65
	 * @return void
66 72
	 */
67 73
	private void initialize() {
68 74
		this.setSize(290, 130);
69 75
		this.add(getJContentPane());
70 76
	}
77

  
71 78
	/**
72 79
	 * This method initializes jContentPane
73
	 * 
80
	 *
74 81
	 * @return javax.swing.JPanel
75 82
	 */
76 83
	private javax.swing.JPanel getJContentPane() {
......
80 87
			jContentPane.add(getJTabbedPane(), java.awt.BorderLayout.CENTER);
81 88
			jContentPane.add(getPbotones(), java.awt.BorderLayout.SOUTH);
82 89
		}
90

  
83 91
		return jContentPane;
84 92
	}
93

  
85 94
	/**
86 95
	 * This method initializes jTabbedPane
87
	 * 
96
	 *
88 97
	 * @return javax.swing.JTabbedPane
89 98
	 */
90 99
	private javax.swing.JTabbedPane getJTabbedPane() {
91
		if(jTabbedPane == null) {
100
		if (jTabbedPane == null) {
92 101
			jTabbedPane = new javax.swing.JTabbedPane();
93
			jTabbedPane.addTab(Utilities.getMessage(this,"Hiperenlace"), null, getPhiperenlace(), null);
94
			jTabbedPane.addTab(Utilities.getMessage(this,"Visualizacion"), null, getPvisualizacion(), null);
102
			jTabbedPane.addTab(PluginServices.getText(this, "Hiperenlace"),
103
				null, getPhiperenlace(), null);
104
			jTabbedPane.addTab(PluginServices.getText(this, "Visualizacion"),
105
				null, getPvisualizacion(), null);
95 106
		}
107

  
96 108
		return jTabbedPane;
97 109
	}
110

  
98 111
	/**
99 112
	 * This method initializes phiperenlace
100
	 * 
113
	 *
101 114
	 * @return javax.swing.JPanel
102 115
	 */
103 116
	private javax.swing.JPanel getPhiperenlace() {
104
		if(phiperenlace == null) {
117
		if (phiperenlace == null) {
105 118
			phiperenlace = new javax.swing.JPanel();
106 119
			phiperenlace.setLayout(new java.awt.BorderLayout());
107 120
			phiperenlace.add(getPhnorte(), java.awt.BorderLayout.NORTH);
108 121
			phiperenlace.add(getPhsur(), java.awt.BorderLayout.SOUTH);
109 122
		}
123

  
110 124
		return phiperenlace;
111 125
	}
126

  
112 127
	/**
113 128
	 * This method initializes phnorte
114
	 * 
129
	 *
115 130
	 * @return javax.swing.JPanel
116 131
	 */
117 132
	private javax.swing.JPanel getPhnorte() {
118
		if(phnorte == null) {
133
		if (phnorte == null) {
119 134
			phnorte = new javax.swing.JPanel();
120 135
			phnorte.add(getJLabel(), null);
121 136
			phnorte.add(getJComboBox(), null);
122 137
		}
138

  
123 139
		return phnorte;
124 140
	}
141

  
125 142
	/**
126 143
	 * This method initializes phsur
127
	 * 
144
	 *
128 145
	 * @return javax.swing.JPanel
129 146
	 */
130 147
	private javax.swing.JPanel getPhsur() {
131
		if(phsur == null) {
148
		if (phsur == null) {
132 149
			phsur = new javax.swing.JPanel();
133 150
			phsur.add(getJLabel1(), null);
134 151
			phsur.add(getJComboBox1(), null);
135 152
		}
153

  
136 154
		return phsur;
137 155
	}
156

  
138 157
	/**
139 158
	 * This method initializes jLabel
140
	 * 
159
	 *
141 160
	 * @return javax.swing.JLabel
142 161
	 */
143 162
	private javax.swing.JLabel getJLabel() {
144
		if(jLabel == null) {
163
		if (jLabel == null) {
145 164
			jLabel = new javax.swing.JLabel();
146
			jLabel.setText(Utilities.getMessage(this,"Campo")+"   ");
165
			jLabel.setText(PluginServices.getText(this, "Campo") + "   ");
147 166
		}
167

  
148 168
		return jLabel;
149 169
	}
170

  
150 171
	/**
151 172
	 * This method initializes jComboBox
152
	 * 
173
	 *
153 174
	 * @return javax.swing.JComboBox
154 175
	 */
155 176
	private javax.swing.JComboBox getJComboBox() {
156
		if(jComboBox == null) {
157
			//if (m_layer instanceof FLyrShp){
158
			String [] names=new String[m_layer.getFieldsCount()];
159
			for (int i=0;i<m_layer.getFieldsCount();i++){
160
				names[i]=m_layer.getFieldName(i);
177
		if (jComboBox == null) {
178
			try {
179
				if (m_layer instanceof AlphanumericData) {
180
					AlphanumericData layer = (AlphanumericData) m_layer;
181
					DataSource ds;
182
					ds = layer.getRecordset();
183

  
184
					String[] names = new String[ds.getFieldCount()];
185

  
186
					for (int i = 0; i < ds.getFieldCount(); i++) {
187
						names[i] = ds.getFieldName(i);
188
					}
189

  
190
					jComboBox = new javax.swing.JComboBox(names);
191

  
192
					if (view.getSelectedField() != null) {
193
						jComboBox.setSelectedItem(view.getSelectedField());
194
					}
195
				}
196
			} catch (DriverLoadException e) {
197
				NotificationManager.addError("No se pudo obtener la tabla", e);
198
			} catch (DriverException e) {
199
				NotificationManager.addError("Error accediendo a los datos", e);
161 200
			}
162
			jComboBox = new javax.swing.JComboBox(names);
163
			if (view.getSelectedField()!=null){
164
				jComboBox.setSelectedItem(view.getSelectedField());
165
			}
166
		//}
167 201
		}
202

  
168 203
		return jComboBox;
169 204
	}
170
	
205

  
171 206
	/**
172 207
	 * This method initializes jLabel1
173
	 * 
208
	 *
174 209
	 * @return javax.swing.JLabel
175 210
	 */
176 211
	private javax.swing.JLabel getJLabel1() {
177
		if(jLabel1 == null) {
212
		if (jLabel1 == null) {
178 213
			jLabel1 = new javax.swing.JLabel();
179
			jLabel1.setText(Utilities.getMessage(this,"Accion_Predefinida")+"  ");
214
			jLabel1.setText(PluginServices.getText(this, "Accion_Predefinida") +
215
				"  ");
180 216
		}
217

  
181 218
		return jLabel1;
182 219
	}
220

  
183 221
	/**
184 222
	 * This method initializes jComboBox1
185
	 * 
223
	 *
186 224
	 * @return javax.swing.JComboBox
187 225
	 */
188 226
	private javax.swing.JComboBox getJComboBox1() {
189
		if(jComboBox1 == null) {
190
			
191
		String[] options=new String[1];
192
		options[0]=Utilities.getMessage(this,"Enlazar_a_ficheros_de_imagen");
193
		jComboBox1 = new javax.swing.JComboBox(options);
227
		if (jComboBox1 == null) {
228
			String[] options = new String[1];
229
			options[0] = PluginServices.getText(this,
230
					"Enlazar_a_ficheros_de_imagen");
231
			jComboBox1 = new javax.swing.JComboBox(options);
194 232
		}
233

  
195 234
		return jComboBox1;
196 235
	}
236

  
197 237
	/**
198 238
	 * This method initializes pbotones
199
	 * 
239
	 *
200 240
	 * @return javax.swing.JPanel
201 241
	 */
202 242
	private javax.swing.JPanel getPbotones() {
203
		if(pbotones == null) {
243
		if (pbotones == null) {
204 244
			pbotones = new javax.swing.JPanel();
205 245
			pbotones.add(getBaceptar(), null);
206 246
			pbotones.add(getBcancelar(), null);
207 247
		}
248

  
208 249
		return pbotones;
209 250
	}
251

  
210 252
	/**
211 253
	 * This method initializes baceptar
212
	 * 
254
	 *
213 255
	 * @return javax.swing.JButton
214 256
	 */
215 257
	private javax.swing.JButton getBaceptar() {
216
		if(baceptar == null) {
258
		if (baceptar == null) {
217 259
			baceptar = new javax.swing.JButton();
218
			baceptar.setText(Utilities.getMessage(this,"Aceptar"));
219
			baceptar.addActionListener(new java.awt.event.ActionListener() { 
220
				public void actionPerformed(java.awt.event.ActionEvent e) {    
221
					view.setSelectedField((jComboBox.getSelectedItem()).toString().trim());
222
					App.instance.getMDIContext().closeView(FThemePropertiesDialog.this);
223
				}
224
			});
260
			baceptar.setText(PluginServices.getText(this, "Aceptar"));
261
			baceptar.addActionListener(new java.awt.event.ActionListener() {
262
					public void actionPerformed(java.awt.event.ActionEvent e) {
263
						view.setSelectedField((jComboBox.getSelectedItem()).toString()
264
											   .trim());
265
						PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this);
266
					}
267
				});
225 268
		}
269

  
226 270
		return baceptar;
227 271
	}
272

  
228 273
	/**
229 274
	 * This method initializes bcancelar
230
	 * 
275
	 *
231 276
	 * @return javax.swing.JButton
232 277
	 */
233 278
	private javax.swing.JButton getBcancelar() {
234
		if(bcancelar == null) {
279
		if (bcancelar == null) {
235 280
			bcancelar = new javax.swing.JButton();
236
			bcancelar.setText(Utilities.getMessage(this,"Cancelar"));
237
			bcancelar.addActionListener(new java.awt.event.ActionListener() { 
238
				public void actionPerformed(java.awt.event.ActionEvent e) {    
239
//					View view =(View)App.instance.getMDIContext().getActiveView();
240
					//view.getMapControl().setTool(MapControl.);
241
					App.instance.getMDIContext().closeView(FThemePropertiesDialog.this);
242
				}
243
			});
281
			bcancelar.setText(PluginServices.getText(this, "Cancelar"));
282
			bcancelar.addActionListener(new java.awt.event.ActionListener() {
283
					public void actionPerformed(java.awt.event.ActionEvent e) {
284
						//					View view =(View)App.instance.getMDIContext().getActiveView();
285
						//view.getMapControl().setTool(MapControl.);
286
						PluginServices.getMDIManager().closeView(FThemePropertiesDialog.this);
287
					}
288
				});
244 289
		}
290

  
245 291
		return bcancelar;
246 292
	}
293

  
247 294
	/**
248 295
	 * This method initializes pvisualizacion
249
	 * 
296
	 *
250 297
	 * @return javax.swing.JPanel
251 298
	 */
252 299
	private javax.swing.JPanel getPvisualizacion() {
253
		if(pvisualizacion == null) {
300
		if (pvisualizacion == null) {
254 301
			pvisualizacion = new javax.swing.JPanel();
255 302
			pvisualizacion.setLayout(new java.awt.BorderLayout());
256 303
			pvisualizacion.add(getPvnorte(), java.awt.BorderLayout.NORTH);
257 304
			pvisualizacion.add(getPvsur(), java.awt.BorderLayout.SOUTH);
258 305
		}
306

  
259 307
		return pvisualizacion;
260 308
	}
309

  
261 310
	/**
262 311
	 * This method initializes pvnorte
263
	 * 
312
	 *
264 313
	 * @return javax.swing.JPanel
265 314
	 */
266 315
	private javax.swing.JPanel getPvnorte() {
267
		if(pvnorte == null) {
316
		if (pvnorte == null) {
268 317
			pvnorte = new javax.swing.JPanel();
269 318
			pvnorte.add(getJLabel2(), null);
270 319
			pvnorte.add(getJTextField(), null);
271 320
		}
321

  
272 322
		return pvnorte;
273 323
	}
324

  
274 325
	/**
275 326
	 * This method initializes pvsur
276
	 * 
327
	 *
277 328
	 * @return javax.swing.JPanel
278 329
	 */
279 330
	private javax.swing.JPanel getPvsur() {
280
		if(pvsur == null) {
331
		if (pvsur == null) {
281 332
			pvsur = new javax.swing.JPanel();
282 333
			pvsur.add(getJLabel3(), null);
283 334
			pvsur.add(getJTextField1(), null);
284 335
		}
336

  
285 337
		return pvsur;
286 338
	}
339

  
287 340
	/**
288 341
	 * This method initializes jLabel2
289
	 * 
342
	 *
290 343
	 * @return javax.swing.JLabel
291 344
	 */
292 345
	private javax.swing.JLabel getJLabel2() {
293
		if(jLabel2 == null) {
346
		if (jLabel2 == null) {
294 347
			jLabel2 = new javax.swing.JLabel();
295
			jLabel2.setText(Utilities.getMessage(this,"Escala_Minima")+"  ");
348
			jLabel2.setText(PluginServices.getText(this, "Escala_Minima") +
349
				"  ");
296 350
		}
351

  
297 352
		return jLabel2;
298 353
	}
354

  
299 355
	/**
300 356
	 * This method initializes jLabel3
301
	 * 
357
	 *
302 358
	 * @return javax.swing.JLabel
303 359
	 */
304 360
	private javax.swing.JLabel getJLabel3() {
305
		if(jLabel3 == null) {
361
		if (jLabel3 == null) {
306 362
			jLabel3 = new javax.swing.JLabel();
307
			jLabel3.setText(Utilities.getMessage(this,"Escala_Maxima")+"  ");
363
			jLabel3.setText(PluginServices.getText(this, "Escala_Maxima") +
364
				"  ");
308 365
		}
366

  
309 367
		return jLabel3;
310 368
	}
369

  
311 370
	/**
312 371
	 * This method initializes jTextField
313
	 * 
372
	 *
314 373
	 * @return javax.swing.JTextField
315 374
	 */
316 375
	private javax.swing.JTextField getJTextField() {
317
		if(jTextField == null) {
376
		if (jTextField == null) {
318 377
			jTextField = new javax.swing.JTextField();
319
			jTextField.setPreferredSize(new java.awt.Dimension(150,20));
378
			jTextField.setPreferredSize(new java.awt.Dimension(150, 20));
320 379
		}
380

  
321 381
		return jTextField;
322 382
	}
383

  
323 384
	/**
324 385
	 * This method initializes jTextField1
325
	 * 
386
	 *
326 387
	 * @return javax.swing.JTextField
327 388
	 */
328 389
	private javax.swing.JTextField getJTextField1() {
329
		if(jTextField1 == null) {
390
		if (jTextField1 == null) {
330 391
			jTextField1 = new javax.swing.JTextField();
331
			jTextField1.setPreferredSize(new java.awt.Dimension(150,20));
392
			jTextField1.setPreferredSize(new java.awt.Dimension(150, 20));
332 393
		}
394

  
333 395
		return jTextField1;
334 396
	}
397

  
335 398
	/* (non-Javadoc)
336 399
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
337 400
	 */
338 401
	public ViewInfo getViewInfo() {
339
		if (m_viewinfo==null){
340
	       	m_viewinfo=new ViewInfo();
341
		m_viewinfo.setFeatures(ViewInfo.MODALDIALOG);
342
		//vi.setResizable(false);
343
		m_viewinfo.setTitle(Utilities.getMessage(this,"propiedades_tema"));
344
		}
345
			return m_viewinfo;
346
		}
402
		ViewInfo m_viewinfo = new ViewInfo(ViewInfo.MODALDIALOG);
403
		m_viewinfo.setTitle(PluginServices.getText(this, "propiedades_tema"));
404

  
405
		return m_viewinfo;
406
	}
407

  
347 408
	/**
348 409
	 * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
349 410
	 */
350 411
	public void viewActivated() {
351 412
	}
352
}  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"
413
} //  @jve:visual-info  decl-index=0 visual-constraint="10,10"

Also available in: Unified diff