Revision 36648

View differences:

branches/v2_0_0_prep/applications/appgvSIG/config/config.xml
11 11
		<label id="distancearea" size="30"/>
12 12
		<label id="projection" size="110"/>
13 13
	</label-set>
14
	<label-set class-name="org.gvsig.app.project.documents.layout.gui.LayoutPanel">
15
		<label id="units" size="80"/>
16
		<label id="2" size="180"/>
17
		<label id="3" size="180"/>
18
		<label id="4" size="50"/>
19
		<label id="5" size="50"/>
20
	</label-set>
21 14
	<extensions>
22 15
		<extension class-name="org.gvsig.app.extension.InitialWarningExtension"
23 16
			description="Initial warning message"
......
51 44
				position="370"
52 45
				is_separator="true"/>
53 46

  
54
			<menu text="Mapa"
55
				position="500"
56
				is_separator="true"/>
57

  
58 47
			<menu text="tools"
59 48
				position="700"
60 49
				is_separator="true"/>
......
65 54
				position="900"
66 55
				is_separator="true"/>
67 56

  
68

  
69

  
70 57
			<menu text="Archivo/nuevo_proyecto"
71 58
				key="n"
72 59
				tooltip="nuevo_tooltip"
......
87 74
				action-command="GUARDAR_COMO" icon="project-save-as"
88 75
				position="10040"
89 76
				last="true"/>
90
			<menu text="Mapa/abrir_plantilla"
91
				action-command="OPENTEMPLATE"
92
				tooltip="abrir_plantilla"
93
				icon="layout-template-open"
94
				position="50010"
95
				last="true"/>
96 77
			<menu text="Archivo/salir"
97 78
				tooltip="salir_tooltip"
98 79
				key="x"
......
287 268
			</tool-bar>
288 269
		</extension>
289 270

  
290
		<extension class-name="org.gvsig.app.extension.ExportLayoutExtension"
291
			description="Extension for exporting the layout to PDF and PostScript."
292
			active="true">
293
			<menu text="Mapa/exportar"
294
				position="50010"
295
				is_separator="true"/>
296
			<menu text="Mapa/exportar/exportar_pdf" action-command="PDF"
297
				 tooltip="exportar_pdf" icon="layout-export-pdf"
298
				 position="5001010"/>
299
			<menu text="Mapa/exportar/exportar_ps" action-command="PS"
300
				 tooltip="exportar_ps" icon="layout-export-ps"
301
				 position="5001020"/>
302
			<tool-bar name="gvSIG" position="1">
303
				<action-tool icon="layout-export-pdf" action-command="PDF"  tooltip="exportar_pdf" position="4"/>
304
				<action-tool icon="layout-export-ps" action-command="PS"  tooltip="exportar_ps" position="5"/>
305
			</tool-bar>
306
		</extension>
307

  
308
		<extension class-name="org.gvsig.app.extension.LayoutExtension"
309
			description="Extensi?n encargada de gestionar los eventos realizados sobre el Layout."
310
			active="true">
311

  
312
			<menu text="Mapa/guardar_como_plantilla" action-command="SAVETEMPLATE"
313
				 tooltip="guardar"
314
				 icon="save-icon"
315
				 position="50020"/>
316
			<menu text="Mapa/navegacion"
317
				position="50030" 
318
				is_separator="true"/>
319
			<menu text="Mapa/navegacion/Zoom_Mas" position="5003010" action-command="LAYOUT_ZOOM_IN" tooltip="Zoom_Mas" icon="layout-zoom-in"/>
320
			<menu text="Mapa/navegacion/Zoom_Menos" position="5003020" action-command="LAYOUT_ZOOM_OUT" tooltip="Zoom_Menos" icon="layout-zoom-out"/>
321
			<menu text="Mapa/navegacion/Zoom_Acercar" position="5003030" action-command="LAYOUT_ZOOMIN" tooltip="Zoom_Acercar" icon="view-zoom-center-in"/>
322
			<menu text="Mapa/navegacion/Zoom_Alejar" position="5003040" action-command="LAYOUT_ZOOMOUT" tooltip="Zoom_Alejar" icon="view-zoom-center-out"/>
323
			<menu text="Mapa/navegacion/Zoom_Completo" position="5003050" action-command="LAYOUT_FULL" tooltip="Zoom_Completo" icon="layout-zoom-fit"/>
324
			<menu text="Mapa/navegacion/Zoom_Real" position="5003060" action-command="REALZOOM" tooltip="Zoom_Real" icon="layout-zoom-real"/>
325
			<menu text="Mapa/navegacion/Zoom_Select" position="5003070" action-command="ZOOMSELECT" tooltip="Zoom_Select" icon="layout-zoom-selected"/>
326
			<menu text="Mapa/navegacion/Desplazamiento" position="5003080" action-command="LAYOUT_PAN"  tooltip="Encuadre" icon="layout-pan"/>
327
			<tool-bar name="Layout_Tools_Zooms" position="20">
328
				<selectable-tool icon="layout-zoom-in" action-command="LAYOUT_ZOOM_IN" tooltip="Zoom_Mas"/>
329
				<selectable-tool icon="layout-zoom-out" action-command="LAYOUT_ZOOM_OUT" tooltip="Zoom_Menos"/>
330
				<action-tool icon="view-zoom-center-in" action-command="LAYOUT_ZOOMIN" tooltip="Zoom_Acercar"/>
331
				<action-tool icon="view-zoom-center-out" action-command="LAYOUT_ZOOMOUT" tooltip="Zoom_Alejar"/>
332
				<action-tool icon="layout-zoom-fit" action-command="LAYOUT_FULL" tooltip="Zoom_Completo"/>
333
				<action-tool icon="layout-zoom-real" action-command="REALZOOM" tooltip="Zoom_Real"/>
334
				<action-tool icon="layout-zoom-selected" action-command="ZOOMSELECT" tooltip="Zoom_Select"/>
335
				<selectable-tool icon="layout-pan" action-command="LAYOUT_PAN"  tooltip="Encuadre"/>
336
			</tool-bar>
337
		</extension>
338

  
339
		<extension class-name="org.gvsig.app.extension.LayoutEditableControls"
340
			description="Extensi?n encargada de gestionar los eventos de edici?n realizados sobre el Layout."
341
			active="true">
342
			<menu text="Mapa/propiedades" position="50040" action-command="PROPERTIES" tooltip="propiedades_mapa"/>
343
		</extension>
344

  
345
		<extension class-name="org.gvsig.app.extension.LayoutEditVertexExtension"
346
			description="Extensi?n encargada de gestionar los eventos de edici?n realizados sobre el Layout."
347
			active="true">
348
			<menu text="Mapa/edicion"
349
				position="50050" 
350
				is_separator="true"/>
351
			<menu text="Mapa/edicion/editar_vertices" position="5005010" action-command="VERTEX" tooltip="editar_vertices" icon="layout-edit-vertex"/>
352
			<tool-bar name="Tools_Select" position="6">
353
				<selectable-tool icon="layout-edit-vertex" action-command="VERTEX" tooltip="editar_vertices" position="4"/>
354
			</tool-bar>
355
		</extension>
356

  
357
		<extension class-name="org.gvsig.app.extension.LayoutInsertToolsExtension"
358
			description="Extensi?n encargada de gestionar los eventos de edici?n realizados sobre el Layout."
359
			active="true">
360
			<menu text="Mapa/seleccion"
361
				position="50060" 
362
				is_separator="true"/>
