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