Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutGraphicControls.java @ 11018

History | View | Annotate | Download (3.92 KB)

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

    
49
import org.apache.log4j.Logger;
50

    
51
import com.iver.andami.PluginServices;
52
import com.iver.andami.plugins.Extension;
53
import com.iver.andami.ui.mdiManager.IWindow;
54
import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics;
55
import com.iver.cit.gvsig.project.documents.layout.gui.Layout;
56

    
57

    
58
/**
59
 * Extensi?n que actua sobre el Layout para controlas las diferentes
60
 * operaciones sobre los gr?ficos.
61
 *
62
 * @author Vicente Caballero Navarro
63
 */
64
public class LayoutGraphicControls extends Extension {
65
        private static Logger logger = Logger.getLogger(LayoutGraphicControls.class.getName());
66
        private Layout layout =null;
67
        /**
68
         * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
69
         */
70
        public void execute(String s) {
71
                layout = (Layout) PluginServices.getMDIManager().getActiveWindow();
72
                FLayoutGraphics lg = new FLayoutGraphics(layout);
73
                logger.debug("Comand : " + s);
74

    
75
                if (s.compareTo("AGRUPAR") == 0) {
76
                        layout.getLayoutContext().getEFS().startComplexCommand();
77
                        lg.grouping();
78
                        layout.getLayoutContext().getEFS().endComplexCommand(PluginServices.getText(this,"group"));
79
                        layout.getModel().setModified(true);
80
                } else if (s.compareTo("DESAGRUPAR") == 0) {
81
                        lg.ungrouping();
82
                        layout.getModel().setModified(true);
83
                } else if (s.compareTo("PROPIEDADES") == 0) {
84
                        if (lg.openFFrameDialog()) {
85
                                layout.getModel().setModified(true);
86
                        }
87
                } else if (s.compareTo("ALINEAR") == 0) {
88
                        lg.aligning();
89
                        layout.getModel().setModified(true);
90
                } else if (s.compareTo("DETRAS") == 0) {
91
                        lg.behind();
92
                        layout.getModel().setModified(true);
93
                } else if (s.compareTo("DELANTE") == 0) {
94
                        lg.before();
95
                        layout.getModel().setModified(true);
96
                } else if (s.compareTo("BORDEAR") == 0) {
97
                        if (lg.border()) {
98
                                layout.getModel().setModified(true);
99
                        }
100
                } else if (s.compareTo("POSICIONAR") == 0) {
101
                        lg.position();
102
                        layout.getModel().setModified(true);
103
                }
104
        }
105

    
106
        /**
107
         * @see com.iver.mdiApp.plugins.IExtension#isVisible()
108
         */
109
        public boolean isVisible() {
110
                IWindow f = PluginServices.getMDIManager().getActiveWindow();
111

    
112
                if (f == null) {
113
                        return false;
114
                }
115

    
116
                if (f instanceof Layout) {
117
                        return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
118
                }
119
                return false;
120
        }
121

    
122
        /**
123
         * @see com.iver.andami.plugins.IExtension#initialize()
124
         */
125
        public void initialize() {
126
        }
127

    
128
        /**
129
         * @see com.iver.andami.plugins.IExtension#isEnabled()
130
         */
131
        public boolean isEnabled() {
132
                layout = (Layout) PluginServices.getMDIManager().getActiveWindow();
133
                if (!layout.getLayoutContext().isEditable())
134
                        return false;
135
                return true;
136
        }
137
}