Revision 6828

View differences:

trunk/applications/appgvSIG/config/text.properties
14 14
Aceptar=Aceptar
15 15
activar=Activar
16 16
add_rows=A?adir filas
17
add_delete_edit_fields=Puede a?adir, borrar o renombrar los campos
17 18
Ajustar_cobertura_wcs=Ajustar cobertura WCS
18 19
Ajustar_transparencia=Ajustar Transparencia
19 20
Al_leer_la_leyenda=Al leer la leyenda
......
81 82
Cuadrado=Cuadrado
82 83
DGNFiles=Ficheros .DGN
83 84
Dado_un_campo_de_atributos=Dado un campo de atributos
85
delete_field=Borrar Campo
84 86
Derecha=Derecha
85 87
Derecho=Derecho
86 88
Descripcion=Descripci\u00F3n
......
128 130
Examinar=Examinar
129 131
Extent=Extent
130 132
Fichero=Fichero
133
field_manager=Editor de campos
131 134
Font=Fuente
132 135
Formato=Formato
133 136
Formato_de_numero_erroneo=Formato de n\u00FAmero incorrecto
......
224 227
Rasterfiles=Ficheros r\u00E1ster
225 228
Recuperar_leyenda=Recuperar leyenda
226 229
Recuperar_y_eliminar_otros_zoom=Recuperar y eliminar otros zooms
230
rename_field=Renombrar Campo
227 231
S\u00EDmbolo=S\u00EDmbolo
228 232
Salir=Salir
229 233
Sample=Ejemplo
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/dialogs/DlgFieldManager.java
77 77
public class DlgFieldManager extends JPanel implements View {
78 78

  
79 79
	/**
80
	 * 
80
	 *
81 81
	 */
82 82
	private static final long serialVersionUID = -4284879326692474318L;
83 83

  
......
98 98
	private JButton jBtnOK = null;
99 99

  
100 100
	private JButton jBtnCancel = null;
101
	
101

  
102 102
	private FPanelCreateField panelNewField = new FPanelCreateField();
103 103

  
104 104
	// private IFieldManager fieldManager;;
......
175 175
					return new Integer(aux.getFieldDecimalCount());
176 176
				case 4:
177 177
					return aux.getDefaultValue();
178
					
178

  
179 179
				}
180 180
			} catch (DriverLoadException e) {
181 181
				e.printStackTrace();
......
201 201
				return PluginServices.getText(this, "FieldDecimalCount");
202 202
			case 4:
203 203
				return PluginServices.getText(this, "FieldDefaultValue");
204
				
204

  
205 205
			}
206 206
			return super.getColumnName(column);
207 207
		}
......
255 255

  
256 256
	/**
257 257
	 * This method initializes
258
	 * 
258
	 *
259 259
	 */
