Statistics
| Revision:

svn-gvsig-desktop / trunk / examples / exaTemplateLayout / src / com / iver / templateLayout / PrintSelectedExtension.java @ 10626

History | View | Annotate | Download (1.29 KB)

1
package com.iver.templateLayout;
2

    
3
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
4
import com.hardcode.gdbms.engine.data.driver.DriverException;
5
import com.iver.andami.PluginServices;
6
import com.iver.andami.messages.NotificationManager;
7
import com.iver.andami.plugins.Extension;
8
import com.iver.andami.ui.mdiManager.IWindow;
9
import com.iver.cit.gvsig.fmap.layers.FLayer;
10
import com.iver.cit.gvsig.fmap.layers.FLayers;
11
import com.iver.cit.gvsig.project.documents.view.gui.View;
12

    
13
public class PrintSelectedExtension extends Extension {
14

    
15
        public void initialize() {
16
                // TODO Auto-generated method stub
17

    
18
        }
19

    
20
        public void execute(String actionCommand) {
21
                IWindow andamiView = PluginServices.getMDIManager().getActiveWindow();
22

    
23
                if (andamiView instanceof View)
24
                {
25
                        View theView = (View) andamiView;
26
                        FLayers layers = theView.getMapControl().getMapContext().getLayers();
27
//                        FLayer[] actives = layers.getActives();
28
                        FLayer layerProvin = layers.getLayer("Provin.shp");
29
                        PrintingManager printingManager = new PrintingManager(layerProvin);
30
                        try {
31
                                printingManager.startPrinting();
32
                        } catch (ReadDriverException e) {
33
                                e.printStackTrace();
34
                                NotificationManager.addError(e);
35
                        }
36
                }
37

    
38
        }
39

    
40
        public boolean isEnabled() {
41
                return true;
42
        }
43

    
44
        public boolean isVisible() {
45
                return true;
46
        }
47

    
48
}