Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / toc / actions / FLyrVectEditPropertiesTocMenuEntry.java @ 12213

History | View | Annotate | Download (5.51 KB)

1 7304 caballero
package com.iver.cit.gvsig.project.documents.view.toc.actions;
2
3
import javax.swing.JDialog;
4
5 10626 caballero
import com.hardcode.gdbms.driver.exceptions.ReadDriverException;
6 7304 caballero
import com.iver.andami.PluginServices;
7 9532 caballero
import com.iver.cit.gvsig.ProjectExtension;
8 7304 caballero
import com.iver.cit.gvsig.fmap.layers.FLayer;
9 9861 caballero
import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
10 7304 caballero
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
11
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
12 9532 caballero
import com.iver.cit.gvsig.project.Project;
13 10679 jaume
import com.iver.cit.gvsig.project.documents.view.legend.gui.ThemeManagerWindow;
14 7304 caballero
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
15
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
16
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
17
 *
18
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
19
 *
20
 * This program is free software; you can redistribute it and/or
21
 * modify it under the terms of the GNU General Public License
22
 * as published by the Free Software Foundation; either version 2
23
 * of the License, or (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
33
 *
34
 * For more information, contact:
35
 *
36
 *  Generalitat Valenciana
37
 *   Conselleria d'Infraestructures i Transport
38
 *   Av. Blasco Ib??ez, 50
39
 *   46010 VALENCIA
40
 *   SPAIN
41
 *
42
 *      +34 963862235
43
 *   gvsig@gva.es
44
 *      www.gvsig.gva.es
45
 *
46
 *    or
47
 *
48
 *   IVER T.I. S.A
49
 *   Salamanca 50
50
 *   46005 Valencia
51
 *   Spain
52
 *
53
 *   +34 963163400
54
 *   dac@iver.es
55
 */
56
/* CVS MESSAGES:
57
 *
58
 * $Id$
59
 * $Log$
60 10679 jaume
 * Revision 1.6  2007-03-09 11:25:00  jaume
61
 * Advanced symbology (start committing)
62 10626 caballero
 *
63 10679 jaume
 * Revision 1.4.2.3  2007/02/01 12:12:41  jaume
64
 * theme manager window and all its components are now dynamic
65
 *
66
 * Revision 1.4.2.2  2007/01/30 18:10:10  jaume
67
 * start commiting labeling stuff
68
 *
69
 * Revision 1.4.2.1  2007/01/26 13:49:03  jaume
70
 * *** empty log message ***
71
 *
72 10626 caballero
 * Revision 1.4  2007/01/23 13:10:45  caballero
73 9861 caballero
 * no mostrar propiedades de una capa de anotaciones
74
 *
75
 * Revision 1.3  2007/01/04 07:24:31  caballero
76 9532 caballero
 * isModified
77
 *
78
 * Revision 1.2  2006/10/02 13:52:34  jaume
79 7738 jaume
 * organize impots
80
 *
81
 * Revision 1.1  2006/09/15 10:41:30  caballero
82 7304 caballero
 * extensibilidad de documentos
83
 *
84
 * Revision 1.1  2006/09/12 15:58:14  jorpiell
85
 * "Sacadas" las opcines del men? de FPopupMenu
86
 *
87
 *
88
 */
89
/**
90
 * Muestra el men? de propiedades del tema.
91
 *
92
 * @author jmorell
93
 */
94
95
96
public class FLyrVectEditPropertiesTocMenuEntry extends AbstractTocContextMenuAction {
97
        public String getGroup() {
98
                return "group2"; //FIXME
99
        }
100
101
        public int getGroupOrder() {
102
                return 20;
103
        }
104
105
        public int getOrder() {
106
                return 0;
107
        }
108
109
        public String getText() {
110
                return PluginServices.getText(this, "propiedades");
111
        }
112
113
        public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
114
                return selectedItems.length == 1;
115
        }
116
117
        public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
118
                if (isTocItemBranch(item)) {
119
                        FLayer lyr = getNodeLayer(item);
120
            if ((lyr instanceof ClassifiableVectorial)) {
121
                    if (!((lyr instanceof FLyrVect) &&
122
                                    !((FLyrVect)lyr).isPropertiesMenuVisible())){
123 9861 caballero
                            if (!(lyr instanceof FLyrAnnotation))
124
                                    return true;
125 7304 caballero
                    }
126
127
            }
128
                }
129
                return false;
130
131
        }
132
133
134
        public void execute(ITocItem item, FLayer[] selectedItems) {
135
                FLayer[] actives = selectedItems;
136 10679 jaume
                ThemeManagerWindow fThemeManagerWindow;
137
//            if (actives.length==1) {
138
//                    if (!actives[0].isAvailable()) return;
139
//                    fThemeManagerWindow = new ThemeManagerWindow();
140
//                    try {
141
//                            fThemeManagerWindow.setMapContext(getMapContext());
142
//                    } catch (com.iver.cit.gvsig.fmap.DriverException e1) {
143
//                            e1.printStackTrace();
144
//                    }
145
//            //PluginServices.getMDIManager().addView(fThemeManagerWindow);
146
//                    if (PluginServices.getMainFrame() == null) {
147
//                            JDialog dlg = new JDialog();
148
//                            fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
149
//                            dlg.getContentPane().add(fThemeManagerWindow);
150
//                            dlg.setModal(false);
151
//                            dlg.pack();
152
//                            dlg.show();
153
//                    } else {
154
//                            PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
155
//                    }
156
//            } else {
157 7304 caballero
                for (int i = 0; i < actives.length; i++){
158
                        if (actives[0].isAvailable()) {
159
                                System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
160 10679 jaume
                                fThemeManagerWindow = new ThemeManagerWindow(actives[i]/*, getMapContext()*/);
161 7304 caballero
                                //PluginServices.getMDIManager().addView(fThemeManagerWindow);
162
                                if (PluginServices.getMainFrame() == null) {
163
                                        JDialog dlg = new JDialog();
164
                                        fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
165
                                        dlg.getContentPane().add(fThemeManagerWindow);
166
                                        dlg.setModal(false);
167
                                        dlg.pack();
168
                                        dlg.show();
169
                                } else {
170
                                        PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
171
                                }
172
                        }
173
                }
174 10679 jaume
//            }
175 9532 caballero
            Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
176
                project.setModified(true);
177 7304 caballero
        }
178
179
}