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