Revision 9192

View differences:

trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/EventsHandler.java
296 296
                    (layout.getTool() == Layout.VIEW_ZOOMIN)) {
297 297
                layout.setStatus(Layout.ZOOM_MAS);
298 298
            } else if ((layout.getTool() == Layout.RECTANGLEVIEW) ||
299
            		(layout.getTool() == Layout.RECTANGLEOVERVIEW) ||
299 300
                    (layout.getTool() == Layout.RECTANGLEPICTURE) ||
300 301
                    (layout.getTool() == Layout.RECTANGLESCALEBAR) ||
301 302
                    (layout.getTool() == Layout.RECTANGLELEGEND) ||
......
416 417
                events.setSelect();
417 418
                layout.refresh();
418 419
            } else if ((layout.getTool() == Layout.RECTANGLEVIEW) ||
420
            		(layout.getTool() == Layout.RECTANGLEOVERVIEW) ||
419 421
                    (layout.getTool() == Layout.RECTANGLEPICTURE) ||
420 422
                    (layout.getTool() == Layout.RECTANGLESCALEBAR) ||
421 423
                    (layout.getTool() == Layout.RECTANGLELEGEND) ||
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/fframes/gui/dialogs/FFrameOverViewDialog.java
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.gui.layout.Layout;
51
import com.iver.cit.gvsig.gui.layout.fframes.FFrameView;
52
import com.iver.cit.gvsig.project.documents.layout.FLayoutUtilities;
53
import com.iver.cit.gvsig.project.documents.layout.fframes.ListViewModel;
54
import com.iver.cit.gvsig.project.documents.layout.fframes.gui.JPRotation;
55
import com.iver.cit.gvsig.project.documents.view.ProjectView;
56

  
57

  
58
/**
59
 * Di?logo para a?adir una localizador al Layout.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63
public class FFrameOverViewDialog extends JPanel implements IFFrameDialog {
64
	private javax.swing.JPanel jContentPane = null;  //  @jve:decl-index=0:visual-constraint="37,10"
65
	private javax.swing.JLabel lVistas = null;
66
	private javax.swing.JScrollPane jScrollPane = null;
67
	private javax.swing.JList liVistas = null; //  @jve:visual-info  decl-index=0 visual-constraint="98,-3"
68
	private javax.swing.JButton bAceptar = null;
69
	private javax.swing.JButton bCancelar = null;
70
	private javax.swing.JLabel lCalidad = null;
71
	private javax.swing.JComboBox cbCalidad = null;
72
	private ProjectView m_projectView = null;
73
	private Rectangle2D rect = new Rectangle2D.Double();
74
	private FFrameView fframeview = null; //new FFrameView();
75
	private Layout m_layout = null;
76
	private boolean isAcepted = false;
77
	private JPRotation rotation = null;
78

  
79
	/**
80
	 * This is the default constructor
81
	 *
82
	 * @param layout Referencia al Layout.
83
	 * @param fframe Referencia al fframe vista.
84
	 */
85
	public FFrameOverViewDialog(Layout layout, FFrameView fframe) {
86
		super();
87
		fframeview = fframe;
88
		m_layout = layout;
89
		initialize();
90
	}
91

  
92
	/**
93
	 * This method initializes this
94
	 */
95
	private void initialize() {
96
		this.setLayout(null);
97
		this.add(getJContentPane(), null);
98
		this.setSize(463, 222);
99

  
100
		getPRotation().setRotation(fframeview.getRotation());
101
	}
102

  
103
	/**
104
	 * Inserta el rect?ngulo que ocupar? el fframe vista.
105
	 *
106
	 * @param r Rect?ngulo.
107
	 */
108
	public void setRectangle(Rectangle2D r) {
109
		rect.setRect(r);
110
	}
111

  
112
	/**
113
	 * This method initializes jContentPane
114
	 *
115
	 * @return javax.swing.JPanel
116
	 */
117
	private javax.swing.JPanel getJContentPane() {
118
		if (jContentPane == null) {
119
			jContentPane = new javax.swing.JPanel();
120
			jContentPane.setLayout(null);
121
			jContentPane.add(getLVistas(), null);
122
			jContentPane.add(getJScrollPane(), null);
123
			jContentPane.add(getLCalidad(), null);
124
			jContentPane.add(getCbCalidad(), null);
125
			jContentPane.add(getbAceptar(), null);
126
			jContentPane.add(getBCancelar(), null);
127
			jContentPane.setSize(462, 184);
128
			jContentPane.setPreferredSize(new java.awt.Dimension(60, 60));
129
			jContentPane.setLocation(0, 0);
130
			jContentPane.add(getPRotation(), null);
131
		}
132

  
133
		return jContentPane;
134
	}
135

  
136
	/**
137
	 * This method initializes lVistas
138
	 *
139
	 * @return javax.swing.JLabel
140
	 */
141
	private javax.swing.JLabel getLVistas() {
142
		if (lVistas == null) {
143
			lVistas = new javax.swing.JLabel();
144
			lVistas.setSize(85, 19);
145
			lVistas.setText(PluginServices.getText(this, "Vista"));
146
			lVistas.setLocation(10, 10);
147
		}
148

  
149
		return lVistas;
150
	}
151

  
152
	/**
153
	 * This method initializes jScrollPane
154
	 *
155
	 * @return javax.swing.JScrollPane
156
	 */
157
	private javax.swing.JScrollPane getJScrollPane() {
158
		if (jScrollPane == null) {
159
			jScrollPane = new javax.swing.JScrollPane();
160
			jScrollPane.setViewportView(getLiVistas());
161
			jScrollPane.setBounds(99, 8, 224, 64);
162
			jScrollPane.setPreferredSize(new java.awt.Dimension(250, 60));
163
		}
164

  
165
		return jScrollPane;
166
	}
167

  
168
	/**
169
	 * This method initializes liVistas
170
	 *
171
	 * @return javax.swing.JList
172
	 */
173
	private javax.swing.JList getLiVistas() {
174
		if (liVistas == null) {
175
			ListViewModel listmodel = new ListViewModel();
176
			listmodel.addViews();
177
			liVistas = new javax.swing.JList();
178
			liVistas.setModel(listmodel);
179
			for (int i = 0; i < liVistas.getModel().getSize(); i++) {
180
				if (fframeview.getMapContext() != null) {
181

  
182
					ProjectView pvaux= (ProjectView) liVistas.getModel()
183
														  .getElementAt(i);
184

  
185
					if (pvaux.getMapContext().equals(fframeview.getMapContext())) {
186
						liVistas.setSelectedIndex(i);
187
						m_projectView= (ProjectView) liVistas.getModel()
188
						  .getElementAt(i);
189
					}
190
				}
191
			}
192

  
193
			liVistas.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
194
					private int selectIndex=-1;
195
					public void valueChanged(
196
						javax.swing.event.ListSelectionEvent e) {
197
						int selectInt = ((JList)e.getSource()).getSelectedIndex();
198
						if (selectInt!=selectIndex){
199
							selectIndex=selectInt;
200
							if (selectIndex==-1)
201
								return;
202
						m_projectView = (ProjectView) liVistas.getModel()
203
															  .getElementAt(selectInt);
204

  
205
						fframeview.setBoundBox(FLayoutUtilities.toSheetRect(
206
								rect, m_layout.getAT()));
207
						fframeview.setView(m_projectView);
208

  
209
						fframeview.setMapUnits(m_projectView.getMapContext()
210
															.getViewPort()
211
															.getMapUnits());
212
					}
213
					}
214
				});
215
		}
