Statistics
| Revision:

svn-gvsig-desktop / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / documents / view / toc / actions / FLyrVectEditPropertiesTocMenuEntry.java @ 15957

History | View | Annotate | Download (4.77 KB)

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