363
			<menu text="Mapa/seleccion/seleccionar_por_rectangulo" position="5006010" action-command="SELECT"  tooltip="seleccionar_por_rectangulo" icon="view-select-geometry"/>
364
			<menu text="Mapa/Insertar"
365
				position="50070" 
366
				is_separator="true"/>
367
			<menu text="Mapa/Insertar/texto" position="5007010" action-command="RECTANGLETEXT" tooltip="insertar_texto" icon="layout-insert-text"/>
368
			<menu text="Mapa/Insertar/punto" position="5007015" action-command="POINT" tooltip="insertar_punto" icon="layout-insert-point"/>
369
			<menu text="Mapa/Insertar/rectangulo" position="5007020" action-command="RECTANGLESIMPLE" tooltip="insertar_rectangulo" icon="layout-insert-polygon"/>
370
			<menu text="Mapa/Insertar/circulo" position="5007025" action-command="CIRCLE" tooltip="insertar_circulo" icon="layout-insert-circle"/>
371
			<menu text="Mapa/Insertar/linea" position="5007030" action-command="LINE" tooltip="insertar_linea" icon="layout-insert-line"/>
372
			<menu text="Mapa/Insertar/polilinea" position="5007035" action-command="POLYLINE" tooltip="insertar_polilinea" icon="layout-insert-polyline"/>
373
			<menu text="Mapa/Insertar/poligono" position="5007040" action-command="POLYGON" tooltip="insertar_poligono" icon="layout-insert-poligon"/>
374
			<menu text="Mapa/Insertar/imagen" position="5007045" action-command="RECTANGLEPICTURE" tooltip="insertar_imagen" icon="layout-insert-image"/>
375
			<menu text="Mapa/Insertar/Vista" position="5007050" action-command="RECTANGLEVIEW" tooltip="insertar_vista" icon="layout-insert-view"/>
376
			<menu text="Mapa/Insertar/Localizador" position="5007055" action-command="RECTANGLEOVERVIEW" tooltip="insertar_localizador" icon="layout-insert-locator"/>
377
			<menu text="Mapa/Insertar/leyenda" position="5007060" action-command="RECTANGLELEGEND"  tooltip="insertar_leyenda" icon="layout-insert-legend"/>
378
			<menu text="Mapa/Insertar/escala" position="5007065" action-command="RECTANGLESCALEBAR"  tooltip="insertar_escala" icon="layout-insert-scalebar"/>
379
			<menu text="Mapa/Insertar/north" position="5007070" action-command="RECTANGLENORTH" tooltip="insertar_norte" icon="layout-insert-north"/>
380
			<menu text="Mapa/Insertar/cajetin" position="5007075" action-command="RECTANGLEBOX" tooltip="insertar_cajetin" icon="layout-insert-box"/>
381

  
382
			<tool-bar name="Tools_Select" position="6">
383
				<selectable-tool icon="view-select-geometry" action-command="SELECT"  tooltip="seleccionar_por_rectangulo" position="5"/>
384
				<action-tool icon="remove-selection" action-command="REMOVE" tooltip="borra_seleccion" position="6"/>
385
			</tool-bar>
386

  
387
			<tool-bar name="Layout_Tools_Insert_Simple" position="7">
388
				<selectable-tool icon="layout-insert-text" action-command="RECTANGLETEXT"  tooltip="insertar_texto" position="1"/>
389
				<selectable-tool icon="layout-insert-image" action-command="RECTANGLEPICTURE"  tooltip="insertar_imagen" position="2"/>
390
				<selectable-tool icon="layout-insert-point" action-command="POINT"  tooltip="insertar_punto" position="3"/>
391
				<selectable-tool icon="layout-insert-polygon" action-command="RECTANGLESIMPLE"  tooltip="insertar_rectangulo" position="4"/>
392
				<selectable-tool icon="layout-insert-circle" action-command="CIRCLE"  tooltip="insertar_circulo" position="5"/>
393
				<selectable-tool icon="layout-insert-line" action-command="LINE"  tooltip="insertar_linea" position="6"/>
394
				<selectable-tool icon="layout-insert-polyline" action-command="POLYLINE"  tooltip="insertar_polilinea" position="7"/>
395
				<selectable-tool icon="layout-insert-poligon" action-command="POLYGON" tooltip="insertar_poligono" position="8"/>
396
			</tool-bar>
397

  
398
			<tool-bar name="Layout_Tools_Insert_Cartografy" position="8">
399
				<selectable-tool icon="layout-insert-view" action-command="RECTANGLEVIEW" tooltip="insertar_vista" position="1"/>
400
				<selectable-tool icon="layout-insert-locator" action-command="RECTANGLEOVERVIEW" tooltip="insertar_localizador" position="2"/>
401
				<selectable-tool icon="layout-insert-legend" action-command="RECTANGLELEGEND"  tooltip="insertar_leyenda" position="3"/>
402
				<selectable-tool icon="layout-insert-scalebar" action-command="RECTANGLESCALEBAR"  tooltip="insertar_escala" position="4"/>
403
				<selectable-tool icon="layout-insert-north" action-command="RECTANGLENORTH"  tooltip="insertar_norte" position="5"/>
404
				<selectable-tool icon="layout-insert-box" action-command="RECTANGLEBOX"  tooltip="insertar_cajetin" position="6"/>
405
			</tool-bar>
406
		</extension>
407

  
408
		<extension class-name="org.gvsig.app.extension.FFrameViewExtension"
409
			description="Extensi?n encargada de gestionar los eventos realizados sobre las vistas a?adidas al Layout."
410
			active="true">
411
			<menu text="Mapa/navegacion_vista"
412
				position="50070" 
413
				is_separator="true"/>
414
			<menu text="Mapa/navegacion_vista/Zoom_Mas_Vista" position="5007010" action-command="VIEW_ZOOMIN" tooltip="Zoom_Mas_Vista" icon="view-zoom-in"/>
415
			<menu text="Mapa/navegacion_vista/Zoom_Menos_Vista" position="5007020" action-command="VIEW_ZOOMOUT" tooltip="Zoom_Menos_Vista" icon="view-zoom-out"/>
416
			<menu text="Mapa/navegacion_vista/Zoom_Completo_Vista" position="5007030" action-command="VIEW_FULL" tooltip="Zoom_Completo_Vista" icon="view-zoom-map-contents"/>
417
			<menu text="Mapa/navegacion_vista/Encuadre_Vista" position="5007040" action-command="VIEW_PAN" tooltip="Encuadre_Vista" icon="view-pan"/>
418
			<tool-bar name="Layout_Tools_View" position="9">
419
				<action-tool icon="view-zoom-map-contents" action-command="VIEW_FULL" tooltip="Zoom_Completo_Vista" position="1"/>
420
				<selectable-tool icon="view-zoom-in" action-command="VIEW_ZOOMIN" tooltip="Zoom_Mas_Vista" position="2"/>
421
				<selectable-tool icon="view-zoom-out" action-command="VIEW_ZOOMOUT" tooltip="Zoom_Menos_Vista" position="3"/>
422
				<selectable-tool icon="view-pan" action-command="VIEW_PAN" tooltip="Encuadre_Vista" position="4"/>
423
			</tool-bar>
424
		</extension>
425

  
426
		<extension class-name="org.gvsig.app.extension.TagExtension"
427
			description="Extensi?n para a?adir un tag a los FFrames."
428
			active="false">
429
			<menu text="Mapa/anadir_tag" position="50075" key="t" action-command="SET_TAG" tooltip="anadir_tag" icon="layout-tag"/>
