svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LinkControls.java @ 8254
History | View | Annotate | Download (3.67 KB)
1 | 312 | fernando | /*
|
---|---|---|---|
2 | * Created on 01-jun-2004
|
||
3 | *
|
||
4 | * To change the template for this generated file go to
|
||
5 | * Window>Preferences>Java>Code Generation>Code and Comments
|
||
6 | */
|
||
7 | 1103 | fjp | /* 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 | 312 | fernando | package com.iver.cit.gvsig; |
48 | |||
49 | 5005 | jorpiell | import org.apache.log4j.Logger; |
50 | |||
51 | 596 | fernando | import com.iver.andami.PluginServices; |
52 | import com.iver.andami.plugins.Extension; |
||
53 | 6878 | cesar | import com.iver.cit.gvsig.fmap.MapContext; |
54 | 1223 | fernando | import com.iver.cit.gvsig.fmap.MapControl; |
55 | 312 | fernando | import com.iver.cit.gvsig.fmap.layers.FLayer; |
56 | 2508 | nacho | import com.iver.cit.gvsig.fmap.layers.FLyrRaster; |
57 | 7392 | sbayarri | import com.iver.cit.gvsig.project.documents.view.IProjectView; |
58 | 7304 | caballero | import com.iver.cit.gvsig.project.documents.view.gui.View; |
59 | 312 | fernando | |
60 | |||
61 | /**
|
||
62 | 775 | vcaballero | * Extensi?n para gestionar los hiperlinks.
|
63 | 312 | fernando | *
|
64 | * @author Vicente Caballero Navarro
|
||
65 | */
|
||
66 | 5005 | jorpiell | public class LinkControls extends Extension { |
67 | 1219 | vcaballero | private static Logger logger = Logger.getLogger(LinkControls.class.getName()); |
68 | 312 | fernando | |
69 | 1219 | vcaballero | /**
|
70 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
|
71 | 1219 | vcaballero | */
|
72 | public void execute(String s) { |
||
73 | 6880 | cesar | View vista = (View) PluginServices.getMDIManager().getActiveWindow(); |
74 | 2429 | caballero | //ProjectView model = vista.getModel();
|
75 | //FMap mapa = model.getMapContext();
|
||
76 | 1223 | fernando | MapControl mapCtrl = vista.getMapControl(); |
77 | 1219 | vcaballero | logger.debug("Comand : " + s);
|
78 | 312 | fernando | |
79 | 1219 | vcaballero | if (s.compareTo("LINK") == 0) { |
80 | mapCtrl.setTool("link");
|
||
81 | } |
||
82 | } |
||
83 | 312 | fernando | |
84 | 1219 | vcaballero | /**
|
85 | 5005 | jorpiell | * @see com.iver.mdiApp.plugins.IExtension#isVisible()
|
86 | 1219 | vcaballero | */
|
87 | public boolean isVisible() { |
||
88 | 6877 | cesar | com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager() |
89 | 6880 | cesar | .getActiveWindow(); |
90 | 5742 | caballero | |
91 | 1219 | vcaballero | if (f == null) { |
92 | return false; |
||
93 | } |
||
94 | 312 | fernando | |
95 | 5900 | jorpiell | if (f instanceof View) { |
96 | 312 | fernando | |
97 | 6878 | cesar | MapContext mapa = ((View) f).getModel().getMapContext();
|
98 | 2508 | nacho | |
99 | return mapa.getLayers().getLayersCount() > 0; |
||
100 | 1219 | vcaballero | } else {
|
101 | return false; |
||
102 | } |
||
103 | } |
||
104 | 312 | fernando | |
105 | 1219 | vcaballero | /**
|
106 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#isEnabled()
|
107 | 1219 | vcaballero | */
|
108 | public boolean isEnabled() { |
||
109 | 6880 | cesar | View f = (View) PluginServices.getMDIManager().getActiveWindow(); |
110 | 312 | fernando | |
111 | 1219 | vcaballero | if (f == null) { |
112 | return false; |
||
113 | } |
||
114 | 596 | fernando | |
115 | 7304 | caballero | if (f instanceof com.iver.cit.gvsig.project.documents.view.gui.View) { |
116 | com.iver.cit.gvsig.project.documents.view.gui.View view = (com.iver.cit.gvsig.project.documents.view.gui.View) f; |
||
117 | 7392 | sbayarri | IProjectView model = view.getModel(); |
118 | 5742 | caballero | if (model.getSelectedField()==null) |
119 | return false; |
||
120 | 2508 | nacho | FLayer[] activas = model.getMapContext().getLayers().getActives();
|
121 | for(int i=0;i<activas.length;i++){ |
||
122 | 6778 | jmvivo | if(activas[i] instanceof FLyrRaster) { |
123 | 2508 | nacho | return false; |
124 | 6778 | jmvivo | } else if (!activas[i].isAvailable()) { |
125 | return false; |
||
126 | } |
||
127 | 2508 | nacho | } |
128 | } |
||
129 | 6778 | jmvivo | return true; |
130 | 1219 | vcaballero | } |
131 | |||
132 | 596 | fernando | /**
|
133 | 5005 | jorpiell | * @see com.iver.andami.plugins.IExtension#initialize()
|
134 | 596 | fernando | */
|
135 | 5005 | jorpiell | public void initialize() { |
136 | 596 | fernando | } |
137 | 312 | fernando | } |