Revision 11589

View differences:

branches/v10/extensions/extAnnotations/config/config.xml
11 11

  
12 12
			<menu text="Capa/export_to/annotation" action-command="ANNOTATIONLAYER" key="d"
13 13
				tooltip="Create annotation layer"
14
				position="7"/>
14
				priority="999"/>
15 15
		</extension>
16 16
	</extensions>
17 17
</plugin-config>
branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/Annotation_Extension.java
58 58
import com.iver.cit.gvsig.project.documents.gui.Annotation_FieldSelect;
59 59
import com.iver.cit.gvsig.project.documents.gui.Annotation_Open;
60 60
import com.iver.cit.gvsig.project.documents.view.IProjectView;
61
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
62
import com.iver.cit.gvsig.project.documents.view.toc.actions.FLyrVectEditPropertiesTocMenuEntry;
61 63
import com.iver.cit.gvsig.project.documents.view.toc.gui.FLyrVectEditPropertiesTocMenuEntry2;
62 64
import com.iver.utiles.extensionPoints.ExtensionPoint;
63 65
import com.iver.utiles.extensionPoints.ExtensionPoints;
......
77 79
     */
78 80
    public void initialize() {
79 81
    	ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
82

  
83
    	AbstractTocContextMenuAction ma=(AbstractTocContextMenuAction)((ExtensionPoint) extensionPoints.get("View_TocActions")).get("FLyrVectEditProperties");
80 84
    	((ExtensionPoint) extensionPoints.get("View_TocActions")).remove("FLyrVectEditProperties");
81
    	((ExtensionPoint) extensionPoints.get("View_TocActions")).remove("FLyrVectEditProperties2");
82
    	((ExtensionPoint) extensionPoints.get("View_TocActions")).put("FLyrVectEditProperties",new FLyrVectEditPropertiesTocMenuEntry2());
85
    	((ExtensionPoint) extensionPoints.get("View_TocActions")).put("FLyrVectEditProperties",new FLyrVectEditPropertiesTocMenuEntry2(ma));
83 86
        //extensionPoints.add("View_TocActions","FLyrVectEditProperties2",new FLyrVectEditPropertiesTocMenuEntry2());
84 87
        System.out.println("A?ado WizardAnnotation.");
85 88
        AddLayer.addWizard(Annotation_Open.class);
branches/v10/extensions/extAnnotations/src/com/iver/cit/gvsig/project/documents/view/toc/gui/FLyrVectEditPropertiesTocMenuEntry2.java
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;

Also available in: Unified diff