430
			<tool-bar name="Mapa" position="10">
431
				<action-tool icon="layout-insert-tag" action-command="SET_TAG" tooltip="anadir_tag" position="1"/>
432
				<action-tool icon="layout-show-tag" action-command="VIEW_TAGS" tooltip="ver_tags" position="2"/>
433
			</tool-bar>
434
		</extension>
435

  
436
		<extension class-name="org.gvsig.app.extension.LayoutGraphicControls"
437
			description="Extensi?n encargada de gestionar los eventos realizados sobre los gr?ficos que contiene el Layout."
438
			active="true">
439
			<menu text="Mapa/Graficos"
440
				position="50080" 
441
				is_separator="true"/>
442
			<menu text="Mapa/Graficos/propiedades" position="5008010" action-command="PROPIEDADES" tooltip="propiedades" />
443
			<menu text="Mapa/Graficos/alinear" position="5008020" action-command="ALINEAR" tooltip="alinear_graficos"/>
444
			<menu text="Mapa/Graficos/agrupar" position="5008030" action-command="AGRUPAR" tooltip="agrupar_graficos" icon="layout-group"/>
445
			<menu text="Mapa/Graficos/desagrupar" position="5008040" action-command="DESAGRUPAR" tooltip="desagrupar_graficos" icon="layout-ungroup"/>
446
			<menu text="Mapa/Graficos/colocar_delante" position="5008050" action-command="DELANTE" tooltip="colocar_delante" icon="layout-bring-to-front"/>
447
			<menu text="Mapa/Graficos/colocar_detras" position="5008060" action-command="DETRAS" tooltip="colocar_detras" icon="layout-send-to-back"/>
448
			<menu text="Mapa/Graficos/tamano_posicion" position="5008070" action-command="POSICIONAR" tooltip="tamano_posicion" icon="layout-set-size-position"/>
449
			<menu text="Mapa/Graficos/linea_grafica" position="5008080" action-command="BORDEAR" tooltip="linea_grafica" icon="layout-add-border"/>
450
			<tool-bar name="Layout_Tools_Graphics" position="11">
451
				<action-tool icon="layout-bring-to-front" action-command="DELANTE" tooltip="colocar_delante" position="1"/>
452
				<action-tool icon="layout-send-to-back" action-command="DETRAS" tooltip="colocar_detras" position="2"/>
453
				<action-tool icon="layout-set-size-position" action-command="POSICIONAR" tooltip="tamano_posicion" position="3"/>
454
				<action-tool icon="layout-group" action-command="AGRUPAR" tooltip="agrupar_graficos" position="4"/>
455
				<action-tool icon="layout-ungroup" action-command="DESAGRUPAR" tooltip="desagrupar_graficos" position="5"/>
456
				<action-tool icon="layout-add-border" action-command="BORDEAR" tooltip="linea_grafica" position="6"/>
457
			</tool-bar>
458
		</extension>
459

  
460
		<extension class-name="org.gvsig.app.extension.FFrameLegendExtension"
461
			description="Extensi?n encargada de controlar un FFrameLegend."
462
			active="true">
463
			<menu text="Mapa/Graficos/simplificar_leyenda" position="5008090" action-command="SIMPLIFICAR" tooltip="simplificar_leyenda"/>
464
		</extension>
465

  
466
		<extension class-name="org.gvsig.app.extension.LayoutRedoExtension"
467
			description="Extensi?n para rehacer cambios sobre el Layout."
468
			active="true">
469
			<menu text="Mapa/rehacer" position="50084" action-command="REDO" tooltip="rehacer" icon="layout-redo"/>
470
			<tool-bar name="Mapa" position="10">
471
				<action-tool icon="layout-redo" action-command="REDO" tooltip="rehacer" position="4"/>
472
			</tool-bar>
473
		</extension>
474

  
475
		<extension class-name="org.gvsig.app.extension.LayoutUndoExtension"
476
			description="Extensi?n para deshacer cambios sobre el Layout."
477
			active="true">
478
			<menu text="Mapa/deshacer" position="50086" action-command="UNDO" tooltip="dehacer" icon="layout-undo"/>
479
			<tool-bar name="Mapa" position="10">
480
				<action-tool icon="layout-undo" action-command="UNDO" tooltip="deshacer" position="3"/>
481
			</tool-bar>
482
		</extension>
483

  
484
		<extension class-name="org.gvsig.app.extension.LayoutCommandStackExtension"
485
			description="Extensi?n encargada de abrir el di?logo para gestionar los comandos apilados."
486
			active="true">
487
			<menu text="Mapa/pila_de_comandos" position="50090" key="k" action-command="COMMANDSTACK" tooltip="pila_de_comandos" icon="edition-command-stack"/>
488
			<tool-bar name="Mapa" position="10">
489
				<action-tool icon="edition-command-stack" action-command="COMMANDSTACK" tooltip="pila_de_comandos" position="5"/>
490
			</tool-bar>
491
		</extension>
492

  
493
		<extension class-name="org.gvsig.app.extension.Print"
494
			description="Extensi?n encargada de la impresi?n."
495
			active="true">
496
			<menu text="Mapa/Imprimir" position="50094" icon="document-print" tooltip="Imprimir"/>
497
			<tool-bar name="Mapa" position="10">
498
				<action-tool icon="document-print" tooltip="Imprimir" position="6"/>
499
			</tool-bar>
500
		</extension>
501

  
502
		<extension class-name="org.gvsig.app.extension.PrintProperties"
503
			escription="Extensi?n encargada de las propiedades de impresi?n."
504
			active="true">
505
			<menu text="Mapa/preparar_pagina" position="50096" action-command="CONFIG" tooltip="preparar_pagina"/>
506
			<tool-bar name="Mapa" position="10">
507
				<action-tool icon="layout-page-setup" tooltip="preparar_pagina" position="7"/>
508
			</tool-bar>
509
		</extension>
510

  
511 271
		<extension class-name="org.gvsig.app.extension.FiltroExtension"
512 272
			description="Extensi?n encargada de abrir el di?logo para filtrar una vista."
513 273
			active="true">
......
558 318
			<menu text="Ayuda/acerca_de" />
559 319
		</extension>
560 320

  
561

  
562 321
	</extensions>
563 322
	<icon src="gvsig-logo-icon" text="gvSIG"/>
