Revision 5457
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/Panels/annotation/ConfigureLabel.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.Panels.annotation; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.Rectangle; |
|
5 |
import java.awt.event.ItemEvent; |
|
6 |
import java.awt.event.ItemListener; |
|
7 |
import java.sql.Types; |
|
8 |
import java.util.ArrayList; |
|
9 |
import java.util.Collection; |
|
10 |
import java.util.HashMap; |
|
11 |
import java.util.Iterator; |
|
12 |
|
|
13 |
import javax.swing.JComboBox; |
|
14 |
import javax.swing.JLabel; |
|
15 |
|
|
16 |
import jwizardcomponent.JWizardComponents; |
|
17 |
import jwizardcomponent.JWizardPanel; |
|
18 |
|
|
19 |
import com.iver.andami.PluginServices; |
|
20 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
21 |
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation; |
|
22 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
public class ConfigureLabel extends JWizardPanel { |
|
27 |
private FLyrAnnotation layer; |
|
28 |
|
|
29 |
private HashMap fieldsNames = new HashMap() ; |
|
30 |
private JLabel lblDescription; |
|
31 |
|
|
32 |
private JLabel lblAngle; |
|
33 |
|
|
34 |
private JLabel lblColor; |
|
35 |
|
|
36 |
private JLabel lblSize; |
|
37 |
|
|
38 |
private JLabel lblSizeUnits; |
|
39 |
|
|
40 |
private JLabel lblFont; |
|
41 |
|
|
42 |
private JLabel lblStep1; |
|
43 |
|
|
44 |
private JLabel lblStep2; |
|
45 |
|
|
46 |
private JLabel lblStep3; |
|
47 |
|
|
48 |
private JLabel lblStep4; |
|
49 |
|
|
50 |
private JComboBox cmbAngle = null; |
|
51 |
private JComboBox cmbColor = null; |
|
52 |
private JComboBox cmbSize = null; |
|
53 |
private JComboBox cmbSizeUnits = null; |
|
54 |
private JComboBox cmbFont = null; |
|
55 |
|
|
56 |
|
|
57 |
|
|
58 |
private static final Rectangle lblDescriptionPosition = new Rectangle(4,4,355,60); |
|
59 |
|
|
60 |
private static final Rectangle lblStep1Position = new Rectangle(4,90,15,15); |
|
61 |
private static final Rectangle lblAnglePosition = new Rectangle(30,90,355,30); |
|
62 |
private static final Rectangle cmbAnglePosition = new Rectangle(30,124,170,18); |
|
63 |
|
|
64 |
|
|
65 |
private static final Rectangle lblStep2Position = new Rectangle(4,150,15,15); |
|
66 |
private static final Rectangle lblColorPosition = new Rectangle(30,150,355,30); |
|
67 |
private static final Rectangle cmbColorPosition = new Rectangle(30,184,170,18); |
|
68 |
|
|
69 |
private static final Rectangle lblStep3Position = new Rectangle(4,210,15,15); |
|
70 |
private static final Rectangle lblSizePosition = new Rectangle(30,210,355,30); |
|
71 |
private static final Rectangle cmbSizePosition = new Rectangle(30,244,170,18); |
|
72 |
private static final Rectangle lblSizeUnitsPosition = new Rectangle(204,244,80,15); |
|
73 |
private static final Rectangle cmbSizeUnitsPosition = new Rectangle(305,244,80,18); |
|
74 |
|
|
75 |
private static final Rectangle lblStep4Position = new Rectangle(4,270,15,15); |
|
76 |
private static final Rectangle lblFontPosition = new Rectangle(30,270,355,30); |
|
77 |
private static final Rectangle cmbFontPosition = new Rectangle(30,304,170,18); |
|
78 |
|
|
79 |
|
|
80 |
private void updateButtonsState() { |
|
81 |
setBackButtonEnabled(true); |
|
82 |
setNextButtonEnabled(false); |
|
83 |
setFinishButtonEnabled(checkIsOkPanelData()); |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
|
|
88 |
protected boolean checkIsOkPanelData() { |
|
89 |
if (((String)this.getCmbSize().getSelectedItem()).trim().length() > 0) { |
|
90 |
return (((String)this.getCmbSizeUnits().getSelectedItem()).trim().length() > 0); |
|
91 |
} |
|
92 |
return true; |
|
93 |
} |
|
94 |
|
|
95 |
|
|
96 |
private class EventsListener implements ItemListener |
|
97 |
{ |
|
98 |
|
|
99 |
public void itemStateChanged(ItemEvent e) { |
|
100 |
updateButtonsState(); |
|
101 |
} |
|
102 |
|
|
103 |
} |
|
104 |
|
|
105 |
private EventsListener eventsListener = new EventsListener(); |
|
106 |
|
|
107 |
|
|
108 |
public ConfigureLabel(JWizardComponents arg0,FLyrAnnotation layer) { |
|
109 |
super(arg0); |
|
110 |
this.layer =layer; |
|
111 |
this.initialize(); |
|
112 |
} |
|
113 |
|
|
114 |
protected void initialize() { |
|
115 |
this.setLayout(null); |
|
116 |
this.setSize(new Dimension(358,263)); |
|
117 |
this.addLabels(); |
|
118 |
|
|
119 |
this.add(getCmbAngle(),null); |
|
120 |
this.add(getCmbColor(),null); |
|
121 |
this.add(getCmbSize(),null); |
|
122 |
this.add(getCmbSizeUnits(),null); |
|
123 |
this.add(getCmbFont(),null); |
|
124 |
|
|
125 |
checkIsOkPanelData(); |
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
protected void addLabels() { |
|
130 |
this.lblDescription = new JLabel(); |
|
131 |
this.lblStep1 = new JLabel(); |
|
132 |
this.lblAngle = new JLabel(); |
|
133 |
this.lblStep2 = new JLabel(); |
|
134 |
this.lblColor= new JLabel(); |
|
135 |
this.lblStep3 = new JLabel(); |
|
136 |
this.lblSize= new JLabel(); |
|
137 |
this.lblSizeUnits= new JLabel(); |
|
138 |
this.lblStep4 = new JLabel(); |
|
139 |
this.lblFont= new JLabel(); |
|
140 |
|
|
141 |
this.lblDescription.setText(PluginServices.getText(this,"descripcion_de_configuracion_capa_de_anotaciones")); |
|
142 |
this.lblStep1.setText("1."); |
|
143 |
this.lblAngle.setText(PluginServices.getText(this,"seleccione_el_campo_angulo_de_la_capa_de_anotaciones")); |
|
144 |
this.lblStep2.setText("2."); |
|
145 |
this.lblColor.setText(PluginServices.getText(this,"seleccione_el_campo_color_de_la_capa_de_anotaciones")); |
|
146 |
this.lblStep3.setText("3."); |
|
147 |
this.lblSize.setText(PluginServices.getText(this,"seleccione_el_campo_tamano_de_la_capa_de_anotaciones")); |
|
148 |
this.lblSizeUnits.setText(PluginServices.getText(this,"en_unidades")); |
|
149 |
this.lblStep4.setText("4."); |
|
150 |
this.lblFont.setText(PluginServices.getText(this,"seleccione_el_campo_fuente_de_la_capa_de_anotaciones")); |
|
151 |
|
|
152 |
//TODO: Posicionar |
|
153 |
this.lblDescription.setBounds(lblDescriptionPosition); |
|
154 |
this.lblStep1.setBounds(lblStep1Position); |
|
155 |
this.lblAngle.setBounds(lblAnglePosition); |
|
156 |
this.lblStep2.setBounds(lblStep2Position); |
|
157 |
this.lblColor.setBounds(lblColorPosition); |
|
158 |
this.lblStep3.setBounds(lblStep3Position); |
|
159 |
this.lblSize.setBounds(lblSizePosition); |
|
160 |
this.lblSizeUnits.setBounds(lblSizeUnitsPosition); |
|
161 |
this.lblStep4.setBounds(lblStep4Position); |
|
162 |
this.lblFont.setBounds(lblFontPosition); |
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
this.add(lblDescription,null); |
|
167 |
this.add(lblStep1,null); |
|
168 |
this.add(lblAngle,null); |
|
169 |
this.add(lblStep2,null); |
|
170 |
this.add(lblColor,null); |
|
171 |
this.add(lblStep3,null); |
|
172 |
this.add(lblSize,null); |
|
173 |
this.add(lblSizeUnits,null); |
|
174 |
this.add(lblStep4,null); |
|
175 |
this.add(lblFont,null); |
|
176 |
|
|
177 |
|
|
178 |
} |
|
179 |
|
|
180 |
private void fillFieldsNames(JComboBox cmb,int[] types) { |
|
181 |
cmb.addItem(""); |
|
182 |
Collection names; |
|
183 |
if (types == null) { |
|
184 |
|
|
185 |
String[] allNames = (String[])this.fieldsNames.get("ALL"); |
|
186 |
if (allNames == null) { |
|
187 |
try { |
|
188 |
SelectableDataSource dataSource = this.layer.getRecordset(); |
|
189 |
|
|
190 |
allNames = dataSource.getFieldNames(); |
|
191 |
this.fieldsNames.put("ALL",allNames); |
|
192 |
|
|
193 |
} catch (DriverException e) { |
|
194 |
// TODO Auto-generated catch block |
|
195 |
e.printStackTrace(); |
|
196 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
197 |
// TODO Auto-generated catch block |
|
198 |
e.printStackTrace(); |
|
199 |
} |
|
200 |
} |
|
201 |
for (int i=0; i < allNames.length; i++) { |
|
202 |
cmb.addItem(allNames[i]); |
|
203 |
} |
|
204 |
return; |
|
205 |
} |
|
206 |
Integer typeKey; |
|
207 |
for (int i=0; i < types.length; i++) { |
|
208 |
typeKey = new Integer(types[i]); |
|
209 |
if (!this.fieldsNames.containsKey(typeKey)){ |
|
210 |
names = this.getFieldsFromType(types[i]); |
|
211 |
this.fieldsNames.put(typeKey,names); |
|
212 |
}else{ |
|
213 |
names = (Collection)this.fieldsNames.get(typeKey); |
|
214 |
} |
|
215 |
if (names != null) { |
|
216 |
Iterator name = names.iterator(); |
|
217 |
while (name.hasNext()){ |
|
218 |
cmb.addItem(name.next()); |
|
219 |
} |
|
220 |
} |
|
221 |
|
|
222 |
} |
|
223 |
} |
|
224 |
private Collection getFieldsFromType(int type){ |
|
225 |
ArrayList result = new ArrayList(); |
|
226 |
try { |
|
227 |
SelectableDataSource dataSource = this.layer.getRecordset(); |
|
228 |
|
|
229 |
for (int i=0; i < dataSource.getFieldCount(); i++) { |
|
230 |
if (dataSource.getFieldType(i) == type){ |
|
231 |
result.add(dataSource.getFieldName(i)); |
|
232 |
} |
|
233 |
} |
|
234 |
} catch (DriverException e) { |
|
235 |
// TODO Auto-generated catch block |
|
236 |
e.printStackTrace(); |
|
237 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
238 |
// TODO Auto-generated catch block |
|
239 |
e.printStackTrace(); |
|
240 |
} |
|
241 |
if (result.size() == 0){ |
|
242 |
return null; |
|
243 |
} |
|
244 |
return result; |
|
245 |
|
|
246 |
} |
|
247 |
|
|
248 |
private JComboBox getCmbAngle() { |
|
249 |
if (this.cmbAngle == null) { |
|
250 |
this.cmbAngle= new JComboBox(); |
|
251 |
this.cmbAngle.setEditable(false); |
|
252 |
this.cmbAngle.setBounds(cmbAnglePosition); |
|
253 |
this.fillFieldsNames(this.cmbAngle,new int[]{Types.INTEGER,Types.DOUBLE}); |
|
254 |
this.cmbAngle.addItemListener(this.eventsListener); |
|
255 |
} |
|
256 |
return this.cmbAngle; |
|
257 |
} |
|
258 |
|
|
259 |
public String getAngleFieldName(){ |
|
260 |
return (String)this.getCmbAngle().getSelectedItem(); |
|
261 |
} |
|
262 |
|
|
263 |
private JComboBox getCmbColor() { |
|
264 |
if (this.cmbColor == null) { |
|
265 |
this.cmbColor= new JComboBox(); |
|
266 |
this.cmbColor.setEditable(false); |
|
267 |
this.cmbColor.setBounds(cmbColorPosition); |
|
268 |
this.fillFieldsNames(this.cmbColor,new int[]{Types.INTEGER}); |
|
269 |
this.cmbColor.addItemListener(this.eventsListener); |
|
270 |
} |
|
271 |
return this.cmbColor; |
|
272 |
} |
|
273 |
|
|
274 |
public String getColorFieldName(){ |
|
275 |
return (String)this.getCmbColor().getSelectedItem(); |
|
276 |
} |
|
277 |
|
|
278 |
|
|
279 |
private JComboBox getCmbSize() { |
|
280 |
if (this.cmbSize == null) { |
|
281 |
this.cmbSize= new JComboBox(); |
|
282 |
this.cmbSize.setEditable(false); |
|
283 |
this.cmbSize.setBounds(cmbSizePosition); |
|
284 |
this.fillFieldsNames(this.cmbSize,new int[]{Types.INTEGER,Types.DOUBLE}); |
|
285 |
this.cmbSize.addItemListener(this.eventsListener); |
|
286 |
} |
|
287 |
return this.cmbSize; |
|
288 |
} |
|
289 |
|
|
290 |
|
|
291 |
public String getSizeFieldName(){ |
|
292 |
return (String)this.getCmbSize().getSelectedItem(); |
|
293 |
} |
|
294 |
|
|
295 |
private JComboBox getCmbSizeUnits() { |
|
296 |
if (this.cmbSizeUnits == null) { |
|
297 |
this.cmbSizeUnits= new JComboBox(); |
|
298 |
this.cmbSizeUnits.setEditable(false); |
|
299 |
this.cmbSizeUnits.setBounds(cmbSizeUnitsPosition); |
|
300 |
this.cmbSizeUnits.addItem(" "); |
|
301 |
this.cmbSizeUnits.addItem(PluginServices.getText(this,"pixels")); |
|
302 |
this.cmbSizeUnits.addItem(PluginServices.getText(this,"metros")); |
|
303 |
this.cmbSizeUnits.addItemListener(this.eventsListener); |
|
304 |
} |
|
305 |
return this.cmbSizeUnits; |
|
306 |
} |
|
307 |
|
|
308 |
public boolean sizeUnitsInPixels(){ |
|
309 |
return (this.getCmbSize().getSelectedIndex() == 1); |
|
310 |
} |
|
311 |
|
|
312 |
|
|
313 |
private JComboBox getCmbFont() { |
|
314 |
if (this.cmbFont == null) { |
|
315 |
this.cmbFont= new JComboBox(); |
|
316 |
this.cmbFont.setEditable(false); |
|
317 |
this.cmbFont.setBounds(cmbFontPosition); |
|
318 |
this.fillFieldsNames(this.cmbFont,new int[]{Types.VARCHAR}); |
|
319 |
this.cmbFont.addItemListener(this.eventsListener); |
|
320 |
} |
|
321 |
return this.cmbFont; |
|
322 |
} |
|
323 |
|
|
324 |
public String getFontFieldName(){ |
|
325 |
return (String)this.getCmbFont().getSelectedItem(); |
|
326 |
} |
|
327 |
|
|
328 |
|
|
329 |
} |
|
0 | 330 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/Panels/annotation/SelectAnnotationLayerNameAndField.java | ||
---|---|---|
1 |
package com.iver.cit.gvsig.gui.Panels.annotation; |
|
2 |
|
|
3 |
import java.awt.Dimension; |
|
4 |
import java.awt.Rectangle; |
|
5 |
import java.awt.event.ItemEvent; |
|
6 |
import java.awt.event.ItemListener; |
|
7 |
import java.util.HashMap; |
|
8 |
import java.util.Map; |
|
9 |
|
|
10 |
import javax.swing.ComboBoxModel; |
|
11 |
import javax.swing.JComboBox; |
|
12 |
import javax.swing.JLabel; |
|
13 |
import javax.swing.JTextField; |
|
14 |
import javax.swing.event.CaretEvent; |
|
15 |
import javax.swing.event.CaretListener; |
|
16 |
|
|
17 |
import com.iver.andami.PluginServices; |
|
18 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
19 |
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation; |
|
20 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
|
21 |
|
|
22 |
import jwizardcomponent.JWizardComponents; |
|
23 |
import jwizardcomponent.JWizardPanel; |
|
24 |
|
|
25 |
public class SelectAnnotationLayerNameAndField extends JWizardPanel { |
|
26 |
private FLyrAnnotation layer; |
|
27 |
|
|
28 |
private JLabel lblDescription = null; |
|
29 |
private JLabel lblStep1 = null; |
|
30 |
private JLabel lblNewLayerName = null; |
|
31 |
private JLabel lblStep2 = null; |
|
32 |
private JLabel lblField = null; |
|
33 |
|
|
34 |
private JTextField txtNewLayerName = null; |
|
35 |
private JComboBox cmbField = null; |
|
36 |
|
|
37 |
|
|
38 |
private static final Rectangle lblDescriptionPosition = new Rectangle(4,4,355,75); |
|
39 |
|
|
40 |
private static final Rectangle lblStep1Position = new Rectangle(4,90,15,15); |
|
41 |
private static final Rectangle lblNewLayerNamePosition = new Rectangle(30,90,355,15); |
|
42 |
private static final Rectangle txtNewLayerNamePosition = new Rectangle(30,109,250,18); |
|
43 |
|
|
44 |
|
|
45 |
private static final Rectangle lblStep2Position = new Rectangle(4,135,15,12); |
|
46 |
private static final Rectangle lblFieldPosition = new Rectangle(30,135,355,30); |
|
47 |
private static final Rectangle cmbFieldPosition = new Rectangle(30,169,170,18); |
|
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
private class EventsListener implements CaretListener,ItemListener |
|
53 |
{ |
|
54 |
public void caretUpdate(CaretEvent arg0) { |
|
55 |
updateButtonsState(); |
|
56 |
} |
|
57 |
|
|
58 |
public void itemStateChanged(ItemEvent e) { |
|
59 |
updateButtonsState(); |
|
60 |
} |
|
61 |
|
|
62 |
} |
|
63 |
|
|
64 |
|
|
65 |
private void updateButtonsState() { |
|
66 |
setBackButtonEnabled(false); |
|
67 |
boolean enabled =checkIsOkPanelData(); |
|
68 |
setNextButtonEnabled(enabled); |
|
69 |
setFinishButtonEnabled(enabled); |
|
70 |
} |
|
71 |
|
|
72 |
|
|
73 |
private EventsListener eventsListener = new EventsListener(); |
|
74 |
|
|
75 |
|
|
76 |
protected boolean checkIsOkPanelData() { |
|
77 |
if (txtNewLayerName.getText().trim().length() < 1) { |
|
78 |
return false; |
|
79 |
} |
|
80 |
if (((String)cmbField.getSelectedItem()).trim().length() < 1) { |
|
81 |
return false; |
|
82 |
} |
|
83 |
return true; |
|
84 |
} |
|
85 |
|
|
86 |
|
|
87 |
public SelectAnnotationLayerNameAndField(JWizardComponents arg0,FLyrAnnotation layer) { |
|
88 |
super(arg0); |
|
89 |
this.layer =layer; |
|
90 |
this.initialize(); |
|
91 |
} |
|
92 |
|
|
93 |
protected void initialize() { |
|
94 |
this.setLayout(null); |
|
95 |
this.setSize(new Dimension(358,263)); |
|
96 |
this.addLabels(); |
|
97 |
|
|
98 |
this.add(getTxtNewLayerName(),null); |
|
99 |
this.add(getCmbField(),null); |
|
100 |
|
|
101 |
checkIsOkPanelData(); |
|
102 |
} |
|
103 |
|
|
104 |
private JTextField getTxtNewLayerName() { |
|
105 |
if (this.txtNewLayerName == null) { |
|
106 |
this.txtNewLayerName = new JTextField(); |
|
107 |
this.txtNewLayerName.setBounds(txtNewLayerNamePosition); |
|
108 |
this.txtNewLayerName.setText("NuevaCapa"); |
|
109 |
this.txtNewLayerName.addCaretListener(eventsListener); |
|
110 |
} |
|
111 |
return this.txtNewLayerName; |
|
112 |
} |
|
113 |
|
|
114 |
public String getNewLayerName() { |
|
115 |
return this.getTxtNewLayerName().getText(); |
|
116 |
} |
|
117 |
|
|
118 |
|
|
119 |
private JComboBox getCmbField() { |
|
120 |
if (this.cmbField == null) { |
|
121 |
this.cmbField = new JComboBox(); |
|
122 |
this.cmbField.setEditable(false); |
|
123 |
this.cmbField.setBounds(cmbFieldPosition); |
|
124 |
this.cmbField.addItemListener(this.eventsListener); |
|
125 |
this.cmbField.addItem(""); |
|
126 |
|
|
127 |
|
|
128 |
try { |
|
129 |
SelectableDataSource dataSource = this.layer.getRecordset(); |
|
130 |
|
|
131 |
String[] fieldsNames = dataSource.getFieldNames(); |
|
132 |
|
|
133 |
for (int i=0; i < fieldsNames.length; i++) { |
|
134 |
this.cmbField.addItem(fieldsNames[i]); |
|
135 |
} |
|
136 |
|
|
137 |
} catch (DriverException e) { |
|
138 |
// TODO Auto-generated catch block |
|
139 |
e.printStackTrace(); |
|
140 |
} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) { |
|
141 |
// TODO Auto-generated catch block |
|
142 |
e.printStackTrace(); |
|
143 |
} |
|
144 |
|
|
145 |
} |
|
146 |
return this.cmbField; |
|
147 |
} |
|
148 |
|
|
149 |
public String getField() { |
|
150 |
return (String)this.getCmbField().getSelectedItem(); |
|
151 |
} |
|
152 |
|
|
153 |
|
|
154 |
protected void addLabels() { |
|
155 |
this.lblDescription = new JLabel(); |
|
156 |
this.lblStep1 = new JLabel(); |
|
157 |
this.lblNewLayerName = new JLabel(); |
|
158 |
this.lblStep2 = new JLabel(); |
|
159 |
this.lblField= new JLabel(); |
|
160 |
|
|
161 |
this.lblDescription.setText(PluginServices.getText(this,"descripcion_de_crear_capa_de_anotaciones")); |
|
162 |
this.lblStep1.setText("1."); |
|
163 |
this.lblNewLayerName.setText(PluginServices.getText(this,"introduzca_el_nombre_de_la_nueva_capa_de_anotaciones")); |
|
164 |
this.lblStep2.setText("2."); |
|
165 |
this.lblField.setText(PluginServices.getText(this,"seleccione_el_campo_de_texto_que_desea_que_se_utilize_para_mostrar_la_nueva_capa_virtual")); |
|
166 |
|
|
167 |
this.lblDescription.setBounds(lblDescriptionPosition); |
|
168 |
this.lblStep1.setBounds(lblStep1Position); |
|
169 |
this.lblNewLayerName.setBounds(lblNewLayerNamePosition); |
|
170 |
this.lblStep2.setBounds(lblStep2Position); |
|
171 |
this.lblField.setBounds(lblFieldPosition); |
|
172 |
|
|
173 |
|
|
174 |
this.add(lblDescription,null); |
|
175 |
this.add(lblStep1,null); |
|
176 |
this.add(lblNewLayerName,null); |
|
177 |
this.add(lblStep2,null); |
|
178 |
this.add(lblField,null); |
|
179 |
|
|
180 |
} |
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
} |
|
0 | 185 |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/ThemeToAnnotationExtension.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig; |
42 | 42 |
|
43 |
import javax.swing.ImageIcon; |
|
44 |
|
|
45 |
import jwizardcomponent.FinishAction; |
|
46 |
import jwizardcomponent.JWizardComponents; |
|
47 |
|
|
43 | 48 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
44 | 49 |
import com.iver.andami.PluginServices; |
45 | 50 |
import com.iver.andami.plugins.Extension; |
... | ... | |
48 | 53 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
49 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation; |
50 | 55 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
56 |
import com.iver.cit.gvsig.fmap.layers.MappingAnnotation; |
|
51 | 57 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
52 |
import com.iver.cit.gvsig.gui.Panels.MappingFieldsToAnotation; |
|
58 |
import com.iver.cit.gvsig.gui.Panels.annotation.ConfigureLabel; |
|
59 |
import com.iver.cit.gvsig.gui.Panels.annotation.SelectAnnotationLayerNameAndField; |
|
60 |
import com.iver.cit.gvsig.gui.simpleWizard.SimpleWizard; |
|
53 | 61 |
import com.iver.cit.gvsig.project.ProjectView; |
54 | 62 |
|
55 | 63 |
|
... | ... | |
69 | 77 |
/** |
70 | 78 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String) |
71 | 79 |
*/ |
80 |
|
|
81 |
public class MyFinishAction extends FinishAction { |
|
82 |
private JWizardComponents myWizardComponents; |
|
83 |
private FMap map; |
|
84 |
private FLyrVect layerVectorial; |
|
85 |
private FLyrAnnotation layerAnnotation; |
|
86 |
|
|
87 |
public MyFinishAction(JWizardComponents wizardComponents, FMap map,FLyrVect layerVectorial, FLyrAnnotation layerAnnotation ) { |
|
88 |
super(wizardComponents); |
|
89 |
this.map = map; |
|
90 |
this.layerVectorial = layerVectorial; |
|
91 |
this.layerAnnotation = layerAnnotation; |
|
92 |
myWizardComponents = wizardComponents; |
|
93 |
} |
|
94 |
|
|
95 |
public void performAction() { |
|
96 |
|
|
97 |
SelectAnnotationLayerNameAndField panel1 = (SelectAnnotationLayerNameAndField) myWizardComponents.getWizardPanel(0); |
|
98 |
ConfigureLabel panel2 = (ConfigureLabel) myWizardComponents.getWizardPanel(1); |
|
99 |
|
|
100 |
SelectableDataSource source; |
|
101 |
MappingAnnotation mapping=new MappingAnnotation(); |
|
102 |
|
|
103 |
try { |
|
104 |
source = this.layerAnnotation.getRecordset(); |
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
mapping.setColumnText(source.getFieldIndexByName(panel1.getField())); |
|
109 |
|
|
110 |
if (!panel2.getAngleFieldName().equals("")) { |
|
111 |
mapping.setColumnRotate(source.getFieldIndexByName(panel2.getAngleFieldName())); |
|
112 |
} |
|
113 |
|
|
114 |
if (!panel2.getColorFieldName().equals("")) { |
|
115 |
mapping.setColumnColor(source.getFieldIndexByName(panel2.getColorFieldName())); |
|
116 |
} |
|
117 |
|
|
118 |
if (!panel2.getSizeFieldName().equals("")) { |
|
119 |
mapping.setColumnHeight(source.getFieldIndexByName(panel2.getSizeFieldName())); |
|
120 |
this.layerAnnotation.setInPixels(panel2.sizeUnitsInPixels()); |
|
121 |
} |
|
122 |
|
|
123 |
if (!panel2.getFontFieldName().equals("")) { |
|
124 |
mapping.setColumnTypeFont(source.getFieldIndexByName(panel2.getFontFieldName())); |
|
125 |
} |
|
126 |
} catch (com.iver.cit.gvsig.fmap.DriverException e) { |
|
127 |
// TODO Que hacemos aqui |
|
128 |
e.printStackTrace(); |
|
129 |
return; |
|
130 |
} catch (DriverException e) { |
|
131 |
// TODO Auto-generated catch block |
|
132 |
e.printStackTrace(); |
|
133 |
} |
|
134 |
|
|
135 |
|
|
136 |
this.layerAnnotation.setName(panel1.getNewLayerName()); |
|
137 |
this.layerAnnotation.setMapping(mapping); |
|
138 |
|
|
139 |
|
|
140 |
this.map.getLayers().addLayer(this.layerAnnotation); |
|
141 |
this.map.getLayers().removeLayer(this.layerVectorial); |
|
142 |
|
|
143 |
} |
|
144 |
|
|
145 |
} |
|
72 | 146 |
public void execute(String actionCommand) { |
73 | 147 |
if ("LAYERTOANNOTATION".equals(actionCommand)) { |
148 |
ImageIcon Logo = new javax.swing.ImageIcon(this.getClass().getClassLoader() |
|
149 |
.getResource("images/package_graphics.png")); |
|
150 |
|
|
151 |
SimpleWizard wizard = new SimpleWizard(Logo); |
|
152 |
|
|
74 | 153 |
FLyrVect lv=(FLyrVect)map.getLayers().getActives()[0]; |
75 | 154 |
FLyrAnnotation la=new FLyrAnnotation(); |
76 | 155 |
la.setSource(lv.getSource()); |
77 | 156 |
|
157 |
|
|
158 |
SelectAnnotationLayerNameAndField panel1 = new SelectAnnotationLayerNameAndField(wizard.getWizardComponents(),la); |
|
159 |
ConfigureLabel panel2 = new ConfigureLabel(wizard.getWizardComponents(),la); |
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
wizard.getWizardComponents().addWizardPanel(panel1); |
|
164 |
wizard.getWizardComponents().addWizardPanel(panel2); |
|
165 |
|
|
166 |
wizard.getWizardComponents().setFinishAction( |
|
167 |
new MyFinishAction(wizard.getWizardComponents(), |
|
168 |
map,lv, la)); |
|
169 |
|
|
170 |
wizard.getViewInfo().setWidth(540); |
|
171 |
wizard.getViewInfo().setHeight(380); |
|
172 |
wizard.getViewInfo().setTitle(PluginServices.getText(this,"to_annotation")); |
|
173 |
|
|
174 |
PluginServices.getMDIManager().addView(wizard); |
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
/* |
|
179 |
FLyrVect lv=(FLyrVect)map.getLayers().getActives()[0]; |
|
180 |
FLyrAnnotation la=new FLyrAnnotation(); |
|
181 |
la.setSource(lv.getSource()); |
|
182 |
|
|
78 | 183 |
MappingFieldsToAnotation mfta=new MappingFieldsToAnotation(la); |
79 | 184 |
PluginServices.getMDIManager().addView(mfta); |
80 | 185 |
|
... | ... | |
82 | 187 |
map.getLayers().addLayer(la); |
83 | 188 |
map.getLayers().removeLayer(lv); |
84 | 189 |
} |
190 |
*/ |
|
191 |
|
|
85 | 192 |
} |
86 | 193 |
} |
87 | 194 |
|
... | ... | |
130 | 237 |
return false; |
131 | 238 |
} |
132 | 239 |
} |
240 |
|
|
241 |
|
|
133 | 242 |
} |
trunk/applications/appgvSIG/text.properties | ||
---|---|---|
674 | 674 |
import=Importar |
675 | 675 |
export=Exportar |
676 | 676 |
web_map_context=Web Map Context |
677 |
No_se_pudo_obtener_la_tabla_de_la_capa=No se pudo obtener la tabla de la capa |
|
677 |
No_se_pudo_obtener_la_tabla_de_la_capa=No se pudo obtener la tabla de la capa |
|
678 |
descripcion_de_crear_capa_de_anotaciones=<HTML>Con esta herramienta puede crear una capa virtual basada en una capa ya existente que le permita realizar un etiquetado avanzado. Cambia la visualizacion de la capa seleccionada mostrando el valor<br> de uno de sus campos.</HTML> |
|
679 |
introduzca_el_nombre_de_la_nueva_capa_de_anotaciones=Introduzca el nombre para la nueva capa de anotaciones |
|
680 |
seleccione_el_campo_de_texto_que_desea_que_se_utilize_para_mostrar_la_nueva_capa_virtual=<HTML>Seleccione el campo de texto que desea que se utilice para mostrar en la nueva capa virtual.</HTML> |
|
681 |
descripcion_de_configuracion_capa_de_anotaciones=<HTML>Si desea utilizar valores comunes a todos los atributos de la capa deje los valores por defecto. Si desea personalizar como se muestran la etiquetas seleccione los campos que almacenan los valores.</HTML> |
|
682 |
seleccione_el_campo_angulo_de_la_capa_de_anotaciones=<HTML>Seleccione el campo donde se almacenar? el ?ngulo con el que se mostrar? el texto de la etiqueta</HTML> |
|
683 |
seleccione_el_campo_color_de_la_capa_de_anotaciones=<HTML>Selecione el campo donde se almacenar? el color con el que se mostrar? la etiqueta</HTML> |
|
684 |
seleccione_el_campo_tamano_de_la_capa_de_anotaciones=<HTML>Selecione el campo donde se almacenar? el alto con el que se mostrar? la etiqueta</HTML> |
|
685 |
seleccione_el_campo_fuente_de_la_capa_de_anotaciones=<HTML>Selecione el campo donde se almacenar? la fuente con el que se mostrar? de la etiqueta</HTML> |
|
686 |
en_unidades=en unidades |
Also available in: Unified diff