Revision 11384 trunk/extensions/extRasterTools-SE/src/org/gvsig/rastertools/cutting/ui/CuttingPanel.java

View differences:

CuttingPanel.java
22 22
import java.awt.Dimension;
23 23
import java.awt.GridBagConstraints;
24 24
import java.awt.GridBagLayout;
25
import java.awt.Insets;
25 26
import java.io.File;
26 27
import java.util.ArrayList;
27 28

  
28
import javax.swing.ImageIcon;
29 29
import javax.swing.JCheckBox;
30 30
import javax.swing.JLabel;
31 31
import javax.swing.JPanel;
32
import javax.swing.JTabbedPane;
33
import javax.swing.JTextField;
32 34

  
33 35
import org.gvsig.fmap.layers.FLyrRasterSE;
34 36
import org.gvsig.gui.beans.buttonbar.ButtonBarContainer;
......
70 72
	private ButtonBarContainer			buttonBarContainer = null;
71 73
	private JPanel									pSelection = null;
72 74
	private TableContainer					tSelection = null;
73
	private JPanel									pCheck = null;
74 75
	private JCheckBox								jCheckBox = null;
76
	private JCheckBox								jCheckLoadLayerInToc = null;
77
	private JCheckBox								jCheckSaveFile = null;
75 78
	private ResolutionPanel					pResolution = null;
76 79
	private CuttingDialog						cuttingDialog = null;
80
	private JPanel									jOptions = null;
81
	private JPanel									jPNameFile = null;
82
	private JTextField							filenameTextField = null;
77 83

  
84
	private JTabbedPane							jTabbedPane1 = null;
85

  
78 86
	FLayer fLayer = null;
79 87

  
80 88
	/**
......
111 119
	 * 
112 120
	 */
113 121
	public CuttingPanel(CuttingDialog cuttingDialog) {
114
		super(ButtonsPanel.BUTTONS_NONE);
115
		this.getButtonsPanel().addSave();
116
		this.getButtonsPanel().addApply();
117
		this.getButtonsPanel().addCancel();
122
		super(ButtonsPanel.BUTTONS_ACCEPTCANCELAPPLY);
118 123

  
119 124
		this.cuttingDialog = cuttingDialog;
120 125
		initialize();
......
147 152
	
148 153
		getButtonBarContainer().getButton(0).addActionListener(cuttingPanelListener);
149 154
		getButtonBarContainer().getButton(1).addActionListener(cuttingPanelListener);
150
		getButtonBarContainer().getButton(2).addActionListener(cuttingPanelListener);
151 155

  
152 156
		this.addButtonPressedListener(cuttingPanelListener);
153 157
	}
......
261 265
		m_MapControl.setTool("cutRaster");
262 266
	}
263 267
	
264
	
265 268
	/**
266 269
	 * This method initializes this
267
	 * 
268 270
	 */