564 323
</plugin-config>
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/preferencespage/PrintPropertiesPage.java
1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.1  2006-10-18 07:57:47  jaume
47
* *** empty log message ***
48
*
49
*
50
*/
51
package org.gvsig.app.gui.preferencespage;
52

  
53
import java.awt.Dimension;
54
import java.awt.GridLayout;
55

  
56
import javax.swing.ButtonGroup;
57
import javax.swing.ImageIcon;
58
import javax.swing.JCheckBox;
59
import javax.swing.JLabel;
60
import javax.swing.JPanel;
61
import javax.swing.JRadioButton;
62
import javax.swing.JTextField;
63

  
64
import org.gvsig.andami.PluginServices;
65
import org.gvsig.andami.preferences.AbstractPreferencePage;
66
import org.gvsig.andami.preferences.StoreException;
67

  
68

  
69
public class PrintPropertiesPage extends AbstractPreferencePage{
70

  
71
	private static final boolean FACTORY_DEFAULT_LANDSCAPED_PAGE = true;
72
	protected static String id = PrintPropertiesPage.class.getName();
73
	private ImageIcon icon;
74
	private JRadioButton rdBtnPortraitPage;
75
	private JRadioButton rdBtnLandscapePage;
76
	private JCheckBox chkCustomMargins;
77
	private JTextField txtTopMargin;
78
	private JTextField txtLeftMargin;
79
	private JTextField txtBottomMargin;
80
	private JTextField txtRightMargin;
81

  
82
	public PrintPropertiesPage() {
83
		super();
84
		setParentID(LayoutPage.class.getName());
85
		icon = PluginServices.getIconTheme().get("prepare-page-icon");
86
		rdBtnPortraitPage = new JRadioButton(PluginServices.getText(this, "options.layout.paper_properties.portrait"));
87
		ImageIcon portrait = PluginServices.getIconTheme().get("portrait-page-setup");
88
		rdBtnLandscapePage = new JRadioButton(PluginServices.getText(this, "options.layout.paper_properties.landscaped"));
89
		ImageIcon landscape = PluginServices.getIconTheme().get("landscape-page-setup");
90

  
91
		ButtonGroup group = new ButtonGroup();
92
		group.add(rdBtnLandscapePage);
93
		group.add(rdBtnPortraitPage);
94

  
95
		JPanel aux = new JPanel(new GridLayout(2,2,10,0));
96
		aux.setPreferredSize(new Dimension(200, 150));
97
		aux.setSize(200, 150);
98
		aux.add(new JLabel(landscape));
99
		aux.add(new JLabel(portrait));
100
		aux.add(rdBtnLandscapePage);
101
		aux.add(rdBtnPortraitPage);
102

  
103
		addComponent(new JLabel(PluginServices.
104
			getText(this, "options.layout.paper_properties.paper_direction")));
105
		addComponent("", aux);
106
		addComponent(chkCustomMargins = new JCheckBox(PluginServices.getText(this, "personalizar_margenes")));
107

  
108
		JPanel aux2 = new JPanel(new GridLayout(2, 4, 10, 3));
109
		aux2.add(new JLabel(PluginServices.getText(this, "Superior")));
110
		aux2.add(txtTopMargin = new JTextField(10));
111
		aux2.add(new JLabel(PluginServices.getText(this, "Izquierdo")));
112
		aux2.add(txtLeftMargin = new JTextField(10));
113
		aux2.add(new JLabel(PluginServices.getText(this, "Inferior")));
114
		aux2.add(txtBottomMargin = new JTextField(10));
115
		aux2.add(new JLabel(PluginServices.getText(this, "Derecho")));
116
		aux2.add(txtRightMargin = new JTextField(10));
117
		addComponent("", aux2);
118
	}
119

  
120
	public void storeValues() throws StoreException {
121
		// TODO Auto-generated method stub
122

  
123
	}
124

  
125
	public void setChangesApplied() {
126
		// TODO Auto-generated method stub
127

  
128
	}
129

  
130
	public String getID() {
131
		return id;
132
	}
133

  
134
	public String getTitle() {
135
		return PluginServices.getText(this, "options.layout.paper_properties.title");
136
	}
137

  
138
	public JPanel getPanel() {
139
		return this;
140
	}
141

  
142
	public void initializeValues() {
143
		// TODO Auto-generated method stub
144

  
145
	}
146

  
147
	public void initializeDefaults() {
148
		rdBtnLandscapePage.setSelected(FACTORY_DEFAULT_LANDSCAPED_PAGE);
149
		rdBtnPortraitPage.setSelected(!FACTORY_DEFAULT_LANDSCAPED_PAGE);
150
	}
151

  
152
	public ImageIcon getIcon() {
153
		return icon;
154
	}
155

  
156
	public boolean isValueChanged() {
157
		// TODO Auto-generated method stub
158
		return false;
159
	}
160

  
161
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/gui/preferencespage/LayoutPage.java
1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2005 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

  
42
/* CVS MESSAGES:
43
*
44
* $Id$
45
* $Log$
46
* Revision 1.7  2006-12-20 14:41:12  caballero
47
* Remodelado Layout
48
*
49
* Revision 1.6  2006/11/08 10:57:55  jaume
50
* remove unecessary imports
51
*
52
* Revision 1.5  2006/10/18 07:57:47  jaume
53
* *** empty log message ***
54
*
55
* Revision 1.4  2006/10/04 09:06:35  jaume
56
* *** empty log message ***
57
*
58
* Revision 1.3  2006/10/04 07:23:53  jaume
59
* refactored ambiguous methods and field names and added some more features for preference pages
60
*
61
* Revision 1.2  2006/10/03 11:12:41  jaume
62
* initialize values
63
*
64
* Revision 1.1  2006/10/03 10:33:34  jaume
65
* *** empty log message ***
66
*
67
*
68
*/
69
package org.gvsig.app.gui.preferencespage;
70

  
71
import javax.swing.ImageIcon;
72
import javax.swing.JCheckBox;
73
import javax.swing.JPanel;
74
import javax.swing.JTextField;
75

  
76
import org.gvsig.andami.PluginServices;
77
import org.gvsig.andami.preferences.AbstractPreferencePage;
78
import org.gvsig.andami.preferences.StoreException;
79
import org.gvsig.app.project.ProjectManager;
80
import org.gvsig.app.project.documents.layout.Attributes;
81
import org.gvsig.app.project.documents.layout.DefaultLayoutManager;
82
import org.gvsig.utils.XMLEntity;
83

  
84
/**
85
 * Layout preference page where the user can establish default values for
86
 * <ol>
87
 *  <li><b>grid horizontal gap</b></li>
88
 *  <li><b>grid vertical gap</b></li>
89
 *  <li><b>show or hide grid</b></li>
90
 *  <li><b>adjust elements to grid</b></li>
91
 *  <li><b>show or hide rules</b></li>
92
 * </ol>
93
 * @author jaume dominguez faus - jaume.dominguez@iver.es
94
 *
95
 */
96
public class LayoutPage extends AbstractPreferencePage{
97

  
98
	private static final boolean FACTORY_DEFAULT_LAYOUT_ENABLE_RULES = true;
99
	private static final boolean FACTORY_DEFAULT_LAYOUT_GRID_SHOW = true;
100
	private static final double FACTORY_DEFAULT_VERTICAL_GAP = 1;
101
	private static final double FACTORY_DEFAULT_HORIZONTAL_GAP = 1;
102
	private static final boolean FACTORY_DEFAULT_LAYOUT_GRID_ENABLE = false;
103
	private static final String DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME = "DefaultShowLayoutGrid";
104
	private static final String DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME = "DefaultEnableLayoutGrid";
105
	private static final String DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME = "DefaultShowLayoutRules";
106
	private static final String DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME = "DefaultGridVerticalGap";
107
	private static final String DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME = "DefaultGridHorizontalGap";
108
	static String id = LayoutPage.class.getName();;
109
	private ImageIcon icon;
110
	private JCheckBox chkGridEnabled;
111
	private JCheckBox chkShowRules;
112
	private JCheckBox chkShowGrid;
113
	private JTextField txtVGap;
114
	private JTextField txtHGap;
115

  
116
	private static DefaultLayoutManager layoutManager = null;
117
	
118
	/**
119
	 * Builds preference page where the user can establish default values for
120
	 * <ol>
121
	 *  <li><b>grid horizontal gap</b></li>
122
	 *  <li><b>grid vertical gap</b></li>
123
	 *  <li><b>show or hide grid</b></li>
124
	 *  <li><b>adjust elements to grid</b></li>
125
	 *  <li><b>show or hide rules</b></li>
126
	 * </ol>
127
	 */
128
	public LayoutPage() {
129
		super();
130
		 layoutManager = (DefaultLayoutManager)ProjectManager.getInstance().getDocumentManager(DefaultLayoutManager.TYPENAME);
131

  
132
		icon = PluginServices.getIconTheme().get("mapa-icono");
133

  
134
		// horizontal gap text field
135
		addComponent(PluginServices.getText(this, "espaciado_horizontal"), txtHGap = new JTextField(5));
136

  
137
		// vertical gap text field
138
		addComponent(PluginServices.getText(this, "espaciado_vertical"), txtVGap = new JTextField(5));
139

  
140
		// show/hide show check
141
		addComponent(chkShowGrid = new JCheckBox(PluginServices.getText(this, "visualizar_cuadricula")));
142

  
143
		// enable/disable grid
144
		addComponent(chkGridEnabled = new JCheckBox(PluginServices.getText(this, "malla_activada")));
145

  
146
		// show/hide rules
147
		addComponent(chkShowRules = new JCheckBox(PluginServices.getText(this, "activar_regla")));
148

  
149

  
150
	}
151

  
152
	public void storeValues() throws StoreException {
153
		double hGap, vGap;
154
		boolean gridEnabled, showRules, showGrid;
155
		try {
156
			hGap = Double.parseDouble(txtHGap.getText());
157
			vGap = Double.parseDouble(txtVGap.getText());
158
			gridEnabled = chkGridEnabled.isSelected();
159
			showGrid = chkShowGrid.isSelected();
160
			showRules = chkShowRules.isSelected();
161
		} catch (Exception e) {
162
			throw new StoreException(PluginServices.getText(this, "invalid_value_for_gap"));
163
		}
164
		layoutManager.setDefaultShowGrid(showGrid);
165
		layoutManager.setDefaultAdjustToGrid(gridEnabled);
166
		layoutManager.setDefaultShowRulers(showRules);
167
		Attributes.setDefaultGridGap(hGap, vGap);
168
		PluginServices ps = PluginServices.getPluginServices(this);
169
		XMLEntity xml = ps.getPersistentXML();
170
		xml.putProperty(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME, hGap);
171
		xml.putProperty(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME, vGap);
172
		xml.putProperty(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME, showGrid);
173
		xml.putProperty(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME, gridEnabled);
174
		xml.putProperty(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME, showRules);
175
	}
176

  
177
	public String getID() {
178
		return id;
179
	}
180

  
181
	public String getTitle() {
182
		return PluginServices.getText(this, "Mapa");
183
	}
184

  
185
	public JPanel getPanel() {
186
		return this;
187
	}
188

  
189
	public void initializeValues() {
190
		PluginServices ps = PluginServices.getPluginServices(this);
191
		XMLEntity xml = ps.getPersistentXML();
192
		double hGap=FACTORY_DEFAULT_HORIZONTAL_GAP;
193
		double vGap=FACTORY_DEFAULT_VERTICAL_GAP;
194
		boolean showGrid=FACTORY_DEFAULT_LAYOUT_GRID_SHOW;
195
		boolean gridEnabled=FACTORY_DEFAULT_LAYOUT_GRID_ENABLE;
196
		boolean showRules=FACTORY_DEFAULT_LAYOUT_ENABLE_RULES;
197
		// horizontal gap
198
		if (xml.contains(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME)) {
199
			hGap=xml.getDoubleProperty(DEFAULT_LAYOUT_GRID_HORIZONTAL_GAP_KEY_NAME);
200
		}
201
		txtHGap.setText(String.valueOf(hGap));
202

  
203
		// vertical gap
204
		if (xml.contains(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME)) {
205
			vGap=xml.getDoubleProperty(DEFAULT_LAYOUT_GRID_VERTICAL_GAP_KEY_NAME);
206
		}
207
		txtVGap.setText(String.valueOf(vGap));
208

  
209
		// show/hide grid check
210
		if (xml.contains(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME)) {
211
			showGrid=xml.getBooleanProperty(DEFAULT_SHOW_LAYOUT_GRID_KEY_NAME);
212
		}
213
		chkShowGrid.setSelected(showGrid);
214

  
215
		// enable/disable grid check
216
		if (xml.contains(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME)) {
217
			gridEnabled=xml.getBooleanProperty(DEFAULT_ENABLE_LAYOUT_GRID_KEY_NAME);
218
		}
219
		chkGridEnabled.setSelected(gridEnabled);
220

  
221
		// enable/disable rules
222
		if (xml.contains(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME)) {
223
			showRules=xml.getBooleanProperty(DEFAULT_SHOW_LAYOUT_RULES_KEY_NAME);
224
		}
225
		chkShowRules.setSelected(showRules);
226

  
227
		layoutManager.setDefaultShowGrid(showGrid);
228
		layoutManager.setDefaultAdjustToGrid(gridEnabled);
229
		layoutManager.setDefaultShowRulers(showRules);
230
		Attributes.setDefaultGridGap(hGap, vGap);
231
	}
232

  
233
	public void initializeDefaults() {
234
		txtHGap.setText(String.valueOf(FACTORY_DEFAULT_HORIZONTAL_GAP));
235
		txtVGap.setText(String.valueOf(FACTORY_DEFAULT_VERTICAL_GAP));
236
		chkShowGrid.setSelected(FACTORY_DEFAULT_LAYOUT_GRID_SHOW);
237
		chkGridEnabled.setSelected(FACTORY_DEFAULT_LAYOUT_GRID_ENABLE);
238
		chkShowRules.setSelected(FACTORY_DEFAULT_LAYOUT_ENABLE_RULES);
239
	}
240

  
241
	public ImageIcon getIcon() {
242
		return icon;
243
	}
244

  
245
	public boolean isValueChanged() {
246
		return super.hasChanged();
247
	}
248

  
249
	public void setChangesApplied() {
250
		setChanged(false);
251
	}
252
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/view/gui/ViewProperties.java
45 45
import org.gvsig.app.project.Project;
46 46
import org.gvsig.app.project.ProjectManager;
47 47
import org.gvsig.app.project.documents.Document;
48
import org.gvsig.app.project.documents.layout.Attributes;
49 48
import org.gvsig.app.project.documents.view.DefaultViewDocument;
50 49
import org.gvsig.app.project.documents.view.ViewManager;
51 50
import org.gvsig.fmap.mapcontext.MapContext;
......
581 580
                        if (!jPanelProj.getCurProj().isProjected()) {
582 581
                            getCmbMapUnits().setSelectedItem(
583 582
                                PluginServices
584
                                    .getText(this, Attributes.DEGREES));
583
                                    .getText(this, "Grados"));
585 584
                            getCmbMapUnits().setEnabled(false);
586 585
                        } else {
587 586
                            if (getCmbMapUnits().getSelectedItem().equals(
588 587
                                PluginServices
589
                                    .getText(this, Attributes.DEGREES))) {
588
                                    .getText(this, "Grados"))) {
590 589
                                getCmbMapUnits().setSelectedIndex(1);
591 590
                            }
592 591
                            getCmbMapUnits().setEnabled(true);
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/LayoutEvents.java
1
/*
2
 * Created on 27-jul-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package org.gvsig.app.project.documents.layout;
46

  
47
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionListener;
49
import java.awt.event.ComponentEvent;
50
import java.awt.event.ComponentListener;
51
import java.awt.event.MouseEvent;
52
import java.awt.event.MouseListener;
53
import java.awt.event.MouseMotionListener;
54

  
55
import org.gvsig.app.project.documents.layout.gui.FPopupMenu;
56
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
57
import org.gvsig.fmap.mapcontrol.tools.BehaviorException;
58
import org.gvsig.utils.exceptionHandling.ExceptionHandlingSupport;
59
import org.gvsig.utils.exceptionHandling.ExceptionListener;
60

  
61

  
62

  
63
/**
64
 * Eventos que se realizan sobre el Layout.
65
 *
66
 * @author Vicente Caballero Navarro
67
 */
68
public class LayoutEvents implements ActionListener, ComponentListener,
69
    MouseMotionListener, MouseListener{
70
    private LayoutPanel layout = null;
71
    private ExceptionHandlingSupport exceptionHandlingSupport = new ExceptionHandlingSupport();
72

  
73
    /**
74
     * Crea un nuevo EventsHandler.
75
     *
76
     * @param l Referencia al Layout.
77
     */
78
    public LayoutEvents(LayoutPanel l) {
79
        layout = l;
80
    }
81

  
82
    /**
83
     * @see java.awt.event.ComponentListener#componentHidden(java.awt.event.ComponentEvent)
84
     */
85
    public void componentHidden(ComponentEvent arg0) {
86
    }
87

  
88
    /**
89
     * @see java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent)
90
     */
91
    public void componentMoved(ComponentEvent arg0) {
92
    }
93

  
94
    /**
95
     * @see java.awt.event.ComponentListener#componentResized(java.awt.event.ComponentEvent)
96
     */
97
    public void componentResized(ComponentEvent arg0) {
98
        layout.getLayoutControl().fullRect();
99
    }
100

  
101
    /**
102
     * @see java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent)
103
     */
104
    public void componentShown(ComponentEvent arg0) {
105
    }
106

  
107
    /**
108
     * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
109
     */
110
    public void actionPerformed(ActionEvent arg0) {
111
        layout.repaint();
112
    }
113

  
114
    /**
115
     * @see java.awt.event.MouseMotionListener#mouseDragged(java.awt.event.MouseEvent)
116
     */
117
    public void mouseDragged(MouseEvent e) {
118
    	if (e.getButton() != MouseEvent.BUTTON3) {
119
            layout.getLayoutControl().setLastPoint();
120
            layout.repaint();
121
        }
122
    	try {
123
			layout.getLayoutControl().getCurrentLayoutTool().mouseDragged(e);
124
		} catch (BehaviorException t) {
125
			throwException(t);
126
		}
127
        layout.getLayoutControl().setPosition(e.getPoint());
128
    }
129

  
130
    /**
131
     * @see java.awt.event.MouseMotionListener#mouseMoved(java.awt.event.MouseEvent)
132
     */
133
    public void mouseMoved(MouseEvent e) {
134
    	try {
135
			layout.getLayoutControl().getCurrentLayoutTool().mouseMoved(e);
136
		} catch (BehaviorException t) {
137
			throwException(t);
138
		}
139
        layout.getLayoutControl().setPosition(e.getPoint());
140
        layout.repaint();
141
    }
142

  
143
    /**
144
     * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
145
     */
146
    public void mouseClicked(MouseEvent e) {
147
    	try {
148
			layout.getLayoutControl().getCurrentLayoutTool().mouseClicked(e);
149
		} catch (BehaviorException t) {
150
			throwException(t);
151
		}
152
    }
153

  
154
    /**
155
	 * A?ade un listener de tipo ExceptionListener.
156
	 *
157
	 * @param o ExceptionListener.
158
	 */
159
	public void addExceptionListener(ExceptionListener o) {
160
		exceptionHandlingSupport.addExceptionListener(o);
161
	}
162

  
163
	/**
164
	 * Borra la ExceptioListener que se pasa como par?metro.
165
	 *
166
	 * @param o ExceptionListener.
167
	 *
168
	 * @return True si se borra correctamente.
169
	 */
170
	public boolean removeExceptionListener(ExceptionListener o) {
171
		return exceptionHandlingSupport.removeExceptionListener(o);
172
	}
173

  
174
	/**
175
	 * Lanza una Excepci?n.
176
	 *
177
	 * @param t Excepci?n.
178
	 */
179
	protected void throwException(Throwable t) {
180
		exceptionHandlingSupport.throwException(t);
181
	}
182

  
183
	/**
184
     * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
185
     */
186
    public void mouseEntered(MouseEvent e) {
187
       layout.getLayoutControl().clearMouseImage();
188
       try {
189
			layout.getLayoutControl().getCurrentLayoutTool().mouseEntered(e);
190
		} catch (BehaviorException t) {
191
			throwException(t);
192
		}
193
    }
194

  
195
    /**
196
     * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
197
     */
198
    public void mouseExited(MouseEvent e) {
199
    	try {
200
			layout.getLayoutControl().getCurrentLayoutTool().mouseExited(e);
201
		} catch (BehaviorException t) {
202
			throwException(t);
203
		}
204
    }
205

  
206
    /**
207
     * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
208
     */
209
    public void mousePressed(MouseEvent e) {
210
        if (e.getButton() == MouseEvent.BUTTON1) {
211
        	layout.getLayoutControl().setPointAnt();
212
            layout.getLayoutControl().setFirstPoint();
213
        	try {
214
    			layout.getLayoutControl().getCurrentLayoutTool().mousePressed(e);
215
    		} catch (BehaviorException t) {
216
    			throwException(t);
217
    		}
218
    	} else
219
    		if (e.getButton() == MouseEvent.BUTTON3) {
220
    			FPopupMenu popmenu = new FPopupMenu(layout);
221
				layout.add(popmenu);
222
				popmenu.show(e.getComponent(), e.getX(), e.getY());
223
    		}
224
    }
225

  
226
    /**
227
     * @see java.awt.event.MouseListener#mouseReleassed(java.awt.event.MouseEvent)
228
     */
229
    public void mouseReleased(MouseEvent e) {
230
        if (e.getButton() != MouseEvent.BUTTON3) {
231
            layout.getLayoutControl().setLastPoint();
232
        }
233

  
234
        if (e.getButton() == MouseEvent.BUTTON1) {
235
        	try {
236
    			layout.getLayoutControl().getCurrentLayoutTool().mouseReleased(e);
237
    		} catch (BehaviorException t) {
238
    			throwException(t);
239
    		}
240
            layout.getLayoutControl().setCancelDrawing(false);
241
        } else if (e.getButton() == MouseEvent.BUTTON3) {
242
        }
243

  
244

  
245
    }
246
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/FLayoutGraphics.java
1
/*
2
 * Created on 27-jul-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package org.gvsig.app.project.documents.layout;
46

  
47
import java.awt.geom.Rectangle2D;
48
import java.util.ArrayList;
49

  
50
import org.slf4j.Logger;
51
import org.slf4j.LoggerFactory;
52

  
53
import org.gvsig.andami.PluginServices;
54
import org.gvsig.app.project.ProjectManager;
55
import org.gvsig.app.project.documents.layout.fframes.FFrameGroup;
56
import org.gvsig.app.project.documents.layout.fframes.FFrameLegend;
57
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
58
import org.gvsig.app.project.documents.layout.fframes.IFFrameUseFMap;
59
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog;
60
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
61
import org.gvsig.app.project.documents.layout.gui.dialogs.FAlignDialog;
62
import org.gvsig.app.project.documents.layout.gui.dialogs.FBorderDialog;
63
import org.gvsig.app.project.documents.layout.gui.dialogs.FPositionDialog;
64

  
65

  
66

  
67
/**
68
 * Operaciones realizadas sobre el conjunto de FFrames.
69
 *
70
 * @author Vicente Caballero Navarro
71
 */
72
public class FLayoutGraphics {
73
    protected static final Logger LOG = LoggerFactory.getLogger(FLayoutGraphics.class);
74
    private LayoutPanel layout;
75
	private FAlignDialog m_alignLayout = null;
76
	private FBorderDialog borderdialog = null;
77
	private FPositionDialog positiondialog = null;
78
	private LayoutManager layoutManager = null;
79

  
80
	/**
81
	 * Crea un nuevo FLayoutGraphics.
82
	 *
83
	 * @param l Referencia al Layout.
84
	 */
85
	public FLayoutGraphics(LayoutPanel layoutPanel) {
86
		layout = layoutPanel;
87
		layoutManager = (LayoutManager)ProjectManager.getInstance().getDocumentManager(DefaultLayoutManager.TYPENAME);
88
	}
89

  
90
	/**
91
	 * Transforma un FFrameLegend a FFrames de tipo FFrameSymbol y FFrameText.
92
	 */
93
	public void simplify() {
94
		layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"simplify"));
95
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
96
		for (int i = fframes.length - 1; i >= 0; i--) {
97
			IFFrame fframe = fframes[i];
98

  
99
			if (fframe instanceof FFrameLegend) {
100
				if (fframe.getSelected() != IFFrame.NOSELECT) {
101
					((FFrameLegend) fframe).toFFrames(layout.getLayoutContext());
102
				}
103
			}
104
		}
105
		layout.getLayoutContext().getFrameCommandsRecord().endComplex();
106
		layout.getLayoutControl().refresh();
107
	}
108

  
109
	/**
110
	 * Agrupar en un FFrameGroup todos los FFrames seleccionados.
111
	 */
112
	public void grouping() {
113
		//		Se debe controlar de alguna forma si hay varios seleccionados.
114
		FFrameGroup fframegroup =(FFrameGroup)layoutManager.createFrame(FFrameGroup.PERSISTENCE_DEFINITION_NAME);
115

  
116
//		fframegroup.setLayout(layout);
117
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
118
		if (fframes.length > 1) {
119
			ArrayList selecList = new ArrayList();
120

  
121
			for (int i = fframes.length - 1; i >= 0; i--) {
122
				IFFrame fframe = fframes[i];
123

  
124
				if (fframe.getSelected() != IFFrame.NOSELECT) {
125
					selecList.add(fframe);
126
					layout.getLayoutContext().delFFrame(fframe);
127
				}
128
			}
129

  
130
			for (int i = selecList.size() - 1; i >= 0; i--) {
131
				fframegroup.addFFrame((IFFrame) selecList.get(i));
132
			}
133

  
134
			fframegroup.setAt(layout.getLayoutControl().getAT());
135

  
136
			Rectangle2D.Double rd = fframegroup.getRectangle(layout.getLayoutControl().getAT());
137

  
138
			Rectangle2D.Double rd1 = FLayoutUtilities.toSheetRect(rd,
139
					layout.getLayoutControl().getAT());
140

  
141
			fframegroup.setBoundBox(rd1);
142
			fframegroup.setSelected(true);
143
			layout.getLayoutContext().addFFrame(fframegroup, true,true);
144
			layout.getLayoutControl().refresh();
145
		}
146
	}
147

  
148
	/**
149
	 * Desagrupar los FFrames que estan contenidos dentro del FFrameGroup en
150
	 * FFrames individuales.
151
	 */
152
	public void ungrouping() {
153
		layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"ungroup"));
