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