root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / layout / fframes / gui / dialogs / FFrameOverViewDialog.java @ 24986
History | View | Annotate | Download (13 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* 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
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs; |
42 |
|
43 |
import java.awt.geom.Rectangle2D; |
44 |
|
45 |
import javax.swing.JList; |
46 |
import javax.swing.JPanel; |
47 |
|
48 |
import com.iver.andami.PluginServices; |
49 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
50 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities; |
51 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameOverView; |
52 |
import com.iver.cit.gvsig.project.documents.layout.fframes.FFrameView; |
53 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
54 |
import com.iver.cit.gvsig.project.documents.layout.fframes.ListViewModel; |
55 |
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation; |
56 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
57 |
|
58 |
|
59 |
/**
|
60 |
* Di?logo para a?adir una localizador al Layout.
|
61 |
*
|
62 |
* @author Vicente Caballero Navarro
|
63 |
*/
|
64 |
public class FFrameOverViewDialog extends JPanel implements IFFrameDialog { |
65 |
private javax.swing.JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="37,10" |
66 |
private javax.swing.JLabel lVistas = null; |
67 |
private javax.swing.JScrollPane jScrollPane = null; |
68 |
private javax.swing.JList liVistas = null; // @jve:visual-info decl-index=0 visual-constraint="98,-3" |
69 |
private javax.swing.JButton bAceptar = null; |
70 |
private javax.swing.JButton bCancelar = null; |
71 |
private javax.swing.JLabel lCalidad = null; |
72 |
private javax.swing.JComboBox cbCalidad = null; |
73 |
private Rectangle2D rect = new Rectangle2D.Double(); |
74 |
private FFrameOverView fframeoverview = null; //new FFrameView(); |
75 |
private Layout m_layout = null; |
76 |
private boolean isAcepted = false; |
77 |
private JPRotation rotation = null; |
78 |
private FFrameOverView newFFrameView;
|
79 |
private FFrameView fframeDependence;
|
80 |
private FFrameView fframeview;
|
81 |
|
82 |
|
83 |
/**
|
84 |
* This is the default constructor
|
85 |
*
|
86 |
* @param layout Referencia al Layout.
|
87 |
* @param fframe Referencia al fframe vista.
|
88 |
*/
|
89 |
public FFrameOverViewDialog(Layout layout, FFrameOverView fframe) {
|
90 |
super();
|
91 |
fframeoverview = fframe; |
92 |
fframeDependence=(FFrameView)fframeoverview.getFFrameDependence()[0];
|
93 |
m_layout = layout; |
94 |
initialize(); |
95 |
} |
96 |
|
97 |
/**
|
98 |
* This method initializes this
|
99 |
*/
|
100 |
private void initialize() { |
101 |
this.setLayout(null); |
102 |
this.add(getJContentPane(), null); |
103 |
this.setSize(463, 222); |
104 |
|
105 |
getPRotation().setRotation(fframeoverview.getRotation()); |
106 |
} |
107 |
|
108 |
/**
|
109 |
* Inserta el rect?ngulo que ocupar? el fframe vista.
|
110 |
*
|
111 |
* @param r Rect?ngulo.
|
112 |
*/
|
113 |
public void setRectangle(Rectangle2D r) { |
114 |
rect.setRect(r); |
115 |
} |
116 |
|
117 |
/**
|
118 |
* This method initializes jContentPane
|
119 |
*
|
120 |
* @return javax.swing.JPanel
|
121 |
*/
|
122 |
private javax.swing.JPanel getJContentPane() {
|
123 |
if (jContentPane == null) { |
124 |
jContentPane = new javax.swing.JPanel();
|
125 |
jContentPane.setLayout(null);
|
126 |
jContentPane.add(getLVistas(), null);
|
127 |
jContentPane.add(getJScrollPane(), null);
|
128 |
jContentPane.add(getLCalidad(), null);
|
129 |
jContentPane.add(getCbCalidad(), null);
|
130 |
jContentPane.add(getbAceptar(), null);
|
131 |
jContentPane.add(getBCancelar(), null);
|
132 |
jContentPane.setSize(462, 184); |
133 |
jContentPane.setPreferredSize(new java.awt.Dimension(60, 60)); |
134 |
jContentPane.setLocation(0, 0); |
135 |
jContentPane.add(getPRotation(), null);
|
136 |
} |
137 |
|
138 |
return jContentPane;
|
139 |
} |
140 |
|
141 |
/**
|
142 |
* This method initializes lVistas
|
143 |
*
|
144 |
* @return javax.swing.JLabel
|
145 |
*/
|
146 |
private javax.swing.JLabel getLVistas() {
|
147 |
if (lVistas == null) { |
148 |
lVistas = new javax.swing.JLabel();
|
149 |
lVistas.setSize(85, 19); |
150 |
lVistas.setText(PluginServices.getText(this, "Vista")); |
151 |
lVistas.setLocation(10, 10); |
152 |
} |
153 |
|
154 |
return lVistas;
|
155 |
} |
156 |
|
157 |
/**
|
158 |
* This method initializes jScrollPane
|
159 |
*
|
160 |
* @return javax.swing.JScrollPane
|
161 |
*/
|
162 |
private javax.swing.JScrollPane getJScrollPane() {
|
163 |
if (jScrollPane == null) { |
164 |
jScrollPane = new javax.swing.JScrollPane();
|
165 |
jScrollPane.setViewportView(getLiVistas()); |
166 |
jScrollPane.setBounds(99, 8, 224, 64); |
167 |
jScrollPane.setPreferredSize(new java.awt.Dimension(250, 60)); |
168 |
} |
169 |
|
170 |
return jScrollPane;
|
171 |
} |
172 |
|
173 |
/**
|
174 |
* This method initializes liVistas
|
175 |
*
|
176 |
* @return javax.swing.JList
|
177 |
*/
|
178 |
private javax.swing.JList getLiVistas() {
|
179 |
if (liVistas == null) { |
180 |
ListViewModel listmodel = new ListViewModel();
|
181 |
|
182 |
//listmodel.addViews();
|
183 |
listmodel.addViews(m_layout); |
184 |
|
185 |
///ArrayList list = listmodel.getViews();
|
186 |
liVistas = new javax.swing.JList();
|
187 |
liVistas.setModel(listmodel); |
188 |
|
189 |
for (int i = 0; i < liVistas.getModel().getSize(); i++) { |
190 |
if (fframeDependence != null) { |
191 |
fframeview = (FFrameView) liVistas.getModel().getElementAt(i); |
192 |
|
193 |
if (fframeview == fframeoverview.getFFrameDependence()[0]) { |
194 |
liVistas.setSelectedIndex(i); |
195 |
} |
196 |
|
197 |
/*m_projectView=(ProjectView)liVistas.getModel().getElementAt(i);
|
198 |
if (m_projectView.getMapContext()==fframelegend.getFMap()){
|
199 |
liVistas.setSelectedIndex(i);
|
200 |
}
|
201 |
*/
|
202 |
} |
203 |
} |
204 |
|
205 |
liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
206 |
private int selectIndex=-1; |
207 |
public void valueChanged( |
208 |
javax.swing.event.ListSelectionEvent e) { |
209 |
IFFrame[] fframes=m_layout.getLayoutContext().getFFrames();
|
210 |
int selectInt =((JList) e.getSource()) |
211 |
.getSelectedIndex(); |
212 |
if (selectInt != selectIndex) {
|
213 |
selectIndex = selectInt; |
214 |
if (selectIndex == -1) |
215 |
return;
|
216 |
fframeview = (FFrameView) liVistas.getModel() |
217 |
.getElementAt(selectInt); |
218 |
|
219 |
for (int i = 0; i < fframes.length; i++) { |
220 |
IFFrame f = fframes[i]; |
221 |
|
222 |
if (f instanceof FFrameView) { |
223 |
if (((FFrameView) f).getView() == fframeview
|
224 |
.getView()) { |
225 |
fframeDependence=fframeview; |
226 |
// fframelegend
|
227 |
// .setFFrameDependence(fframeview);
|
228 |
} |
229 |
} |
230 |
} |
231 |
|
232 |
// fframelegend.setFFrameView(fframeview);
|
233 |
} |
234 |
} |
235 |
|
236 |
}); |
237 |
} |
238 |
|
239 |
return liVistas;
|
240 |
} |
241 |
// /**
|
242 |
// * This method initializes liVistas
|
243 |
// *
|
244 |
// * @return javax.swing.JList
|
245 |
// */
|
246 |
// private javax.swing.JList getLiVistas() {
|
247 |
// if (liVistas == null) {
|
248 |
// ListViewModel listmodel = new ListViewModel();
|
249 |
// listmodel.addViews();
|
250 |
// liVistas = new javax.swing.JList();
|
251 |
// liVistas.setModel(listmodel);
|
252 |
// for (int i = 0; i < liVistas.getModel().getSize(); i++) {
|
253 |
// if (fframeoverview.getMapContext() != null) {
|
254 |
//
|
255 |
// ProjectView pvaux= (ProjectView) liVistas.getModel()
|
256 |
// .getElementAt(i);
|
257 |
//
|
258 |
// if (pvaux.getMapContext().equals(fframeoverview.getMapContext())) {
|
259 |
// liVistas.setSelectedIndex(i);
|
260 |
// m_projectView= (ProjectView) liVistas.getModel()
|
261 |
// .getElementAt(i);
|
262 |
// }
|
263 |
// }
|
264 |
// }
|
265 |
//
|
266 |
// liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
267 |
// private int selectIndex=-1;
|
268 |
// public void valueChanged(
|
269 |
// javax.swing.event.ListSelectionEvent e) {
|
270 |
// int selectInt = ((JList)e.getSource()).getSelectedIndex();
|
271 |
// if (selectInt!=selectIndex){
|
272 |
// selectIndex=selectInt;
|
273 |
// if (selectIndex==-1)
|
274 |
// return;
|
275 |
// m_projectView = (ProjectView) liVistas.getModel()
|
276 |
// .getElementAt(selectInt);
|
277 |
//
|
278 |
//// fframeview.setBoundBox(FLayoutUtilities.toSheetRect(
|
279 |
//// rect, m_layout.getAT()));
|
280 |
//// fframeview.setView(m_projectView);
|
281 |
////
|
282 |
//// fframeview.setMapUnits(m_projectView.getMapContext()
|
283 |
//// .getViewPort()
|
284 |
//// .getMapUnits());
|
285 |
// }
|
286 |
// }
|
287 |
// });
|
288 |
// }
|
289 |
//
|
290 |
// return liVistas;
|
291 |
// }
|
292 |
|
293 |
/**
|
294 |
* This method initializes jButton
|
295 |
*
|
296 |
* @return javax.swing.JButton
|
297 |
*/
|
298 |
private javax.swing.JButton getbAceptar() {
|
299 |
if (bAceptar == null) { |
300 |
bAceptar = new javax.swing.JButton();
|
301 |
bAceptar.setSize(85, 26); |
302 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
303 |
bAceptar.setLocation(59, 136); |
304 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
305 |
|
306 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
307 |
newFFrameView=(FFrameOverView)fframeoverview.cloneFFrame(m_layout); |
308 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
309 |
rect, m_layout.getLayoutControl().getAT())); |
310 |
newFFrameView.setRotation(getPRotation().getRotation()); |
311 |
if (fframeDependence!=null) { |
312 |
newFFrameView.setName(fframeDependence.getView().getName()); |
313 |
|
314 |
newFFrameView.setFFrameDependence(fframeDependence); |
315 |
newFFrameView.setView(fframeDependence.getView()); |
316 |
|
317 |
newFFrameView.setQuality(getCbCalidad() |
318 |
.getSelectedIndex()); |
319 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
320 |
rect, m_layout.getLayoutControl().getAT())); |
321 |
|
322 |
/* for (int i=0;i<m_layout.getFFrames().size();i++){
|
323 |
IFFrame fframe=(IFFrame)m_layout.getFFrames().get(i);
|
324 |
if (fframe instanceof FFrameScaleBar){
|
325 |
if (((FFrameScaleBar)fframe).getFFrameView()==fframeview){
|
326 |
if (getJComboBox().getSelectedIndex()!=0){
|
327 |
((FFrameScaleBar)fframe).setIsFixed(true);
|
328 |
((FFrameScaleBar)fframe).setScaleView(Long.parseLong(getJTextField().getText()));
|
329 |
}else{
|
330 |
((FFrameScaleBar)fframe).setIsFixed(false);
|
331 |
}
|
332 |
|
333 |
}
|
334 |
}
|
335 |
|
336 |
|
337 |
}
|
338 |
*/
|
339 |
} |
340 |
|
341 |
isAcepted = true;
|
342 |
|
343 |
//}else{
|
344 |
// isAcepted=false;
|
345 |
//}
|
346 |
PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this); |
347 |
fframeoverview.refresh(); |
348 |
//m_layout.refresh();
|
349 |
} |
350 |
}); |
351 |
} |
352 |
|
353 |
return bAceptar;
|
354 |
} |
355 |
|
356 |
/**
|
357 |
* This method initializes bCancelar
|
358 |
*
|
359 |
* @return javax.swing.JButton
|
360 |
*/
|
361 |
private javax.swing.JButton getBCancelar() {
|
362 |
if (bCancelar == null) { |
363 |
bCancelar = new javax.swing.JButton();
|
364 |
bCancelar.setSize(85, 26); |
365 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
366 |
bCancelar.setLocation(199, 136); |
367 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
368 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
369 |
newFFrameView=null;
|
370 |
PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this); |
371 |
} |
372 |
}); |
373 |
} |
374 |
|
375 |
return bCancelar;
|
376 |
} |
377 |
|
378 |
/**
|
379 |
* This method initializes lCalidad
|
380 |
*
|
381 |
* @return javax.swing.JLabel
|
382 |
*/
|
383 |
private javax.swing.JLabel getLCalidad() {
|
384 |
if (lCalidad == null) { |
385 |
lCalidad = new javax.swing.JLabel();
|
386 |
lCalidad.setSize(86, 16); |
387 |
lCalidad.setText(PluginServices.getText(this, "calidad")); |
388 |
lCalidad.setLocation(14, 112); |
389 |
} |
390 |
|
391 |
return lCalidad;
|
392 |
} |
393 |
|
394 |
/**
|
395 |
* This method initializes cbCalidad
|
396 |
*
|
397 |
* @return javax.swing.JComboBox
|
398 |
*/
|
399 |
private javax.swing.JComboBox getCbCalidad() {
|
400 |
if (cbCalidad == null) { |
401 |
//String[] s={"Presentaci?n","Borrador"};
|
402 |
cbCalidad = new javax.swing.JComboBox();
|
403 |
cbCalidad.setSize(220, 20); |
404 |
cbCalidad.addItem(PluginServices.getText(this, "presentacion")); |
405 |
cbCalidad.addItem(PluginServices.getText(this, "borrador")); |
406 |
cbCalidad.setSelectedIndex(fframeoverview.getQuality()); |
407 |
cbCalidad.setPreferredSize(new java.awt.Dimension(200, 20)); |
408 |
cbCalidad.setLocation(104, 112); |
409 |
} |
410 |
|
411 |
return cbCalidad;
|
412 |
} |
413 |
|
414 |
/* (non-Javadoc)
|
415 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
416 |
*/
|
417 |
public WindowInfo getWindowInfo() {
|
418 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
419 |
|
420 |
//vi.setResizable(false);
|
421 |
m_viewinfo.setTitle(PluginServices.getText(this,
|
422 |
"propiedades_marco_localizador"));
|
423 |
|
424 |
return m_viewinfo;
|
425 |
} |
426 |
|
427 |
/**
|
428 |
* @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
|
429 |
*/
|
430 |
public boolean getIsAcepted() { |
431 |
return isAcepted;
|
432 |
} |
433 |
|
434 |
/**
|
435 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
436 |
*/
|
437 |
public void viewActivated() { |
438 |
} |
439 |
|
440 |
/**
|
441 |
* This method initializes rotation
|
442 |
*
|
443 |
* @return javax.swing.JPanel
|
444 |
*/
|
445 |
private JPRotation getPRotation() {
|
446 |
if (rotation == null) { |
447 |
rotation = new JPRotation();
|
448 |
rotation.setBounds(330, 30, 120, 130); |
449 |
} |
450 |
return rotation;
|
451 |
} |
452 |
|
453 |
public IFFrame getFFrame() {
|
454 |
return newFFrameView;
|
455 |
} |
456 |
|
457 |
public Object getWindowProfile() { |
458 |
return WindowInfo.DIALOG_PROFILE;
|
459 |
} |
460 |
} // @jve:decl-index=0:visual-constraint="10,10"
|