154
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
155
		for (int i = fframes.length - 1; i >= 0; i--) {
156
			IFFrame fframe = fframes[i];
157

  
158
			if (fframe.getSelected() != IFFrame.NOSELECT) {
159
				if (fframe instanceof FFrameGroup) {
160
					FFrameGroup fframegroup = (FFrameGroup) fframe;
161
					ArrayList selecList = new ArrayList();
162

  
163
					for (int j = fframegroup.getFFrames().length - 1; j >= 0;
164
							j--) {
165
						selecList.add(fframegroup.getFFrames()[j]);
166
					}
167

  
168
					for (int j = selecList.size() - 1; j >= 0; j--) {
169
						IFFrame frame=(IFFrame) selecList.get(j);
170
						frame.setRotation(frame.getRotation()+fframe.getRotation());
171
						layout.getLayoutContext().addFFrameSameProperties(frame);
172
					}
173
					layout.getLayoutContext().delFFrame(fframegroup);
174
				}
175
			}
176
		}
177
		layout.getLayoutContext().getFrameCommandsRecord().endComplex();
178
		layout.getLayoutControl().refresh();
179
	}
180

  
181
	/**
182
	 * Abre el di?logo para alinear los FFrames.
183
	 */
184
	public void aligning() {
185
		m_alignLayout = new FAlignDialog(layout);
186
		PluginServices.getMDIManager().addWindow(m_alignLayout);
187
	}
