Revision 38112 branches/v2_0_0_prep/libraries/libProjection/src/org/cresques/ui/cts/CSSelectionPanel.java
CSSelectionPanel.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.cresques.ui.cts; |
25 | 25 |
|
26 |
import java.awt.GridBagConstraints; |
|
27 |
import java.awt.GridBagLayout; |
|
28 |
import java.awt.Insets; |
|
29 |
|
|
30 |
import javax.swing.BorderFactory; |
|
31 |
import javax.swing.JComponent; |
|
26 | 32 |
import javax.swing.JLabel; |
27 | 33 |
import javax.swing.JPanel; |
34 |
import javax.swing.border.TitledBorder; |
|
28 | 35 |
|
29 | 36 |
import org.cresques.Messages; |
30 | 37 |
import org.cresques.cts.IProjection; |
31 | 38 |
import org.cresques.ui.LoadableComboBox; |
32 | 39 |
|
33 |
|
|
34 | 40 |
//import es.gva.cit.geoexplorer.ui.LoadableComboBox; |
35 | 41 |
|
36 | 42 |
/** |
37 | 43 |
* Panel de edici?n de Sistemas de referencia |
44 |
* |
|
38 | 45 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
39 | 46 |
*/ |
40 | 47 |
public class CSSelectionPanel extends JPanel { |
48 |
|
|
41 | 49 |
final private static long serialVersionUID = -3370601314380922368L; |
42 | 50 |
private LoadableComboBox datumComboBox = null; |
43 | 51 |
private LoadableComboBox projComboBox = null; |
... | ... | |
55 | 63 |
super(); |
56 | 64 |
|
57 | 65 |
if (tit == null) { |
58 |
//tit = "Sistema de referencia"; |
|
59 |
//TODO: add com.iver.andami.PluginServices to this project |
|
60 |
//change all the labels from fix text got from the internationalitation |
|
61 | 66 |
tit = Messages.getText("reference_system"); |
62 |
if (tit == null) tit="Reference System"; |
|
67 |
if (tit == null) |
|
68 |
tit = "Reference System"; |
|
63 | 69 |
} |
64 | 70 |
|
65 | 71 |
this.tit = tit; |
... | ... | |
69 | 75 |
|
70 | 76 |
/** |
71 | 77 |
* Inicializa el panel. |
78 |
* |
|
72 | 79 |
* @return javax.swing.JPanel |
73 | 80 |
*/ |
74 | 81 |
private void initialize() { |
75 |
setPreferredSize(new java.awt.Dimension(295, 170)); |
|
76 |
setLayout(null); |
|
82 |
setLayout(new GridBagLayout()); |
|
83 |
GridBagConstraints c = new GridBagConstraints(); |
|
84 |
c.insets = new Insets(2, 5, 2, 5); |
|
85 |
c.gridy = -1; |
|
77 | 86 |
|
78 |
/*javax.swing.border.Border border = javax.swing.BorderFactory.createCompoundBorder( |
|
79 |
javax.swing. BorderFactory.createTitledBorder("Sistema de coordenadas"), |
|
80 |
javax.swing.BorderFactory.createEmptyBorder(5,5,5,5)); */ |
|
81 |
setBorder(javax.swing.BorderFactory.createCompoundBorder(null, |
|
82 |
javax.swing.BorderFactory.createTitledBorder(null, |
|
83 |
Messages.getText("reference_system"), |
|
84 |
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, |
|
85 |
javax.swing.border.TitledBorder.DEFAULT_POSITION, |
|
86 |
null, |
|
87 |
null))); |
|
87 |
setBorder(BorderFactory.createCompoundBorder(null, BorderFactory |
|
88 |
.createTitledBorder(null, Messages.getText("reference_system"), |
|
89 |
TitledBorder.DEFAULT_JUSTIFICATION, |
|
90 |
TitledBorder.DEFAULT_POSITION, null, null))); |
|
88 | 91 |
|
89 |
jLabel = new JLabel(); |
|
90 |
jLabel.setBounds(15, 15, 77, 23); |
|
91 |
jLabel.setText(Messages.getText("datum") + ":"); |
|
92 |
add(jLabel, null); |
|
93 |
add(getDatumComboBox(), null); |
|
92 |
jLabel = new JLabel(Messages.getText("datum") + ":"); |
|
93 |
addRow(c, jLabel, getDatumComboBox()); |
|
94 | 94 |
|
95 |
jLabel1 = new JLabel(); |
|
96 |
jLabel1.setBounds(15, 60, 77, 23); |
|
97 |
jLabel1.setText(Messages.getText("projection") + ":"); |
|
98 |
add(jLabel1, null); |
|
99 |
add(getProjComboBox(), null); |
|
95 |
jLabel1 = new JLabel(Messages.getText("projection") + ":"); |
|
96 |
addRow(c, jLabel1, getProjComboBox()); |
|
100 | 97 |
|
101 |
jLabel2 = new JLabel(); |
|
102 |
jLabel2.setBounds(15, 105, 77, 23); |
|
103 |
jLabel2.setText(Messages.getText("zone") + ":"); |
|
104 |
add(jLabel2, null); |
|
105 |
add(getHuseComboBox(), null); |
|
98 |
jLabel2 = new JLabel(Messages.getText("zone") + ":"); |
|
99 |
addRow(c, jLabel2, getHuseComboBox()); |
|
106 | 100 |
|
107 | 101 |
setHuseComboBoxEnabled(false); |
108 | 102 |
} |
... | ... | |
136 | 130 |
|
137 | 131 |
setDatumComboBoxEnabled(true); |
138 | 132 |
getDatumComboBox().setSelectedIndex(model.getSelectedDatum()); |
139 |
|
|
133 |
|
|
140 | 134 |
getProjComboBox().removeAllItems(); |
141 | 135 |
getProjComboBox().loadData(model.getProjectionList()); |
142 | 136 |
|
143 | 137 |
model.setProjection(proj); |
144 | 138 |
getProjComboBox().setSelectedIndex(model.getSelectedProj()); |
145 | 139 |
model.setProjection(proj); |
146 |
|
|
140 |
|
|
147 | 141 |
if (model.getSelectedZone() >= 0) { |
148 | 142 |
setHuseComboBoxEnabled(true); |
149 | 143 |
getHuseComboBox().removeAllItems(); |
... | ... | |
159 | 153 |
|
160 | 154 |
/** |
161 | 155 |
* Inicializa datumComboBox |
162 |
* |
|
156 |
*
|
|
163 | 157 |
* @return javax.swing.JComboBox |
164 | 158 |
*/ |
165 | 159 |
private LoadableComboBox getDatumComboBox() { |
166 | 160 |
if (datumComboBox == null) { |
167 | 161 |
datumComboBox = new LoadableComboBox(); |
168 |
datumComboBox.setBounds(14, 35, 250, 23); |
|
169 | 162 |
|
170 |
// ((LoadableComboBox) datumComboBox).loadData(model.getDatumList()); |
|
171 | 163 |
datumComboBox.addItemListener(new java.awt.event.ItemListener() { |
172 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
173 |
model.setSelectedDatum(e.getItem()); |
|
174 |
getProjComboBox().removeAllItems(); |
|
175 |
getProjComboBox().loadData(model.getProjectionList()); |
|
176 |
} |
|
177 |
}); |
|
164 |
|
|
165 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
166 |
model.setSelectedDatum(e.getItem()); |
|
167 |
getProjComboBox().removeAllItems(); |
|
168 |
getProjComboBox().loadData(model.getProjectionList()); |
|
169 |
} |
|
170 |
}); |
|
178 | 171 |
} |
179 | 172 |
|
180 | 173 |
return datumComboBox; |
... | ... | |
182 | 175 |
|
183 | 176 |
/** |
184 | 177 |
* Inicializa projComboBox |
185 |
* |
|
178 |
*
|
|
186 | 179 |
* @return javax.swing.JComboBox |
187 | 180 |
*/ |
188 | 181 |
private LoadableComboBox getProjComboBox() { |
189 | 182 |
if (projComboBox == null) { |
190 | 183 |
projComboBox = new LoadableComboBox(); |
191 |
projComboBox.setBounds(14, 80, 250, 23); |
|
184 |
// projComboBox.setBounds(14, 80, 250, 23);
|
|
192 | 185 |
projComboBox.addItemListener(new java.awt.event.ItemListener() { |
193 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
194 |
model.setSelectedProj(e.getItem()); |
|
195 | 186 |
|
196 |
if (model.getSelectedProjType() == CSSelectionModel.TRANSVERSAL) { |
|
197 |
setHuseComboBoxEnabled(true); |
|
198 |
getHuseComboBox().removeAllItems(); |
|
199 |
getHuseComboBox().loadData(model.getZoneList()); |
|
187 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
188 |
model.setSelectedProj(e.getItem()); |
|
200 | 189 |
|
201 |
} else { |
|
202 |
setHuseComboBoxEnabled(false); |
|
203 |
} |
|
190 |
if (model.getSelectedProjType() == CSSelectionModel.TRANSVERSAL) { |
|
191 |
setHuseComboBoxEnabled(true); |
|
192 |
getHuseComboBox().removeAllItems(); |
|
193 |
getHuseComboBox().loadData(model.getZoneList()); |
|
204 | 194 |
|
205 |
// if (model.getSelectedProjType() == CSSelectionModel.NONE) { |
|
206 |
// setDatumComboBoxEnabled(false); |
|
207 |
// } else { |
|
208 |
// setDatumComboBoxEnabled(true); |
|
209 |
// } |
|
195 |
} else { |
|
196 |
setHuseComboBoxEnabled(false); |
|
210 | 197 |
} |
211 |
}); |
|
198 |
|
|
199 |
} |
|
200 |
}); |
|
212 | 201 |
} |
213 | 202 |
|
214 | 203 |
return projComboBox; |
... | ... | |
216 | 205 |
|
217 | 206 |
/** |
218 | 207 |
* Inicializa usoComboBox |
219 |
* |
|
208 |
*
|
|
220 | 209 |
* @return javax.swing.JComboBox |
221 | 210 |
*/ |
222 | 211 |
private LoadableComboBox getHuseComboBox() { |
223 | 212 |
if (huseComboBox == null) { |
224 | 213 |
huseComboBox = new LoadableComboBox(); |
225 |
huseComboBox.setBounds(14, 125, 250, 23); |
|
226 | 214 |
huseComboBox.addItemListener(new java.awt.event.ItemListener() { |
227 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
228 |
model.setSelectedZone(e.getItem()); |
|
229 |
} |
|
230 |
}); |
|
215 |
|
|
216 |
public void itemStateChanged(java.awt.event.ItemEvent e) { |
|
217 |
model.setSelectedZone(e.getItem()); |
|
218 |
} |
|
219 |
}); |
|
231 | 220 |
} |
232 | 221 |
|
233 | 222 |
return huseComboBox; |
... | ... | |
239 | 228 |
public IProjection getProjection() { |
240 | 229 |
return model.getProjection(); |
241 | 230 |
} |
231 |
|
|
232 |
private void addRow(GridBagConstraints c, JComponent label, JComponent text) { |
|
233 |
c.anchor = GridBagConstraints.WEST; |
|
234 |
c.weightx = 0.0d; |
|
235 |
c.gridx = 0; |
|
236 |
c.gridy++; |
|
237 |
add(label, c); |
|
238 |
|
|
239 |
c.fill = GridBagConstraints.HORIZONTAL; |
|
240 |
c.weightx = 1.0d; |
|
241 |
c.gridx = 1; |
|
242 |
add(text, c); |
|
243 |
} |
|
242 | 244 |
} |
Also available in: Unified diff