216

  
217
		return liVistas;
218
	}
219

  
220
	/**
221
	 * This method initializes jButton
222
	 *
223
	 * @return javax.swing.JButton
224
	 */
225
	private javax.swing.JButton getbAceptar() {
226
		if (bAceptar == null) {
227
			bAceptar = new javax.swing.JButton();
228
			bAceptar.setSize(85, 26);
229
			bAceptar.setText(PluginServices.getText(this, "Aceptar"));
230
			bAceptar.setLocation(59, 136);
231
			bAceptar.addActionListener(new java.awt.event.ActionListener() {
232
					public void actionPerformed(java.awt.event.ActionEvent e) {
233
						fframeview.setBoundBox(FLayoutUtilities.toSheetRect(
234
								rect, m_layout.getAT()));
235
						fframeview.setRotation(getPRotation().getRotation());
236
						if (m_projectView != null) {
237
							fframeview.setName(m_projectView.getName());
238

  
239
							fframeview.setView(m_projectView);
240

  
241
							fframeview.setQuality(getCbCalidad()
242
													  .getSelectedIndex());
243
							fframeview.setBoundBox(FLayoutUtilities.toSheetRect(
244
									rect, m_layout.getAT()));
245

  
246
							/*        for (int i=0;i<m_layout.getFFrames().size();i++){
247
							   IFFrame fframe=(IFFrame)m_layout.getFFrames().get(i);
248
							   if (fframe instanceof FFrameScaleBar){
249
							           if (((FFrameScaleBar)fframe).getFFrameView()==fframeview){
250
							           if (getJComboBox().getSelectedIndex()!=0){
251
							           ((FFrameScaleBar)fframe).setIsFixed(true);
252
							           ((FFrameScaleBar)fframe).setScaleView(Long.parseLong(getJTextField().getText()));
253
							           }else{
254
							                   ((FFrameScaleBar)fframe).setIsFixed(false);
255
							           }
256

  
257
							           }
258
							   }
259

  
260

  
261
							   }
262
							 */
263
						}
264

  
265
						isAcepted = true;
266

  
267
						//}else{
268
						//	isAcepted=false;
269
						//}
270
						PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this);
271
						fframeview.refresh();
272
						m_layout.refresh();
273
					}
274
				});
275
		}