188
	/**
189
	 * Posiciona los FFrames seleccionados delante de los no seleccionados.
190
	 */
191
	public void before() {
192
		layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"change_before"));
193
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
194
		for (int i = fframes.length - 1; i >= 0; i--) {
195
			IFFrame fframe = fframes[i];
196
			if (fframe.getSelected() != IFFrame.NOSELECT) {
197
				if (fframe instanceof FFrameGroup) {
198
					((FFrameGroup) fframe).setAt(layout.getLayoutControl().getAT());
199
				}
200

  
201
				IFFrame fframeAux;
202
                try {
203
                    fframeAux = (IFFrame)fframe.clone();
204
                    fframeAux.setLevel(layout.getLayoutContext().getNumBefore());
205
                    layout.getLayoutContext().getFrameCommandsRecord().update(fframe,fframeAux);
206
                    fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
207
                } catch (CloneNotSupportedException e) {
208
                    LOG.error("It is not possible clonate the object", e);
209
                }				
210
			}
211
		}
212
		layout.getLayoutContext().getFrameCommandsRecord().endComplex();
213
		layout.getLayoutContext().updateFFrames();
214
		layout.getLayoutControl().refresh();
215
	}
216

  
217
	/**
218
	 * Posiciona los FFrames seleccionados detr?s de los FFrames no
219
	 * seleccionados.
220
	 */
