Statistics
| Revision:

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

History | View | Annotate | Download (1.92 KB)

1
/*
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
import com.iver.andami.PluginServices;
12
import com.iver.andami.plugins.Extension;
13
import com.iver.cit.gvsig.fmap.FMap;
14
import com.iver.cit.gvsig.fmap.layers.FLayer;
15
import com.iver.cit.gvsig.gui.View;
16

    
17

    
18
/**
19
 * DOCUMENT ME!
20
 *
21
 * @author Vicente Caballero Navarro
22
 */
23
public class LinkControls implements Extension {
24
    private static Logger logger = Logger.getLogger(ViewControls.class.getName());
25

    
26
    /**
27
     * DOCUMENT ME!
28
     *
29
     * @param status DOCUMENT ME!
30
     * @param s DOCUMENT ME!
31
     */
32
    public void execute(String s) {
33
        View view = (View) PluginServices.getMDIManager().getActiveView();
34
        logger.debug("Comand : " + s);
35

    
36
        //TODO implementar bien
37
        //view.getMapControl().setTool(MapControl.LINK);
38
    }
39

    
40
    /**
41
     * @see com.iver.mdiApp.plugins.Extension#isVisible()
42
     */
43
    public boolean isVisible() {
44
        com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager().getActiveView();
45
        if (f == null) {
46
            return false;
47
        }
48

    
49
        if (f.getClass() == View.class) {
50
            FMap mapa = ((View) f).getModel().getMapContext();
51

    
52
            View v = (View) f;
53

    
54
            return mapa.getLayers().getLayersCount() > 0;
55
        } else {
56
            return false;
57
        }
58
    }
59

    
60
    /**
61
     * DOCUMENT ME!
62
     *
63
     * @return DOCUMENT ME!
64
     */
65
    public boolean isEnabled() {
66
        View f = (View) PluginServices.getMDIManager().getActiveView();
67

    
68
        if (f == null) {
69
            return false;
70
        }
71

    
72
        FLayer[] selected = f.getModel().getMapContext().getLayers().getActives();
73

    
74
        return selected.length > 0;
75
    }
76

    
77
        /**
78
         * @see com.iver.andami.plugins.Extension#inicializar()
79
         */
80
        public void inicializar() {
81
        }
82
}