276

  
277
		return bAceptar;
278
	}
279

  
280
	/**
281
	 * This method initializes bCancelar
282
	 *
283
	 * @return javax.swing.JButton
284
	 */
285
	private javax.swing.JButton getBCancelar() {
286
		if (bCancelar == null) {
287
			bCancelar = new javax.swing.JButton();
288
			bCancelar.setSize(85, 26);
289
			bCancelar.setText(PluginServices.getText(this, "Cancelar"));
290
			bCancelar.setLocation(199, 136);
291
			bCancelar.addActionListener(new java.awt.event.ActionListener() {
292
					public void actionPerformed(java.awt.event.ActionEvent e) {
293
						PluginServices.getMDIManager().closeWindow(FFrameOverViewDialog.this);
294
					}
295
				});
296
		}
297

  
298
		return bCancelar;
299
	}
300

  
301
	/**
302
	 * This method initializes lCalidad
303
	 *
304
	 * @return javax.swing.JLabel
305
	 */
306
	private javax.swing.JLabel getLCalidad() {
307
		if (lCalidad == null) {
308
			lCalidad = new javax.swing.JLabel();
309
			lCalidad.setSize(86, 16);
310
			lCalidad.setText(PluginServices.getText(this, "calidad"));
311
			lCalidad.setLocation(14, 112);
312
		}
313

  
314
		return lCalidad;
315
	}
316

  
317
	/**
318
	 * This method initializes cbCalidad
319
	 *
320
	 * @return javax.swing.JComboBox
321
	 */
