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