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