svn-gvsig-desktop / branches / v2_0_0_prep / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutGraphicControls.java @ 28546
History | View | Annotate | Download (4.93 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.slf4j.Logger; |
50 |
import org.slf4j.LoggerFactory; |
51 |
|
52 |
import com.iver.andami.PluginServices; |
53 |
import com.iver.andami.plugins.Extension; |
54 |
import com.iver.andami.ui.mdiManager.IWindow; |
55 |
import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics; |
56 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
57 |
|
58 |
|
59 |
/**
|
60 |
* Extensi?n que actua sobre el Layout para controlas las diferentes
|
61 |
* operaciones sobre los gr?ficos.
|
62 |
*
|
63 |
* @author Vicente Caballero Navarro
|
64 |
*/
|
65 |
public class LayoutGraphicControls extends Extension { |
66 |
private static final Logger logger = LoggerFactory |
67 |
.getLogger(LayoutGraphicControls.class); |
68 |
private Layout layout =null; |
69 |
/**
|
70 |
* @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
71 |
*/
|
72 |
public void execute(String s) { |
73 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
74 |
FLayoutGraphics lg = new FLayoutGraphics(layout);
|
75 |
logger.debug("Comand : " + s);
|
76 |
|
77 |
if (s.compareTo("AGRUPAR") == 0) { |
78 |
layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"group")); |
79 |
lg.grouping(); |
80 |
layout.getLayoutContext().getFrameCommandsRecord().endComplex(); |
81 |
layout.getModel().setModified(true);
|
82 |
} else if (s.compareTo("DESAGRUPAR") == 0) { |
83 |
lg.ungrouping(); |
84 |
layout.getModel().setModified(true);
|
85 |
} else if (s.compareTo("PROPIEDADES") == 0) { |
86 |
if (lg.openFFrameDialog()) {
|
87 |
layout.getModel().setModified(true);
|
88 |
} |
89 |
} else if (s.compareTo("ALINEAR") == 0) { |
90 |
lg.aligning(); |
91 |
layout.getModel().setModified(true);
|
92 |
} else if (s.compareTo("DETRAS") == 0) { |
93 |
lg.behind(); |
94 |
layout.getModel().setModified(true);
|
95 |
} else if (s.compareTo("DELANTE") == 0) { |
96 |
lg.before(); |
97 |
layout.getModel().setModified(true);
|
98 |
} else if (s.compareTo("BORDEAR") == 0) { |
99 |
if (lg.border()) {
|
100 |
layout.getModel().setModified(true);
|
101 |
} |
102 |
} else if (s.compareTo("POSICIONAR") == 0) { |
103 |
lg.position(); |
104 |
layout.getModel().setModified(true);
|
105 |
} |
106 |
} |
107 |
|
108 |
/**
|
109 |
* @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
110 |
*/
|
111 |
public boolean isVisible() { |
112 |
IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
113 |
|
114 |
if (f == null) { |
115 |
return false; |
116 |
} |
117 |
|
118 |
if (f instanceof Layout) { |
119 |
return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0; |
120 |
} |
121 |
return false; |
122 |
} |
123 |
|
124 |
/**
|
125 |
* @see com.iver.andami.plugins.IExtension#initialize()
|
126 |
*/
|
127 |
public void initialize() { |
128 |
registerIcons(); |
129 |
} |
130 |
|
131 |
private void registerIcons(){ |
132 |
PluginServices.getIconTheme().registerDefault( |
133 |
"layout-group",
|
134 |
this.getClass().getClassLoader().getResource("images/agrupar.png") |
135 |
); |
136 |
PluginServices.getIconTheme().registerDefault( |
137 |
"layout-ungroup",
|
138 |
this.getClass().getClassLoader().getResource("images/desagrupar.png") |
139 |
); |
140 |
PluginServices.getIconTheme().registerDefault( |
141 |
"layout-bring-to-front",
|
142 |
this.getClass().getClassLoader().getResource("images/delante.png") |
143 |
); |
144 |
PluginServices.getIconTheme().registerDefault( |
145 |
"layout-send-to-back",
|
146 |
this.getClass().getClassLoader().getResource("images/detras.png") |
147 |
); |
148 |
PluginServices.getIconTheme().registerDefault( |
149 |
"layout-set-size-position",
|
150 |
this.getClass().getClassLoader().getResource("images/posicionar.png") |
151 |
); |
152 |
PluginServices.getIconTheme().registerDefault( |
153 |
"layout-add-border",
|
154 |
this.getClass().getClassLoader().getResource("images/bordear.png") |
155 |
); |
156 |
} |
157 |
|
158 |
/**
|
159 |
* @see com.iver.andami.plugins.IExtension#isEnabled()
|
160 |
*/
|
161 |
public boolean isEnabled() { |
162 |
layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
163 |
if (!layout.getLayoutContext().isEditable())
|
164 |
return false; |
165 |
return true; |
166 |
} |
167 |
} |