Statistics
| Revision:

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

History | View | Annotate | Download (1.31 KB)

1
package com.iver.cit.gvsig;
2

    
3
import com.iver.andami.PluginServices;
4
import com.iver.andami.plugins.Extension;
5
import com.iver.cit.gvsig.fmap.FMap;
6
import com.iver.cit.gvsig.fmap.ViewPort;
7
import com.iver.cit.gvsig.gui.View;
8

    
9

    
10
public class ZoomPrev implements Extension {
11

    
12
        /**
13
         * @see com.iver.mdiApp.plugins.Extension#isEnabled()
14
         */
15
        public boolean isEnabled() {
16
                View vista = (View) PluginServices.getMDIManager().getActiveView();
17
                ViewPort vp = vista.getModel().getMapContext().getViewPort();
18
                return vp.getExtents().hasPrevious();
19
        }
20

    
21
        /**
22
         * @see com.iver.mdiApp.plugins.Extension#isVisible()
23
         */
24
        public boolean isVisible() {
25
                com.iver.andami.ui.mdiManager.View f = PluginServices.getMDIManager().getActiveView();
26

    
27
                if (f == null) {
28
                        return false;
29
                }
30

    
31
                if (f.getClass() == View.class) {
32
                        View v = (View) f;
33

    
34
                        FMap mapa = v.getModel().getMapContext();
35
                        return mapa.getLayers().getLayersCount() > 0;
36
                } else {
37
                        return false;
38
                }
39
        }
40

    
41
        /**
42
         * @see com.iver.mdiApp.plugins.Extension#updateUI(java.lang.String)
43
         */
44
        public void execute(String arg0) {
45
                View vista = (View) PluginServices.getMDIManager().getActiveView();
46
                ViewPort vp = vista.getModel().getMapContext().getViewPort();
47
                vp.setExtentPrev();
48
        }
49

    
50
        /**
51
         * @see com.iver.andami.plugins.Extension#inicializar()
52
         */
53
        public void inicializar() {
54
        }
55

    
56
}