221
	public void behind() {
222
		layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"change_behind"));
223
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
224
		for (int i = fframes.length - 1; i >= 0; i--) {
225
			IFFrame fframe = fframes[i];
226
			if (fframe.getSelected() != IFFrame.NOSELECT) {
227
				if (fframe instanceof FFrameGroup) {
228
					((FFrameGroup) fframe).setAt(layout.getLayoutControl().getAT());
229
				}
230

  
231
				IFFrame fframeAux;
232
                try {                    
233
                    fframeAux = (IFFrame)fframe.clone();
234
                    fframeAux.setLevel(layout.getLayoutContext().getNumBehind());
235
                    layout.getLayoutContext().getFrameCommandsRecord().update(fframe,fframeAux);
236
                    fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
237
                } catch (CloneNotSupportedException e) {
238
                    LOG.error("It is not possible clonate the object", e);
239
                }				
240
			}
241
		}
242
		layout.getLayoutContext().getFrameCommandsRecord().endComplex();
243
		layout.getLayoutContext().updateFFrames();
244
		layout.getLayoutControl().refresh();
245
	}
246

  
247
	/**
248
	 * Abre el di?logo adecuadao a las propiedades del FFrame seleccionado,
249
	 * ahora mismo solo se abre cuando hay un solo FFrame seleccionado.
250
	 */
