root / trunk / prototypes / mobile / desktop / extensions / extExportMobile / src / es / prodevelop / gvsig / exportMobile / ClipExtension.java @ 19320
History | View | Annotate | Download (2.1 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.About; |
8 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
9 |
import com.iver.cit.gvsig.project.ProjectExtent; |
10 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
11 |
|
12 |
import es.prodevelop.gvsig.exportMobile.ui.order.FLayerWithNewName; |
13 |
import es.prodevelop.gvsig.exportMobile.ui.panels.ExportPanel; |
14 |
|
15 |
|
16 |
/**
|
17 |
*
|
18 |
* This extension allows a user to export all the layers in a view
|
19 |
*
|
20 |
* @author amoreno
|
21 |
*
|
22 |
*/
|
23 |
public class ClipExtension extends Extension { |
24 |
|
25 |
/**
|
26 |
* Starts the extension
|
27 |
*/
|
28 |
public void initialize() { |
29 |
|
30 |
// about
|
31 |
java.net.URL newurl = |
32 |
createResourceUrl("about/export-mobile-about.html");
|
33 |
About claseAbout = (About) PluginServices.getExtension(com.iver.cit.gvsig.About.class); |
34 |
claseAbout.getAboutPanel().addAboutUrl("Export to gvSIG Mobile", newurl);
|
35 |
} |
36 |
|
37 |
|
38 |
public boolean isEnabled() { |
39 |
|
40 |
return true; |
41 |
} |
42 |
|
43 |
/**
|
44 |
* is visible when a view is the active window
|
45 |
*/
|
46 |
public boolean isVisible() { |
47 |
com.iver.andami.ui.mdiManager.IWindow f = (com.iver.andami.ui.mdiManager.IWindow) PluginServices |
48 |
.getMDIManager().getActiveWindow(); |
49 |
|
50 |
if (f == null) { |
51 |
return false; |
52 |
} |
53 |
|
54 |
return (f instanceof View); |
55 |
} |
56 |
|
57 |
/**
|
58 |
* @param actionCommand not used
|
59 |
* It's called when the export to gvsig mobile button is pressed
|
60 |
*/
|
61 |
public void execute(String actionCommand) { |
62 |
|
63 |
View view = (View) PluginServices.getMDIManager().getActiveWindow(); |
64 |
view.getModel().getProject().getExtents(); |
65 |
// root
|
66 |
FLayers rt = view.getMapControl().getMapContext().getLayers(); |
67 |
ArrayList lyrsNewName = FLayerWithNewName.getAll(rt);
|
68 |
ProjectExtent[] listExtent = view.getModel().getProject().getExtents();
|
69 |
ExportPanel infPanel = new ExportPanel(lyrsNewName, listExtent);
|
70 |
PluginServices.getMDIManager().addWindow(infPanel); |
71 |
} |
72 |
|
73 |
private java.net.URL createResourceUrl(String path) { |
74 |
return getClass().getClassLoader().getResource(path);
|
75 |
} |
76 |
|
77 |
} |