svn-gvsig-desktop / trunk / examples / exaTemplateLayout / src / com / iver / templateLayout / PrintSelectedExtension.java @ 7531
History | View | Annotate | Download (1.21 KB)
1 |
package com.iver.templateLayout; |
---|---|
2 |
|
3 |
import com.iver.andami.PluginServices; |
4 |
import com.iver.andami.messages.NotificationManager; |
5 |
import com.iver.andami.plugins.Extension; |
6 |
import com.iver.andami.ui.mdiManager.IWindow; |
7 |
import com.iver.cit.gvsig.fmap.DriverException; |
8 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
9 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
10 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
11 |
|
12 |
public class PrintSelectedExtension extends Extension { |
13 |
|
14 |
public void initialize() { |
15 |
// TODO Auto-generated method stub
|
16 |
|
17 |
} |
18 |
|
19 |
public void execute(String actionCommand) { |
20 |
IWindow andamiView = PluginServices.getMDIManager().getActiveWindow(); |
21 |
|
22 |
if (andamiView instanceof View) |
23 |
{ |
24 |
View theView = (View) andamiView; |
25 |
FLayers layers = theView.getMapControl().getMapContext().getLayers(); |
26 |
// FLayer[] actives = layers.getActives();
|
27 |
FLayer layerProvin = layers.getLayer("Provin.shp");
|
28 |
PrintingManager printingManager = new PrintingManager(layerProvin);
|
29 |
try {
|
30 |
printingManager.startPrinting(); |
31 |
} catch (DriverException e) {
|
32 |
e.printStackTrace(); |
33 |
NotificationManager.addError(e); |
34 |
} |
35 |
} |
36 |
|
37 |
} |
38 |
|
39 |
public boolean isEnabled() { |
40 |
return true; |
41 |
} |
42 |
|
43 |
public boolean isVisible() { |
44 |
return true; |
45 |
} |
46 |
|
47 |
} |