Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / LayoutControls.java @ 312

History | View | Annotate | Download (3.85 KB)

1
/*
2
 * Created on 05-may-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 com.iver.cit.gvsig.gui.layout.FLayoutZooms;
10
import com.iver.cit.gvsig.gui.layout.Layout;
11

    
12
import com.iver.mdiApp.App;
13
import com.iver.mdiApp.AppStatus;
14
import com.iver.mdiApp.plugins.AbstractExtension;
15
import com.iver.mdiApp.ui.MDIManager.View;
16

    
17
import org.apache.log4j.Logger;
18

    
19

    
20
/**
21
 * DOCUMENT ME!
22
 *
23
 * @author Vicente Caballero Navarro
24
 */
25
public class LayoutControls extends AbstractExtension {
26
    private static Logger logger = Logger.getLogger(LayoutControls.class.getName());
27

    
28
    /**
29
     * DOCUMENT ME!
30
     *
31
     * @param status DOCUMENT ME!
32
     * @param s DOCUMENT ME!
33
     */
34
    public void updateUI(AppStatus status, String s) {
35
        Layout layout = (Layout) status.getActiveView();
36
        FLayoutZooms zooms = new FLayoutZooms(layout);
37
        logger.debug("Comand : " + s);
38

    
39
        if (s.compareTo("PAN") == 0) {
40
            layout.setTool(Layout.PAN);
41
        } else if (s.compareTo("ZOOM_IN") == 0) {
42
            layout.setTool(Layout.ZOOM_MAS);
43
        } else if (s.compareTo("ZOOM_OUT") == 0) {
44
            layout.setTool(Layout.ZOOM_MENOS);
45
        } else if (s.compareTo("RECTANGLEVIEW") == 0) {
46
            layout.setTool(Layout.RECTANGLEVIEW);
47
        } else if (s.compareTo("RECTANGLEPICTURE") == 0) {
48
            layout.setTool(Layout.RECTANGLEPICTURE);
49
        } else if (s.compareTo("RECTANGLESCALEBAR") == 0) {
50
            layout.setTool(Layout.RECTANGLESCALEBAR);
51
        } else if (s.compareTo("RECTANGLELEGEND") == 0) {
52
            layout.setTool(Layout.RECTANGLELEGEND);
53
        } else if (s.compareTo("RECTANGLETEXT") == 0) {
54
            layout.setTool(Layout.RECTANGLETEXT);
55
        } else if (s.compareTo("SELECT") == 0) {
56
            layout.setTool(Layout.SELECT);
57
        } else if (s.compareTo("POINT") == 0) {
58
            layout.setTool(Layout.POINT);
59
        } else if (s.compareTo("LINE") == 0) {
60
            layout.setTool(Layout.LINE);
61
        } else if (s.compareTo("POLYLINE") == 0) {
62
            layout.setTool(Layout.POLYLINE);
63
        } else if (s.compareTo("CIRCLE") == 0) {
64
            layout.setTool(Layout.CIRCLE);
65
        } else if (s.compareTo("RECTANGLESIMPLE") == 0) {
66
            layout.setTool(Layout.RECTANGLESIMPLE);
67
        } else if (s.compareTo("POLYGON") == 0) {
68
            layout.setTool(Layout.POLYGON);
69
        } else if (s.compareTo("CONFIG") == 0) {
70
            layout.showFConfig();
71
        } else if (s.compareTo("PROPERTIES") == 0) {
72
            layout.showFProperties();
73
        } else if (s.compareTo("FULL") == 0) {
74
            layout.fullRect();
75
        } else if (s.compareTo("REALZOOM") == 0) {
76
            zooms.realZoom();
77
        } else if (s.compareTo("ZOOMOUT") == 0) {
78
            zooms.zoomOut();
79
        } else if (s.compareTo("ZOOMIN") == 0) {
80
            zooms.zoomIn();
81
        } else if (s.compareTo("ZOOMSELECT") == 0) {
82
            zooms.zoomSelect();
83
        } else if (s.compareTo("VIEW_ZOOMIN") == 0) {
84
            layout.setTool(Layout.VIEW_ZOOMIN);
85
        } else if (s.compareTo("VIEW_ZOOMOUT") == 0) {
86
            layout.setTool(Layout.VIEW_ZOOMOUT);
87
        } else if (s.compareTo("VIEW_FULL") == 0) {
88
            layout.viewFull();
89
        } else if (s.compareTo("VIEW_PAN") == 0) {
90
            layout.setTool(Layout.VIEW_PAN);
91
        }
92
    }
93

    
94
    /**
95
     * @see com.iver.mdiApp.plugins.Extension#isVisible()
96
     */
97
    public boolean isVisible() {
98
        View f = App.instance.getMDIContext().getActiveView();
99

    
100
        if (f == null) {
101
            return false;
102
        }
103

    
104
        if (f.getClass() == Layout.class) {
105
            Layout layout = (Layout) f;
106

    
107
            return true; //layout.m_Display.getMapControl().getMapContext().getLayers().layerCount() > 0;
108
        } else {
109
            return false;
110
        }
111
    }
112
}