Revision 1219 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/LinkControls.java
LinkControls.java | ||
---|---|---|
46 | 46 |
*/ |
47 | 47 |
package com.iver.cit.gvsig; |
48 | 48 |
|
49 |
import org.apache.log4j.Logger; |
|
50 |
|
|
51 | 49 |
import com.iver.andami.PluginServices; |
52 | 50 |
import com.iver.andami.plugins.Extension; |
51 |
|
|
53 | 52 |
import com.iver.cit.gvsig.fmap.FMap; |
54 | 53 |
import com.iver.cit.gvsig.fmap.NewMapControl; |
55 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
56 | 55 |
import com.iver.cit.gvsig.gui.View; |
57 | 56 |
import com.iver.cit.gvsig.project.castor.ProjectView; |
58 | 57 |
|
58 |
import org.apache.log4j.Logger; |
|
59 | 59 |
|
60 |
|
|
60 | 61 |
/** |
61 | 62 |
* Extensi?n para gestionar los hiperlinks. |
62 | 63 |
* |
63 | 64 |
* @author Vicente Caballero Navarro |
64 | 65 |
*/ |
65 | 66 |
public class LinkControls implements Extension { |
66 |
private static Logger logger = Logger.getLogger(ViewControls.class.getName());
|
|
67 |
private static Logger logger = Logger.getLogger(LinkControls.class.getName());
|
|
67 | 68 |
|
68 |
/** |
|
69 |
* DOCUMENT ME! |
|
70 |
* |
|
71 |
* @param status DOCUMENT ME! |
|
72 |
* @param s DOCUMENT ME! |
|
73 |
*/ |
|
74 |
public void execute(String s) { |
|
75 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
76 |
ProjectView model=vista.getModel(); |
|
77 |
FMap mapa = model.getMapContext(); |
|
78 |
NewMapControl mapCtrl = vista.getMapControl(); |
|
79 |
logger.debug("Comand : " + s); |
|
80 |
if (s.compareTo("LINK") == 0) { |
|
81 |
mapCtrl.setTool("link"); |
|
82 |
} |
|
83 |
} |
|
69 |
/** |
|
70 |
* @see com.iver.andami.plugins.Extension#execute(java.lang.String) |
|
71 |
*/ |
|
72 |
public void execute(String s) { |
|
73 |
View vista = (View) PluginServices.getMDIManager().getActiveView(); |
|
74 |
ProjectView model = vista.getModel(); |
|
75 |
FMap mapa = model.getMapContext(); |
|
76 |
NewMapControl mapCtrl = vista.getMapControl(); |
|
77 |
logger.debug("Comand : " + s); |
|
84 | 78 |
|
85 |
/** |
|
86 |
* @see com.iver.mdiApp.plugins.Extension#isVisible() |
|
87 |
*/ |
|
88 |
public boolean isVisible() { |
|
89 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager().getActiveView(); |
|
90 |
if (f == null) { |
|
91 |
return false; |
|
92 |
} |
|
79 |
if (s.compareTo("LINK") == 0) { |
|
80 |
mapCtrl.setTool("link"); |
|
81 |
} |
|
82 |
} |
|
93 | 83 |
|
94 |
if (f.getClass() == View.class) { |
|
95 |
FMap mapa = ((View) f).getModel().getMapContext(); |
|
84 |
/** |
|
85 |
* @see com.iver.mdiApp.plugins.Extension#isVisible() |
|
86 |
*/ |
|
87 |
public boolean isVisible() { |
|
88 |
com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager() |
|
89 |
.getActiveView(); |
|
96 | 90 |
|
97 |
View v = (View) f; |
|
91 |
if (f == null) { |
|
92 |
return false; |
|
93 |
} |
|
98 | 94 |
|
99 |
return mapa.getLayers().getLayersCount() > 0; |
|
100 |
} else { |
|
101 |
return false; |
|
102 |
} |
|
103 |
} |
|
95 |
if (f.getClass() == View.class) { |
|
96 |
FMap mapa = ((View) f).getModel().getMapContext(); |
|
104 | 97 |
|
105 |
/** |
|
106 |
* DOCUMENT ME! |
|
107 |
* |
|
108 |
* @return DOCUMENT ME! |
|
109 |
*/ |
|
110 |
public boolean isEnabled() { |
|
111 |
View f = (View) PluginServices.getMDIManager().getActiveView(); |
|
98 |
View v = (View) f; |
|
112 | 99 |
|
113 |
if (f == null) { |
|
114 |
return false; |
|
115 |
} |
|
100 |
return mapa.getLayers().getLayersCount() > 0; |
|
101 |
} else { |
|
102 |
return false; |
|
103 |
} |
|
104 |
} |
|
116 | 105 |
|
117 |
FLayer[] selected = f.getModel().getMapContext().getLayers().getActives(); |
|
106 |
/** |
|
107 |
* @see com.iver.andami.plugins.Extension#isEnabled() |
|
108 |
*/ |
|
109 |
public boolean isEnabled() { |
|
110 |
View f = (View) PluginServices.getMDIManager().getActiveView(); |
|
118 | 111 |
|
119 |
return selected.length > 0; |
|
120 |
} |
|
112 |
if (f == null) { |
|
113 |
return false; |
|
114 |
} |
|
121 | 115 |
|
116 |
FLayer[] selected = f.getModel().getMapContext().getLayers().getActives(); |
|
117 |
|
|
118 |
return selected.length > 0; |
|
119 |
} |
|
120 |
|
|
122 | 121 |
/** |
123 | 122 |
* @see com.iver.andami.plugins.Extension#inicializar() |
124 | 123 |
*/ |
Also available in: Unified diff