Revision 36475
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/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" |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/AbstractViewPanel.java | ||
---|---|---|
1 | 1 |
/* gvSIG. Geographic Information System of the Valencian Government |
2 |
* |
|
3 |
* Copyright (C) 2007-2009 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
*/ |
|
2 |
*
|
|
3 |
* Copyright (C) 2007-2009 Infrastructures and Transports Department
|
|
4 |
* of the Valencian Government (CIT)
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or
|
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 2
|
|
9 |
* of the License, or (at your option) any later version.
|
|
10 |
*
|
|
11 |
* This program is distributed in the hope that it will be useful,
|
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
15 |
*
|
|
16 |
* You should have received a copy of the GNU General Public License
|
|
17 |
* along with this program; if not, write to the Free Software
|
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
19 |
* MA 02110-1301, USA.
|
|
20 |
*
|
|
21 |
*/
|
|
22 | 22 |
|
23 | 23 |
/* |
24 |
* AUTHORS (In addition to CIT): |
|
25 |
* 2004-2009 IVER TI |
|
26 |
* |
|
27 |
*/ |
|
24 |
* AUTHORS (In addition to CIT):
|
|
25 |
* 2004-2009 IVER TI
|
|
26 |
*
|
|
27 |
*/
|
|
28 | 28 |
package org.gvsig.app.project.documents.view.gui; |
29 | 29 |
|
30 | 30 |
import java.awt.Graphics; |
... | ... | |
34 | 34 |
import javax.swing.JSplitPane; |
35 | 35 |
|
36 | 36 |
import org.cresques.cts.IProjection; |
37 |
|
|
37 | 38 |
import org.gvsig.andami.PluginServices; |
38 | 39 |
import org.gvsig.andami.messages.NotificationManager; |
39 |
import org.gvsig.andami.ui.mdiManager.IWindowListener; |
|
40 | 40 |
import org.gvsig.andami.ui.mdiManager.IWindowTransform; |
41 |
import org.gvsig.andami.ui.mdiManager.SingletonWindow; |
|
42 | 41 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
43 | 42 |
import org.gvsig.app.project.documents.gui.WindowLayout; |
43 |
import org.gvsig.app.project.documents.view.MapOverview; |
|
44 | 44 |
import org.gvsig.app.project.documents.view.ViewDocument; |
45 |
import org.gvsig.app.project.documents.view.MapOverview; |
|
46 | 45 |
import org.gvsig.app.project.documents.view.toc.gui.TOC; |
47 | 46 |
import org.gvsig.fmap.mapcontrol.MapControl; |
48 | 47 |
import org.gvsig.utils.exceptionHandling.ExceptionListener; |
49 | 48 |
|
50 |
|
|
51 | 49 |
/** |
52 |
* |
|
53 |
* @author 2005- Vicente Caballero |
|
54 |
* @author 2009- Joaquin del Cerro |
|
55 | 50 |
* |
51 |
* @author 2005- Vicente Caballero |
|
52 |
* @author 2009- Joaquin del Cerro |
|
53 |
* |
|
56 | 54 |
*/ |
57 | 55 |
|
58 |
public abstract class AbstractViewPanel extends JPanel |
|
59 |
implements IView, IWindowTransform {
|
|
56 |
public abstract class AbstractViewPanel extends JPanel implements IView,
|
|
57 |
IWindowTransform {
|
|
60 | 58 |
|
61 |
/** |
|
59 |
/**
|
|
62 | 60 |
* |
63 | 61 |
*/ |
64 |
private static final long serialVersionUID = -259620280790490262L;
|
|
62 |
private static final long serialVersionUID = -259620280790490262L;
|
|
65 | 63 |
|
66 |
protected MapControl m_MapControl; |
|
67 |
protected MapOverview m_MapLoc; |
|
64 |
protected MapControl m_MapControl;
|
|
65 |
protected MapOverview m_MapLoc;
|
|
68 | 66 |
|
69 |
// store the properties of the window |
|
70 |
protected WindowInfo m_viewInfo = null; |
|
71 |
protected WindowLayout windowLayout = null; |
|
67 |
// store the properties of the window
|
|
68 |
protected WindowInfo m_viewInfo = null;
|
|
69 |
protected WindowLayout windowLayout = null;
|
|
72 | 70 |
|
73 |
protected TOC m_TOC; |
|
74 |
protected ViewDocument modelo; |
|
75 |
protected ViewExceptionListener mapControlExceptionListener = new ViewExceptionListener(); |
|
71 |
protected TOC m_TOC; |
|
72 |
protected ViewDocument modelo; |
|
73 |
protected ViewExceptionListener mapControlExceptionListener = |
|
74 |
new ViewExceptionListener(); |
|
76 | 75 |
|
77 |
protected boolean isPalette=false;
|
|
78 |
protected MapOverViewPalette movp; |
|
79 |
protected ViewSplitPane tempMainSplit=null;
|
|
80 |
protected JSplitPane tempSplitToc=null;
|
|
76 |
protected boolean isPalette = false;
|
|
77 |
protected MapOverViewPalette movp;
|
|
78 |
protected ViewSplitPane tempMainSplit = null;
|
|
79 |
protected JSplitPane tempSplitToc = null;
|
|
81 | 80 |
|
82 |
public void windowActivated() { |
|
83 |
// By default do nothing |
|
84 |
} |
|
85 |
|
|
86 |
public void toPalette() { |
|
87 |
// By default do nothing |
|
88 |
} |
|
89 |
|
|
90 |
public void restore() { |
|
91 |
// By default do nothing |
|
92 |
} |
|
93 |
|
|
81 |
public void windowActivated() { |
|
82 |
// By default do nothing |
|
83 |
} |
|
94 | 84 |
|
95 |
protected class ViewSplitPane extends JSplitPane{ |
|
96 |
/** |
|
97 |
* |
|
98 |
*/ |
|
99 |
private static final long serialVersionUID = -7506953938664812652L; |
|
100 |
private int lastDivider=0; |
|
101 |
public ViewSplitPane(int horizontal_split) { |
|
102 |
super(horizontal_split); |
|
103 |
} |
|
85 |
public void toPalette() { |
|
86 |
// By default do nothing |
|
87 |
} |
|
104 | 88 |
|
105 |
protected void paintChildren(Graphics g) { |
|
106 |
if (lastDivider!=lastDividerLocation){ |
|
107 |
System.out.println("paintChildren = "+this.lastDividerLocation); |
|
108 |
lastDivider=lastDividerLocation; |
|
109 |
} |
|
110 |
super.paintChildren(g); |
|
111 |
} |
|
89 |
public void restore() { |
|
90 |
// By default do nothing |
|
91 |
} |
|
112 | 92 |
|
113 |
} |
|
114 |
/** |
|
115 |
* Creates a new View object. Before using it, it must be initialized |
|
116 |
* using the <code>initialize()</code> method. |
|
117 |
* |
|
118 |
* @see initialize() |
|
119 |
*/ |
|
120 |
public AbstractViewPanel() { |
|
121 |
// Do nothing |
|
122 |
} |
|
93 |
protected class ViewSplitPane extends JSplitPane { |
|
123 | 94 |
|
124 |
/** |
|
125 |
* Create the internal componentes and populate the window with them. |
|
126 |
* If the layout properties were set using the |
|
127 |
* <code>setWindowData(WindowData)</code> |
|
128 |
* method, the window will be populated according to this |
|
129 |
* properties. |
|
130 |
*/ |
|
131 |
protected void initialize() { |
|
132 |
// Do nothing |
|
133 |
} |
|
95 |
private static final long serialVersionUID = -7506953938664812652L; |
|
96 |
private int lastDivider = 0; |
|
134 | 97 |
|
135 |
/** |
|
136 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
137 |
* for this View. It is not intended to retrieve the ViewInfo object in a |
|
138 |
* later time. <strong>Use PluginServices.getMDIManager().getViewInfo(view) |
|
139 |
* to retrieve the ViewInfo object at any time after the creation of the |
|
140 |
* object. |
|
141 |
* |
|
142 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
143 |
*/ |
|
144 |
public WindowInfo getWindowInfo() { |
|
145 |
if (m_viewInfo == null) |
|
146 |
{ |
|
147 |
m_viewInfo = new WindowInfo(WindowInfo.ICONIFIABLE | WindowInfo.RESIZABLE | |
|
148 |
WindowInfo.MAXIMIZABLE); |
|
98 |
public ViewSplitPane(int horizontal_split) { |
|
99 |
super(horizontal_split); |
|
100 |
} |
|
149 | 101 |
|
150 |
m_viewInfo.setWidth(500); |
|
151 |
m_viewInfo.setHeight(300); |
|
152 |
m_viewInfo.setTitle(PluginServices.getText(this, "Vista") + " : " + |
|
153 |
modelo.getName()); |
|
154 |
} |
|
155 |
return m_viewInfo; |
|
156 |
} |
|
102 |
protected void paintChildren(Graphics g) { |
|
103 |
if (lastDivider != lastDividerLocation) { |
|
104 |
System.out.println("paintChildren = " |
|
105 |
+ this.lastDividerLocation); |
|
106 |
lastDivider = lastDividerLocation; |
|
107 |
} |
|
108 |
super.paintChildren(g); |
|
109 |
} |
|
157 | 110 |
|
158 |
/** |
|
159 |
* @see org.gvsig.andami.ui.mdiManager.IWindowListener#windowClosed() |
|
160 |
*/ |
|
161 |
public void windowClosed() { |
|
162 |
if (movp!=null) { |
|
163 |
PluginServices.getMDIManager().closeWindow(movp); |
|
164 |
} |
|
165 |
if (modelo != null) { |
|
166 |
modelo.setWindowLayout( this.getWindowLayout() ); |
|
167 |
} |
|
168 |
} |
|
111 |
} |
|
169 | 112 |
|
170 |
/** |
|
171 |
* @deprecated See {@link #getViewDocument()} |
|
172 |
*/ |
|
173 |
public ViewDocument getModel() { |
|
174 |
return modelo; |
|
175 |
} |
|
113 |
/** |
|
114 |
* Creates a new View object. Before using it, it must be initialized |
|
115 |
* using the <code>initialize()</code> method. |
|
116 |
* |
|
117 |
* @see initialize() |
|
118 |
*/ |
|
119 |
public AbstractViewPanel() { |
|
120 |
// Do nothing |
|
121 |
} |
|
176 | 122 |
|
177 |
public ViewDocument getViewDocument() { |
|
178 |
return modelo; |
|
179 |
} |
|
123 |
/** |
|
124 |
* Create the internal componentes and populate the window with them. |
|
125 |
* If the layout properties were set using the |
|
126 |
* <code>setWindowData(WindowData)</code> method, the window will be |
|
127 |
* populated according to this |
|
128 |
* properties. |
|
129 |
*/ |
|
130 |
protected void initialize() { |
|
131 |
// Do nothing |
|
132 |
} |
|
180 | 133 |
|
181 |
public MapOverview getMapOverview() { |
|
182 |
return m_MapLoc; |
|
183 |
} |
|
134 |
/** |
|
135 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
136 |
* for this View. It is not intended to retrieve the ViewInfo object in a |
|
137 |
* later time. <strong>Use PluginServices.getMDIManager().getViewInfo(view) |
|
138 |
* to retrieve the ViewInfo object at any time after the creation of the |
|
139 |
* object. |
|
140 |
* |
|
141 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
142 |
*/ |
|
143 |
public WindowInfo getWindowInfo() { |
|
144 |
if (m_viewInfo == null) { |
|
145 |
m_viewInfo = |
|
146 |
new WindowInfo(WindowInfo.ICONIFIABLE | WindowInfo.RESIZABLE |
|
147 |
| WindowInfo.MAXIMIZABLE); |
|
184 | 148 |
|
185 |
public MapControl getMapControl() { |
|
186 |
return m_MapControl; |
|
187 |
} |
|
149 |
m_viewInfo.setWidth(500); |
|
150 |
m_viewInfo.setHeight(300); |
|
151 |
m_viewInfo.setTitle(PluginServices.getText(this, "Vista") + " : " |
|
152 |
+ modelo.getName()); |
|
153 |
} |
|
154 |
return m_viewInfo; |
|
155 |
} |
|
188 | 156 |
|
189 |
public TOC getTOC() { |
|
190 |
return m_TOC; |
|
191 |
} |
|
157 |
/** |
|
158 |
* @see org.gvsig.andami.ui.mdiManager.IWindowListener#windowClosed() |
|
159 |
*/ |
|
160 |
public void windowClosed() { |
|
161 |
if (movp != null) { |
|
162 |
PluginServices.getMDIManager().closeWindow(movp); |
|
163 |
} |
|
164 |
if (modelo != null) { |
|
165 |
modelo.setWindowLayout(this.getWindowLayout()); |
|
166 |
} |
|
167 |
} |
|
192 | 168 |
|
193 |
/* (non-Javadoc) |
|
194 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonView#getModel() |
|
195 |
*/ |
|
169 |
/** |
|
170 |
* @deprecated See {@link #getViewDocument()} |
|
171 |
*/ |
|
172 |
public ViewDocument getModel() { |
|
173 |
return modelo; |
|
174 |
} |
|
196 | 175 |
|
197 |
public Object getWindowModel() {
|
|
198 |
return modelo; |
|
199 |
} |
|
176 |
public ViewDocument getViewDocument() {
|
|
177 |
return modelo;
|
|
178 |
}
|
|
200 | 179 |
|
201 |
/** |
|
202 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
203 |
* for this View. It is not intended to retrieve the ViewInfo object in a |
|
204 |
* later time. <strong>Use PluginServices.getMDIManager().getViewInfo(view) |
|
205 |
* to retrieve the ViewInfo object at any time after the creation of the |
|
206 |
* object. |
|
207 |
* |
|
208 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
209 |
*/ |
|
180 |
public MapOverview getMapOverview() { |
|
181 |
return m_MapLoc; |
|
182 |
} |
|
210 | 183 |
|
211 |
public boolean isPalette() {
|
|
212 |
return isPalette;
|
|
213 |
}
|
|
184 |
public MapControl getMapControl() {
|
|
185 |
return m_MapControl;
|
|
186 |
}
|
|
214 | 187 |
|
215 |
public void repaintMap() {
|
|
216 |
m_MapControl.drawMap(false);
|
|
217 |
} |
|
188 |
public TOC getTOC() {
|
|
189 |
return m_TOC;
|
|
190 |
}
|
|
218 | 191 |
|
219 |
public class ViewExceptionListener implements ExceptionListener { |
|
192 |
/* |
|
193 |
* (non-Javadoc) |
|
194 |
* |
|
195 |
* @see com.iver.mdiApp.ui.MDIManager.SingletonView#getModel() |
|
196 |
*/ |
|
220 | 197 |
|
221 |
/** |
|
222 |
* @see com.iver.cit.gvsig.fmap.ExceptionListener#exceptionThrown(java.lang.Throwable) |
|
223 |
*/ |
|
224 |
public void exceptionThrown(Throwable t) { |
|
225 |
NotificationManager.addError(t.getMessage(), t); |
|
226 |
} |
|
198 |
public Object getWindowModel() { |
|
199 |
return modelo; |
|
200 |
} |
|
227 | 201 |
|
228 |
} |
|
202 |
/** |
|
203 |
* This method is used to get <strong>an initial</strong> ViewInfo object |
|
204 |
* for this View. It is not intended to retrieve the ViewInfo object in a |
|
205 |
* later time. <strong>Use PluginServices.getMDIManager().getViewInfo(view) |
|
206 |
* to retrieve the ViewInfo object at any time after the creation of the |
|
207 |
* object. |
|
208 |
* |
|
209 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#getWindowInfo() |
|
210 |
*/ |
|
229 | 211 |
|
230 |
/** |
|
231 |
* @return |
|
232 |
*/ |
|
233 |
public BufferedImage getImage() { |
|
234 |
return m_MapControl.getImage(); |
|
235 |
} |
|
212 |
public boolean isPalette() { |
|
213 |
return isPalette; |
|
214 |
} |
|
236 | 215 |
|
237 |
public void setProjection(IProjection proj) |
|
238 |
{ |
|
239 |
getMapControl().setProjection(proj); |
|
240 |
} |
|
241 |
|
|
242 |
public IProjection getProjection() |
|
243 |
{ |
|
244 |
return getMapControl().getProjection(); |
|
245 |
} |
|
216 |
public void repaintMap() { |
|
217 |
m_MapControl.drawMap(false); |
|
218 |
} |
|
246 | 219 |
|
247 |
public WindowLayout getWindowLayout() { |
|
248 |
if (windowLayout == null) { |
|
249 |
windowLayout = new WindowLayout(); |
|
250 |
} |
|
251 |
windowLayout.set("MainWindow.X", Integer.toString(this.getX())); |
|
252 |
windowLayout.set("MainWindow.Y", Integer.toString(this.getY())); |
|
253 |
windowLayout.set("MainWindow.Width", Integer.toString(this.getWidth())); |
|
254 |
windowLayout.set("MainWindow.Height", Integer.toString(this.getHeight())); |
|
220 |
public class ViewExceptionListener implements ExceptionListener { |
|
255 | 221 |
|
256 |
windowLayout.set("MainDivider.Location", Integer.toString(tempMainSplit.getDividerLocation())); |
|
257 |
windowLayout.set("MainDivider.X", Integer.toString(tempMainSplit.getX())); |
|
258 |
windowLayout.set("MainDivider.Y", Integer.toString(tempMainSplit.getY())); |
|
259 |
windowLayout.set("MainDivider.Width", Integer.toString(tempMainSplit.getWidth())); |
|
260 |
windowLayout.set("MainDivider.Height", Integer.toString(tempMainSplit.getHeight())); |
|
222 |
/** |
|
223 |
* @see com.iver.cit.gvsig.fmap.ExceptionListener#exceptionThrown(java.lang.Throwable) |
|
224 |
*/ |
|
225 |
public void exceptionThrown(Throwable t) { |
|
226 |
NotificationManager.addError(t.getMessage(), t); |
|
227 |
} |
|
261 | 228 |
|
262 |
if (isPalette()) { |
|
263 |
windowLayout.set("GraphicLocator.isPalette", "true"); |
|
264 |
} else { |
|
265 |
windowLayout.set("GraphicLocator.isPalette", "false"); |
|
266 |
if (tempSplitToc!=null) { |
|
267 |
windowLayout.set("TOCDivider.Location", Integer.toString(tempSplitToc.getDividerLocation())); |
|
268 |
windowLayout.set("TOCDivider.X", Integer.toString(tempSplitToc.getX())); |
|
269 |
windowLayout.set("TOCDivider.Y", Integer.toString(tempSplitToc.getY())); |
|
270 |
windowLayout.set("TOCDivider.Width", Integer.toString(tempSplitToc.getWidth())); |
|
271 |
windowLayout.set("TOCDivider.Height", Integer.toString(tempSplitToc.getHeight())); |
|
272 |
} |
|
273 |
} |
|
274 |
if (m_TOC!=null) { |
|
275 |
windowLayout.set("TOC.Width", Integer.toString(m_TOC.getWidth())); |
|
276 |
windowLayout.set("TOC.Height", Integer.toString(m_TOC.getHeight())); |
|
277 |
} |
|
278 |
if (m_MapControl!=null) { |
|
279 |
windowLayout.set("MapControl.Width", Integer.toString(m_MapControl.getWidth())); |
|
280 |
windowLayout.set("MapControl.Height", Integer.toString(m_MapControl.getHeight())); |
|
281 |
} |
|
282 |
if (m_MapLoc!=null) { |
|
283 |
windowLayout.set("GraphicLocator.Width", Integer.toString(m_MapLoc.getWidth())); |
|
284 |
windowLayout.set("GraphicLocator.Height", Integer.toString(m_MapLoc.getHeight())); |
|
285 |
} |
|
229 |
} |
|
286 | 230 |
|
287 |
return windowLayout; |
|
288 |
} |
|
231 |
/** |
|
232 |
* @return |
|
233 |
*/ |
|
234 |
public BufferedImage getImage() { |
|
235 |
return m_MapControl.getImage(); |
|
236 |
} |
|
289 | 237 |
|
290 |
public void setWindowLayout(WindowLayout data) { |
|
291 |
windowLayout = data; |
|
292 |
} |
|
238 |
public void setProjection(IProjection proj) { |
|
239 |
getMapControl().setProjection(proj); |
|
240 |
} |
|
241 |
|
|
242 |
public IProjection getProjection() { |
|
243 |
return getMapControl().getProjection(); |
|
244 |
} |
|
245 |
|
|
246 |
public WindowLayout getWindowLayout() { |
|
247 |
if (windowLayout == null) { |
|
248 |
windowLayout = new WindowLayout(); |
|
249 |
} |
|
250 |
windowLayout.set("MainWindow.X", Integer.toString(this.getX())); |
|
251 |
windowLayout.set("MainWindow.Y", Integer.toString(this.getY())); |
|
252 |
windowLayout.set("MainWindow.Width", Integer.toString(this.getWidth())); |
|
253 |
windowLayout.set("MainWindow.Height", |
|
254 |
Integer.toString(this.getHeight())); |
|
255 |
|
|
256 |
windowLayout.set("MainDivider.Location", |
|
257 |
Integer.toString(tempMainSplit.getDividerLocation())); |
|
258 |
windowLayout.set("MainDivider.X", |
|
259 |
Integer.toString(tempMainSplit.getX())); |
|
260 |
windowLayout.set("MainDivider.Y", |
|
261 |
Integer.toString(tempMainSplit.getY())); |
|
262 |
windowLayout.set("MainDivider.Width", |
|
263 |
Integer.toString(tempMainSplit.getWidth())); |
|
264 |
windowLayout.set("MainDivider.Height", |
|
265 |
Integer.toString(tempMainSplit.getHeight())); |
|
266 |
|
|
267 |
if (isPalette()) { |
|
268 |
windowLayout.set("GraphicLocator.isPalette", "true"); |
|
269 |
} else { |
|
270 |
windowLayout.set("GraphicLocator.isPalette", "false"); |
|
271 |
if (tempSplitToc != null) { |
|
272 |
windowLayout.set("TOCDivider.Location", |
|
273 |
Integer.toString(tempSplitToc.getDividerLocation())); |
|
274 |
windowLayout.set("TOCDivider.X", |
|
275 |
Integer.toString(tempSplitToc.getX())); |
|
276 |
windowLayout.set("TOCDivider.Y", |
|
277 |
Integer.toString(tempSplitToc.getY())); |
|
278 |
windowLayout.set("TOCDivider.Width", |
|
279 |
Integer.toString(tempSplitToc.getWidth())); |
|
280 |
windowLayout.set("TOCDivider.Height", |
|
281 |
Integer.toString(tempSplitToc.getHeight())); |
|
282 |
} |
|
283 |
} |
|
284 |
if (m_TOC != null) { |
|
285 |
windowLayout.set("TOC.Width", Integer.toString(m_TOC.getWidth())); |
|
286 |
windowLayout.set("TOC.Height", Integer.toString(m_TOC.getHeight())); |
|
287 |
} |
|
288 |
if (m_MapControl != null) { |
|
289 |
windowLayout.set("MapControl.Width", |
|
290 |
Integer.toString(m_MapControl.getWidth())); |
|
291 |
windowLayout.set("MapControl.Height", |
|
292 |
Integer.toString(m_MapControl.getHeight())); |
|
293 |
} |
|
294 |
if (m_MapLoc != null) { |
|
295 |
windowLayout.set("GraphicLocator.Width", |
|
296 |
Integer.toString(m_MapLoc.getWidth())); |
|
297 |
windowLayout.set("GraphicLocator.Height", |
|
298 |
Integer.toString(m_MapLoc.getHeight())); |
|
299 |
} |
|
300 |
|
|
301 |
return windowLayout; |
|
302 |
} |
|
303 |
|
|
304 |
public void setWindowLayout(WindowLayout data) { |
|
305 |
windowLayout = data; |
|
306 |
} |
|
293 | 307 |
} |
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/FPanelExtentSelector.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
|
1 |
/* gvSIG. Geographic Information System of the Valencian Government
|
|
2 | 2 |
* |
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana. |
|
4 |
* |
|
3 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
|
4 |
* of the Valencian Government (CIT) |
|
5 |
* |
|
5 | 6 |
* This program is free software; you can redistribute it and/or |
6 | 7 |
* modify it under the terms of the GNU General Public License |
7 | 8 |
* as published by the Free Software Foundation; either version 2 |
8 | 9 |
* of the License, or (at your option) any later version. |
9 |
* |
|
10 |
*
|
|
10 | 11 |
* This program is distributed in the hope that it will be useful, |
11 | 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | 14 |
* GNU General Public License for more details. |
14 |
* |
|
15 |
*
|
|
15 | 16 |
* You should have received a copy of the GNU General Public License |
16 | 17 |
* along with this program; if not, write to the Free Software |
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
* |
|
19 |
* For more information, contact: |
|
20 |
* |
|
21 |
* Generalitat Valenciana |
|
22 |
* Conselleria d'Infraestructures i Transport |
|
23 |
* Av. Blasco Ib??ez, 50 |
|
24 |
* 46010 VALENCIA |
|
25 |
* SPAIN |
|
26 |
* |
|
27 |
* +34 963862235 |
|
28 |
* gvsig@gva.es |
|
29 |
* www.gvsig.gva.es |
|
30 |
* |
|
31 |
* or |
|
32 |
* |
|
33 |
* IVER T.I. S.A |
|
34 |
* Salamanca 50 |
|
35 |
* 46005 Valencia |
|
36 |
* Spain |
|
37 |
* |
|
38 |
* +34 963163400 |
|
39 |
* dac@iver.es |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
40 | 21 |
*/ |
41 | 22 |
package org.gvsig.app.project.documents.view.gui; |
42 | 23 |
|
43 | 24 |
import java.awt.BorderLayout; |
44 | 25 |
import java.awt.FlowLayout; |
45 | 26 |
import java.util.ArrayList; |
27 |
import java.util.List; |
|
46 | 28 |
|
29 |
import javax.swing.JButton; |
|
47 | 30 |
import javax.swing.JPanel; |
48 | 31 |
import javax.swing.ListModel; |
49 | 32 |
|
... | ... | |
51 | 34 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
52 | 35 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
53 | 36 |
import org.gvsig.app.project.documents.view.ListSelectorListener; |
54 |
import org.gvsig.gui.beans.swing.JButton;
|
|
37 |
import org.gvsig.tools.swing.api.ToolsSwingLocator;
|
|
55 | 38 |
|
56 |
|
|
57 |
|
|
58 | 39 |
/** |
59 | 40 |
* DOCUMENT ME! |
60 |
* |
|
41 |
*
|
|
61 | 42 |
* @author Fernando Gonz?lez Cort?s |
62 | 43 |
*/ |
63 | 44 |
public class FPanelExtentSelector extends JPanel implements IWindow { |
45 |
|
|
46 |
private static final long serialVersionUID = -8246729582621010542L; |
|
64 | 47 |
private javax.swing.JScrollPane jScrollPane = null; |
65 | 48 |
private javax.swing.JList lista = null; |
66 | 49 |
private JButton btnAceptar = null; |
67 | 50 |
private ListModel modelo = null; |
68 |
private ArrayList selectionListeners = new ArrayList(); |
|
69 |
private JButton btnEliminar = null; |
|
70 |
private javax.swing.JPanel jPanel = null; |
|
71 |
private javax.swing.JPanel jPanel1 = null; |
|
72 |
private javax.swing.JLabel jLabel = null; |
|
73 |
private javax.swing.JTextField txtGuardar = null; |
|
74 |
private JButton btnGuardar = null; |
|
75 |
private WindowInfo m_viewinfo = null; |
|
76 |
private JPanel jPanel2 = null; |
|
77 |
private JPanel jPanel3 = null; |
|
51 |
private List<ListSelectorListener> selectionListeners = |
|
52 |
new ArrayList<ListSelectorListener>(); |
|
53 |
private JButton btnEliminar = null; |
|
54 |
private javax.swing.JPanel jPanel = null; |
|
55 |
private javax.swing.JPanel jPanel1 = null; |
|
56 |
private javax.swing.JLabel jLabel = null; |
|
57 |
private javax.swing.JTextField txtGuardar = null; |
|
58 |
private JButton btnGuardar = null; |
|
59 |
private WindowInfo m_viewinfo = null; |
|
60 |
private JPanel jPanel2 = null; |
|
61 |
private JPanel jPanel3 = null; |
|
62 |
|
|
78 | 63 |
/** |
79 | 64 |
* This is the default constructor |
80 | 65 |
*/ |
... | ... | |
88 | 73 |
*/ |
89 | 74 |
private void initialize() { |
90 | 75 |
this.setLayout(new BorderLayout()); |
91 |
this.setSize(new java.awt.Dimension(530,320)); |
|
76 |
this.setSize(new java.awt.Dimension(530, 320));
|
|
92 | 77 |
this.add(getJPanel(), java.awt.BorderLayout.NORTH); |
93 | 78 |
this.add(getJPanel1(), java.awt.BorderLayout.SOUTH); |
94 | 79 |
|
95 |
|
|
96 | 80 |
} |
97 | 81 |
|
98 | 82 |
/** |
99 | 83 |
* This method initializes jScrollPane |
100 |
* |
|
84 |
*
|
|
101 | 85 |
* @return javax.swing.JScrollPane |
102 | 86 |
*/ |
103 | 87 |
private javax.swing.JScrollPane getJScrollPane() { |
Also available in: Unified diff