Revision 36475 branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/FPanelLocConfig.java
FPanelLocConfig.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 18-jun-2004 |
|
1 |
/* gvSIG. Geographic Information System of the Valencian Government |
|
3 | 2 |
* |
4 |
* TODO To change the template for this generated file go to |
|
5 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
6 |
*/ |
|
7 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
8 |
* |
|
9 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
10 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
11 | 6 |
* This program is free software; you can redistribute it and/or |
12 | 7 |
* modify it under the terms of the GNU General Public License |
13 | 8 |
* as published by the Free Software Foundation; either version 2 |
14 | 9 |
* of the License, or (at your option) any later version. |
15 |
* |
|
10 |
*
|
|
16 | 11 |
* This program is distributed in the hope that it will be useful, |
17 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
19 | 14 |
* GNU General Public License for more details. |
20 |
* |
|
15 |
*
|
|
21 | 16 |
* You should have received a copy of the GNU General Public License |
22 | 17 |
* along with this program; if not, write to the Free Software |
23 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
24 |
* |
|
25 |
* For more information, contact: |
|
26 |
* |
|
27 |
* Generalitat Valenciana |
|
28 |
* Conselleria d'Infraestructures i Transport |
|
29 |
* Av. Blasco Ib??ez, 50 |
|
30 |
* 46010 VALENCIA |
|
31 |
* SPAIN |
|
32 |
* |
|
33 |
* +34 963862235 |
|
34 |
* gvsig@gva.es |
|
35 |
* www.gvsig.gva.es |
|
36 |
* |
|
37 |
* or |
|
38 |
* |
|
39 |
* IVER T.I. S.A |
|
40 |
* Salamanca 50 |
|
41 |
* 46005 Valencia |
|
42 |
* Spain |
|
43 |
* |
|
44 |
* +34 963163400 |
|
45 |
* dac@iver.es |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
46 | 21 |
*/ |
47 | 22 |
package org.gvsig.app.project.documents.view.gui; |
48 | 23 |
|
... | ... | |
53 | 28 |
|
54 | 29 |
import javax.swing.BorderFactory; |
55 | 30 |
import javax.swing.DefaultListModel; |
31 |
import javax.swing.JButton; |
|
56 | 32 |
import javax.swing.JDialog; |
57 | 33 |
import javax.swing.JOptionPane; |
58 | 34 |
import javax.swing.JPanel; |
... | ... | |
69 | 45 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
70 | 46 |
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable; |
71 | 47 |
import org.gvsig.fmap.mapcontrol.MapControl; |
72 |
import org.gvsig.gui.beans.swing.JButton;
|
|
48 |
import org.gvsig.tools.swing.api.ToolsSwingLocator;
|
|
73 | 49 |
|
74 |
|
|
75 | 50 |
/** |
76 | 51 |
* @author FJP |
77 |
* |
|
78 |
* TODO To change the template for this generated type comment go to |
|
79 |
* Window - Preferences - Java - Code Generation - Code and Comments |
|
52 |
*
|
|
53 |
* TODO To change the template for this generated type comment go to
|
|
54 |
* Window - Preferences - Java - Code Generation - Code and Comments
|
|
80 | 55 |
*/ |
81 |
public class FPanelLocConfig extends JPanel implements ActionListener,IWindow { |
|
82 |
private javax.swing.JLabel jLabel = null; |
|
83 |
private javax.swing.JList jList = null; // @jve:decl-index=0:visual-constraint="390,10" |
|
84 |
private JButton jBtnAddLayer = null; // |
|
85 |
private JButton jBtnRemoveLayer = null; |
|
86 |
private JButton jBtnEditLegend = null; |
|
87 |
private JButton jBtnCancel = null; |
|
56 |
public class FPanelLocConfig extends JPanel implements ActionListener, IWindow { |
|
88 | 57 |
|
89 |
//private JDialog m_Owner; |
|
90 |
private MapControl mapCtrl; |
|
91 |
private WindowInfo m_viewinfo = null; |
|
92 |
private JPanel pnlButtons = null; // @jve:decl-index=0:visual-constraint="10,159" |
|
93 |
private BasicArrowButton jBtnUp; |
|
94 |
private BasicArrowButton jBtnDown; |
|
95 |
/** |
|
96 |
* This is the default constructor |
|
97 |
*/ |
|
98 |
public FPanelLocConfig( MapControl mc) { |
|
99 |
super(); |
|
100 |
mapCtrl = mc; |
|
101 |
initialize(); |
|
102 |
refreshList(); |
|
103 |
updateControls(null); |
|
104 |
} |
|
58 |
private static final long serialVersionUID = -3331364698732098356L; |
|
59 |
private javax.swing.JLabel jLabel = null; |
|
60 |
private javax.swing.JList jList = null; // @jve:decl-index=0:visual-constraint="390,10" |
|
61 |
private JButton jBtnAddLayer = null; // |
|
62 |
private JButton jBtnRemoveLayer = null; |
|
63 |
private JButton jBtnEditLegend = null; |
|
64 |
private JButton jBtnCancel = null; |
|
105 | 65 |
|
106 |
private void refreshList() |
|
107 |
{ |
|
108 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
109 |
lstModel.clear(); |
|
110 |
for (int i=mapCtrl.getMapContext().getLayers().getLayersCount()-1; i >=0; i--) |
|
111 |
{ |
|
112 |
FLayer lyr = mapCtrl.getMapContext().getLayers().getLayer(i); |
|
113 |
lstModel.addElement(lyr.getName()); |
|
114 |
} |
|
115 |
} |
|
66 |
private MapControl mapCtrl; |
|
67 |
private WindowInfo m_viewinfo = null; |
|
68 |
private JPanel pnlButtons = null; // @jve:decl-index=0:visual-constraint="10,159" |
|
69 |
private BasicArrowButton jBtnUp; |
|
70 |
private BasicArrowButton jBtnDown; |
|
116 | 71 |
|
117 |
/** |
|
118 |
* This method initializes this |
|
119 |
* |
|
120 |
* @return void |
|
121 |
*/ |
|
122 |
private void initialize() { |
|
123 |
this.setLayout(null); |
|
124 |
this.setSize(550, 200); |
|
125 |
// this.setPreferredSize(new java.awt.Dimension(370,200)); |
|
126 |
this.add(getJLabel(), null); |
|
127 |
this.add(getJList(), null); |
|
128 |
this.add(getJBtnUp(), null); |
|
129 |
this.add(getJBtnDown(), null); |
|
130 |
this.add(getJPanel(), null); |
|
131 |
} |
|
132 |
/** |
|
72 |
/** |
|
73 |
* This is the default constructor |
|
74 |
*/ |
|
75 |
public FPanelLocConfig(MapControl mc) { |
|
76 |
super(); |
|
77 |
mapCtrl = mc; |
|
78 |
initialize(); |
|
79 |
refreshList(); |
|
80 |
updateControls(null); |
|
81 |
} |
|
133 | 82 |
|
134 |
* This method initializes jLabel |
|
83 |
private void refreshList() { |
|
84 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
85 |
lstModel.clear(); |
|
86 |
for (int i = mapCtrl.getMapContext().getLayers().getLayersCount() - 1; i >= 0; i--) { |
|
87 |
FLayer lyr = mapCtrl.getMapContext().getLayers().getLayer(i); |
|
88 |
lstModel.addElement(lyr.getName()); |
|
89 |
} |
|
90 |
} |
|
135 | 91 |
|
136 |
* |
|
92 |
/** |
|
93 |
* This method initializes this |
|
94 |
* |
|
95 |
* @return void |
|
96 |
*/ |
|
97 |
private void initialize() { |
|
98 |
this.setLayout(null); |
|
99 |
this.setSize(550, 200); |
|
100 |
this.add(getJLabel(), null); |
|
101 |
this.add(getJList(), null); |
|
102 |
this.add(getJBtnUp(), null); |
|
103 |
this.add(getJBtnDown(), null); |
|
104 |
this.add(getJPanel(), null); |
|
105 |
} |
|
137 | 106 |
|
138 |
* @return javax.swing.JLabel |
|
107 |
/** |
|
108 |
* This method initializes jLabel |
|
109 |
* |
|
110 |
* @return javax.swing.JLabel |
|
111 |
*/ |
|
112 |
private javax.swing.JLabel getJLabel() { |
|
113 |
if (jLabel == null) { |
|
114 |
jLabel = new javax.swing.JLabel(); |
|
115 |
jLabel.setText(PluginServices |
|
116 |
.getText(this, "Capas_del_localizador") + ":"); |
|
117 |
jLabel.setBounds(10, 15, 132, 25); |
|
118 |
} |
|
119 |
return jLabel; |
|
120 |
} |
|
139 | 121 |
|
140 |
*/ |
|
141 |
private javax.swing.JLabel getJLabel() { |
|
142 |
if (jLabel == null) { |
|
143 |
jLabel = new javax.swing.JLabel(); |
|
144 |
jLabel.setText(PluginServices.getText(this,"Capas_del_localizador")+":"); |
|
145 |
jLabel.setBounds(10, 15, 132, 25); |
|
146 |
} |
|
147 |
return jLabel; |
|
148 |
} |
|
122 |
/** |
|
123 |
* This method initializes jList |
|
124 |
* |
|
125 |
* @return javax.swing.JList |
|
126 |
*/ |
|
127 |
public javax.swing.JList getJList() { |
|
128 |
if (jList == null) { |
|
129 |
jList = new javax.swing.JList(new DefaultListModel()); |
|
130 |
jList.setBounds(10, 49, 357, 139); |
|
131 |
jList |
|
132 |
.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
133 |
jList.setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
|
134 |
jList |
|
135 |
.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
149 | 136 |
|
150 |
/** |
|
137 |
public void valueChanged( |
|
138 |
javax.swing.event.ListSelectionEvent e) { |
|
139 |
updateControls(e); |
|
140 |
} |
|
141 |
}); |
|
151 | 142 |
|
152 |
* This method initializes jList |
|
143 |
} |
|
144 |
return jList; |
|
145 |
} |
|
153 | 146 |
|
154 |
* |
|
147 |
private void updateControls(javax.swing.event.ListSelectionEvent e) { |
|
148 |
System.out.println("valueChanged()"); // TODO Auto-generated Event stub |
|
149 |
// valueChanged() |
|
150 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
151 |
int selIndex = jList.getSelectedIndex(); |
|
152 |
jBtnDown.setEnabled(false); |
|
153 |
jBtnUp.setEnabled(false); |
|
155 | 154 |
|
156 |
* @return javax.swing.JList |
|
155 |
if (selIndex != -1) { |
|
156 |
if (lstModel.getSize() > 1) { |
|
157 |
if (selIndex < (lstModel.getSize() - 1)) { |
|
158 |
jBtnDown.setEnabled(true); |
|
159 |
} |
|
157 | 160 |
|
158 |
*/ |
|
159 |
public javax.swing.JList getJList() { |
|
160 |
if (jList == null) { |
|
161 |
jList = new javax.swing.JList(new DefaultListModel()); |
|
162 |
jList.setBounds(10, 49, 357, 139); |
|
163 |
jList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); |
|
164 |
jList.setBorder(BorderFactory.createLineBorder(Color.BLACK)); |
|
165 |
jList.addListSelectionListener(new javax.swing.event.ListSelectionListener() { |
|
161 |
if (selIndex > 0) { |
|
162 |
jBtnUp.setEnabled(true); |
|
163 |
} |
|
164 |
} |
|
166 | 165 |
|
167 |
public void valueChanged(javax.swing.event.ListSelectionEvent e) { |
|
168 |
updateControls(e); |
|
169 |
} |
|
170 |
}); |
|
166 |
} |
|
171 | 167 |
|
172 |
} |
|
173 |
return jList; |
|
174 |
} |
|
168 |
} |
|
175 | 169 |
|
176 |
private void updateControls(javax.swing.event.ListSelectionEvent e) |
|
177 |
{ |
|
178 |
System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged() |
|
179 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
180 |
int selIndex = jList.getSelectedIndex(); |
|
181 |
jBtnDown.setEnabled(false); |
|
182 |
jBtnUp.setEnabled(false); |
|
170 |
/** |
|
171 |
* This method initializes jBtnUp |
|
172 |
* |
|
173 |
* @return JButton |
|
174 |
*/ |
|
175 |
private BasicArrowButton getJBtnUp() { |
|
176 |
if (jBtnUp == null) { |
|
177 |
jBtnUp = |
|
178 |
new javax.swing.plaf.basic.BasicArrowButton( |
|
179 |
javax.swing.SwingConstants.NORTH); |
|
180 |
jBtnUp.setBounds(374, 49, 25, 23); |
|
181 |
jBtnUp.setToolTipText(PluginServices.getText(this, "Subir_capa")); |
|
182 |
jBtnUp.addActionListener(this); |
|
183 |
jBtnUp.setActionCommand("UP"); |
|
183 | 184 |
|
184 |
if (selIndex != -1) |
|
185 |
{ |
|
186 |
if (lstModel.getSize() > 1) |
|
187 |
{ |
|
188 |
if (selIndex < (lstModel.getSize()-1)) { |
|
189 |
jBtnDown.setEnabled(true); |
|
190 |
} |
|
185 |
} |
|
186 |
return jBtnUp; |
|
187 |
} |
|
191 | 188 |
|
192 |
if (selIndex > 0) { |
|
193 |
jBtnUp.setEnabled(true); |
|
194 |
} |
|
195 |
} |
|
189 |
/** |
|
190 |
* This method initializes jBtnDown |
|
191 |
* |
|
192 |
* @return JButton |
|
193 |
*/ |
|
194 |
private BasicArrowButton getJBtnDown() { |
|
195 |
if (jBtnDown == null) { |
|
196 |
jBtnDown = |
|
197 |
new javax.swing.plaf.basic.BasicArrowButton( |
|
198 |
javax.swing.SwingConstants.SOUTH); |
|
199 |
jBtnDown.setBounds(374, 164, 25, 23); |
|
200 |
jBtnDown.setToolTipText(PluginServices.getText(this, "Bajar_capa")); |
|
201 |
jBtnDown.setActionCommand("DOWN"); |
|
202 |
jBtnDown.addActionListener(this); |
|
203 |
} |
|
204 |
return jBtnDown; |
|
205 |
} |
|
196 | 206 |
|
197 |
} |
|
207 |
/** |
|
208 |
* This method initializes jButton2 |
|
209 |
* |
|
210 |
* @return JButton |
|
211 |
*/ |
|
212 |
private JButton getJBtnAddLayer() { |
|
213 |
if (jBtnAddLayer == null) { |
|
214 |
jBtnAddLayer = |
|
215 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton(); |
|
216 |
jBtnAddLayer.setText(PluginServices.getText(this, "Anadir_capa") |
|
217 |
+ "..."); |
|
218 |
jBtnAddLayer.addActionListener(this); |
|
219 |
jBtnAddLayer.setActionCommand("ADD_LAYER"); |
|
220 |
} |
|
221 |
return jBtnAddLayer; |
|
222 |
} |
|
198 | 223 |
|
224 |
/** |
|
225 |
* This method initializes jBtnRemoveLayer |
|
226 |
* |
|
227 |
* @return JButton |
|
228 |
*/ |
|
229 |
private JButton getJBtnRemoveLayer() { |
|
230 |
if (jBtnRemoveLayer == null) { |
|
231 |
jBtnRemoveLayer = |
|
232 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton(); |
|
233 |
jBtnRemoveLayer.setText(PluginServices.getText(this, "Quitar_capa") |
|
234 |
+ "..."); |
|
235 |
jBtnRemoveLayer.addActionListener(this); |
|
236 |
jBtnRemoveLayer.setActionCommand("REMOVE_LAYER"); |
|
199 | 237 |
|
200 |
} |
|
238 |
} |
|
239 |
return jBtnRemoveLayer; |
|
240 |
} |
|
201 | 241 |
|
202 |
/** |
|
242 |
/** |
|
243 |
* This method initializes jBtnEditLegend |
|
244 |
* |
|
245 |
* @return JButton |
|
246 |
*/ |
|
247 |
private JButton getJBtnEditLegend() { |
|
248 |
if (jBtnEditLegend == null) { |
|
249 |
jBtnEditLegend = |
|
250 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton(); |
|
251 |
jBtnEditLegend.setText(PluginServices.getText(this, |
|
252 |
"Editar_leyenda") + "..."); |
|
253 |
jBtnEditLegend.addActionListener(this); |
|
254 |
jBtnEditLegend.setActionCommand("EDIT_LEGEND"); |
|
255 |
} |
|
256 |
return jBtnEditLegend; |
|
257 |
} |
|
203 | 258 |
|
204 |
* This method initializes jBtnUp |
|
259 |
/** |
|
260 |
* This method initializes jBtnCancel |
|
261 |
* |
|
262 |
* @return JButton |
|
263 |
*/ |
|
264 |
private JButton getJBtnCancel() { |
|
265 |
if (jBtnCancel == null) { |
|
266 |
jBtnCancel = |
|
267 |
ToolsSwingLocator.getUsabilitySwingManager().createJButton(); |
|
268 |
jBtnCancel.setText(PluginServices.getText(this, "Cerrar")); |
|
269 |
jBtnCancel.setActionCommand("CANCEL"); |
|
270 |
jBtnCancel.addActionListener(this); |
|
205 | 271 |
|
206 |
* |
|
272 |
} |
|
273 |
return jBtnCancel; |
|
274 |
} |
|
207 | 275 |
|
208 |
* @return JButton |
|
276 |
public void actionPerformed(ActionEvent e) { |
|
277 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
278 |
FLayers theLayers = mapCtrl.getMapContext().getLayers(); |
|
209 | 279 |
|
210 |
*/ |
|
211 |
private BasicArrowButton getJBtnUp() { |
|
212 |
if (jBtnUp == null) { |
|
213 |
jBtnUp = new javax.swing.plaf.basic.BasicArrowButton( |
|
214 |
javax.swing.SwingConstants.NORTH); |
|
215 |
jBtnUp.setBounds(374, 49, 25, 23); |
|
216 |
jBtnUp.setToolTipText(PluginServices.getText(this,"Subir_capa")); |
|
217 |
jBtnUp.addActionListener(this); |
|
218 |
jBtnUp.setActionCommand("UP"); |
|
280 |
int numLayers = theLayers.getLayersCount() - 1; |
|
219 | 281 |
|
220 |
} |
|
221 |
return jBtnUp; |
|
222 |
} |
|
223 |
|
|
224 |
/** |
|
225 |
|
|
226 |
* This method initializes jBtnDown |
|
227 |
|
|
228 |
* |
|
229 |
|
|
230 |
* @return JButton |
|
231 |
|
|
232 |
*/ |
|
233 |
private BasicArrowButton getJBtnDown() { |
|
234 |
if (jBtnDown == null) { |
|
235 |
jBtnDown = new javax.swing.plaf.basic.BasicArrowButton( |
|
236 |
javax.swing.SwingConstants.SOUTH); |
|
237 |
jBtnDown.setBounds(374, 164, 25, 23); |
|
238 |
jBtnDown.setToolTipText(PluginServices.getText(this,"Bajar_capa")); |
|
239 |
jBtnDown.setActionCommand("DOWN"); |
|
240 |
jBtnDown.addActionListener(this); |
|
241 |
} |
|
242 |
return jBtnDown; |
|
243 |
} |
|
244 |
|
|
245 |
/** |
|
246 |
|
|
247 |
* This method initializes jButton2 |
|
248 |
|
|
249 |
* |
|
250 |
|
|
251 |
* @return JButton |
|
252 |
|
|
253 |
*/ |
|
254 |
private JButton getJBtnAddLayer() { |
|
255 |
if (jBtnAddLayer == null) { |
|
256 |
jBtnAddLayer = new JButton(); |
|
257 |
jBtnAddLayer.setText(PluginServices.getText(this,"Anadir_capa")+"..."); |
|
258 |
jBtnAddLayer.addActionListener(this); |
|
259 |
jBtnAddLayer.setActionCommand("ADD_LAYER"); |
|
260 |
} |
|
261 |
return jBtnAddLayer; |
|
262 |
} |
|
263 |
|
|
264 |
/** |
|
265 |
|
|
266 |
* This method initializes jBtnRemoveLayer |
|
267 |
|
|
268 |
* |
|
269 |
|
|
270 |
* @return JButton |
|
271 |
|
|
272 |
*/ |
|
273 |
private JButton getJBtnRemoveLayer() { |
|
274 |
if (jBtnRemoveLayer == null) { |
|
275 |
jBtnRemoveLayer = new JButton(); |
|
276 |
jBtnRemoveLayer.setText(PluginServices.getText(this,"Quitar_capa")+"..."); |
|
277 |
jBtnRemoveLayer.addActionListener(this); |
|
278 |
jBtnRemoveLayer.setActionCommand("REMOVE_LAYER"); |
|
279 |
|
|
280 |
} |
|
281 |
return jBtnRemoveLayer; |
|
282 |
} |
|
283 |
|
|
284 |
/** |
|
285 |
|
|
286 |
* This method initializes jBtnEditLegend |
|
287 |
|
|
288 |
* |
|
289 |
|
|
290 |
* @return JButton |
|
291 |
|
|
292 |
*/ |
|
293 |
private JButton getJBtnEditLegend() { |
|
294 |
if (jBtnEditLegend == null) { |
|
295 |
jBtnEditLegend = new JButton(); |
|
296 |
jBtnEditLegend.setText(PluginServices.getText(this,"Editar_leyenda")+"..."); |
|
297 |
jBtnEditLegend.addActionListener(this); |
|
298 |
jBtnEditLegend.setActionCommand("EDIT_LEGEND"); |
|
299 |
} |
|
300 |
return jBtnEditLegend; |
|
301 |
} |
|
302 |
|
|
303 |
/** |
|
304 |
|
|
305 |
* This method initializes jBtnCancel |
|
306 |
|
|
307 |
* |
|
308 |
|
|
309 |
* @return JButton |
|
310 |
|
|
311 |
*/ |
|
312 |
private JButton getJBtnCancel() { |
|
313 |
if (jBtnCancel == null) { |
|
314 |
jBtnCancel = new JButton(); |
|
315 |
jBtnCancel.setText(PluginServices.getText(this,"Cerrar")); |
|
316 |
jBtnCancel.setActionCommand("CANCEL"); |
|
317 |
jBtnCancel.addActionListener(this); |
|
318 |
|
|
319 |
} |
|
320 |
return jBtnCancel; |
|
321 |
} |
|
322 |
|
|
323 |
/* (non-Javadoc) |
|
324 |
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) |
|
325 |
*/ |
|
326 |
public void actionPerformed(ActionEvent e) |
|
327 |
{ |
|
328 |
DefaultListModel lstModel = (DefaultListModel) getJList().getModel(); |
|
329 |
FLayers theLayers = mapCtrl.getMapContext().getLayers(); |
|
330 |
// IProjection proj = null; |
|
331 |
|
|
332 |
int numLayers = theLayers.getLayersCount()-1; |
|
333 |
|
|
334 |
if (e.getActionCommand() == "CANCEL") |
|
335 |
{ |
|
336 |
if (PluginServices.getMainFrame() != null) |
|
337 |
{ |
|
338 |
PluginServices.getMDIManager().closeWindow(FPanelLocConfig.this); |
|
339 |
} |
|
340 |
else |
|
341 |
{ |
|
342 |
((JDialog) (getParent().getParent().getParent().getParent())).dispose(); |
|
343 |
} |
|
344 |
} |
|
345 |
if (e.getActionCommand() == "ADD_LAYER") |
|
346 |
{ |
|
347 |
AddLayer addLayer = (AddLayer)PluginServices.getExtension( AddLayer.class);//new AddLayer(); |
|
348 |
//addLayer.initialize(); |
|
282 |
if (e.getActionCommand() == "CANCEL") { |
|
283 |
if (PluginServices.getMainFrame() != null) { |
|
284 |
PluginServices.getMDIManager() |
|
285 |
.closeWindow(FPanelLocConfig.this); |
|
286 |
} else { |
|
287 |
((JDialog) (getParent().getParent().getParent().getParent())) |
|
288 |
.dispose(); |
|
289 |
} |
|
290 |
} |
|
291 |
if (e.getActionCommand() == "ADD_LAYER") { |
|
292 |
AddLayer addLayer = |
|
293 |
(AddLayer) PluginServices.getExtension(AddLayer.class);// new |
|
294 |
// AddLayer(); |
|
295 |
// addLayer.initialize(); |
|
349 | 296 |
if (addLayer.addLayers(mapCtrl)) { |
350 |
refreshList();
|
|
351 |
updateControls(null);
|
|
297 |
refreshList();
|
|
298 |
updateControls(null);
|
|
352 | 299 |
} |
353 |
if (mapCtrl instanceof MapOverview){ |
|
354 |
((MapOverview)mapCtrl).refreshExtent();
|
|
300 |
if (mapCtrl instanceof MapOverview) {
|
|
301 |
((MapOverview) mapCtrl).refreshExtent();
|
|
355 | 302 |
} |
356 | 303 |
|
357 |
} |
|
358 |
if (e.getActionCommand() == "REMOVE_LAYER") |
|
359 |
{ |
|
360 |
if (jList.getSelectedIndex() != -1) |
|
361 |
{ |
|
362 |
theLayers.removeLayer((String) lstModel.get(jList.getSelectedIndex())); |
|
363 |
lstModel.remove(jList.getSelectedIndex()); |
|
364 |
///mapCtrl.drawMap(); |
|
365 |
updateControls(null); |
|
366 |
if (mapCtrl instanceof MapOverview){ |
|
367 |
((MapOverview)mapCtrl).refreshExtent(); |
|
304 |
} |
|
305 |
if (e.getActionCommand() == "REMOVE_LAYER") { |
|
306 |
if (jList.getSelectedIndex() != -1) { |
|
307 |
theLayers.removeLayer((String) lstModel.get(jList |
|
308 |
.getSelectedIndex())); |
|
309 |
lstModel.remove(jList.getSelectedIndex()); |
|
310 |
// /mapCtrl.drawMap(); |
|
311 |
updateControls(null); |
|
312 |
if (mapCtrl instanceof MapOverview) { |
|
313 |
((MapOverview) mapCtrl).refreshExtent(); |
|
368 | 314 |
} |
369 |
} |
|
370 |
} |
|
371 |
if (e.getActionCommand() == "EDIT_LEGEND") |
|
372 |
{ |
|
373 |
int idSelec = jList.getSelectedIndex(); |
|
374 |
if (idSelec != -1) |
|
375 |
{ |
|
376 |
FLayer lyr = theLayers.getLayer((String) lstModel.get(idSelec)); |
|
377 |
if (lyr instanceof Classifiable) |
|
378 |
{ |
|
379 |
ThemeManagerWindow m_LegendEditor = new ThemeManagerWindow(lyr/*, mapCtrl.getMapContext()*/); |
|
380 |
theLayers.setActive(false); |
|
381 |
lyr.setActive(true); |
|
382 |
if (PluginServices.getMainFrame() == null) { |
|
383 |
JDialog dlg = new JDialog(); |
|
315 |
} |
|
316 |
} |
|
317 |
if (e.getActionCommand() == "EDIT_LEGEND") { |
|
318 |
int idSelec = jList.getSelectedIndex(); |
|
319 |
if (idSelec != -1) { |
|
320 |
FLayer lyr = theLayers.getLayer((String) lstModel.get(idSelec)); |
|
321 |
if (lyr instanceof Classifiable) { |
|
322 |
ThemeManagerWindow m_LegendEditor = |
|
323 |
new ThemeManagerWindow(lyr/* , mapCtrl.getMapContext() */); |
|
324 |
theLayers.setActive(false); |
|
325 |
lyr.setActive(true); |
|
326 |
if (PluginServices.getMainFrame() == null) { |
|
327 |
JDialog dlg = new JDialog(); |
|
384 | 328 |
|
385 |
m_LegendEditor.setPreferredSize(m_LegendEditor.getSize()); |
|
386 |
dlg.getContentPane().add(m_LegendEditor); |
|
387 |
dlg.setModal(true); |
|
388 |
dlg.pack(); |
|
389 |
dlg.show(); |
|
329 |
m_LegendEditor.setPreferredSize(m_LegendEditor |
|
330 |
.getSize()); |
|
331 |
dlg.getContentPane().add(m_LegendEditor); |
|
332 |
dlg.setModal(true); |
|
333 |
dlg.pack(); |
|
334 |
dlg.setVisible(true); |
|
390 | 335 |
|
391 |
} else { |
|
392 |
PluginServices.getMDIManager().addWindow(m_LegendEditor); |
|
393 |
} |
|
394 |
} |
|
395 |
else |
|
396 |
{ |
|
397 |
JOptionPane.showMessageDialog(null, PluginServices.getText(this,"Solo_para_capas_vectoriales")+"."); |
|
398 |
} |
|
336 |
} else { |
|
337 |
PluginServices.getMDIManager() |
|
338 |
.addWindow(m_LegendEditor); |
|
339 |
} |
|
340 |
} else { |
|
341 |
JOptionPane.showMessageDialog( |
|
342 |
null, |
|
343 |
PluginServices.getText(this, |
|
344 |
"Solo_para_capas_vectoriales") + "."); |
|
345 |
} |
|
399 | 346 |
|
400 |
}
|
|
347 |
}
|
|
401 | 348 |
|
402 |
} |
|
403 |
if (e.getActionCommand() == "UP") |
|
404 |
{ |
|
405 |
int idSelec = jList.getSelectedIndex(); |
|
406 |
int fromIndex = idSelec; |
|
407 |
int toIndex = idSelec-1; |
|
408 |
FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex)); |
|
409 |
try { |
|
410 |
theLayers.moveTo(numLayers-fromIndex, numLayers-toIndex); |
|
411 |
} catch (CancelationException e1) { |
|
412 |
e1.printStackTrace(); |
|
413 |
} |
|
349 |
} |
|
350 |
if (e.getActionCommand() == "UP") { |
|
351 |
int idSelec = jList.getSelectedIndex(); |
|
352 |
int fromIndex = idSelec; |
|
353 |
int toIndex = idSelec - 1; |
|
354 |
FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex)); |
|
355 |
try { |
|
356 |
theLayers.moveTo(numLayers - fromIndex, numLayers - toIndex); |
|
357 |
} catch (CancelationException e1) { |
|
358 |
e1.printStackTrace(); |
|
359 |
} |
|
414 | 360 |
|
415 |
lstModel.remove(fromIndex);
|
|
416 |
lstModel.add(toIndex,aux.getName());
|
|
361 |
lstModel.remove(fromIndex);
|
|
362 |
lstModel.add(toIndex, aux.getName());
|
|
417 | 363 |
|
418 |
jList.setSelectedIndex(toIndex); |
|
364 |
jList.setSelectedIndex(toIndex); |
|
365 |
} |
|
366 |
if (e.getActionCommand() == "DOWN") { |
|
367 |
int idSelec = jList.getSelectedIndex(); |
|
368 |
int fromIndex = idSelec; |
|
369 |
int toIndex = idSelec + 1; |
|
370 |
FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex)); |
|
371 |
try { |
|
372 |
theLayers.moveTo(numLayers - fromIndex, numLayers - toIndex); |
|
373 |
} catch (CancelationException e1) { |
|
374 |
e1.printStackTrace(); |
|
375 |
} |
|
419 | 376 |
|
420 |
///mapCtrl.drawMap(); |
|
421 |
} |
|
422 |
if (e.getActionCommand() == "DOWN") |
|
423 |
{ |
|
424 |
int idSelec = jList.getSelectedIndex(); |
|
425 |
int fromIndex = idSelec; |
|
426 |
int toIndex = idSelec+1; |
|
427 |
FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex)); |
|
428 |
try { |
|
429 |
theLayers.moveTo(numLayers-fromIndex, numLayers-toIndex); |
|
430 |
} catch (CancelationException e1) { |
|
431 |
e1.printStackTrace(); |
|
432 |
} |
|
377 |
lstModel.remove(fromIndex); |
|
378 |
lstModel.add(toIndex, aux.getName()); |
|
433 | 379 |
|
434 |
lstModel.remove(fromIndex);
|
|
435 |
lstModel.add(toIndex,aux.getName());
|
|
380 |
jList.setSelectedIndex(toIndex);
|
|
381 |
}
|
|
436 | 382 |
|
437 |
jList.setSelectedIndex(toIndex);
|
|
383 |
}
|
|
438 | 384 |
|
439 |
///mapCtrl.drawMap(); |
|
440 |
} |
|
385 |
public WindowInfo getWindowInfo() { |
|
386 |
if (m_viewinfo == null) { |
|
387 |
m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG); |
|
388 |
m_viewinfo.setTitle(PluginServices.getText(this, |
|
389 |
"Configurar_localizador")); |
|
390 |
m_viewinfo.setWidth(this.getWidth() + 8); |
|
391 |
m_viewinfo.setHeight(this.getHeight() + 8); |
|
392 |
} |
|
393 |
return m_viewinfo; |
|
394 |
} |
|
441 | 395 |
|
396 |
/** |
|
397 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated() |
|
398 |
*/ |
|
399 |
public void viewActivated() { |
|
400 |
} |
|
442 | 401 |
|
443 |
} |
|
444 |
/* (non-Javadoc) |
|
445 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo() |
|
446 |
*/ |
|
447 |
public WindowInfo getWindowInfo() { |
|
448 |
if (m_viewinfo==null){ |
|
449 |
m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG); |
|
450 |
m_viewinfo.setTitle(PluginServices.getText(this,"Configurar_localizador")); |
|
451 |
m_viewinfo.setWidth(this.getWidth()+8); |
|
452 |
m_viewinfo.setHeight(this.getHeight()+8); |
|
453 |
} |
|
454 |
return m_viewinfo; |
|
455 |
} |
|
456 |
/** |
|
457 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated() |
|
458 |
*/ |
|
459 |
public void viewActivated() { |
|
460 |
} |
|
402 |
/** |
|
403 |
* This method initializes jPanel |
|
404 |
* |
|
405 |
* @return javax.swing.JPanel |
|
406 |
*/ |
|
407 |
private JPanel getJPanel() { |
|
408 |
if (pnlButtons == null) { |
|
409 |
pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); |
|
410 |
pnlButtons.setBounds(new java.awt.Rectangle(0, 200, |
|
411 |
this.getWidth(), 37)); |
|
412 |
pnlButtons.add(getJBtnAddLayer(), null); |
|
413 |
pnlButtons.add(getJBtnRemoveLayer(), null); |
|
414 |
pnlButtons.add(getJBtnEditLegend(), null); |
|
415 |
pnlButtons.add(getJBtnCancel(), null); |
|
416 |
} |
|
417 |
return pnlButtons; |
|
418 |
} |
|
461 | 419 |
|
462 |
/** |
|
463 |
* This method initializes jPanel |
|
464 |
* |
|
465 |
* @return javax.swing.JPanel |
|
466 |
*/ |
|
467 |
private JPanel getJPanel() { |
|
468 |
if (pnlButtons == null) { |
|
469 |
pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5)); |
|
470 |
pnlButtons.setBounds(new java.awt.Rectangle(0,200, this.getWidth(),37)); |
|
471 |
pnlButtons.add(getJBtnAddLayer(), null); |
|
472 |
pnlButtons.add(getJBtnRemoveLayer(), null); |
|
473 |
pnlButtons.add(getJBtnEditLegend(), null); |
|
474 |
pnlButtons.add(getJBtnCancel(), null); |
|
475 |
} |
|
476 |
return pnlButtons; |
|
477 |
} |
|
420 |
/** |
|
421 |
* Obtiene el MapControl asociado al localizador |
|
422 |
* |
|
423 |
* @return MapControl |
|
424 |
*/ |
|
425 |
public MapControl getMapCtrl() { |
|
426 |
return mapCtrl; |
|
427 |
} |
|
478 | 428 |
|
479 |
/** |
|
480 |
* Obtiene el MapControl asociado al localizador |
|
481 |
* @return MapControl |
|
482 |
*/ |
|
483 |
public MapControl getMapCtrl() { |
|
484 |
return mapCtrl; |
|
485 |
} |
|
486 |
public Object getWindowProfile() { |
|
487 |
return WindowInfo.DIALOG_PROFILE; |
|
488 |
} |
|
429 |
public Object getWindowProfile() { |
|
430 |
return WindowInfo.DIALOG_PROFILE; |
|
431 |
} |
|
489 | 432 |
|
490 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10" |
|
433 |
} // @jve:visual-info decl-index=0 visual-constraint="10,10" |
Also available in: Unified diff