Revision 8783 branches/v10+Piloto/libraries/libCq_CMS_praster/src/org/cresques/ui/filter/RasterTransparencyPanel.java

View differences:

RasterTransparencyPanel.java
28 28
import java.awt.GridBagLayout;
29 29
import java.awt.event.ActionEvent;
30 30
import java.awt.event.ActionListener;
31
import java.awt.event.ComponentEvent;
32
import java.awt.event.ComponentListener;
33 31
import java.awt.event.FocusEvent;
34 32
import java.awt.event.FocusListener;
35 33

  
......
40 38
import javax.swing.event.ChangeEvent;
41 39
import javax.swing.event.ChangeListener;
42 40

  
41
import org.cresques.ui.raster.IResize;
43 42
import org.cresques.ui.raster.RGBInputPanel;
44 43

  
45
import java.awt.FlowLayout;
46
import java.awt.Insets;
47 44

  
48

  
49 45
/**
50 46
 * Dialogo para asignar la transparencia por pixel y global al raster.
51 47
 * @author Nacho Brodin (brodin_ign@gva.es)
52 48
 */
53
public class RasterTransparencyPanel extends JPanel implements ComponentListener, ActionListener, FocusListener, ChangeListener{
49
public class RasterTransparencyPanel extends JPanel implements ActionListener, FocusListener, ChangeListener, IResize{
54 50
    final private static long serialVersionUID = -3370601314380922368L;
55 51

  
56 52
    /**
53
     * Variables para la asignaci?n de tama?o de los componentes del panel.
54
     */
55
    private int						wComp = 445, hComp = 239;
56
    private int						wPixel = wComp - 15, hPixel = hComp - 59;
57
    private int						wList = wPixel - 20, hList = hPixel - 60;
58
    private int						wGeneral = wPixel, hGeneral = 55;
59
    private int						wSlider = wGeneral - 160;
60
    
61
    
62
    /**
57 63
     * Nombre del panel
58 64
     */
59 65
    private String 						nom = "Transparencia";
......
100 106
        gridBagConstraints1.gridx = 0;
101 107
        gridBagConstraints1.gridy = 0;
102 108
        this.setLayout(new GridBagLayout());
103
        this.setBounds(0, 0, 445, 239);
104
        this.setPreferredSize(new java.awt.Dimension(445, 239));
109
        this.setBounds(0, 0, wComp, hComp);
110
        this.setPreferredSize(new java.awt.Dimension(wComp, hComp));
105 111
        this.add(getPTransparencyByPixel(), gridBagConstraints1);
106 112
        this.add(getOpacityPanel(), gridBagConstraints4);
107 113
        initControls();
108
        this.addComponentListener(this);
114
        //this.setComponentSize(wComp, hComp);
109 115
    }
110 116

  
111 117
    /**
......
174 180
        if (pGeneralTrans == null) {
175 181
        	pGeneralTrans = new JPanel();
176 182
        	pGeneralTrans.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Opacidad", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
177
        	pGeneralTrans.setPreferredSize(new java.awt.Dimension(430,55));
183
        	pGeneralTrans.setPreferredSize(new java.awt.Dimension(wGeneral,hGeneral));
178 184
        	pGeneralTrans.add(getOpacityCheck(), null);
179 185
        	pGeneralTrans.add(getOpacitySlider(), null);
180 186
        	pGeneralTrans.add(getOpacityText(), null);
......
207 213
    public JSlider getOpacitySlider() {
208 214
        if (slOpacidad == null) {
209 215
            slOpacidad = new JSlider();
210
            slOpacidad.setPreferredSize(new java.awt.Dimension(270, 16));
216
            slOpacidad.setPreferredSize(new java.awt.Dimension(wSlider, 16));
211 217
            slOpacidad.addChangeListener(this);
212 218
        }
213 219

  
......
284 290
	public TransparencyByPixelPanel getPTranspByPixel() {
285 291
		if (pTranspByPixel == null) {
286 292
			pTranspByPixel = new TransparencyByPixelPanel();
287
			pTranspByPixel.setPreferredSize(new java.awt.Dimension(410,120));
293
			pTranspByPixel.setPreferredSize(new java.awt.Dimension(wList,hList));
288 294
			pTranspByPixel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0,0,0,0));
289 295
			pTranspByPixel.setControlEnabled(false);
290 296
		}
......
313 319
			pTransparencyByPixel = new JPanel();
314 320
			pTransparencyByPixel.setLayout(new GridBagLayout());
315 321
			pTransparencyByPixel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Transparencia por pixel", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
316
			pTransparencyByPixel.setPreferredSize(new java.awt.Dimension(430,180));
322
			pTransparencyByPixel.setPreferredSize(new java.awt.Dimension(wPixel,hPixel));
317 323
			pTransparencyByPixel.add(getJPanel1(), gridBagConstraints2);
318 324
			pTransparencyByPixel.add(getPTranspByPixel(), gridBagConstraints);
319 325
		}
320 326
		return pTransparencyByPixel;
321 327
	}
322 328

  
323
	public void componentHidden(ComponentEvent e) {
324
		// TODO Auto-generated method stub
325
		
326
	}
327

  
328
	public void componentMoved(ComponentEvent e) {
329
		// TODO Auto-generated method stub
330
		
331
	}
332 329
	/**
333
	 * Redimensiona el panel cuando se redimensiona el contenedor de ?ste
330
	 * Ajusta el tama?o de todos los componentes a partir del tama?o
331
	 * introducido para el panel.
332
	 * @param w
333
	 * @param h
334 334
	 */
335
	public void componentResized(ComponentEvent e) {
336
		/*if (e.getSource() == this){
337
			int nWidth = this.getSize().width;
338
			int nHeight = this.getSize().height;
339
			int difWidth = nWidth - 445;
340
			int difHeight = nHeight - 239;
341
			this.pTransparencyByPixel.setSize(this.pTransparencyByPixel.getSize().width + difWidth, this.pTransparencyByPixel.getSize().height + difHeight);
342
			this.pTransparencyByPixel.setLocation(14, 19);
343
			this.pGeneralTrans.setSize(this.pGeneralTrans.getSize().width + difWidth, this.pGeneralTrans.getSize().height);
344
			this.pGeneralTrans.setLocation(14, this.pGeneralTrans.getLocation().y + difHeight/2);
345
			this.slOpacidad.setSize(this.slOpacidad.getSize().width + difWidth, this.slOpacidad.getSize().height);
346
			this.tOpacidad.setLocation(this.tOpacidad.getLocation().x + difWidth, this.tOpacidad.getLocation().y);
347
			this.pTranspByPixel.setLocation(this.pTranspByPixel.getLocation().x + difWidth/2, this.pTranspByPixel.getLocation().y + difHeight/2);
348
		}*/
335
	public void setComponentSize(int w, int h){
336
		wComp = w; hComp = h;
337
		wPixel = wComp - 15; hPixel = hComp - 59;
338
		wList = wPixel - 20; hList = hPixel - 60;
339
		wGeneral = wComp - 15; hGeneral = 55; 
340
		wSlider = wGeneral - 160;
341
		    
342
		this.setPreferredSize(new java.awt.Dimension(wComp, hComp));
343
		pTransparencyByPixel.setPreferredSize(new java.awt.Dimension(wPixel,hPixel));
344
		pGeneralTrans.setPreferredSize(new java.awt.Dimension(wGeneral,hGeneral));
345
		pTranspByPixel.setPreferredSize(new java.awt.Dimension(wList,hList));
346
		pTranspByPixel.setComponentSize(wList, hList);
347
		slOpacidad.setPreferredSize(new java.awt.Dimension(wSlider, 16));
348
        
349 349
		
350 350
	}
351 351

  
352
	public void componentShown(ComponentEvent e) {
353
		// TODO Auto-generated method stub
354
		
355
	}
356

  
357 352
	/**
358 353
     * Eventos sobre TextField y CheckBox. Controla eventos de checkbox de opacidad, transparencia,
359 354
     * recorte de colas y los textfield de opacidad, valores de transparencia por banda y

Also available in: Unified diff