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