Statistics
| Revision:

svn-gvsig-desktop / trunk / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / toc / WFSVectorialPropsTocMenuEntry.java @ 10072

History | View | Annotate | Download (4.45 KB)

1 6201 jorpiell
package com.iver.cit.gvsig.gui.toc;
2
3
import java.awt.event.ActionEvent;
4
5
import javax.swing.JDialog;
6
import javax.swing.JMenuItem;
7
8
import com.iver.andami.PluginServices;
9
import com.iver.cit.gvsig.fmap.layers.FLayer;
10
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
11
import com.iver.cit.gvsig.fmap.layers.FLyrWFS;
12
import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
13 7304 caballero
import com.iver.cit.gvsig.project.documents.view.legend.gui.FThemeManagerWindow;
14
import com.iver.cit.gvsig.project.documents.view.toc.TocMenuEntry;
15
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu;
16 6201 jorpiell
17
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
18
 *
19
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
20
 *
21
 * This program is free software; you can redistribute it and/or
22
 * modify it under the terms of the GNU General Public License
23
 * as published by the Free Software Foundation; either version 2
24
 * of the License, or (at your option) any later version.
25
 *
26
 * This program is distributed in the hope that it will be useful,
27
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29
 * GNU General Public License for more details.
30
 *
31
 * You should have received a copy of the GNU General Public License
32
 * along with this program; if not, write to the Free Software
33
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
34
 *
35
 * For more information, contact:
36
 *
37
 *  Generalitat Valenciana
38
 *   Conselleria d'Infraestructures i Transport
39
 *   Av. Blasco Ib??ez, 50
40
 *   46010 VALENCIA
41
 *   SPAIN
42
 *
43
 *      +34 963862235
44
 *   gvsig@gva.es
45
 *      www.gvsig.gva.es
46
 *
47
 *    or
48
 *
49
 *   IVER T.I. S.A
50
 *   Salamanca 50
51
 *   46005 Valencia
52
 *   Spain
53
 *
54
 *   +34 963163400
55
 *   dac@iver.es
56
 */
57
/* CVS MESSAGES:
58
 *
59
 * $Id$
60
 * $Log$
61 7721 jorpiell
 * Revision 1.4  2006-10-02 09:09:45  jorpiell
62
 * Cambios del 10 copiados al head
63 7304 caballero
 *
64
 * Revision 1.2  2006/08/29 07:56:12  cesar
65 6880 cesar
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
66
 *
67
 * Revision 1.1  2006/07/05 12:05:41  jorpiell
68 6201 jorpiell
 * Se ha modificado para que avise si se han recuperado las mismas features que marca el campo buffer
69
 *
70
 *
71
 */
72
/**
73
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
74
 */
75
public class WFSVectorialPropsTocMenuEntry extends TocMenuEntry{
76
        private JMenuItem prop;
77
        public void initialize(FPopupMenu m) {
78
                super.initialize(m);
79
                FLayer lyr = null;
80
                if (isTocItemBranch()) {
81
                        lyr = getNodeLayer();
82
            if ((lyr instanceof FLyrWFS)) {
83
                                prop = new JMenuItem(PluginServices.getText(this, "propiedades"));
84
                                getMenu().add(prop);
85
                                prop.setFont(FPopupMenu.theFont);
86
                                if (getMapContext().getLayers().getActives().length == 1) {
87
                                        prop.setEnabled(true);
88
                                } else {
89
                                        prop.setEnabled(false);
90
                                }
91
                                //Cambio estilo
92
                                prop.addActionListener(this);
93
94
                        }
95
                }
96
        }
97
        public void actionPerformed(ActionEvent e) {
98
                FLayer[] actives = getMapContext().getLayers().getActives();
99
                FThemeManagerWindow fThemeManagerWindow;
100
                if (actives.length==1) {
101
                        System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
102
                        fThemeManagerWindow = new FThemeManagerWindow();
103
                        try {
104
                                fThemeManagerWindow.setMapContext(getMapContext());
105
                        } catch (com.iver.cit.gvsig.fmap.DriverException e1) {
106
                                e1.printStackTrace();
107
                        }
108
                        //PluginServices.getMDIManager().addView(fThemeManagerWindow);
109
                        if (PluginServices.getMainFrame() == null) {
110
                                JDialog dlg = new JDialog();
111
                                fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
112
                                dlg.getContentPane().add(fThemeManagerWindow);
113
                                dlg.setModal(false);
114
                                dlg.pack();
115
                                dlg.show();
116
                        } else {
117 6880 cesar
                                PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
118 6201 jorpiell
                        }
119
                } else {
120
                        for (int i = 0; i < actives.length; i++){
121
                                System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
122
                                fThemeManagerWindow = new FThemeManagerWindow(actives[i], getMapContext());
123
                                //PluginServices.getMDIManager().addView(fThemeManagerWindow);
124
                                if (PluginServices.getMainFrame() == null) {
125
                                        JDialog dlg = new JDialog();
126
                                        fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
127
                                        dlg.getContentPane().add(fThemeManagerWindow);
128
                                        dlg.setModal(false);
129
                                        dlg.pack();
130
                                        dlg.show();
131
                                } else {
132 6880 cesar
                                        PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
133 6201 jorpiell
                                }
134
                        }
135
                }
136
        }
137
138
139
}