260 260
	public DlgFieldManager(IEditableSource ies) {
261 261
		super();
......
289 289

  
290 290
	/**
291 291
	 * This method initializes this
292
	 * 
292
	 *
293 293
	 */
294 294
	private void initialize() {
295 295
		jLabel = new JLabel();
296 296
		jLabel.setBounds(new java.awt.Rectangle(14, 9, 361, 34));
297
		jLabel.setText("Puede a?adir, borrar o renombrar los campos:");
297
		jLabel.setText(PluginServices.getText(this, "add_delete_edit_fields")+": ");
298 298
		this.setLayout(null);
299 299
		this.setSize(new java.awt.Dimension(462,327));
300 300
		this.add(jLabel, null);
......
311 311
		if (viewInfo == null) {
312 312
			viewInfo = new ViewInfo(ViewInfo.MODALDIALOG | ViewInfo.PALETTE
313 313
					| ViewInfo.RESIZABLE);
314
			viewInfo.setTitle(PluginServices.getText(this, "field_manager"));
314 315
		}
315 316
		return viewInfo;
316 317
	}
......
318 319
	/**
319 320
	 * Convierte lo que hay en la tabla en una definici?n de campos adecuada
320 321
	 * para crear un LayerDefinition
321
	 * 
322
	 *
322 323
	 * @return
323 324
	 */
324 325
	public FieldDescription[] getFieldsDescription() {
......
353 354

  
354 355
	/**
355 356
	 * This method initializes jScrollPane
356
	 * 
357
	 *
357 358
	 * @return javax.swing.JScrollPane
358 359
	 */
359 360
	private JScrollPane getJScrollPane() {
......
367 368

  
368 369
	/**
369 370
	 * This method initializes jTableFields
370
	 * 
371
	 *
371 372
	 * @return javax.swing.JTable
372 373
	 */
373 374
	private JTable getJTableFields() {
......
400 401
					{
401 402
						getJBtnRenameField().setEnabled(true);
402 403
					}
403
						
404

  
404 405
				}
405 406
			});
406 407

  
......
410 411

  
411 412
	/**
412 413
	 * This method initializes jBtnNewField
413
	 * 
414
	 *
414 415
	 * @return javax.swing.JButton
415 416
	 */
416 417
	private JButton getJBtnNewField() {
......
419 420
			jBtnNewField.setBounds(new java.awt.Rectangle(332,60,118,25));
420 421
			jBtnNewField.setText(PluginServices.getText(this, "New Field"));
421 422
			jBtnNewField.addActionListener(new java.awt.event.ActionListener() {
422
				public void actionPerformed(java.awt.event.ActionEvent e) {					
423
										
423
				public void actionPerformed(java.awt.event.ActionEvent e) {
424

  
424 425
					ActionListener okAction;
425 426
					okAction = new java.awt.event.ActionListener() {
426 427
						public void actionPerformed(java.awt.event.ActionEvent e){
......
435 436
								}
436 437
								edAdapter.addField(fld);
437 438
								jTableFields.revalidate();
438
								PluginServices.getMDIManager().closeView(panelNewField);								
439
								PluginServices.getMDIManager().closeView(panelNewField);
439 440
							} catch (EditionException e1) {
440 441
								NotificationManager.addError(e1);
441 442
							} catch (ParseException e2) {
......
446 447
								NotificationManager.addError(e3);
447 448
							}
448 449

  
449
							
450

  
450 451
						}
451 452
					};
452 453
					panelNewField.setOkAction(okAction);
......
459 460

  
460 461
	/**
461 462
	 * This method initializes jButton
462
	 * 
463
	 *
463 464
	 * @return javax.swing.JButton
464 465
	 */
465 466
	private JButton getJButton() {
466 467
		if (jBtnDeleteField == null) {
467 468
			jBtnDeleteField = new JButton();
468 469
			jBtnDeleteField.setBounds(new java.awt.Rectangle(332,90,118,25));
469
			jBtnDeleteField.setText("Delete Field");
470
			jBtnDeleteField.setText(PluginServices.getText(this, "delete_field"));
470 471
			jBtnDeleteField
471 472
					.addActionListener(new java.awt.event.ActionListener() {
472 473
						public void actionPerformed(java.awt.event.ActionEvent e) {
473 474
							int[] selecteds = jTableFields.getSelectedRows();
474 475
							TableModel tm = jTableFields.getModel();
475
							
476 476

  
477

  
477 478
							for (int i = selecteds.length - 1; i >= 0; i--)
478 479
							{
479 480
								String fieldName = (String) tm.getValueAt(selecteds[i],0);
......
494 495

  
495 496
	/**
496 497
	 * This method initializes jBtnRenameField
497
	 * 
498
	 *
498 499
	 * @return javax.swing.JButton
499 500
	 */
500 501
	private JButton getJBtnRenameField() {
......
502 503
			jBtnRenameField = new JButton();
503 504
			jBtnRenameField
504 505
					.setBounds(new java.awt.Rectangle(332,120,118,25));
505
			jBtnRenameField.setText("Rename Field...");
506
			jBtnRenameField.setText(PluginServices.getText(this, "rename_field") +"...");
506 507
			jBtnRenameField.addActionListener(new java.awt.event.ActionListener() {
507 508
				public void actionPerformed(java.awt.event.ActionEvent e) {
508 509
					int[] selecteds = jTableFields.getSelectedRows();
509 510
					TableModel tm = jTableFields.getModel();
510
					
511 511

  
512

  
512 513
					for (int i = selecteds.length - 1; i >= 0; i--)
513 514
					{
514 515
						String fieldName = (String) tm.getValueAt(selecteds[i],0);
515 516
						try {
516 517
							String newName = JOptionPane.showInputDialog(
517
									(Component) PluginServices.getMDIManager().getActiveView(), 
518
									(Component) PluginServices.getMDIManager().getActiveView(),
518 519
									PluginServices.getText(this, "please_insert_new_field_name"),
519 520
									fieldName
520 521
									);
......
526 527
										PluginServices.getText(this, "field_already_exists"));
527 528
								return;
528 529
							}
529
							
530 530

  
531

  
531 532
							edAdapter.renameField(fieldName, newName);
532 533
						} catch (EditionException e1) {
533 534
							// TODO Auto-generated catch block
......
541 542
						}
542 543
					}
543 544
					jTableFields.repaint();
544
					
545

  
545 546
				}
546 547
			});
547 548
		}
......
550 551

  
551 552
	/**
552 553
	 * This method initializes jBtnOK
553
	 * 
554
	 *
554 555
	 * @return javax.swing.JButton
555 556
	 */
556 557
	private JButton getJBtnOK() {
557 558
		if (jBtnOK == null) {
558 559
			jBtnOK = new JButton();
559 560
			jBtnOK.setBounds(new java.awt.Rectangle(134,278,91,23));
560
			jBtnOK.setText("Aceptar");
561
			jBtnOK.setText(PluginServices.getText(this, "aceptar"));
561 562
			jBtnOK.addActionListener(new java.awt.event.ActionListener() {
562 563
				public void actionPerformed(java.awt.event.ActionEvent e) {
563 564
					PluginServices.getMDIManager().closeView(DlgFieldManager.this);
......
569 570

  
570 571
	/**
571 572
	 * This method initializes jButton
572
	 * 
573
	 *
573 574
	 * @return javax.swing.JButton
574 575
	 */
575 576
	private JButton getJButton2() {
576 577
		if (jBtnCancel == null) {
577 578
			jBtnCancel = new JButton();
578 579
			jBtnCancel.setBounds(new java.awt.Rectangle(239,278,91,23));
579
			jBtnCancel.setText("Cancelar");
580
			jBtnCancel.setText(PluginServices.getText(this, "cancelar"));
580 581
			jBtnCancel.addActionListener(new java.awt.event.ActionListener() {
581 582
				public void actionPerformed(java.awt.event.ActionEvent e) {
582 583
					PluginServices.getMDIManager().closeView(DlgFieldManager.this);
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/panels/FPanelCreateField.java
60 60
import com.iver.andami.ui.mdiManager.View;
61 61
import com.iver.andami.ui.mdiManager.ViewInfo;
62 62
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
63
import java.awt.GridLayout;
63 64

  
64 65
public class FPanelCreateField extends JPanel implements View {
65 66

  
......
76 77
	private ViewInfo viewInfo;
77 78
	private JPanel jPanel = null;  //  @jve:decl-index=0:visual-constraint="299,27"
78 79
	private AcceptCancelPanel jPanelOkCancel = null;
80
	private JPanel jPnlFields = null;
79 81
	public FPanelCreateField() {
80 82
		super();
81 83
		// TODO Auto-generated constructor stub
......
104 106
		if (viewInfo == null)
105 107
		{
106 108
			viewInfo = new ViewInfo(ViewInfo.MODALDIALOG);
109
			viewInfo.setWidth(this.getWidth()+8);
110
			viewInfo.setHeight(this.getHeight());
111
			viewInfo.setTitle(PluginServices.getText(this, "field_properties"));
107 112
		}
108 113
		return viewInfo;
109 114
	}
110 115

  
111 116
	/**
112 117
	 * This method initializes this
113
	 * 
118
	 *
114 119
	 * @return void
115 120
	 */
116 121
	private void initialize() {
117
		
122

  
118 123
		this.setLayout(new BorderLayout());
119
		this.setSize(300, 250);
120
		this.setPreferredSize(new java.awt.Dimension(400,300));
124
		this.setSize(300, 210);
125
		this.setPreferredSize(new java.awt.Dimension(300,210));
121 126
		this.add(getJPanel(), java.awt.BorderLayout.CENTER);
122 127
		this.add(getJPanelOkCancel(), java.awt.BorderLayout.SOUTH);
123
		
128

  
124 129
	}
125 130

  
126 131
	/**
127
	 * This method initializes jTxtFieldName	
128
	 * 	
129
	 * @return javax.swing.JTextField	
132
	 * This method initializes jTxtFieldName
133
	 *
134
	 * @return javax.swing.JTextField
130 135
	 */
131 136
	private JTextField getJTxtFieldName() {
132 137
		if (jTxtFieldName == null) {
......
137 142
	}
138 143

  
139 144
	/**
140
	 * This method initializes jCboFieldType	
141
	 * 	
142
	 * @return javax.swing.JComboBox	
145
	 * This method initializes jCboFieldType
146
	 *
147
	 * @return javax.swing.JComboBox
143 148
	 */
144 149
	private JComboBox getJCboFieldType() {
145 150
		if (jCboFieldType == null) {
......
150 155
			jCboFieldType.addItem("Integer");
151 156
			jCboFieldType.addItem("Double");
152 157
			jCboFieldType.addItem("String");
153
			
158

  
154 159
			jCboFieldType.setSelectedIndex(4);
155 160
			jCboFieldType.addActionListener(new java.awt.event.ActionListener() {
156 161
				public void actionPerformed(java.awt.event.ActionEvent e) {
......
165 170
					}
166 171
					else
167 172
						getJTxtFieldLength().setEnabled(true);
168
					
173

  
169 174
				}
170 175
			});
171
			
176

  
172 177
		}
173 178
		return jCboFieldType;
174 179
	}
175 180

  
176 181
	/**
177
	 * This method initializes jTxtFieldLength	
178
	 * 	
179
	 * @return javax.swing.JTextField	
182
	 * This method initializes jTxtFieldLength
183
	 *
184
	 * @return javax.swing.JTextField
180 185
	 */
181 186
	private JTextField getJTxtFieldLength() {
182 187
		if (jTxtFieldLength == null) {
......
187 192
	}
188 193

  
189 194
	/**
190
	 * This method initializes jTxtFieldPrecision	
191
	 * 	
192
	 * @return javax.swing.JTextField	
195
	 * This method initializes jTxtFieldPrecision
196
	 *
197
	 * @return javax.swing.JTextField
193 198
	 */
194 199
	private JTextField getJTxtFieldPrecision() {
195 200
		if (jTxtFieldPrecision == null) {
......
201 206
	}
202 207

  
203 208
	/**
204
	 * This method initializes jTxtDefaultValue	
205
	 * 	
206
	 * @return javax.swing.JTextField	
209
	 * This method initializes jTxtDefaultValue
210
	 *
211
	 * @return javax.swing.JTextField
207 212
	 */
208 213
	private JTextField getJTxtDefaultValue() {
209 214
		if (jTxtDefaultValue == null) {
......
213 218
		return jTxtDefaultValue;
214 219
	}
215 220

  
216
	public FieldDescription getFieldDescription() throws ParseException 
221
	public FieldDescription getFieldDescription() throws ParseException
217 222
	{
218 223
		FieldDescription newField = new FieldDescription();
219 224
		newField.setFieldName(getJTxtFieldName().getText());
220 225
		String strType = (String) getJCboFieldType().getModel().getSelectedItem();
221 226
		int fieldType = FieldDescription.stringToType(strType);
222 227
		newField.setFieldType(fieldType);
223
		int fieldLength = Integer.parseInt(getJTxtFieldLength().getText());
224
		newField.setFieldLength(fieldLength);
228
		try {
229
			int fieldLength = Integer.parseInt(getJTxtFieldLength().getText());
230
			newField.setFieldLength(fieldLength);
231
		} catch (Exception e) {
232
			throw new ParseException(e.getMessage(), 0);
233
		}
234

  
225 235
		if (fieldType == Types.DOUBLE)
226 236
		{
227 237
			newField.setFieldDecimalCount(
......
230 240
		}
231 241
		else
232 242
			newField.setFieldDecimalCount(0);
233
		String defaultValue = getJTxtDefaultValue().getText(); 
243
		String defaultValue = getJTxtDefaultValue().getText();
234 244
		if (defaultValue != null)
235 245
		{
236
			
246

  
237 247
			if (defaultValue.compareTo("")==0)
238 248
				newField.setDefaultValue(ValueFactory.createNullValue());
239 249
			else
......
245 255

  
246 256
	public void setOkAction(ActionListener okAction) {
247 257
		getJPanelOkCancel().setOkButtonActionListener(okAction);
248
		
258

  
249 259
	}
250 260

  
251 261
	/**
252
	 * This method initializes jPanel	
253
	 * 	
254
	 * @return javax.swing.JPanel	
262
	 * This method initializes jPanel
263
	 *
264
	 * @return javax.swing.JPanel
255 265
	 */
256 266
	private JPanel getJPanel() {
257 267
		if (jPanel == null) {
258
			jLblDefaultValue = new JLabel();
259
			jLblDefaultValue.setBounds(new java.awt.Rectangle(14,163,125,22));
260
			jLblDefaultValue.setText("default_value");
261
			jLblFieldPrecision = new JLabel();
262
			jLblFieldPrecision.setBounds(new java.awt.Rectangle(14,126,112,22));
263
			jLblFieldPrecision.setText("precision");
264
			jLblFieldLength = new JLabel();
265
			jLblFieldLength.setBounds(new java.awt.Rectangle(14,89,99,22));
266
			jLblFieldLength.setText("field_length");
267
			jLblFieldType = new JLabel();
268
			jLblFieldType.setBounds(new java.awt.Rectangle(14,52,94,22));
269
			jLblFieldType.setText("field_type");
270
			jLblFieldName = new JLabel();
271
			jLblFieldName.setText("field_name");
272
			jLblFieldName.setBounds(new java.awt.Rectangle(14,15,99,22));
273
			
274 268
			jPanel = new JPanel();
275 269
			jPanel.setLayout(null);
276
			
277
			jPanel.add(jLblFieldName, null);
278
			jPanel.add(getJTxtFieldName(), null);
279
			jPanel.add(jLblFieldType, null);
280
			jPanel.add(getJCboFieldType(), null);
281
			jPanel.add(jLblFieldLength, null);
282
			jPanel.add(getJTxtFieldLength(), null);
283
			jPanel.add(jLblFieldPrecision, null);
284
			jPanel.add(getJTxtFieldPrecision(), null);
285
			jPanel.add(jLblDefaultValue, null);
286
			jPanel.add(getJTxtDefaultValue(), null);
287
			
270

  
271
			jPanel.add(getJPnlFields(), null);
288 272
		}
289 273
		return jPanel;
290 274
	}
291 275

  
292 276
	/**
293
	 * This method initializes jPanelOkCancel	
294
	 * 	
295
	 * @return javax.swing.JPanel	
277
	 * This method initializes jPanelOkCancel
278
	 *
279
	 * @return javax.swing.JPanel
296 280
	 */
297 281
	private AcceptCancelPanel getJPanelOkCancel() {
298 282
		if (jPanelOkCancel == null) {
......
301 285
				public void actionPerformed(java.awt.event.ActionEvent e) {
302 286
					PluginServices.getMDIManager().closeView(FPanelCreateField.this);
303 287
				};
304
			});	
288
			});
305 289
			jPanelOkCancel.setPreferredSize(new java.awt.Dimension(10,50));
306 290
		}
307 291
		return jPanelOkCancel;
308 292
	}
309 293

  
294
	/**
295
	 * This method initializes jPnlFields
296
	 *
297
	 * @return javax.swing.JPanel
298
	 */
299
	private JPanel getJPnlFields() {
300
		if (jPnlFields == null) {
301
			GridLayout gridLayout = new GridLayout();
302
			gridLayout.setRows(6);
303
			gridLayout.setVgap(3);
304
			gridLayout.setHgap(5);
305
			gridLayout.setColumns(2);
306
			jPnlFields = new JPanel();
307
			jPnlFields.setLayout(gridLayout);
308
			jPnlFields.setBounds(new java.awt.Rectangle(5,12,290,142));
309
			jLblDefaultValue = new JLabel();
310
			jLblDefaultValue.setBounds(new java.awt.Rectangle(14,163,125,22));
311
			jLblDefaultValue.setText("default_value");
312
			jLblFieldPrecision = new JLabel();
313
			jLblFieldPrecision.setBounds(new java.awt.Rectangle(14,126,112,22));
314
			jLblFieldPrecision.setText("precision");
315
			jLblFieldLength = new JLabel();
316
			jLblFieldLength.setBounds(new java.awt.Rectangle(14,89,99,22));
317
			jLblFieldLength.setText("field_length");
318
			jLblFieldType = new JLabel();
319
			jLblFieldType.setBounds(new java.awt.Rectangle(14,52,94,22));
320
			jLblFieldType.setText("field_type");
321
			jLblFieldName = new JLabel();
322
			jLblFieldName.setText("field_name");
323
			jLblFieldName.setBounds(new java.awt.Rectangle(14,15,99,22));
324
			jPnlFields.add(jLblFieldName, null);
325
			jPnlFields.add(getJTxtFieldName(), null);
326
			jPnlFields.add(jLblFieldType, null);
327
			jPnlFields.add(getJCboFieldType(), null);
328
			jPnlFields.add(jLblFieldLength, null);
329
			jPnlFields.add(getJTxtFieldLength(), null);
330
			jPnlFields.add(jLblFieldPrecision, null);
331
			jPnlFields.add(getJTxtFieldPrecision(), null);
332
			jPnlFields.add(jLblDefaultValue, null);
333
			jPnlFields.add(getJTxtDefaultValue(), null);
334
		}
335
		return jPnlFields;
336
	}
337

  
310 338
}  //  @jve:decl-index=0:visual-constraint="9,10"

Also available in: Unified diff