svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / org / gvsig / app / project / documents / layout / fframes / gui / dialogs / FFrameOverViewDialog.java @ 33647
History | View | Annotate | Download (13.8 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 org.gvsig.app.project.documents.layout.fframes.gui.dialogs; |
42 |
|
43 |
import java.awt.geom.Rectangle2D; |
44 |
|
45 |
import javax.swing.JList; |
46 |
|
47 |
import org.gvsig.andami.PluginServices; |
48 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
49 |
import org.gvsig.app.project.documents.layout.FLayoutUtilities; |
50 |
import org.gvsig.app.project.documents.layout.fframes.FFrameOverView; |
51 |
import org.gvsig.app.project.documents.layout.fframes.FFrameView; |
52 |
import org.gvsig.app.project.documents.layout.fframes.IFFrame; |
53 |
import org.gvsig.app.project.documents.layout.fframes.ListViewModel; |
54 |
import org.gvsig.app.project.documents.layout.fframes.ListWithoutOverViewModel; |
55 |
import org.gvsig.app.project.documents.layout.fframes.gui.JPRotation; |
56 |
import org.gvsig.app.project.documents.layout.gui.LayoutPanel; |
57 |
|
58 |
|
59 |
|
60 |
/**
|
61 |
* Di?logo para a?adir una localizador al Layout.
|
62 |
*
|
63 |
* @author Vicente Caballero Navarro
|
64 |
*/
|
65 |
public class FFrameOverViewDialog extends AbstractFFrameDialog implements IFFrameDialog { |
66 |
private javax.swing.JPanel jContentPane = null; // @jve:decl-index=0:visual-constraint="37,10" |
67 |
private javax.swing.JLabel lVistas = null; |
68 |
private javax.swing.JScrollPane jScrollPane = null; |
69 |
private javax.swing.JList liVistas = null; // @jve:visual-info decl-index=0 visual-constraint="98,-3" |
70 |
private javax.swing.JButton bAceptar = null; |
71 |
private javax.swing.JButton bCancelar = null; |
72 |
private javax.swing.JLabel lCalidad = null; |
73 |
private javax.swing.JComboBox cbCalidad = null; |
74 |
private Rectangle2D rect = new Rectangle2D.Double(); |
75 |
private FFrameOverView fframeoverview = null; //new FFrameView(); |
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 layoutPanel Referencia al Layout.
|
87 |
* @param fframe Referencia al fframe vista.
|
88 |
*/
|
89 |
public FFrameOverViewDialog(LayoutPanel layoutPanel, IFFrame frame) {
|
90 |
super(layoutPanel, frame);
|
91 |
fframeoverview = (FFrameOverView) frame; |
92 |
fframeDependence = (FFrameView)fframeoverview.getFFrameDependence()[0];
|
93 |
initialize(); |
94 |
} |
95 |
|
96 |
/**
|
97 |
* This method initializes this
|
98 |
*/
|
99 |
private void initialize() { |
100 |
this.setLayout(null); |
101 |
this.add(getJContentPane(), null); |
102 |
this.setSize(463, 222); |
103 |
|
104 |
getPRotation().setRotation(fframeoverview.getRotation()); |
105 |
} |
106 |
|
107 |
/**
|
108 |
* Inserta el rect?ngulo que ocupar? el fframe vista.
|
109 |
*
|
110 |
* @param r Rect?ngulo.
|
111 |
*/
|
112 |
public void setRectangle(Rectangle2D r) { |
113 |
rect.setRect(r); |
114 |
} |
115 |
|
116 |
/**
|
117 |
* This method initializes jContentPane
|
118 |
*
|
119 |
* @return javax.swing.JPanel
|
120 |
*/
|
121 |
private javax.swing.JPanel getJContentPane() {
|
122 |
if (jContentPane == null) { |
123 |
jContentPane = new javax.swing.JPanel();
|
124 |
jContentPane.setLayout(null);
|
125 |
jContentPane.add(getLVistas(), null);
|
126 |
jContentPane.add(getJScrollPane(), null);
|
127 |
jContentPane.add(getLCalidad(), null);
|
128 |
jContentPane.add(getCbCalidad(), null);
|
129 |
jContentPane.add(getbAceptar(), null);
|
130 |
jContentPane.add(getBCancelar(), null);
|
131 |
jContentPane.setSize(462, 184); |
132 |
jContentPane.setPreferredSize(new java.awt.Dimension(60, 60)); |
133 |
jContentPane.setLocation(0, 0); |
134 |
jContentPane.add(getPRotation(), null);
|
135 |
} |
136 |
|
137 |
return jContentPane;
|
138 |
} |
139 |
|
140 |
/**
|
141 |
* This method initializes lVistas
|
142 |
*
|
143 |
* @return javax.swing.JLabel
|
144 |
*/
|
145 |
private javax.swing.JLabel getLVistas() {
|
146 |
if (lVistas == null) { |
147 |
lVistas = new javax.swing.JLabel();
|
148 |
lVistas.setSize(85, 19); |
149 |
lVistas.setText(PluginServices.getText(this, "Vista")); |
150 |
lVistas.setLocation(10, 10); |
151 |
} |
152 |
|
153 |
return lVistas;
|
154 |
} |
155 |
|
156 |
/**
|
157 |
* This method initializes jScrollPane
|
158 |
*
|
159 |
* @return javax.swing.JScrollPane
|
160 |
*/
|
161 |
private javax.swing.JScrollPane getJScrollPane() {
|
162 |
if (jScrollPane == null) { |
163 |
jScrollPane = new javax.swing.JScrollPane();
|
164 |
jScrollPane.setViewportView(getLiVistas()); |
165 |
jScrollPane.setBounds(99, 8, 224, 64); |
166 |
jScrollPane.setPreferredSize(new java.awt.Dimension(250, 60)); |
167 |
} |
168 |
|
169 |
return jScrollPane;
|
170 |
} |
171 |
|
172 |
/**
|
173 |
* This method initializes liVistas
|
174 |
*
|
175 |
* @return javax.swing.JList
|
176 |
*/
|
177 |
private javax.swing.JList getLiVistas() {
|
178 |
if (liVistas == null) { |
179 |
ListViewModel listmodel = new ListWithoutOverViewModel();
|
180 |
|
181 |
listmodel.addViews(layoutPanel); |
182 |
|
183 |
///ArrayList list = listmodel.getViews();
|
184 |
liVistas = new javax.swing.JList();
|
185 |
liVistas.setModel(listmodel); |
186 |
|
187 |
for (int i = 0; i < liVistas.getModel().getSize(); i++) { |
188 |
if (fframeDependence != null) { |
189 |
fframeview = (FFrameView) liVistas.getModel().getElementAt(i); |
190 |
|
191 |
if (fframeview == fframeoverview.getFFrameDependence()[0]) { |
192 |
liVistas.setSelectedIndex(i); |
193 |
} |
194 |
|
195 |
/*m_projectView=(ProjectView)liVistas.getModel().getElementAt(i);
|
196 |
if (m_projectView.getMapContext()==fframelegend.getFMap()){
|
197 |
liVistas.setSelectedIndex(i);
|
198 |
}
|
199 |
*/
|
200 |
} |
201 |
} |
202 |
|
203 |
liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
204 |
private int selectIndex=-1; |
205 |
public void valueChanged( |
206 |
javax.swing.event.ListSelectionEvent e) { |
207 |
IFFrame[] fframes = layoutPanel.getLayoutContext().getFFrames();
|
208 |
int selectInt =((JList) e.getSource()) |
209 |
.getSelectedIndex(); |
210 |
if (selectInt != selectIndex) {
|
211 |
selectIndex = selectInt; |
212 |
if (selectIndex == -1) { |
213 |
return;
|
214 |
} |
215 |
fframeview = (FFrameView) liVistas.getModel() |
216 |
.getElementAt(selectInt); |
217 |
|
218 |
for (int i = 0; i < fframes.length; i++) { |
219 |
IFFrame f = fframes[i]; |
220 |
|
221 |
if (f instanceof FFrameView) { |
222 |
if (((FFrameView) f).getView() == fframeview
|
223 |
.getView()) { |
224 |
fframeDependence=fframeview; |
225 |
// fframelegend
|
226 |
// .setFFrameDependence(fframeview);
|
227 |
} |
228 |
} |
229 |
} |
230 |
|
231 |
// fframelegend.setFFrameView(fframeview);
|
232 |
} |
233 |
} |
234 |
|
235 |
}); |
236 |
} |
237 |
|
238 |
return liVistas;
|
239 |
} |
240 |
// /**
|
241 |
// * This method initializes liVistas
|
242 |
// *
|
243 |
// * @return javax.swing.JList
|
244 |
// */
|
245 |
// private javax.swing.JList getLiVistas() {
|
246 |
// if (liVistas == null) {
|
247 |
// ListViewModel listmodel = new ListViewModel();
|
248 |
// listmodel.addViews();
|
249 |
// liVistas = new javax.swing.JList();
|
250 |
// liVistas.setModel(listmodel);
|
251 |
// for (int i = 0; i < liVistas.getModel().getSize(); i++) {
|
252 |
// if (fframeoverview.getMapContext() != null) {
|
253 |
//
|
254 |
// ProjectView pvaux= (ProjectView) liVistas.getModel()
|
255 |
// .getElementAt(i);
|
256 |
//
|
257 |
// if (pvaux.getMapContext().equals(fframeoverview.getMapContext())) {
|
258 |
// liVistas.setSelectedIndex(i);
|
259 |
// m_projectView= (ProjectView) liVistas.getModel()
|
260 |
// .getElementAt(i);
|
261 |
// }
|
262 |
// }
|
263 |
// }
|
264 |
//
|
265 |
// liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
|
266 |
// private int selectIndex=-1;
|
267 |
// public void valueChanged(
|
268 |
// javax.swing.event.ListSelectionEvent e) {
|
269 |
// int selectInt = ((JList)e.getSource()).getSelectedIndex();
|
270 |
// if (selectInt!=selectIndex){
|
271 |
// selectIndex=selectInt;
|
272 |
// if (selectIndex==-1)
|
273 |
// return;
|
274 |
// m_projectView = (ProjectView) liVistas.getModel()
|
275 |
// .getElementAt(selectInt);
|
276 |
//
|
277 |
//// fframeview.setBoundBox(FLayoutUtilities.toSheetRect(
|
278 |
//// rect, m_layout.getAT()));
|
279 |
//// fframeview.setView(m_projectView);
|
280 |
////
|
281 |
//// fframeview.setMapUnits(m_projectView.getMapContext()
|
282 |
//// .getViewPort()
|
283 |
//// .getMapUnits());
|
284 |
// }
|
285 |
// }
|
286 |
// });
|
287 |
// }
|
288 |
//
|
289 |
// return liVistas;
|
290 |
// }
|
291 |
|
292 |
/**
|
293 |
* This method initializes jButton
|
294 |
*
|
295 |
* @return javax.swing.JButton
|
296 |
*/
|
297 |
private javax.swing.JButton getbAceptar() {
|
298 |
if (bAceptar == null) { |
299 |
bAceptar = new javax.swing.JButton();
|
300 |
bAceptar.setSize(85, 26); |
301 |
bAceptar.setText(PluginServices.getText(this, "Aceptar")); |
302 |
bAceptar.setLocation(59, 136); |
303 |
bAceptar.addActionListener(new java.awt.event.ActionListener() {
|
304 |
|
305 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
306 |
try {
|
307 |
newFFrameView=(FFrameOverView)fframeoverview.clone(); |
308 |
newFFrameView.setBoundBox(FLayoutUtilities.toSheetRect( |
309 |
rect, layoutPanel.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, layoutPanel.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 |
} catch (CloneNotSupportedException e1) { |
341 |
LOG.error("It is not possible clonate the object", e);
|
342 |
} |
343 |
|
344 |
|
345 |
isAcepted = true;
|
346 |
|
347 |
//}else{
|
348 |
// isAcepted=false;
|
349 |
//}
|
350 |
PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this); |
351 |
fframeoverview.refresh(); |
352 |
//m_layout.refresh();
|
353 |
} |
354 |
}); |
355 |
} |
356 |
|
357 |
return bAceptar;
|
358 |
} |
359 |
|
360 |
/**
|
361 |
* This method initializes bCancelar
|
362 |
*
|
363 |
* @return javax.swing.JButton
|
364 |
*/
|
365 |
private javax.swing.JButton getBCancelar() {
|
366 |
if (bCancelar == null) { |
367 |
bCancelar = new javax.swing.JButton();
|
368 |
bCancelar.setSize(85, 26); |
369 |
bCancelar.setText(PluginServices.getText(this, "Cancelar")); |
370 |
bCancelar.setLocation(199, 136); |
371 |
bCancelar.addActionListener(new java.awt.event.ActionListener() {
|
372 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
373 |
newFFrameView=null;
|
374 |
PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this); |
375 |
} |
376 |
}); |
377 |
} |
378 |
|
379 |
return bCancelar;
|
380 |
} |
381 |
|
382 |
/**
|
383 |
* This method initializes lCalidad
|
384 |
*
|
385 |
* @return javax.swing.JLabel
|
386 |
*/
|
387 |
private javax.swing.JLabel getLCalidad() {
|
388 |
if (lCalidad == null) { |
389 |
lCalidad = new javax.swing.JLabel();
|
390 |
lCalidad.setSize(86, 16); |
391 |
lCalidad.setText(PluginServices.getText(this, "calidad")); |
392 |
lCalidad.setLocation(14, 112); |
393 |
} |
394 |
|
395 |
return lCalidad;
|
396 |
} |
397 |
|
398 |
/**
|
399 |
* This method initializes cbCalidad
|
400 |
*
|
401 |
* @return javax.swing.JComboBox
|
402 |
*/
|
403 |
private javax.swing.JComboBox getCbCalidad() {
|
404 |
if (cbCalidad == null) { |
405 |
//String[] s={"Presentaci?n","Borrador"};
|
406 |
cbCalidad = new javax.swing.JComboBox();
|
407 |
cbCalidad.setSize(220, 20); |
408 |
cbCalidad.addItem(PluginServices.getText(this, "presentacion")); |
409 |
cbCalidad.addItem(PluginServices.getText(this, "borrador")); |
410 |
cbCalidad.setSelectedIndex(fframeoverview.getQuality()); |
411 |
cbCalidad.setPreferredSize(new java.awt.Dimension(200, 20)); |
412 |
cbCalidad.setLocation(104, 112); |
413 |
} |
414 |
|
415 |
return cbCalidad;
|
416 |
} |
417 |
|
418 |
/* (non-Javadoc)
|
419 |
* @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
|
420 |
*/
|
421 |
public WindowInfo getWindowInfo() {
|
422 |
WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
|
423 |
|
424 |
//vi.setResizable(false);
|
425 |
m_viewinfo.setTitle(PluginServices.getText(this,
|
426 |
"propiedades_marco_localizador"));
|
427 |
|
428 |
return m_viewinfo;
|
429 |
} |
430 |
|
431 |
/**
|
432 |
* @see org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
|
433 |
*/
|
434 |
public boolean getIsAcepted() { |
435 |
return isAcepted;
|
436 |
} |
437 |
|
438 |
/**
|
439 |
* @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
|
440 |
*/
|
441 |
public void viewActivated() { |
442 |
} |
443 |
|
444 |
/**
|
445 |
* This method initializes rotation
|
446 |
*
|
447 |
* @return javax.swing.JPanel
|
448 |
*/
|
449 |
private JPRotation getPRotation() {
|
450 |
if (rotation == null) { |
451 |
rotation = new JPRotation();
|
452 |
rotation.setBounds(330, 30, 120, 130); |
453 |
} |
454 |
return rotation;
|
455 |
} |
456 |
|
457 |
public IFFrame getFFrame() {
|
458 |
return newFFrameView;
|
459 |
} |
460 |
|
461 |
|
462 |
public Object getWindowProfile() { |
463 |
return WindowInfo.DIALOG_PROFILE;
|
464 |
} |
465 |
|
466 |
} // @jve:decl-index=0:visual-constraint="10,10"
|