269 271
	private void initialize() {
272
		jTabbedPane1 = new JTabbedPane();
273
		
270 274
		GridBagConstraints gridBagConstraints = new GridBagConstraints();
271 275
		gridBagConstraints.gridx = 0;
272 276
		gridBagConstraints.gridy = 0;
......
276 280
		GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
277 281
		gridBagConstraints2.gridx = 0;
278 282
		gridBagConstraints2.gridy = 2;
279
		GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
280
		gridBagConstraints3.gridx = 0;
281
		gridBagConstraints3.gridy = 3;
282
		GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
283
		gridBagConstraints4.gridx = 0;
284
		gridBagConstraints4.gridy = 4;
285
		GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
286
		gridBagConstraints5.gridx = 0;
287
		gridBagConstraints5.gridy = 5;
288
		this.setLayout(new GridBagLayout());
289
		this.add(getCoor_pixel(), gridBagConstraints);
290
		this.add(getCoor_reales(), gridBagConstraints1);
291
		this.add(getButtonBarContainer(), gridBagConstraints2);
292
		this.add(getPResolution(), gridBagConstraints3);
293
		this.add(getPSelection(), gridBagConstraints4);
294
		this.add(getPCheck(), gridBagConstraints5);
295
		getButtonsPanel().getButton(ButtonsPanel.BUTTON_SAVE).setEnabled(false);
283
		gridBagConstraints2.insets = new java.awt.Insets(5, 0, 0, 0);
284

  
285
		JPanel jpanel1 = new JPanel();
286
		jpanel1.setLayout(new GridBagLayout());
287
		jpanel1.add(getCoor_pixel(), gridBagConstraints);
288
		jpanel1.add(getCoor_reales(), gridBagConstraints1);
289
		jpanel1.add(getButtonBarContainer(), gridBagConstraints2);
290

  
291
		jTabbedPane1.addTab(PluginServices.getText(this, "coordenadas_recorte"), jpanel1);
292
		jTabbedPane1.addTab(PluginServices.getText(this, "resolucion_espacial"), getPResolution());
293
		jTabbedPane1.addTab(PluginServices.getText(this, "seleccion_bandas"), getPSelection());
294
		jTabbedPane1.addTab(PluginServices.getText(this, "otras_opciones"), getJOptions());
295

  
296
		this.setLayout(new BorderLayout());
297
		this.add(jTabbedPane1, BorderLayout.CENTER);
296 298
	}
297 299

  
298 300
	/*
......
349 351
			buttonBarContainer.setPreferredSize(new java.awt.Dimension(wPanel - 4, 32));
350 352
			buttonBarContainer.addButton("fullExtent.png", PluginServices.getText(this, "fullExtent"), 0);
351 353
			buttonBarContainer.addButton("selectTool.png", PluginServices.getText(this, "select_tool"), 1);
352
			buttonBarContainer.addButton("down.png", PluginServices.getText(this, "expandir"), 2);
353 354
			buttonBarContainer.setButtonAlignment("right");
354
			buttonBarContainer.setComponentBorder(true);
355
			buttonBarContainer.setComponentBorder(false);
355 356
		}
356 357
		return buttonBarContainer;
357 358
	}
......
380 381
			pSelection = new JPanel();
381 382
			pSelection.setLayout(new BorderLayout());
382 383
			pSelection.setPreferredSize(new java.awt.Dimension(wPanel, 120));
383
			pSelection.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "seleccion_bandas"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Dialog", java.awt.Font.PLAIN, 10), null));
384 384
			pSelection.add(getTSelection(), BorderLayout.CENTER);
385 385
			
386 386
		}
......
409 409
	 * 	
410 410
	 * @return javax.swing.JPanel	
411 411
	 */
412
	private JPanel getPCheck() {
413
		if (pCheck == null) {
414
			JLabel jLabel = new JLabel();
415
			jLabel.setText(PluginServices.getText(this, "crear_1_capa_por_banda"));
416
			pCheck = new JPanel();
417
			pCheck.setLayout(new BorderLayout());
418
			pCheck.setPreferredSize(new Dimension(410 - 10, 30));
419
			pCheck.add(getCbOneLyrPerBand(), java.awt.BorderLayout.WEST);
420
			pCheck.add(jLabel, java.awt.BorderLayout.CENTER);
412
	private JPanel getJOptions() {
413
		if (jOptions == null) {
414
			jOptions = new JPanel();
415
			jOptions.setLayout(new GridBagLayout());
416
			jOptions.add(getJPNameFile(), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
417
	        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
418
	        new Insets(0, 0, 5, 5), 0, 0));
419
			jOptions.add(getCbOneLyrPerBand(), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
420
	        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
421
	        new Insets(0, 0, 5, 5), 0, 0));
422
			jOptions.add(getCbSaveFile(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
423
	        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
424
	        new Insets(0, 0, 5, 5), 0, 0));
425
			jOptions.add(getCbLoadLayerInToc(), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
426
	        GridBagConstraints.CENTER, GridBagConstraints.BOTH,
427
	        new Insets(0, 0, 5, 5), 0, 0));
428
			jOptions.setPreferredSize(new java.awt.Dimension(wPanel, 135));
421 429
		}
