Statistics
| Revision:

root / trunk / extensions / extAnnotations / src / com / iver / cit / gvsig / project / documents / view / toc / gui / Annotation_EditPropertiesTocMenuEntry.java @ 11536

History | View | Annotate | Download (4.74 KB)

1
package com.iver.cit.gvsig.project.documents.view.toc.gui;
2

    
3
import javax.swing.JDialog;
4

    
5
import com.iver.andami.PluginServices;
6
import com.iver.cit.gvsig.fmap.layers.Annotation_Layer;
7
import com.iver.cit.gvsig.fmap.layers.FLayer;
8
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
9
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
10
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
11
import com.iver.cit.gvsig.project.documents.view.legend.gui.Annotation_Properties;
12
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
13
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
14
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
15
 *
16
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
17
 *
18
 * This program is free software; you can redistribute it and/or
19
 * modify it under the terms of the GNU General Public License
20
 * as published by the Free Software Foundation; either version 2
21
 * of the License, or (at your option) any later version.
22
 *
23
 * This program is distributed in the hope that it will be useful,
24
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26
 * GNU General Public License for more details.
27
 *
28
 * You should have received a copy of the GNU General Public License
29
 * along with this program; if not, write to the Free Software
30
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
31
 *
32
 * For more information, contact:
33
 *
34
 *  Generalitat Valenciana
35
 *   Conselleria d'Infraestructures i Transport
36
 *   Av. Blasco Ib??ez, 50
37
 *   46010 VALENCIA
38
 *   SPAIN
39
 *
40
 *      +34 963862235
41
 *   gvsig@gva.es
42
 *      www.gvsig.gva.es
43
 *
44
 *    or
45
 *
46
 *   IVER T.I. S.A
47
 *   Salamanca 50
48
 *   46005 Valencia
49
 *   Spain
50
 *
51
 *   +34 963163400
52
 *   dac@iver.es
53
 */
54

    
55
/**
56
 * Muestra el men? de propiedades de la capa de anotationes.
57
 *
58
 * @author Vicente Caballero Navarro
59
 */
60

    
61

    
62
public class Annotation_EditPropertiesTocMenuEntry extends AbstractTocContextMenuAction {
63
        public String getGroup() {
64
                return "group2"; //FIXME
65
        }
66

    
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")+PluginServices.getText(this,"snnotation");
77
        }
78

    
79
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
80
                return selectedItems.length == 1;
81
        }
82

    
83
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
84
                if (isTocItemBranch(item)) {
85
                        FLayer lyr = getNodeLayer(item);
86
            if ((lyr instanceof ClassifiableVectorial)) {
87
                    if (!((lyr instanceof Annotation_Layer) &&
88
                                    !((Annotation_Layer)lyr).isPropertiesMenuVisible())){
89
                            return true;
90
                    }
91

    
92
            }
93
                }
94
                return false;
95

    
96
        }
97

    
98

    
99
        public void execute(ITocItem item, FLayer[] selectedItems) {
100
                FLayer[] actives = selectedItems;
101
                Annotation_Properties annotationProperties=new Annotation_Properties((Annotation_Layer)actives[0]);
102

    
103
//            if (actives.length==1) {
104
//                    if (!actives[0].isAvailable()) return;
105
//                    System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
106
//                    annotationProperties = new Annotation_Properties();
107
//                    try {
108
//                            annotationProperties.setMapContext(getMapContext());
109
//                    } catch (com.iver.cit.gvsig.fmap.DriverException e1) {
110
//                            e1.printStackTrace();
111
//                    }
112
//            //PluginServices.getMDIManager().addView(fThemeManagerWindow);
113
//                    if (PluginServices.getMainFrame() == null) {
114
//                            JDialog dlg = new JDialog();
115
//                            annotationProperties.setPreferredSize(annotationProperties.getSize());
116
//                            dlg.getContentPane().add(annotationProperties);
117
//                            dlg.setModal(false);
118
//                            dlg.pack();
119
//                            dlg.show();
120
//                    } else {
121
//                            PluginServices.getMDIManager().addWindow(annotationProperties);
122
//                    }
123
//            } else {
124
//                for (int i = 0; i < actives.length; i++){
125
//                        if (actives[0].isAvailable()) {
126
//                                System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
127
//                                annotationProperties = new Annotation_Properties(actives[i], getMapContext());
128
//                                //PluginServices.getMDIManager().addView(fThemeManagerWindow);
129
//                                if (PluginServices.getMainFrame() == null) {
130
//                                        JDialog dlg = new JDialog();
131
//                                        annotationProperties.setPreferredSize(annotationProperties.getSize());
132
//                                        dlg.getContentPane().add(annotationProperties);
133
//                                        dlg.setModal(false);
134
//                                        dlg.pack();
135
//                                        dlg.show();
136
//                                } else {
137
//                                        PluginServices.getMDIManager().addWindow(annotationProperties);
138
//                                }
139
//                        }
140
//                }
141
//            }
142
        }
143

    
144
}