Statistics
| Revision:

root / trunk / prototypes / mobile / desktop / extensions / extExportMobile / src / es / prodevelop / gvsig / exportMobile / ClipExtension.java @ 19196

History | View | Annotate | Download (1.87 KB)

1
package es.prodevelop.gvsig.exportMobile;
2

    
3
import java.util.ArrayList;
4

    
5
import com.iver.andami.PluginServices;
6
import com.iver.andami.plugins.Extension;
7
import com.iver.cit.gvsig.fmap.layers.FLayers;
8
import com.iver.cit.gvsig.project.ProjectExtent;
9
import com.iver.cit.gvsig.project.documents.view.gui.View;
10

    
11
import es.prodevelop.gvsig.exportMobile.ui.order.FLayerWithNewName;
12
import es.prodevelop.gvsig.exportMobile.ui.panels.ExportPanel;
13

    
14

    
15
/**
16
 * 
17
 * This extension allows a user to export all the layers in a view
18
 * 
19
 * @author amoreno
20
 *
21
 */
22
public class ClipExtension extends Extension {
23

    
24
        /**
25
         * Starts the extension
26
         */
27
        public void initialize() {
28
//                //Initialiser SOAP writer with the desination SOAP file
29
                //File destFile = new File("SOAPComEventModif.xml");
30
                //CommMessageWriterManager.registerManager(new CommMessageWriterManager(new SOAPCommMessageWriter(destFile)));
31
        }
32

    
33
        
34
        public boolean isEnabled() {
35

    
36
                return true;
37
        }
38

    
39
        /**
40
         * is visible when a view is the active window
41
         */
42
        public boolean isVisible() {
43
                com.iver.andami.ui.mdiManager.IWindow f = (com.iver.andami.ui.mdiManager.IWindow) PluginServices
44
                                .getMDIManager().getActiveWindow();
45

    
46
                if (f == null) {
47
                        return false;
48
                }
49

    
50
                return (f instanceof View);
51
        }
52

    
53
        /**
54
         * @param actionCommand not used
55
         * It's called when the export to gvsig mobile button is pressed
56
         */
57
        public void execute(String actionCommand) {
58

    
59
                View view = (View) PluginServices.getMDIManager().getActiveWindow();
60
                view.getModel().getProject().getExtents();
61
                // root
62
                FLayers rt = view.getMapControl().getMapContext().getLayers();
63
                ArrayList lyrsNewName = FLayerWithNewName.getAll(rt);
64
                ProjectExtent[] listExtent = view.getModel().getProject().getExtents();
65
                ExportPanel infPanel = new ExportPanel(lyrsNewName, listExtent);
66
                PluginServices.getMDIManager().addWindow(infPanel);
67
        }
68
}