Statistics
| Revision:

root / branches / v10 / extensions / extWFS2 / src / com / iver / cit / gvsig / gui / toc / WFSVectorialPropsTocMenuEntry.java @ 8847

History | View | Annotate | Download (4.55 KB)

1
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
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

    
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: WFSVectorialPropsTocMenuEntry.java 8847 2006-11-17 11:29:00Z ppiqueras $
60
 * $Log$
61
 * Revision 1.2.2.2  2006-11-17 11:28:45  ppiqueras
62
 * Corregidos bugs y a?adida nueva funcionalidad.
63
 *
64
 * Revision 1.4  2006/10/02 09:09:45  jorpiell
65
 * Cambios del 10 copiados al head
66
 *
67
 * Revision 1.2  2006/08/29 07:56:12  cesar
68
 * Rename the *View* family of classes to *Window* (ie: SingletonView to SingletonWindow, ViewInfo to WindowInfo, etc)
69
 *
70
 * Revision 1.1  2006/07/05 12:05:41  jorpiell
71
 * Se ha modificado para que avise si se han recuperado las mismas features que marca el campo buffer
72
 *
73
 *
74
 */
75
/**
76
 * @author Jorge Piera Llodr? (piera_jor@gva.es)
77
 */
78
public class WFSVectorialPropsTocMenuEntry extends TocMenuEntry{
79
        private JMenuItem prop;
80
        public void initialize(FPopupMenu m) {
81
                super.initialize(m);
82
                FLayer lyr = null;
83
                if (isTocItemBranch()) {                        
84
                        lyr = getNodeLayer();
85
            if ((lyr instanceof FLyrWFS)) {
86
                                prop = new JMenuItem(PluginServices.getText(this, "propiedades"));
87
                                getMenu().add(prop);
88
                                prop.setFont(FPopupMenu.theFont);
89
                                if (getMapContext().getLayers().getActives().length == 1) {
90
                                        prop.setEnabled(true);
91
                                } else {
92
                                        prop.setEnabled(false);
93
                                }
94
                                //Cambio estilo
95
                                prop.addActionListener(this);
96
                                
97
                        }
98
                }
99
        }
100
        public void actionPerformed(ActionEvent e) {
101
                FLayer[] actives = getMapContext().getLayers().getActives();
102
                FThemeManagerWindow fThemeManagerWindow;
103
                if (actives.length==1) {
104
                        System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
105
                        fThemeManagerWindow = new FThemeManagerWindow();
106
                        try {
107
                                fThemeManagerWindow.setMapContext(getMapContext());
108
                        } catch (com.iver.cit.gvsig.fmap.DriverException e1) {
109
                                e1.printStackTrace();
110
                        }
111
                        //PluginServices.getMDIManager().addView(fThemeManagerWindow);
112
                        if (PluginServices.getMainFrame() == null) {
113
                                JDialog dlg = new JDialog();
114
                                fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
115
                                dlg.getContentPane().add(fThemeManagerWindow);
116
                                dlg.setModal(false);
117
                                dlg.pack();
118
                                dlg.show();
119
                        } else {
120
                                PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
121
                        }
122
                } else {
123
                        for (int i = 0; i < actives.length; i++){
124
                                System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
125
                                fThemeManagerWindow = new FThemeManagerWindow(actives[i], getMapContext());
126
                                //PluginServices.getMDIManager().addView(fThemeManagerWindow);
127
                                if (PluginServices.getMainFrame() == null) {
128
                                        JDialog dlg = new JDialog();
129
                                        fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
130
                                        dlg.getContentPane().add(fThemeManagerWindow);
131
                                        dlg.setModal(false);
132
                                        dlg.pack();
133
                                        dlg.show();
134
                                } else {
135
                                        PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
136
                                }
137
                        }
138
                }                
139
        }
140
        
141
        
142
}