Statistics
| Revision:

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

History | View | Annotate | Download (3.52 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.gui.layout.Layout;
55
import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics;
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.getEFS().startComplexCommand();
77
                        lg.grouping();
78
                        layout.getEFS().endComplexCommand(PluginServices.getText(this,"group"));
79
                } else if (s.compareTo("DESAGRUPAR") == 0) {
80
                        lg.ungrouping();
81
                } else if (s.compareTo("PROPIEDADES") == 0) {
82
                        lg.openFFrameDialog();
83
                } else if (s.compareTo("ALINEAR") == 0) {
84
                        lg.aligning();
85
                } else if (s.compareTo("DETRAS") == 0) {
86
                        lg.behind();
87
                } else if (s.compareTo("DELANTE") == 0) {
88
                        lg.before();
89
                } else if (s.compareTo("BORDEAR") == 0) {
90
                        lg.border();
91
                } else if (s.compareTo("POSICIONAR") == 0) {
92
                        lg.position();
93
                }
94
        }
95

    
96
        /**
97
         * @see com.iver.mdiApp.plugins.IExtension#isVisible()
98
         */
99
        public boolean isVisible() {
100
                IWindow f = PluginServices.getMDIManager().getActiveWindow();
101

    
102
                if (f == null) {
103
                        return false;
104
                }
105

    
106
                if (f instanceof Layout) {
107
                        return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
108
                } else {
109
                        return false;
110
                }
111
        }
112

    
113
        /**
114
         * @see com.iver.andami.plugins.IExtension#initialize()
115
         */
116
        public void initialize() {
117
        }
118

    
119
        /**
120
         * @see com.iver.andami.plugins.IExtension#isEnabled()
121
         */
122
        public boolean isEnabled() {
123
                layout = (Layout) PluginServices.getMDIManager().getActiveWindow();
124
                if (!layout.isEditable())
125
                        return false;
126
                return true;
127
        }
128
}