Statistics
| Revision:

root / branches / v10 / extensions / extGraph_predes / src / com / iver / cit / gvsig / project / documents / view / toc / FLyrVectEditPropertiesTocMenuEntry2.java @ 11094

History | View | Annotate | Download (5.24 KB)

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

    
3
import javax.swing.JDialog;
4

    
5
import com.iver.andami.PluginServices;
6
import com.iver.cit.gvsig.fmap.layers.FLayer;
7
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
8
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
9
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
10
import com.iver.cit.gvsig.project.documents.view.legend.gui.FThemeManagerWindow2;
11
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
12
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
13
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
14
 *
15
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
16
 *
17
 * This program is free software; you can redistribute it and/or
18
 * modify it under the terms of the GNU General Public License
19
 * as published by the Free Software Foundation; either version 2
20
 * of the License, or (at your option) any later version.
21
 *
22
 * This program is distributed in the hope that it will be useful,
23
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
 * GNU General Public License for more details.
26
 *
27
 * You should have received a copy of the GNU General Public License
28
 * along with this program; if not, write to the Free Software
29
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
30
 *
31
 * For more information, contact:
32
 *
33
 *  Generalitat Valenciana
34
 *   Conselleria d'Infraestructures i Transport
35
 *   Av. Blasco Ib??ez, 50
36
 *   46010 VALENCIA
37
 *   SPAIN
38
 *
39
 *      +34 963862235
40
 *   gvsig@gva.es
41
 *      www.gvsig.gva.es
42
 *
43
 *    or
44
 *
45
 *   IVER T.I. S.A
46
 *   Salamanca 50
47
 *   46005 Valencia
48
 *   Spain
49
 *
50
 *   +34 963163400
51
 *   dac@iver.es
52
 */
53
/* CVS MESSAGES:
54
 *
55
 * $Id: FLyrVectEditPropertiesTocMenuEntry2.java 11094 2007-04-10 14:38:10Z jmvivo $
56
 * $Log$
57
 * Revision 1.1.2.2  2007-04-10 14:38:10  jmvivo
58
 * Sustituida la entrada del toc de 'propiedades'
59
 *
60
 * Revision 1.1.2.1  2007/04/10 11:05:45  jaume
61
 * REMOVED UPDATE WINDOW PROPERTIES FROM build.xml
62
 *
63
 * Revision 1.1.2.1  2007/04/10 10:51:49  jaume
64
 * *** empty log message ***
65
 *
66
 * Revision 1.2.2.2  2007/01/23 12:25:44  caballero
67
 * No mostrar propiedades de una capa de anotaciones
68
 *
69
 * Revision 1.2.2.1  2006/11/15 04:10:44  jjdelcerro
70
 * *** empty log message ***
71
 *
72
 * Revision 1.2  2006/10/02 13:52:34  jaume
73
 * organize impots
74
 *
75
 * Revision 1.1  2006/09/15 10:41:30  caballero
76
 * extensibilidad de documentos
77
 *
78
 * Revision 1.1  2006/09/12 15:58:14  jorpiell
79
 * "Sacadas" las opcines del men? de FPopupMenu
80
 *
81
 *
82
 */
83
/**
84
 * Muestra el men? de propiedades del tema.
85
 *
86
 * @author jmorell
87
 */
88

    
89

    
90
public class FLyrVectEditPropertiesTocMenuEntry2 extends AbstractTocContextMenuAction {
91
        public String getGroup() {
92
                return "group2"; //FIXME
93
        }
94

    
95
        public int getGroupOrder() {
96
                return 20;
97
        }
98

    
99
        public int getOrder() {
100
                return 0;
101
        }
102

    
103
        public String getText() {
104
                return PluginServices.getText(this, "propiedades");
105
        }
106

    
107
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
108
                return selectedItems.length == 1;
109
        }
110

    
111
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
112
                if (isTocItemBranch(item)) {
113
                        FLayer lyr = getNodeLayer(item);
114
            if ((lyr instanceof ClassifiableVectorial)) {
115
                    if (!((lyr instanceof FLyrVect) &&
116
                                    !((FLyrVect)lyr).isPropertiesMenuVisible())){
117
                            if (!(lyr instanceof FLyrAnnotation))
118
                                    return true;
119
                    }
120

    
121
            }
122
                }
123
                return false;
124

    
125
        }
126

    
127

    
128
        public void execute(ITocItem item, FLayer[] selectedItems) {
129
                FLayer[] actives = selectedItems;
130
                FThemeManagerWindow2 fThemeManagerWindow;
131
            if (actives.length==1) {
132
                    if (!actives[0].isAvailable()) return;
133
                    System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
134
                    fThemeManagerWindow = new FThemeManagerWindow2();
135
                    try {
136
                            fThemeManagerWindow.setMapContext(getMapContext());
137
                    } catch (com.iver.cit.gvsig.fmap.DriverException e1) {
138
                            e1.printStackTrace();
139
                    }
140
            //PluginServices.getMDIManager().addView(fThemeManagerWindow);
141
                    if (PluginServices.getMainFrame() == null) {
142
                            JDialog dlg = new JDialog();
143
                            fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
144
                            dlg.getContentPane().add(fThemeManagerWindow);
145
                            dlg.setModal(false);
146
                            dlg.pack();
147
                            dlg.show();
148
                    } else {
149
                            PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
150
                    }
151
            } else {
152
                for (int i = 0; i < actives.length; i++){
153
                        if (actives[0].isAvailable()) {
154
                                System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
155
                                fThemeManagerWindow = new FThemeManagerWindow2(actives[i], getMapContext());
156
                                //PluginServices.getMDIManager().addView(fThemeManagerWindow);
157
                                if (PluginServices.getMainFrame() == null) {
158
                                        JDialog dlg = new JDialog();
159
                                        fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
160
                                        dlg.getContentPane().add(fThemeManagerWindow);
161
                                        dlg.setModal(false);
162
                                        dlg.pack();
163
                                        dlg.show();
164
                                } else {
165
                                        PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
166
                                }
167
                        }
168
                }
169
            }
170
        }
171

    
172
}