Revision 8783 branches/v10+Piloto/libraries/libCq_CMS_praster/src/org/cresques/ui/raster/InfoPanel.java

View differences:

InfoPanel.java
25 25

  
26 26
import java.awt.GridBagConstraints;
27 27
import java.awt.GridBagLayout;
28
import java.awt.event.ComponentEvent;
29
import java.awt.event.ComponentListener;
30 28
import java.awt.image.DataBuffer;
31 29

  
32 30
import javax.swing.JEditorPane;
......
43 41
 * Panel de informacion de la imagen r?ster de la que se muestran las propiedades
44 42
 *
45 43
 */
46
public class InfoPanel extends JPanel implements ComponentListener{
44
public class InfoPanel extends JPanel implements IResize{
47 45

  
46
	
47
	private int						wComp = 445, hComp = 239;
48
	private int						wScroll = wComp - 5, hScroll = hComp - 9;
49
	private int						wEditor = wComp - 20, hEditor = hComp - 19;
50
	
48 51
	private final String bgColor0 = "\"#FEEDD6\""; // light salmon
49 52
    private final String bgColor1 = "\"#EAEAEA\""; // light grey
50 53
    private final String bgColor2 = "\"#F2FEFF\""; // light blue
......
101 104
	 */
102 105
	public InfoPanel(FilterRasterDialogPanel parent) {
103 106
		super();
104
		this.files = parent.grf;
107
		this.files = parent.getGrf();
105 108
		this.parent = parent;
106 109
		this.props = parent.props;
107 110
		initialize();
......
121 124
		gridBagConstraints.weighty = 1.0;
122 125
		gridBagConstraints.insets = new java.awt.Insets(5,8,5,8);
123 126
		this.setLayout(new GridBagLayout());
124
		this.setSize(445, 239);
125
		this.setPreferredSize(new java.awt.Dimension(445,239));
127
		//this.setSize(wComp, hComp);
128
		//this.setPreferredSize(new java.awt.Dimension(wComp,hComp));
126 129
		this.add(getJScrollPane(), gridBagConstraints);
127
		this.addComponentListener(this);
128 130
		//refresh();
131
		this.setComponentSize(wComp, hComp);
129 132
		this.getJEditorPane().repaint();
130 133
		
131 134
	}
......
138 141
	private JScrollPane getJScrollPane() {
139 142
		if (jScrollPane == null) {
140 143
			jScrollPane = new JScrollPane();
141
			jScrollPane.setPreferredSize(new java.awt.Dimension(440,260));
144
			//jScrollPane.setPreferredSize(new java.awt.Dimension(wScroll,hScroll));
142 145
			jScrollPane.setViewportView(getJEditorPane());
143 146
			
144 147

  
......
155 158
		if (jEditorPane == null) {
156 159
			jEditorPane = new JEditorPane();
157 160
			jEditorPane.setEditable(false);
158
			jEditorPane.setSize(new java.awt.Dimension(425,220));
161
			//jEditorPane.setSize(new java.awt.Dimension(wEditor,hEditor));
159 162
			
160 163
		}
161 164
		return jEditorPane;
......
382 385
		for (int i = 0 ; i < files.length ; i++){
383 386
			meta = files[i].getMetadata();
384 387
			if (meta != null){
385
				datos = true;
386 388
				metadatos = meta.getMetadataString();
387 389
				String fichero = 
388 390
					"  <tr valign=\"top\">" +
......
390 392
					"  </tr>";
391 393
				propiedades = propiedades + fichero;
392 394
				for(int j = 0 ; j<metadatos.length ; j++){
395
					datos = true;
393 396
					if ((j%2 == 0) || j == 0) color = bgColor0;
394 397
					else color = bgColor1;
395 398
					int index = metadatos[j].indexOf("=");
......
437 440
		this.getJScrollPane().setAlignmentY(0);
438 441
	}
439 442

  
440
	public void componentHidden(ComponentEvent e) {
441
		// TODO Auto-generated method stub
443
	
444
	public void setComponentSize(int w, int h){
445
		wComp = w; hComp = h;
446
		wScroll = wComp - 5; hScroll = hComp - 9;
447
		wEditor = wComp - 20; hEditor = hComp - 19;
442 448
		
449
		this.setSize(wComp, hComp);
450
		this.setPreferredSize(new java.awt.Dimension(wComp,hComp));
451
		jScrollPane.setPreferredSize(new java.awt.Dimension(wScroll,hScroll));
452
		jEditorPane.setSize(new java.awt.Dimension(wEditor,hEditor));
453
			
443 454
	}
444

  
445
	public void componentMoved(ComponentEvent e) {
446
		// TODO Auto-generated method stub
447
		
448
	}
449
	/**
450
	 * Cambia el tama?o del panel cuando se redimensiona su contenedor
451
	 */
452
	public void componentResized(ComponentEvent e) {
453
		if(e.getSource() == this){
454
			this.getJScrollPane().setSize(this.getJScrollPane().getWidth() + 1, this.getJScrollPane().getHeight() + 1);
455
			this.getJEditorPane().setSize(this.getJEditorPane().getWidth() + 1, this.getJEditorPane().getHeight() + 1);
456
			jScrollPane.getVerticalScrollBar().setValue(0);
457
		}
458
		
459
	}
460

  
461
	public void componentShown(ComponentEvent e) {
462
		// TODO Auto-generated method stub
463
		
464
	}
465 455
	
466 456
}
467 457

  

Also available in: Unified diff