422
		return pCheck;
430
		return jOptions;
423 431
	}
424 432
	
433
	private JPanel getJPNameFile() {
434
		if (jPNameFile == null) {
435
			jPNameFile = new JPanel();
436
			jPNameFile.add(new JLabel(PluginServices.getText(this, "nombre_capas") + ":"));
437
			jPNameFile.add(getFilenameTextField());
438
		}
439
		return jPNameFile;
440
	}
425 441

  
442
	public JTextField getFilenameTextField() {
443
		if (filenameTextField == null) {
444
			filenameTextField = new JTextField();
445
			filenameTextField.setText("cutlayer");
446
			filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height));
447
		}
448
		return filenameTextField;
449
	}
450
	
451
	public JCheckBox getCbSaveFile() {
452
		if (jCheckSaveFile == null) {
453
			jCheckSaveFile = new JCheckBox();
454
			jCheckSaveFile.setText(PluginServices.getText(this, "guardar_en_disco"));
455
		}
456
		return jCheckSaveFile;
457
	}
426 458
	/**
427 459
	 * This method initializes jCheckBox1	
428 460
	 * 	
......
431 463
	public JCheckBox getCbOneLyrPerBand() {
432 464
		if (jCheckBox == null) {
433 465
			jCheckBox = new JCheckBox();
466
			jCheckBox.setText(PluginServices.getText(this, "crear_1_capa_por_banda"));
434 467
		}
435 468
		return jCheckBox;
436 469
	}
437 470
	
471
	public JCheckBox getCbLoadLayerInToc() {
472
		if (jCheckLoadLayerInToc == null) {
473
			jCheckLoadLayerInToc = new JCheckBox();
474
			jCheckLoadLayerInToc.setText(PluginServices.getText(this, "cargar_en_toc"));
475
		}
476
		return jCheckLoadLayerInToc;
477
	}
478
	
438 479
	/**
439 480
	 * Expande o contrae el panel inferior seg?n el estado en el que se encuentre.
440
	 *
441 481
	 */
482
/*
442 483
	public void showExtrasForPanel(boolean contract) {
443 484
		this.getPResolution().setVisible(contract);
444 485
		this.getPSelection().setVisible(contract);
445
		this.getPCheck().setVisible(contract);
486
		this.getJOptions().setVisible(contract);
446 487

  
447 488
		wPanel = PluginServices.getMDIManager().getWindowInfo(getCuttingDialog()).getWidth();
448

  
449
		int minHeight = getCoor_pixel().getHeight() + getCoor_reales().getHeight() + getButtonBarContainer().getHeight() + getButtonsPanel().getHeight() + 40;
450
		int maxHeight = minHeight + getPResolution().getHeight() + getPSelection().getHeight() + getPCheck().getHeight();
489
		
490
		int minHeight = getCoor_pixel().getHeight() + getCoor_reales().getHeight() + getButtonBarContainer().getHeight() + getButtonsPanel().getHeight() + 49;
491
		int maxHeight = minHeight + getPResolution().getHeight() + getPSelection().getHeight() + getJOptions().getHeight();
451 492
		if (contract) {
452 493
			PluginServices.getMDIManager().getWindowInfo(getCuttingDialog()).setWidth(wPanel);
453 494
			PluginServices.getMDIManager().getWindowInfo(getCuttingDialog()).setHeight(maxHeight);
......
462 503
		}
463 504
		this.validate();
464 505
	}
465
	
506
*/
466 507
	/**
467 508
	 * Asigna el valor del campo "Ancho" a partir del double que lo representa
468 509
	 * y con el n?mero de decimales que se especifica en el par?metro dec
......
677 718
	public String getLastTool() {
678 719
		return lastTool;
679 720
	}
721
	
722
	public String getViewName() {
723
		return viewName;
724
	}
680 725
}

Also available in: Unified diff