251
	public boolean openFFrameDialog() {
252
		IFFrame[] selecList = layout.getLayoutContext().getFFrameSelected();
253

  
254
		if (selecList.length == 1) {
255
			IFFrame frame=selecList[0];
256
//			int toolaux = layout.getTool();
257
//			layout.setTool(getType(frame));
258
//			IFFrame fframeAux=frame.cloneFFrame(layout);
259
			IFFrameDialog fframeDialog = layout.createFFrameDialog(frame);
260
			 IFFrame fframeAux = null;
261
			if (fframeDialog != null) {
262
			    PluginServices.getMDIManager().addWindow(fframeDialog);
263
			    fframeAux = fframeDialog.getFFrame();
264
				if (fframeAux instanceof IFFrameUseFMap)
265
					((IFFrameUseFMap)fframeAux).refresh();				
266
				layout.getLayoutContext().getFrameCommandsRecord().update(frame,fframeAux);
267
				fframeAux.getBoundingBox(layout.getLayoutControl().getAT());
268
				layout.getLayoutContext().updateFFrames();
269
				layout.getLayoutControl().setIsReSel(true);
270
				layout.getLayoutControl().refresh();
271
			}
272
//			layout.setTool(toolaux);
273
			if (fframeAux!=null)
274
				return true;
275
		}
276
		return false;
277
	}
278

  
279
	/**
280
	 * Selecci?n de todos los FFrames del Layout.
281
	 */
282
	public void selecAll() {
283
		IFFrame[] fframes=layout.getLayoutContext().getFFrames();
284
		for (int i = fframes.length - 1; i >= 0; i--) {
285
			IFFrame fframe =fframes[i];
286
			fframe.setSelected(true);
287
		}
288
		layout.getLayoutControl().refresh();
289
	}
290

  
291
	/**
292
	 * Abre el di?logo para a?adir un borde a los fframes.
293
	 */
294
	public boolean border() {
295
		borderdialog = new FBorderDialog(layout);
296
		PluginServices.getMDIManager().addWindow(borderdialog);
297
		return borderdialog.isAccepted();
298
	}
299

  
300
	/**
301
	 * Abre el di?logo de cambio de posici?n y tama?o del FFrame.
302
	 */
303
	public void position() {
304

  
305
		IFFrame[] fframes=layout.getLayoutContext().getFFrameSelected();
306
		if (fframes.length!=0){
307
			for (int i=0;i<fframes.length;i++){
308
				positiondialog = new FPositionDialog(layout,fframes[i]);
309
				PluginServices.getMDIManager().addWindow(positiondialog);
310
			}
311
		}
312
	}
313
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/LayoutManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 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
package org.gvsig.app.project.documents.layout;
23

  
24
import java.awt.geom.AffineTransform;
25

  
26
import org.gvsig.app.project.documents.DocumentManager;
27
import org.gvsig.app.project.documents.layout.fframes.IFFrame;
28
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog;
29
import org.gvsig.app.project.documents.layout.gui.LayoutPanel;
30

  
31
/**
32
 * @author gvSIG Team
33
 * @version $Id$
34
 *
35
 */
36
public interface LayoutManager extends DocumentManager {
37

  
38
    public static String TEMPLATE_FILE_EXTENSION = ".gvsLayoutTemp";
39

  
40
    public IFFrame createFrame(String frameName);
41

  
42
    public IFFrameDialog createFFrameDialog(IFFrame fframe, LayoutPanel layoutPanel, AffineTransform affineTransform);
43

  
44
    public IFFrameDialog createFFrameDialog(IFFrame fframe, LayoutPanel layoutPanel);
45
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/Size.java
1
/*
2
 * Created on 19-may-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
10
 * modify it under the terms of the GNU General Public License
11
 * as published by the Free Software Foundation; either version 2
12
 * of the License, or (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
22
 *
23
 * For more information, contact:
24
 *
25
 *  Generalitat Valenciana
26
 *   Conselleria d'Infraestructures i Transport
27
 *   Av. Blasco Ib??ez, 50
28
 *   46010 VALENCIA
29
 *   SPAIN
30
 *
31
 *      +34 963862235
32
 *   gvsig@gva.es
33
 *      www.gvsig.gva.es
34
 *
35
 *    or
36
 *
37
 *   IVER T.I. S.A
38
 *   Salamanca 50
39
 *   46005 Valencia
40
 *   Spain
41
 *
42
 *   +34 963163400
43
 *   dac@iver.es
44
 */
45
package org.gvsig.app.project.documents.layout;
46

  
47
import org.gvsig.tools.ToolsLocator;
48
import org.gvsig.tools.dynobject.DynStruct;
49
import org.gvsig.tools.persistence.PersistenceManager;
50
import org.gvsig.tools.persistence.Persistent;
51
import org.gvsig.tools.persistence.PersistentState;
52
import org.gvsig.tools.persistence.exception.PersistenceException;
53

  
54
/**
55
 * Clase que almacena la altura y anchura de un folio.
56
 *
57
 * @author Vicente Caballero Navarro
58
 */
59
public class Size implements Persistent {
60
	public static final String PERSISTENCE_DEFINITION_NAME = "Size";
61
	private static final String HEIGHT_FIELD = "height";
62
	private static final String WIDTH_FIELD = "width";
63
	
64
	private double alto;
65
	private double ancho;
66

  
67
	public Size() {
68
       
69
    }
70
	
71
	/**
72
	 * Creates a new Size object.
73
	 *
74
	 * @param al Altura
75
	 * @param an Anchura
76
	 */
77
	public Size(double al, double an) {
78
		alto = al;
79
		ancho = an;
80
	}
81

  
82
	/**
83
	 * Devuelve el alto del folio.
84
	 *
85
	 * @return altura.
86
	 */
87
	public double getAlto() {
88
		return alto;
89
	}
90

  
91
	/**
92
	 * Devuelve la anchura del folio.
93
	 *
94
	 * @return Anchura.
95
	 */
96
	public double getAncho() {
97
		return ancho;
98
	}
99

  
100
	public static void registerPersistent() {
101
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
102
		if( manager.getDefinition(PERSISTENCE_DEFINITION_NAME)==null ) {
103
			DynStruct definition = manager.addDefinition(
104
					Size.class,
105
					PERSISTENCE_DEFINITION_NAME,
106
					"Size persistence definition",
107
					null, 
108
					null
109
			); 	
110
			
111
			definition.addDynFieldDouble(HEIGHT_FIELD).setMandatory(true);
112
			definition.addDynFieldDouble(WIDTH_FIELD).setMandatory(true);
113
		}
114
	}
115

  
116
	public void loadFromState(PersistentState state)
117
			throws PersistenceException {
118
		alto = state.getDouble(HEIGHT_FIELD);
119
		ancho = state.getDouble(WIDTH_FIELD);
120
	}
121

  
122
	public void saveToState(PersistentState state) throws PersistenceException {
123
		state.set(HEIGHT_FIELD, alto);
124
		state.set(WIDTH_FIELD, ancho);
125
	}
126
}
branches/v2_0_0_prep/applications/appgvSIG/src/org/gvsig/app/project/documents/layout/FLayoutZooms.java
1
/*
2
 * Created on 17-sep-2004
3
 *
4
 */
5
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
6
 *
7
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
8
 *
9
 * This program is free software; you can redistribute it and/or
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff