svn-gvsig-desktop / branches / v10 / extensions / extAnnotations / src / com / iver / cit / gvsig / Annotation_PropertiesExtensionOld.java @ 11588
History | View | Annotate | Download (3.3 KB)
1 |
package com.iver.cit.gvsig; |
---|---|
2 |
|
3 |
import javax.swing.ImageIcon; |
4 |
|
5 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
6 |
import com.iver.andami.PluginServices; |
7 |
import com.iver.andami.plugins.Extension; |
8 |
import com.iver.andami.ui.mdiManager.IWindow; |
9 |
import com.iver.cit.gvsig.fmap.MapContext; |
10 |
import com.iver.cit.gvsig.fmap.layers.Annotation_Layer; |
11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
12 |
import com.iver.cit.gvsig.fmap.layers.FLyrVect; |
13 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
14 |
import com.iver.cit.gvsig.gui.simpleWizard.SimpleWizard; |
15 |
import com.iver.cit.gvsig.project.documents.gui.Annotation_ConfigureLabel; |
16 |
import com.iver.cit.gvsig.project.documents.gui.Annotation_Create; |
17 |
import com.iver.cit.gvsig.project.documents.gui.Annotation_FieldSelect; |
18 |
import com.iver.cit.gvsig.project.documents.gui.Annotation_Modify; |
19 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
20 |
|
21 |
public class Annotation_PropertiesExtensionOld extends Extension { |
22 |
private MapContext map = null; |
23 |
public void initialize() { |
24 |
// TODO Auto-generated method stub
|
25 |
|
26 |
} |
27 |
|
28 |
public void execute(String actionCommand) { |
29 |
if ("ANNOTATIONPROPERTIES".equals(actionCommand)) { |
30 |
ImageIcon Logo = new javax.swing.ImageIcon(this.getClass() |
31 |
.getClassLoader() |
32 |
.getResource("images/package_graphics.png"));
|
33 |
|
34 |
SimpleWizard wizard = new SimpleWizard(Logo);
|
35 |
|
36 |
Annotation_Layer la = (Annotation_Layer) map.getLayers().getActives()[0];
|
37 |
Annotation_FieldSelect panel1 = new Annotation_FieldSelect(wizard
|
38 |
.getWizardComponents(), la); |
39 |
Annotation_ConfigureLabel panel2 = new Annotation_ConfigureLabel(
|
40 |
wizard.getWizardComponents(), la); |
41 |
|
42 |
wizard.getWizardComponents().addWizardPanel(panel1); |
43 |
wizard.getWizardComponents().addWizardPanel(panel2); |
44 |
|
45 |
wizard.getWizardComponents() |
46 |
.setFinishAction( |
47 |
new Annotation_Modify(wizard.getWizardComponents(),
|
48 |
map, la)); |
49 |
|
50 |
wizard.getWindowInfo().setWidth(540);
|
51 |
wizard.getWindowInfo().setHeight(380);
|
52 |
wizard.getWindowInfo().setTitle( |
53 |
PluginServices.getText(this, "to_annotation")); |
54 |
|
55 |
PluginServices.getMDIManager().addWindow(wizard); |
56 |
|
57 |
/*
|
58 |
* FLyrVect lv=(FLyrVect)map.getLayers().getActives()[0];
|
59 |
* FLyrAnnotation la=new FLyrAnnotation();
|
60 |
* la.setSource(lv.getSource());
|
61 |
*
|
62 |
* MappingFieldsToAnotation mfta=new MappingFieldsToAnotation(la);
|
63 |
* PluginServices.getMDIManager().addView(mfta);
|
64 |
*
|
65 |
* if (mfta.isOk()){ map.getLayers().addLayer(la);
|
66 |
* map.getLayers().removeLayer(lv); }
|
67 |
*/
|
68 |
} |
69 |
|
70 |
} |
71 |
|
72 |
public boolean isEnabled() { |
73 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
74 |
|
75 |
if ((v != null) |
76 |
&& v instanceof com.iver.cit.gvsig.project.documents.view.gui.View) {
|
77 |
com.iver.cit.gvsig.project.documents.view.gui.View vista = (com.iver.cit.gvsig.project.documents.view.gui.View) v; |
78 |
IProjectView model = vista.getModel(); |
79 |
map = model.getMapContext(); |
80 |
|
81 |
FLayer[] layers = map.getLayers().getActives();
|
82 |
|
83 |
if (layers.length == 1) { |
84 |
if (layers[0].isAvailable() |
85 |
&& layers[0] instanceof Annotation_Layer) { |
86 |
return true; |
87 |
} |
88 |
} |
89 |
} |
90 |
|
91 |
return false; |
92 |
} |
93 |
|
94 |
public boolean isVisible() { |
95 |
IWindow v = PluginServices.getMDIManager().getActiveWindow(); |
96 |
|
97 |
if (v == null) { |
98 |
return false; |
99 |
} else if (v instanceof com.iver.cit.gvsig.project.documents.view.gui.View) { |
100 |
return true; |
101 |
} else {
|
102 |
return false; |
103 |
} |
104 |
} |
105 |
|
106 |
} |