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 | 6393 | caballero | /*
|
---|---|---|---|
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 | 28033 | cordinyana | import org.slf4j.Logger; |
50 | import org.slf4j.LoggerFactory; |
||
51 | 6393 | caballero | |
52 | import com.iver.andami.PluginServices; |
||
53 | import com.iver.andami.plugins.Extension; |
||
54 | 6877 | cesar | import com.iver.andami.ui.mdiManager.IWindow; |
55 | 7304 | caballero | import com.iver.cit.gvsig.project.documents.layout.FLayoutGraphics; |
56 | 9392 | caballero | import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
57 | 6393 | caballero | |
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 | 28033 | cordinyana | private static final Logger logger = LoggerFactory |
67 | .getLogger(LayoutGraphicControls.class); |
||
68 | 6393 | caballero | private Layout layout =null; |
69 | /**
|
||
70 | * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
||
71 | */
|
||
72 | public void execute(String s) { |
||
73 | 6880 | cesar | layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
74 | 6393 | caballero | FLayoutGraphics lg = new FLayoutGraphics(layout);
|
75 | logger.debug("Comand : " + s);
|
||
76 | |||
77 | 6469 | caballero | if (s.compareTo("AGRUPAR") == 0) { |
78 | 24962 | vcaballero | layout.getLayoutContext().getFrameCommandsRecord().startComplex(PluginServices.getText(this,"group")); |
79 | 6393 | caballero | lg.grouping(); |
80 | 24962 | vcaballero | layout.getLayoutContext().getFrameCommandsRecord().endComplex(); |
81 | 9532 | caballero | layout.getModel().setModified(true);
|
82 | 6393 | caballero | } else if (s.compareTo("DESAGRUPAR") == 0) { |
83 | lg.ungrouping(); |
||
84 | 9532 | caballero | layout.getModel().setModified(true);
|
85 | 6393 | caballero | } else if (s.compareTo("PROPIEDADES") == 0) { |
86 | 9532 | caballero | if (lg.openFFrameDialog()) {
|
87 | layout.getModel().setModified(true);
|
||
88 | } |
||
89 | 6393 | caballero | } else if (s.compareTo("ALINEAR") == 0) { |
90 | lg.aligning(); |
||
91 | 9532 | caballero | layout.getModel().setModified(true);
|
92 | 6393 | caballero | } else if (s.compareTo("DETRAS") == 0) { |
93 | lg.behind(); |
||
94 | 9532 | caballero | layout.getModel().setModified(true);
|
95 | 6393 | caballero | } else if (s.compareTo("DELANTE") == 0) { |
96 | lg.before(); |
||
97 | 9532 | caballero | layout.getModel().setModified(true);
|
98 | 6393 | caballero | } else if (s.compareTo("BORDEAR") == 0) { |
99 | 9532 | caballero | if (lg.border()) {
|
100 | layout.getModel().setModified(true);
|
||
101 | } |
||
102 | 6393 | caballero | } else if (s.compareTo("POSICIONAR") == 0) { |
103 | lg.position(); |
||
104 | 9532 | caballero | layout.getModel().setModified(true);
|
105 | 6393 | caballero | } |
106 | } |
||
107 | |||
108 | /**
|
||
109 | * @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
||
110 | */
|
||
111 | public boolean isVisible() { |
||
112 | 6880 | cesar | IWindow f = PluginServices.getMDIManager().getActiveWindow(); |
113 | 6393 | caballero | |
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 | 9532 | caballero | return false; |
122 | 6393 | caballero | } |
123 | |||
124 | /**
|
||
125 | * @see com.iver.andami.plugins.IExtension#initialize()
|
||
126 | */
|
||
127 | public void initialize() { |
||
128 | 14821 | jmvivo | registerIcons(); |
129 | 6393 | caballero | } |
130 | |||
131 | 14821 | jmvivo | private void registerIcons(){ |
132 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
133 | 14821 | jmvivo | "layout-group",
|
134 | this.getClass().getClassLoader().getResource("images/agrupar.png") |
||
135 | ); |
||
136 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
137 | 14821 | jmvivo | "layout-ungroup",
|
138 | this.getClass().getClassLoader().getResource("images/desagrupar.png") |
||
139 | ); |
||
140 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
141 | 14821 | jmvivo | "layout-bring-to-front",
|
142 | this.getClass().getClassLoader().getResource("images/delante.png") |
||
143 | ); |
||
144 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
145 | 14821 | jmvivo | "layout-send-to-back",
|
146 | this.getClass().getClassLoader().getResource("images/detras.png") |
||
147 | ); |
||
148 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
149 | 14821 | jmvivo | "layout-set-size-position",
|
150 | this.getClass().getClassLoader().getResource("images/posicionar.png") |
||
151 | ); |
||
152 | 15647 | jmvivo | PluginServices.getIconTheme().registerDefault( |
153 | 14821 | jmvivo | "layout-add-border",
|
154 | this.getClass().getClassLoader().getResource("images/bordear.png") |
||
155 | ); |
||
156 | } |
||
157 | |||
158 | 6393 | caballero | /**
|
159 | * @see com.iver.andami.plugins.IExtension#isEnabled()
|
||
160 | */
|
||
161 | public boolean isEnabled() { |
||
162 | 6880 | cesar | layout = (Layout) PluginServices.getMDIManager().getActiveWindow(); |
163 | 9392 | caballero | if (!layout.getLayoutContext().isEditable())
|
164 | 6393 | caballero | return false; |
165 | return true; |
||
166 | } |
||
167 | } |