root / trunk / examples / exaTemplateLayout / src / com / iver / templateLayout / PrintSelectedExtension.java @ 6885
History | View | Annotate | Download (1.22 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 |
|
11 |
public class PrintSelectedExtension extends Extension { |
12 |
|
13 |
public void initialize() { |
14 |
// TODO Auto-generated method stub
|
15 |
|
16 |
} |
17 |
|
18 |
public void execute(String actionCommand) { |
19 |
IWindow andamiView = PluginServices.getMDIManager().getActiveWindow(); |
20 |
|
21 |
if (andamiView instanceof com.iver.cit.gvsig.gui.View) |
22 |
{ |
23 |
com.iver.cit.gvsig.gui.View theView = (com.iver.cit.gvsig.gui.View) andamiView; |
24 |
FLayers layers = theView.getMapControl().getMapContext().getLayers(); |
25 |
// FLayer[] actives = layers.getActives();
|
26 |
FLayer layerProvin = layers.getLayer("Provin.shp");
|
27 |
PrintingManager printingManager = new PrintingManager(layerProvin);
|
28 |
try {
|
29 |
printingManager.startPrinting(); |
30 |
} catch (DriverException e) {
|
31 |
e.printStackTrace(); |
32 |
NotificationManager.addError(e); |
33 |
} |
34 |
} |
35 |
|
36 |
} |
37 |
|
38 |
public boolean isEnabled() { |
39 |
return true; |
40 |
} |
41 |
|
42 |
public boolean isVisible() { |
43 |
return true; |
44 |
} |
45 |
|
46 |
} |