svn-gvsig-desktop / trunk / extensions / extRemoteSensing / src / org / gvsig / remotesensing / imagefusion / gui / FusionImageMainPanel.java @ 19524
History | View | Annotate | Download (5.17 KB)
1 |
package org.gvsig.remotesensing.imagefusion.gui; |
---|---|
2 |
|
3 |
import java.awt.BorderLayout; |
4 |
import java.awt.Dimension; |
5 |
import java.awt.GridBagConstraints; |
6 |
import java.awt.GridBagLayout; |
7 |
import java.awt.Insets; |
8 |
|
9 |
import javax.swing.JLabel; |
10 |
import javax.swing.JPanel; |
11 |
import javax.swing.JTextField; |
12 |
|
13 |
import org.gvsig.raster.RasterLibrary; |
14 |
import org.gvsig.raster.beans.previewbase.IUserPanelInterface; |
15 |
import org.gvsig.raster.util.PropertyEvent; |
16 |
import org.gvsig.raster.util.PropertyListener; |
17 |
|
18 |
import com.iver.andami.PluginServices; |
19 |
|
20 |
|
21 |
/**
|
22 |
* Panel principal de la herramienta de fusion de imagenes.
|
23 |
*
|
24 |
* @version 27/02/2008
|
25 |
* @author Alejandro Mu?oz S?nchez (alejandro.munoz@uclm.es)
|
26 |
*
|
27 |
*/
|
28 |
public class FusionImageMainPanel extends JPanel implements PropertyListener, IUserPanelInterface { |
29 |
|
30 |
private static final long serialVersionUID = -406089078173595028L; |
31 |
private JPanel centralPanel = null; |
32 |
private JPanel jPNameFile = null; |
33 |
private JLabel labelFilename = null; |
34 |
private JTextField filenameTextField = null; |
35 |
private JPanel principalPanel = null; |
36 |
private BandHigthResolutionSelection bandSelectionPanel = null; |
37 |
private MethodFusionPanel methodPanel = null; |
38 |
|
39 |
public FusionImageMainPanel() {
|
40 |
initialize(); |
41 |
translate(); |
42 |
} |
43 |
|
44 |
private void initialize() { |
45 |
setPreferredSize(new Dimension(390,0)); |
46 |
setLayout(new BorderLayout(5, 5)); |
47 |
add(getPrincipalPanel(), BorderLayout.CENTER);
|
48 |
add(getCentralPanel(),BorderLayout.SOUTH);
|
49 |
} |
50 |
|
51 |
/*
|
52 |
* (non-Javadoc)
|
53 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getPanel()
|
54 |
*/
|
55 |
public JPanel getPanel() { |
56 |
return this; |
57 |
} |
58 |
|
59 |
/**
|
60 |
* Seccion donde ir?n todas las traducciones invariables del componente
|
61 |
*/
|
62 |
private void translate() { |
63 |
getLabelFilename().setText(PluginServices.getText(this, "nombre_capa") + ":"); |
64 |
} |
65 |
|
66 |
/**
|
67 |
* Obtener y generar el JPanel central que contendr? las propiedades
|
68 |
* @return
|
69 |
*/
|
70 |
public JPanel getCentralPanel() { |
71 |
if (centralPanel == null) { |
72 |
centralPanel = new JPanel(); |
73 |
centralPanel.setLayout(new BorderLayout()); |
74 |
centralPanel.add(getJPNameFile(), BorderLayout.SOUTH);
|
75 |
} |
76 |
return centralPanel;
|
77 |
} |
78 |
|
79 |
/**
|
80 |
* This method initializes filenameTextField
|
81 |
*
|
82 |
* @return javax.swing.JTextField
|
83 |
*/
|
84 |
public JTextField getFilenameTextField() { |
85 |
if (filenameTextField == null) { |
86 |
filenameTextField = new JTextField(); |
87 |
filenameTextField.setPreferredSize(new Dimension(150, filenameTextField.getPreferredSize().height)); |
88 |
RasterLibrary.addOnlyLayerNameListener(this);
|
89 |
} |
90 |
return filenameTextField;
|
91 |
} |
92 |
|
93 |
private JLabel getLabelFilename() { |
94 |
if (labelFilename == null) { |
95 |
labelFilename = new JLabel(); |
96 |
} |
97 |
return labelFilename;
|
98 |
} |
99 |
|
100 |
/**
|
101 |
* This method initializes jPNameFile
|
102 |
*
|
103 |
* @return javax.swing.JPanel
|
104 |
*/
|
105 |
private JPanel getJPNameFile() { |
106 |
if (jPNameFile == null) { |
107 |
jPNameFile = new JPanel(); |
108 |
jPNameFile.setBorder(javax.swing.BorderFactory.createTitledBorder(null, PluginServices.getText(this, "nombre_capa"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null)); |
109 |
jPNameFile.add(getLabelFilename()); |
110 |
jPNameFile.add(getFilenameTextField()); |
111 |
updateNewLayerText(); |
112 |
} |
113 |
return jPNameFile;
|
114 |
} |
115 |
|
116 |
/*
|
117 |
* (non-Javadoc)
|
118 |
* @see org.gvsig.raster.beans.previewbase.IUserPanelInterface#getTitle()
|
119 |
*/
|
120 |
public String getTitle() { |
121 |
return "Fusion"; |
122 |
} |
123 |
|
124 |
/**
|
125 |
* Cuando alguien ha cambiado la propiedad del nombre de la
|
126 |
* capa se actualiza autom?ticamente
|
127 |
*/
|
128 |
public void actionValueChanged(PropertyEvent e) { |
129 |
updateNewLayerText(); |
130 |
} |
131 |
|
132 |
/**
|
133 |
* Especificar el nombre de la nueva capa para el recuadro de texto asign?ndo
|
134 |
* en cada llamada un nombre consecutivo.
|
135 |
*/
|
136 |
public void updateNewLayerText() { |
137 |
getFilenameTextField().setText(RasterLibrary.getOnlyLayerName()); |
138 |
} |
139 |
|
140 |
public void setFilenameEnabled(boolean value) { |
141 |
getFilenameTextField().setEnabled(value); |
142 |
getLabelFilename().setEnabled(value); |
143 |
} |
144 |
|
145 |
|
146 |
// Panel principal
|
147 |
/**
|
148 |
* @return panel principal del dialogo. En el se recogen los paneles de seleccion de la banda de
|
149 |
* alta resoluci?n y el panel de selecci?n del metodo.
|
150 |
*/
|
151 |
private JPanel getPrincipalPanel(){ |
152 |
if (principalPanel==null){ |
153 |
principalPanel = new JPanel(); |
154 |
principalPanel.setLayout(new GridBagLayout()); |
155 |
GridBagConstraints c = new GridBagConstraints(); |
156 |
c.fill = GridBagConstraints.BOTH;
|
157 |
c.insets=new Insets(2,2,2,2); |
158 |
c.weightx = 1;
|
159 |
c.weighty =1;
|
160 |
c.gridx = 0;
|
161 |
c.gridy = 0;
|
162 |
principalPanel.add(getBandSelectionPanel(), c); |
163 |
|
164 |
c.fill = GridBagConstraints.BOTH;
|
165 |
c.insets=new Insets(2,2,2,2); |
166 |
c.weightx = 1;
|
167 |
c.weighty =0.4;
|
168 |
c.gridx = 0;
|
169 |
c.gridy = 1;
|
170 |
principalPanel.add(getMethodSelectionPanel(), c); |
171 |
} |
172 |
return principalPanel;
|
173 |
} |
174 |
|
175 |
|
176 |
|
177 |
/** @return panel para la seleccion de banda */
|
178 |
public BandHigthResolutionSelection getBandSelectionPanel(){
|
179 |
if(bandSelectionPanel==null){ |
180 |
bandSelectionPanel= new BandHigthResolutionSelection();
|
181 |
} |
182 |
return bandSelectionPanel;
|
183 |
} |
184 |
|
185 |
/** @return panel para la seleccion de metodo */
|
186 |
public MethodFusionPanel getMethodSelectionPanel(){
|
187 |
if(methodPanel ==null){ |
188 |
methodPanel = new MethodFusionPanel();
|
189 |
} |
190 |
return methodPanel;
|
191 |
} |
192 |
|
193 |
|
194 |
|
195 |
} |