svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / ZoomPrev.java @ 312
History | View | Annotate | Download (1.23 KB)
1 | 312 | fernando | package com.iver.cit.gvsig; |
---|---|---|---|
2 | |||
3 | import com.iver.cit.gvsig.fmap.FMap; |
||
4 | import com.iver.cit.gvsig.fmap.ViewPort; |
||
5 | import com.iver.cit.gvsig.gui.View; |
||
6 | import com.iver.mdiApp.App; |
||
7 | import com.iver.mdiApp.AppStatus; |
||
8 | import com.iver.mdiApp.plugins.AbstractExtension; |
||
9 | |||
10 | |||
11 | public class ZoomPrev extends AbstractExtension { |
||
12 | |||
13 | /**
|
||
14 | * @see com.iver.mdiApp.plugins.Extension#isEnabled()
|
||
15 | */
|
||
16 | public boolean isEnabled() { |
||
17 | View vista = (View) App.instance.getMDIContext().getActiveView(); |
||
18 | ViewPort vp = vista.getModel().getMapContext().getViewPort(); |
||
19 | return vp.getExtents().hasPrevious();
|
||
20 | } |
||
21 | |||
22 | /**
|
||
23 | * @see com.iver.mdiApp.plugins.Extension#isVisible()
|
||
24 | */
|
||
25 | public boolean isVisible() { |
||
26 | com.iver.mdiApp.ui.MDIManager.View f = App.instance.getMDIContext().getActiveView(); |
||
27 | |||
28 | if (f == null) { |
||
29 | return false; |
||
30 | } |
||
31 | |||
32 | if (f.getClass() == View.class) { |
||
33 | View v = (View) f; |
||
34 | |||
35 | FMap mapa = v.getModel().getMapContext(); |
||
36 | return mapa.getLayers().getLayerCount() > 0; |
||
37 | } else {
|
||
38 | return false; |
||
39 | } |
||
40 | } |
||
41 | |||
42 | /**
|
||
43 | * @see com.iver.mdiApp.plugins.Extension#updateUI(java.lang.String)
|
||
44 | */
|
||
45 | public void updateUI(AppStatus status, String arg0) { |
||
46 | View vista = (View) status.getActiveView(); |
||
47 | ViewPort vp = vista.getModel().getMapContext().getViewPort(); |
||
48 | vp.setExtentPrev(); |
||
49 | } |
||
50 | |||
51 | } |