Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LinkControls.java @ 1099

History | View | Annotate | Download (2.18 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
package com.iver.cit.gvsig;
8
9
import org.apache.log4j.Logger;
10
11 596 fernando
import com.iver.andami.PluginServices;
12
import com.iver.andami.plugins.Extension;
13 312 fernando
import com.iver.cit.gvsig.fmap.FMap;
14 775 vcaballero
import com.iver.cit.gvsig.fmap.NewMapControl;
15 312 fernando
import com.iver.cit.gvsig.fmap.layers.FLayer;
16
import com.iver.cit.gvsig.gui.View;
17 775 vcaballero
import com.iver.cit.gvsig.project.castor.ProjectView;
18 312 fernando
19
20
/**
21 775 vcaballero
 * Extensi?n para gestionar los hiperlinks.
22 312 fernando
 *
23
 * @author Vicente Caballero Navarro
24
 */
25 596 fernando
public class LinkControls implements Extension {
26 312 fernando
    private static Logger logger = Logger.getLogger(ViewControls.class.getName());
27
28
    /**
29
     * DOCUMENT ME!
30
     *
31
     * @param status DOCUMENT ME!
32
     * @param s DOCUMENT ME!
33
     */
34 596 fernando
    public void execute(String s) {
35 775 vcaballero
             View vista = (View) PluginServices.getMDIManager().getActiveView();
36
         ProjectView model=vista.getModel();
37
         FMap mapa = model.getMapContext();
38
         NewMapControl mapCtrl = vista.getMapControl();
39 312 fernando
        logger.debug("Comand : " + s);
40 775 vcaballero
        if (s.compareTo("LINK") == 0) {
41
                mapCtrl.setTool("link");
42
        }
43 312 fernando
    }
44
45
    /**
46
     * @see com.iver.mdiApp.plugins.Extension#isVisible()
47
     */
48
    public boolean isVisible() {
49 596 fernando
        com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager().getActiveView();
50 312 fernando
        if (f == null) {
51
            return false;
52
        }
53
54
        if (f.getClass() == View.class) {
55
            FMap mapa = ((View) f).getModel().getMapContext();
56
57
            View v = (View) f;
58
59 387 fjp
            return mapa.getLayers().getLayersCount() > 0;
60 312 fernando
        } else {
61
            return false;
62
        }
63
    }
64
65
    /**
66
     * DOCUMENT ME!
67
     *
68
     * @return DOCUMENT ME!
69
     */
70
    public boolean isEnabled() {
71 596 fernando
        View f = (View) PluginServices.getMDIManager().getActiveView();
72 312 fernando
73
        if (f == null) {
74
            return false;
75
        }
76
77
        FLayer[] selected = f.getModel().getMapContext().getLayers().getActives();
78
79
        return selected.length > 0;
80
    }
81 596 fernando
82
        /**
83
         * @see com.iver.andami.plugins.Extension#inicializar()
84
         */
85
        public void inicializar() {
86
        }
87 312 fernando
}