322
	private javax.swing.JComboBox getCbCalidad() {
323
		if (cbCalidad == null) {
324
			//String[] s={"Presentaci?n","Borrador"};
325
			cbCalidad = new javax.swing.JComboBox();
326
			cbCalidad.setSize(220, 20);
327
			cbCalidad.addItem(PluginServices.getText(this, "presentacion"));
328
			cbCalidad.addItem(PluginServices.getText(this, "borrador"));
329
			cbCalidad.setSelectedIndex(fframeview.getQuality());
330
			cbCalidad.setPreferredSize(new java.awt.Dimension(200, 20));
331
			cbCalidad.setLocation(104, 112);
332
		}
333

  
334
		return cbCalidad;
335
	}
336

  
337
	/* (non-Javadoc)
338
	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
339
	 */
340
	public WindowInfo getWindowInfo() {
341
		WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODALDIALOG);
342

  
343
		//vi.setResizable(false);
344
		m_viewinfo.setTitle(PluginServices.getText(this,
345
				"propiedades_marco_localizador"));
346

  
347
		return m_viewinfo;
348
	}
349

  
350
	/**
351
	 * @see com.iver.cit.gvsig.project.documents.layout.fframes.gui.dialogs.IFFrameDialog#getIsAcepted()
352
	 */
353
	public boolean getIsAcepted() {
354
		return isAcepted;
355
	}
356

  
357
	/**
358
	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
359
	 */
360
	public void viewActivated() {
361
	}
362

  
363
	/**
364
	 * This method initializes rotation
365
	 *
366
	 * @return javax.swing.JPanel
367
	 */
368
	private JPRotation getPRotation() {
369
		if (rotation == null) {
370
			rotation = new JPRotation();
371
			rotation.setBounds(330, 30, 120, 130);
372
		}
373
		return rotation;
374
	}
375
}  //  @jve:decl-index=0:visual-constraint="10,10"
0 376

  
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/FLayoutGraphics.java
53 53
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGroup;
54 54
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend;
55 55
import com.iver.cit.gvsig.gui.layout.fframes.FFrameNorth;
56
import com.iver.cit.gvsig.gui.layout.fframes.FFrameOverView;
56 57
import com.iver.cit.gvsig.gui.layout.fframes.FFramePicture;
57 58
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar;
58 59
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable;
......
264 265
	 * @return entero.
265 266
	 */
266 267
	private int getType(IFFrame fframe) {
267
		if (fframe instanceof FFrameView) {
268
		if (fframe instanceof FFrameOverView) {
269
			return Layout.RECTANGLEOVERVIEW;
270
		} else if (fframe instanceof FFrameView) {
268 271
			return Layout.RECTANGLEVIEW;
269 272
		} else if (fframe instanceof FFrameText) {
270 273
			return Layout.RECTANGLETEXT;
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/documents/layout/FLayoutFunctions.java
56 56
import com.iver.cit.gvsig.gui.layout.fframes.FFrameGroup;
57 57
import com.iver.cit.gvsig.gui.layout.fframes.FFrameLegend;
58 58
import com.iver.cit.gvsig.gui.layout.fframes.FFrameNorth;
59
import com.iver.cit.gvsig.gui.layout.fframes.FFrameOverView;
59 60
import com.iver.cit.gvsig.gui.layout.fframes.FFramePicture;
60 61
import com.iver.cit.gvsig.gui.layout.fframes.FFrameScaleBar;
61 62
import com.iver.cit.gvsig.gui.layout.fframes.FFrameTable;
......
163 164
			fframe = new FFrameView();
164 165
			((IFFrameLayoutDependence)fframe).setLayout(layout);
165 166
			isadd = true;
167
		} else if (layout.getTool() == Layout.RECTANGLEOVERVIEW) {
168
			fframe = new FFrameOverView();
169
			((IFFrameLayoutDependence)fframe).setLayout(layout);
170
			isadd = true;
166 171
		} else if (layout.getTool() == Layout.RECTANGLEPICTURE) {
167 172
			fframe = new FFramePicture();
168 173
			isadd = true;

Also available in: Unified diff