12 |
12 |
import com.iver.cit.gvsig.project.documents.view.legend.gui.FThemeManagerWindow2;
|
13 |
13 |
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
|
14 |
14 |
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
|
|
15 |
import com.iver.cit.gvsig.project.documents.view.toc.actions.DelegatedTocContextMenuAction;
|
15 |
16 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
16 |
17 |
*
|
17 |
18 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
... | ... | |
59 |
60 |
*/
|
60 |
61 |
|
61 |
62 |
|
62 |
|
public class FLyrVectEditPropertiesTocMenuEntry2 extends AbstractTocContextMenuAction {
|
63 |
|
public String getGroup() {
|
64 |
|
return "group2"; //FIXME
|
|
63 |
public class FLyrVectEditPropertiesTocMenuEntry2 extends DelegatedTocContextMenuAction {
|
|
64 |
public FLyrVectEditPropertiesTocMenuEntry2(AbstractTocContextMenuAction delegated) {
|
|
65 |
super(delegated);
|
65 |
66 |
}
|
66 |
67 |
|
67 |
|
public int getGroupOrder() {
|
68 |
|
return 20;
|
69 |
|
}
|
70 |
|
|
71 |
|
public int getOrder() {
|
72 |
|
return 0;
|
73 |
|
}
|
74 |
|
|
75 |
|
public String getText() {
|
76 |
|
return PluginServices.getText(this, "propiedades");
|
77 |
|
}
|
78 |
|
|
79 |
|
public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
|
80 |
|
return selectedItems.length == 1;
|
81 |
|
}
|
82 |
|
|
83 |
68 |
public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
|
84 |
69 |
if (isTocItemBranch(item)) {
|
85 |
70 |
FLayer lyr = getNodeLayer(item);
|
86 |
|
if ((lyr instanceof ClassifiableVectorial)) {
|
87 |
|
if (!((lyr instanceof FLyrVect) &&
|
88 |
|
!((FLyrVect)lyr).isPropertiesMenuVisible())){
|
89 |
|
if (!(lyr instanceof FLyrAnnotation))
|
90 |
|
return true;
|
91 |
|
}
|
92 |
|
|
93 |
|
}
|
|
71 |
if (lyr instanceof Annotation_Layer){
|
|
72 |
return true;
|
|
73 |
}
|
94 |
74 |
}
|
95 |
|
return false;
|
96 |
|
|
|
75 |
return super.isVisible(item,selectedItems);
|
97 |
76 |
}
|
98 |
77 |
|
99 |
78 |
|
... | ... | |
102 |
81 |
if (actives[0] instanceof Annotation_Layer)
|
103 |
82 |
annotationExecute(item,selectedItems);
|
104 |
83 |
else
|
105 |
|
vectorialExecute(item,selectedItems);
|
|
84 |
super.execute(item,selectedItems);
|
106 |
85 |
}
|
107 |
86 |
|
108 |
|
private void vectorialExecute(ITocItem item, FLayer[] selectedItems) {
|
109 |
|
FLayer[] actives = selectedItems;
|
110 |
|
FThemeManagerWindow fThemeManagerWindow;
|
111 |
|
if (actives.length==1) {
|
112 |
|
if (!actives[0].isAvailable()) return;
|
113 |
|
System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
|
114 |
|
fThemeManagerWindow = new FThemeManagerWindow(actives[0],actives[0].getMapContext());
|
115 |
|
try {
|
116 |
|
fThemeManagerWindow.setMapContext(getMapContext());
|
117 |
|
} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
|
118 |
|
e1.printStackTrace();
|
119 |
|
}
|
120 |
|
//PluginServices.getMDIManager().addView(fThemeManagerWindow);
|
121 |
|
if (PluginServices.getMainFrame() == null) {
|
122 |
|
JDialog dlg = new JDialog();
|
123 |
|
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
|
124 |
|
dlg.getContentPane().add(fThemeManagerWindow);
|
125 |
|
dlg.setModal(false);
|
126 |
|
dlg.pack();
|
127 |
|
dlg.show();
|
128 |
|
} else {
|
129 |
|
PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
|
130 |
|
}
|
131 |
|
} else {
|
132 |
|
for (int i = 0; i < actives.length; i++){
|
133 |
|
if (actives[0].isAvailable()) {
|
134 |
|
System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
|
135 |
|
fThemeManagerWindow = new FThemeManagerWindow(actives[i], getMapContext());
|
136 |
|
//PluginServices.getMDIManager().addView(fThemeManagerWindow);
|
137 |
|
if (PluginServices.getMainFrame() == null) {
|
138 |
|
JDialog dlg = new JDialog();
|
139 |
|
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
|
140 |
|
dlg.getContentPane().add(fThemeManagerWindow);
|
141 |
|
dlg.setModal(false);
|
142 |
|
dlg.pack();
|
143 |
|
dlg.show();
|
144 |
|
} else {
|
145 |
|
PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
|
146 |
|
}
|
147 |
|
}
|
148 |
|
}
|
149 |
|
}
|
150 |
|
}
|
151 |
|
|
152 |
87 |
private void annotationExecute(ITocItem item, FLayer[] selectedItems) {
|
153 |
88 |
FLayer[] actives = selectedItems;
|
154 |
89 |
FThemeManagerWindow2 fThemeManagerWindow;
|