Revision 42175
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1148 | 1148 |
</tool-bar> |
1149 | 1149 |
</extension> |
1150 | 1150 |
|
1151 |
<extension class-name="org.gvsig.app.extension.LayerPropertiesExtension" |
|
1152 |
description="" |
|
1153 |
active="true"> |
|
1151 | 1154 |
|
1155 |
<action |
|
1156 |
name="layer-properties" |
|
1157 |
label="propiedades" |
|
1158 |
tooltip="_Layer_properties" |
|
1159 |
position="609000000" |
|
1160 |
action-command="layer-properties" |
|
1161 |
icon="layer-properties" |
|
1162 |
accelerator="" |
|
1163 |
/> |
|
1164 |
|
|
1165 |
<menu |
|
1166 |
name="layer-properties" |
|
1167 |
text="Layer/propiedades" |
|
1168 |
/> |
|
1169 |
|
|
1170 |
</extension> |
|
1152 | 1171 |
</extensions> |
1153 | 1172 |
|
1154 | 1173 |
</plugin-config> |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/ViewDocument.java | ||
---|---|---|
36 | 36 |
public interface ViewDocument extends Document, ExtendedPropertiesSupport { |
37 | 37 |
|
38 | 38 |
public static final String VIEW_PROPERTIES_PAGE_GROUP = "ViewDocument"; |
39 |
public static final String LAYER_PROPERTIES_PAGE_GROUP = "LayerPropertiesPageGroup"; |
|
39 | 40 |
|
40 | 41 |
/** |
41 | 42 |
* Gets the FMap's contexts of the main map in the view. |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/legend/gui/ThemeManagerWindow.java | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* Copyright (C) 2007-2013 gvSIG Association. |
5 | 5 |
* |
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License
|
|
8 |
* as published by the Free Software Foundation; either version 3
|
|
9 |
* of the License, or (at your option) any later version.
|
|
6 |
* This program is free software; you can redistribute it and/or modify it under
|
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
|
9 |
* version. |
|
10 | 10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14 |
* GNU General Public License for more details.
|
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
14 |
* details. |
|
15 | 15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
20 | 19 |
* |
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
23 | 22 |
*/ |
24 | 23 |
package org.gvsig.app.project.documents.view.legend.gui; |
25 | 24 |
|
26 |
import java.awt.BorderLayout; |
|
27 |
import java.awt.Dimension; |
|
28 |
import java.awt.FlowLayout; |
|
29 |
import java.awt.event.ActionEvent; |
|
30 |
import java.awt.event.ActionListener; |
|
31 | 25 |
import java.util.ArrayList; |
32 |
import java.util.Collections; |
|
33 |
import java.util.Comparator; |
|
34 |
import java.util.Date; |
|
35 |
import java.util.Hashtable; |
|
26 |
import java.util.HashMap; |
|
36 | 27 |
import java.util.List; |
28 |
import java.util.Map; |
|
29 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
37 | 30 |
|
38 |
import javax.swing.JOptionPane; |
|
39 |
import javax.swing.JPanel; |
|
40 |
import javax.swing.JTabbedPane; |
|
41 |
import javax.swing.event.ChangeListener; |
|
42 |
|
|
43 |
import org.gvsig.andami.PluginServices; |
|
44 |
import org.gvsig.andami.ui.mdiManager.IWindow; |
|
45 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
|
46 | 31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
47 |
import org.gvsig.gui.beans.swing.JButton; |
|
32 |
import org.gvsig.fmap.mapcontrol.MapControlLocator; |
|
33 |
import org.gvsig.propertypage.PropertiesPage; |
|
34 |
import org.gvsig.propertypage.PropertiesPageFactory; |
|
35 |
import org.gvsig.propertypage.PropertiesPageManager; |
|
48 | 36 |
import org.slf4j.Logger; |
49 | 37 |
import org.slf4j.LoggerFactory; |
50 | 38 |
|
39 |
public final class ThemeManagerWindow { |
|
51 | 40 |
|
52 |
/** |
|
53 |
* |
|
54 |
* @author jaume dominguez faus - jaume.dominguez@iver.es |
|
55 |
* @version 01-feb-2007 |
|
56 |
*/ |
|
57 |
public final class ThemeManagerWindow extends JPanel implements IWindow, ActionListener { |
|
58 |
private static final Logger logger = LoggerFactory.getLogger(ThemeManagerWindow.class); |
|
59 |
|
|
60 |
private static final long serialVersionUID = 4650656815369149211L; |
|
61 |
private static int selectedTabIndex = 0; |
|
62 |
private static ArrayList<Class<? extends AbstractThemeManagerPage>> pages = |
|
63 |
new ArrayList<Class<? extends AbstractThemeManagerPage>>(); |
|
64 |
private FLayer layer; |
|
65 |
//private Legend legend; // Le asignaremos la leyenda del primer tema activo. |
|
66 |
private JTabbedPane tabs = new JTabbedPane(); // @jve:decl-index=0: |
|
67 |
private JPanel panelButtons; |
|
68 |
private static Hashtable<Class<? extends AbstractThemeManagerPage>, ArrayList<Class<? extends FLayer>>> s = |
|
69 |
new Hashtable<Class<? extends AbstractThemeManagerPage>, ArrayList<Class<? extends FLayer>>>(); |
|
41 |
private static final Logger logger = LoggerFactory.getLogger(ThemeManagerWindow.class); |
|
70 | 42 |
|
43 |
private static final long serialVersionUID = 4650656815369149211L; |
|
44 |
/* |
|
45 |
private static int selectedTabIndex = 0; |
|
46 |
private static ArrayList<Class<? extends AbstractThemeManagerPage>> pages = |
|
47 |
new ArrayList<Class<? extends AbstractThemeManagerPage>>(); |
|
48 |
private FLayer layer; |
|
49 |
private JTabbedPane tabs = new JTabbedPane(); // @jve:decl-index=0: |
|
50 |
private JPanel panelButtons; |
|
51 |
*/ |
|
52 |
private static Map<Class<? extends AbstractThemeManagerPage>, List<Class<? extends FLayer>>> s |
|
53 |
= new HashMap<Class<? extends AbstractThemeManagerPage>, List<Class<? extends FLayer>>>(); |
|
71 | 54 |
|
72 |
/** |
|
73 |
* Sobrecarga del constructor. Este se utiliza cuando se llama a este |
|
74 |
* di?logo desde la barra de comandos. |
|
75 |
* |
|
76 |
*/ |
|
77 |
public ThemeManagerWindow(FLayer l) { |
|
78 |
this.layer = l; |
|
55 |
private static class ThemeManagerPropertiesPageFactory implements PropertiesPageFactory { |
|
79 | 56 |
|
80 |
// TODO falta definir leyenda para cualquier tipo de capa |
|
81 |
// y decidir entonces qu? opciones soporta cada una para |
|
82 |
// que el di?logo se autorrellene |
|
83 |
initialize(); |
|
84 |
} |
|
57 |
private Class<? extends AbstractThemeManagerPage> pageClass; |
|
58 |
private AbstractThemeManagerPage page = null; |
|
85 | 59 |
|
86 |
private void initialize() { |
|
87 |
|
|
88 |
StringBuffer msgerr = new StringBuffer(); |
|
89 |
List<AbstractThemeManagerPage> activePages = this.getActivePages(layer, msgerr); |
|
60 |
public ThemeManagerPropertiesPageFactory(Class<? extends AbstractThemeManagerPage> pageClass) { |
|
61 |
this.pageClass = pageClass; |
|
62 |
} |
|
90 | 63 |
|
91 |
for (int i = 0; i < activePages.size(); i++) { |
|
92 |
AbstractThemeManagerPage tab = activePages.get(i); |
|
93 |
String tabName = null; |
|
94 |
try { |
|
95 |
tab.setModel(layer); |
|
96 |
tabName = tab.getName(); |
|
97 |
} catch( Throwable ex) { |
|
98 |
msgerr.append(translate("_Cant_initialice_property_page_{0}", tabName)) |
|
99 |
.append("\n"); |
|
100 |
logger.warn("Can't set model of property page '"+tabName+"' from class '"+tab.getClass().getName()+"'.", ex); |
|
101 |
} |
|
102 |
tabs.addTab(tabName, tab); |
|
103 |
} |
|
64 |
private AbstractThemeManagerPage getPage(FLayer layer) throws InstantiationException, IllegalAccessException { |
|
65 |
if (this.page == null) { |
|
66 |
AbstractThemeManagerPage p = pageClass.newInstance(); |
|
67 |
p.setModel(layer); |
|
68 |
this.page = p; |
|
69 |
} |
|
70 |
return this.page; |
|
71 |
} |
|
104 | 72 |
|
105 |
if (tabs.getComponentCount()>selectedTabIndex) { |
|
106 |
tabs.setSelectedIndex(selectedTabIndex); |
|
107 |
} |
|
108 |
tabs.setPreferredSize(new java.awt.Dimension(640,390)); |
|
73 |
public String getGroupID() { |
|
74 |
return ViewDocument.LAYER_PROPERTIES_PAGE_GROUP; |
|
75 |
} |
|
109 | 76 |
|
77 |
public boolean isVisible(Object obj) { |
|
78 |
try { |
|
79 |
AbstractThemeManagerPage page = this.getPage((FLayer) obj); |
|
80 |
return page.isTabEnabledForLayer((FLayer) obj); |
|
81 |
} catch (Throwable th) { |
|
82 |
logger.warn("can't determine if the page must be visible to the object '" + obj + "'", th); |
|
83 |
} |
|
84 |
return false; |
|
85 |
} |
|
110 | 86 |
|
111 |
setLayout(new BorderLayout()); |
|
112 |
add(tabs, java.awt.BorderLayout.CENTER); |
|
113 |
|
|
114 |
// The listener must be added after the tabs are added to the window |
|
115 |
tabs.addChangeListener(new ChangeListener() { |
|
116 |
public void stateChanged(javax.swing.event.ChangeEvent e) { |
|
117 |
//remember the visible tab |
|
118 |
selectedTabIndex = tabs.getSelectedIndex(); |
|
119 |
if (selectedTabIndex<0) { |
|
120 |
selectedTabIndex = 0; |
|
121 |
} |
|
122 |
}; |
|
123 |
}); |
|
124 |
add(getPanelButtons(), java.awt.BorderLayout.SOUTH); |
|
125 |
setSize(new Dimension(780, 540)); |
|
126 |
if( msgerr.length()>0 ) { |
|
127 |
PluginServices.getMainFrame().messageDialog(msgerr.toString(), "_Warning", JOptionPane.WARNING_MESSAGE); |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
private List<AbstractThemeManagerPage> getActivePages(FLayer layer, StringBuffer msgerr) { |
|
132 |
List<AbstractThemeManagerPage> activePages = new ArrayList(); |
|
133 |
for (int i = 0; i < pages.size(); i++) { |
|
134 |
Date t1 = new Date(); |
|
135 |
String pageName = "(unknow)"; |
|
136 |
Class<? extends AbstractThemeManagerPage> pageClass = this.pages.get(i); |
|
137 |
AbstractThemeManagerPage page = null; |
|
138 |
try { |
|
139 |
page = pageClass.newInstance(); |
|
140 |
if( page.isTabEnabledForLayer(layer) ) { |
|
141 |
activePages.add(page); |
|
142 |
} |
|
143 |
pageName = page.getName(); |
|
144 |
} catch (Exception e) { |
|
145 |
if( msgerr!=null ) { |
|
146 |
msgerr.append(translate("_Cant_add_property_page_related_to_{0}", pageClass.getName())) |
|
147 |
.append("\n"); |
|
148 |
} |
|
149 |
logger.warn("Can't initialize propety page from class "+pageClass.getName(),e); |
|
150 |
} |
|
151 |
Date t2 = new Date(); |
|
152 |
logger.info("Page "+i+", "+pageName+" loaded in "+ (t2.getTime()-t1.getTime())+" seconds."); |
|
87 |
public PropertiesPage create(Object obj) { |
|
88 |
try { |
|
89 |
return this.getPage((FLayer) obj); |
|
90 |
} catch (Exception ex) { |
|
91 |
logger.warn("Can't create the page '"+this.pageClass+"' asociated to '"+obj+"'.",ex); |
|
92 |
return null; |
|
153 | 93 |
} |
154 |
Collections.sort(activePages, new Comparator<AbstractThemeManagerPage>() { |
|
155 |
public int compare(AbstractThemeManagerPage o1, AbstractThemeManagerPage o2) { |
|
156 |
try { |
|
157 |
// int n = Integer.compare(o1.getPriority(), o2.getPriority()); |
|
158 |
// |
|
159 |
// Integer.compare not is compatible with ava 1.5 use next line for |
|
160 |
// compatibility |
|
161 |
int n = Integer.valueOf(o2.getPriority()).compareTo(Integer.valueOf(o1.getPriority())); |
|
162 |
|
|
163 |
if( n!=0 ) { |
|
164 |
return n; |
|
165 |
} |
|
166 |
return o1.getName().compareToIgnoreCase(o2.getName()); |
|
167 |
} catch(Exception ex) { |
|
168 |
logger.warn("Problems ordering properies page, assume pages have same order.",ex); |
|
169 |
return 0; |
|
170 |
} |
|
171 |
} |
|
172 |
}); |
|
173 |
return activePages; |
|
174 | 94 |
} |
175 |
|
|
176 |
private String translate(String msg, String arg1) { |
|
177 |
String[] args = null; |
|
178 |
String translation = null; |
|
179 |
if (msg == null) { |
|
180 |
return ""; |
|
181 |
} |
|
182 |
if( arg1 != null ) { |
|
183 |
args = new String[] { arg1 }; |
|
184 |
} |
|
185 |
translation = org.gvsig.i18n.Messages.getText(msg, args); |
|
186 |
if (translation == null) { |
|
187 |
return "_"+msg.replace("_", " "); |
|
188 |
} |
|
189 |
return translation; |
|
190 |
} |
|
191 |
|
|
192 |
private JPanel getPanelButtons() { |
|
193 |
if (panelButtons == null) { |
|
194 |
panelButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5,5)); |
|
195 | 95 |
|
196 |
JButton btnAceptar = new JButton(PluginServices.getText(this,"Aceptar")); |
|
197 |
btnAceptar.setActionCommand("OK"); |
|
198 |
btnAceptar.addActionListener(this); |
|
96 |
} |
|
199 | 97 |
|
200 |
JButton btnApply = new JButton(PluginServices.getText(this,"Apply")); |
|
201 |
btnApply.setActionCommand("APPLY"); |
|
202 |
btnApply.addActionListener(this); |
|
98 |
public ThemeManagerWindow() { |
|
99 |
} |
|
203 | 100 |
|
101 |
public static void addPage(Class<? extends AbstractThemeManagerPage> pageClass) { |
|
102 |
PropertiesPageManager manager = MapControlLocator.getPropertiesPageManager(); |
|
103 |
manager.registerFactory(new ThemeManagerPropertiesPageFactory(pageClass)); |
|
104 |
} |
|
204 | 105 |
|
205 |
JButton btnCancelar = new JButton(PluginServices.getText(this,"Cerrar")); |
|
206 |
btnCancelar.setActionCommand("CANCEL"); |
|
207 |
btnCancelar.addActionListener(this); |
|
208 |
panelButtons.setPreferredSize(new java.awt.Dimension(493,33)); |
|
209 |
panelButtons.add(btnCancelar); |
|
210 |
panelButtons.add(btnApply); |
|
211 |
panelButtons.add(btnAceptar); |
|
212 |
} |
|
213 |
return panelButtons; |
|
214 |
} |
|
106 |
public static void setTabEnabledForLayer(Class<? extends AbstractThemeManagerPage> abstractThemeManagerPageClass, Class<? extends FLayer> fLayerClazz, boolean enabled) { |
|
107 |
ArrayList<Class<? extends FLayer>> enabledLayers; |
|
108 |
if (enabled == true) { |
|
109 |
if (!s.containsKey(abstractThemeManagerPageClass)) { |
|
110 |
enabledLayers = new ArrayList<Class<? extends FLayer>>(); |
|
111 |
enabledLayers.add(fLayerClazz); |
|
112 |
s.put(abstractThemeManagerPageClass, enabledLayers); |
|
113 |
} else { |
|
114 |
enabledLayers = (ArrayList<Class<? extends FLayer>>) s.get(abstractThemeManagerPageClass); |
|
115 |
enabledLayers.add(fLayerClazz); |
|
116 |
} |
|
117 |
} else { |
|
118 |
if (!s.containsKey(abstractThemeManagerPageClass)) { |
|
119 |
return; |
|
120 |
} |
|
121 |
enabledLayers = (ArrayList<Class<? extends FLayer>>) s.get(abstractThemeManagerPageClass); |
|
122 |
enabledLayers.remove(fLayerClazz); |
|
123 |
} |
|
124 |
} |
|
215 | 125 |
|
216 |
public void actionPerformed(ActionEvent e) { |
|
217 |
if (e.getActionCommand() == "OK") { |
|
218 |
/* Causes all the tabs in the ThemeManagerWindow to perform THEIR apply-action |
|
219 |
* then fires the LegendChanged event that causes the view to be refreshed. |
|
220 |
* After that, it closes the window. |
|
221 |
*/ |
|
222 |
actionPerformed(new ActionEvent(e.getSource(), e.getID(), "APPLY")); |
|
126 |
; |
|
223 | 127 |
|
224 |
close(); |
|
225 |
} else if (e.getActionCommand() == "CANCEL") { |
|
226 |
/* Causes all the tabs in the ThemeManagerWindow to perform THEIR cancel-action |
|
227 |
* then closes the window. |
|
228 |
*/ |
|
229 |
for (int i = 0; i < tabs.getTabCount(); i++) { |
|
230 |
AbstractThemeManagerPage tab = (AbstractThemeManagerPage) tabs.getComponentAt(i); |
|
231 |
tab.cancelAction(); |
|
232 |
} |
|
233 |
close(); |
|
234 |
} else if (e.getActionCommand() == "APPLY") { |
|
235 |
/* Causes the current visible tab in the ThemeManagerWindow to perform |
|
236 |
* ITS specific apply-action. |
|
237 |
*/ |
|
238 |
for (int i = 0; i < tabs.getTabCount(); i++) { |
|
239 |
AbstractThemeManagerPage tab = (AbstractThemeManagerPage) tabs.getComponentAt(i); |
|
240 |
tab.applyAction(); |
|
241 |
} |
|
242 |
layer.getMapContext().callLegendChanged(); |
|
243 |
} else {} |
|
244 |
// Lots of temporary objects were create. |
|
245 |
// let's try some memory cleanup |
|
246 |
System.gc(); |
|
247 |
} |
|
128 |
public static boolean isTabEnabledForLayer(AbstractThemeManagerPage page, FLayer layer) { |
|
129 |
try { |
|
130 |
return s.get(page.getClass()).contains(layer.getClass()); |
|
131 |
} catch (Exception ex) { |
|
132 |
return false; |
|
133 |
} |
|
134 |
} |
|
248 | 135 |
|
249 |
private void close() { |
|
250 |
PluginServices.getMDIManager().closeWindow(ThemeManagerWindow.this); |
|
251 |
} |
|
136 |
} |
|
252 | 137 |
|
253 |
public WindowInfo getWindowInfo() { |
|
254 |
WindowInfo viewInfo = new WindowInfo(WindowInfo.MODELESSDIALOG|WindowInfo.RESIZABLE); |
|
255 |
viewInfo.setWidth(getWidth()); |
|
256 |
viewInfo.setHeight(getHeight()); |
|
257 |
viewInfo.setTitle(PluginServices.getText(this,"propiedades_de_la_capa")); |
|
258 |
return viewInfo; |
|
259 |
} |
|
260 | 138 |
|
261 |
public static void addPage(Class<? extends AbstractThemeManagerPage> abstractThemeManagerPageClass) { |
|
262 |
pages.add(abstractThemeManagerPageClass); |
|
263 |
} |
|
264 |
|
|
265 |
public static void setTabEnabledForLayer(Class<? extends AbstractThemeManagerPage> abstractThemeManagerPageClass, Class<? extends FLayer> fLayerClazz, boolean enabled) { |
|
266 |
ArrayList<Class<? extends FLayer>> enabledLayers; |
|
267 |
if (enabled == true) { |
|
268 |
if (!s.containsKey(abstractThemeManagerPageClass)) { |
|
269 |
enabledLayers = new ArrayList<Class<? extends FLayer>> (); |
|
270 |
enabledLayers.add(fLayerClazz); |
|
271 |
s.put(abstractThemeManagerPageClass, enabledLayers); |
|
272 |
} else { |
|
273 |
enabledLayers = s.get(abstractThemeManagerPageClass); |
|
274 |
enabledLayers.add(fLayerClazz); |
|
275 |
} |
|
276 |
} else { |
|
277 |
if (!s.containsKey(abstractThemeManagerPageClass)) { |
|
278 |
return; |
|
279 |
} |
|
280 |
enabledLayers = s.get(abstractThemeManagerPageClass); |
|
281 |
enabledLayers.remove(fLayerClazz); |
|
282 |
} |
|
283 |
}; |
|
284 |
|
|
285 |
public static boolean isTabEnabledForLayer(AbstractThemeManagerPage page, FLayer layer) { |
|
286 |
try { |
|
287 |
return s.get(page.getClass()).contains(layer.getClass()); |
|
288 |
} catch( Exception ex) { |
|
289 |
return false; |
|
290 |
} |
|
291 |
} |
|
292 |
|
|
293 |
public Object getWindowProfile() { |
|
294 |
return WindowInfo.TOOL_PROFILE; |
|
295 |
}; |
|
296 |
} // @jve:decl-index=0:visual-constraint="10,10" |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/FPanelLocConfig.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
import java.awt.BorderLayout; |
27 | 27 |
import java.awt.Color; |
28 |
import java.awt.FlowLayout; |
|
29 | 28 |
import java.awt.GridLayout; |
30 | 29 |
import java.awt.event.ActionEvent; |
31 | 30 |
import java.awt.event.ActionListener; |
... | ... | |
33 | 32 |
import javax.swing.BorderFactory; |
34 | 33 |
import javax.swing.DefaultListModel; |
35 | 34 |
import javax.swing.JButton; |
36 |
import javax.swing.JComponent; |
|
37 | 35 |
import javax.swing.JDialog; |
38 | 36 |
import javax.swing.JLabel; |
39 |
import javax.swing.JList; |
|
40 | 37 |
import javax.swing.JOptionPane; |
41 | 38 |
import javax.swing.JPanel; |
42 |
import javax.swing.ListModel; |
|
43 | 39 |
import javax.swing.SwingUtilities; |
44 | 40 |
import javax.swing.plaf.basic.BasicArrowButton; |
45 | 41 |
|
... | ... | |
51 | 47 |
import org.gvsig.andami.ui.mdiManager.WindowInfo; |
52 | 48 |
import org.gvsig.app.extension.AddLayer; |
53 | 49 |
import org.gvsig.app.project.documents.view.MapOverview; |
54 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
|
|
50 |
import org.gvsig.app.project.documents.view.ViewDocument;
|
|
55 | 51 |
import org.gvsig.fmap.mapcontext.layers.CancelationException; |
56 | 52 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
57 | 53 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
58 | 54 |
import org.gvsig.fmap.mapcontext.layers.operations.Classifiable; |
59 | 55 |
import org.gvsig.fmap.mapcontrol.MapControl; |
56 |
import org.gvsig.tools.ToolsLocator; |
|
60 | 57 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
58 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
61 | 59 |
|
62 | 60 |
/** |
63 | 61 |
* @author FJP |
... | ... | |
345 | 343 |
FLayer lyr = lli.getLayer(); |
346 | 344 |
|
347 | 345 |
if (lyr instanceof Classifiable) { |
348 |
ThemeManagerWindow m_LegendEditor = |
|
349 |
new ThemeManagerWindow(lyr/* , mapCtrl.getMapContext() */); |
|
350 |
theLayers.setActive(false); |
|
351 |
lyr.setActive(true); |
|
352 |
if (PluginServices.getMainFrame() == null) { |
|
353 |
JDialog dlg = new JDialog(); |
|
346 |
LayerProperties dlg = new LayerProperties(lyr); |
|
347 |
WindowManager wm = ToolsSwingLocator.getWindowManager(); |
|
348 |
wm.showWindow( |
|
349 |
dlg.asJComponent(), |
|
350 |
ToolsLocator.getI18nManager().getTranslation("propiedades_de_la_capa"), |
|
351 |
WindowManager.MODE.DIALOG |
|
352 |
); |
|
354 | 353 |
|
355 |
m_LegendEditor.setPreferredSize(m_LegendEditor |
|
356 |
.getSize()); |
|
357 |
dlg.getContentPane().add(m_LegendEditor); |
|
358 |
dlg.setModal(true); |
|
359 |
dlg.pack(); |
|
360 |
dlg.setVisible(true); |
|
361 |
|
|
362 |
} else { |
|
363 |
PluginServices.getMDIManager() |
|
364 |
.addWindow(m_LegendEditor); |
|
365 |
} |
|
366 | 354 |
} else { |
367 | 355 |
JOptionPane.showMessageDialog( |
368 | 356 |
null, |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/gui/LayerProperties.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.app.project.documents.view.gui; |
|
25 |
|
|
26 |
import java.awt.Dimension; |
|
27 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
28 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
29 |
import org.gvsig.propertypage.BasePropertiesPageDialog; |
|
30 |
|
|
31 |
/** |
|
32 |
* Dialogo donde se muestran las propiedades de una capa |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
*/ |
|
36 |
public class LayerProperties extends BasePropertiesPageDialog { |
|
37 |
|
|
38 |
private static final long serialVersionUID = 5328865370833315385L; |
|
39 |
|
|
40 |
public LayerProperties(FLayer layer) { |
|
41 |
super(layer,ViewDocument.LAYER_PROPERTIES_PAGE_GROUP); |
|
42 |
this.setPreferredSize(new Dimension(778, 570)); |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
protected boolean useTabsAlwais() { |
|
47 |
return super.useTabsAlwais(); |
|
48 |
// return true; |
|
49 |
} |
|
50 |
|
|
51 |
} |
|
0 | 52 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/ViewManager.java | ||
---|---|---|
148 | 148 |
this.addTOCContextAction(action); |
149 | 149 |
} |
150 | 150 |
|
151 |
public void addTOCContextAction(String theAction, String group, int groupOrder, int order) { |
|
152 |
ActionInfoManager actionManager = PluginsLocator.getActionInfoManager(); |
|
153 |
ActionInfo action = actionManager.getAction(theAction); |
|
154 |
if( action==null ) { |
|
155 |
String errmsg = "Action '"+theAction+"' not found"; |
|
156 |
logger.info(errmsg); |
|
157 |
throw new RuntimeException(errmsg); |
|
158 |
} |
|
159 |
this.addTOCContextAction( |
|
160 |
action.getName(), |
|
161 |
new ActionInfoAdapterToContextMenuAction(action, group, groupOrder,0) |
|
162 |
); |
|
163 |
} |
|
164 |
|
|
151 | 165 |
public void addTOCContextAction(ActionInfo action) { |
152 | 166 |
this.addTOCContextAction(action.getName(), new ActionInfoAdapterToContextMenuAction(action, "default", 10000)); |
153 | 167 |
} |
... | ... | |
161 | 175 |
ActionInfoAdapterToContextMenuAction(ActionInfo action, String group, int groupOrder) { |
162 | 176 |
super(action, group, groupOrder); |
163 | 177 |
} |
178 |
ActionInfoAdapterToContextMenuAction(ActionInfo action, String group, int groupOrder, int order) { |
|
179 |
super(action, group, groupOrder,order); |
|
180 |
} |
|
164 | 181 |
} |
165 | 182 |
|
166 | 183 |
/** |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/actions/FLyrVectEditPropertiesTocMenuEntry.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.app.project.documents.view.toc.actions; |
25 | 25 |
|
26 |
import javax.swing.JDialog; |
|
27 | 26 |
|
28 | 27 |
import org.gvsig.andami.PluginServices; |
29 | 28 |
import org.gvsig.app.extension.ProjectExtension; |
30 | 29 |
import org.gvsig.app.project.Project; |
31 |
import org.gvsig.app.project.documents.view.legend.gui.ThemeManagerWindow;
|
|
30 |
import org.gvsig.app.project.documents.view.gui.LayerProperties;
|
|
32 | 31 |
import org.gvsig.app.project.documents.view.toc.AbstractTocContextMenuAction; |
33 | 32 |
import org.gvsig.app.project.documents.view.toc.ITocItem; |
34 | 33 |
import org.gvsig.app.project.documents.view.toc.TocItemBranch; |
35 | 34 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
36 | 35 |
import org.gvsig.fmap.mapcontext.layers.operations.ClassifiableVectorial; |
37 | 36 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
37 |
import org.gvsig.tools.ToolsLocator; |
|
38 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
39 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
38 | 40 |
|
39 | 41 |
/** |
40 | 42 |
* Muestra el men? de propiedades del tema. |
... | ... | |
93 | 95 |
// long t1 = System.currentTimeMillis(); |
94 | 96 |
|
95 | 97 |
FLayer lyr = getNodeLayer(item); |
96 |
ThemeManagerWindow fThemeManagerWindow = null; |
|
97 | 98 |
|
98 | 99 |
if (lyr.isAvailable()) { |
99 |
fThemeManagerWindow = new ThemeManagerWindow(lyr); |
|
100 |
} |
|
100 |
LayerProperties dlg = new LayerProperties(lyr); |
|
101 |
WindowManager wm = ToolsSwingLocator.getWindowManager(); |
|
102 |
wm.showWindow( |
|
103 |
dlg.asJComponent(), |
|
104 |
ToolsLocator.getI18nManager().getTranslation("propiedades_de_la_capa"), |
|
105 |
WindowManager.MODE.WINDOW |
|
106 |
); |
|
107 |
} |
|
101 | 108 |
|
102 |
if (PluginServices.getMainFrame() == null) { |
|
103 |
JDialog dlg = new JDialog(); |
|
104 |
fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize()); |
|
105 |
dlg.getContentPane().add(fThemeManagerWindow); |
|
106 |
dlg.setModal(false); |
|
107 |
dlg.pack(); |
|
108 |
dlg.setVisible(true); |
|
109 |
// System.err.println("open properties dialog time: "+(System.currentTimeMillis()-t1)); |
|
110 |
} else { |
|
111 |
// System.err.println("open properties dialog time: "+(System.currentTimeMillis()-t1)); |
|
112 |
PluginServices.getMDIManager().addWindow(fThemeManagerWindow); |
|
113 |
} |
|
114 |
|
|
115 | 109 |
Project project=((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject(); |
116 | 110 |
project.setModified(true); |
117 | 111 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/project/documents/view/toc/gui/FPopupMenu.java | ||
---|---|---|
89 | 89 |
|
90 | 90 |
viewManager.addTOCContextAction("FSymbolChangeColor", new ChangeSymbolTocMenuEntry()); |
91 | 91 |
viewManager.addTOCContextAction("ChangeName", new ChangeNameTocMenuEntry()); |
92 |
viewManager.addTOCContextAction("FLyrVectEditProperties", new FLyrVectEditPropertiesTocMenuEntry()); |
|
92 |
// viewManager.addTOCContextAction("FLyrVectEditProperties", new FLyrVectEditPropertiesTocMenuEntry());
|
|
93 | 93 |
viewManager.addTOCContextAction("ZoomAlTema", new ZoomAlTemaTocMenuEntry()); |
94 | 94 |
viewManager.addTOCContextAction("EliminarCapa", new EliminarCapaTocMenuEntry()); |
95 | 95 |
viewManager.addTOCContextAction("VerErroresCapa", new ShowLayerErrorsTocMenuEntry()); |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/LayerPropertiesExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or modify it under |
|
7 |
* the terms of the GNU General Public License as published by the Free Software |
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later |
|
9 |
* version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
14 |
* details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License along with |
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51 |
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
19 |
* |
|
20 |
* For any additional information, do not hesitate to contact us at info AT |
|
21 |
* gvsig.com, or visit our website www.gvsig.com. |
|
22 |
*/ |
|
23 |
package org.gvsig.app.extension; |
|
24 |
|
|
25 |
import org.gvsig.andami.plugins.Extension; |
|
26 |
import org.gvsig.app.ApplicationLocator; |
|
27 |
import org.gvsig.app.ApplicationManager; |
|
28 |
import org.gvsig.app.project.documents.view.ViewDocument; |
|
29 |
import org.gvsig.app.project.documents.view.gui.IView; |
|
30 |
import org.gvsig.app.project.documents.view.gui.LayerProperties; |
|
31 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
32 |
import org.gvsig.tools.ToolsLocator; |
|
33 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
34 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
35 |
|
|
36 |
public class LayerPropertiesExtension extends Extension { |
|
37 |
|
|
38 |
public void initialize() { |
|
39 |
} |
|
40 |
|
|
41 |
public void execute(String s) { |
|
42 |
|
|
43 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
44 |
|
|
45 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
46 |
if (view == null) { |
|
47 |
return; |
|
48 |
} |
|
49 |
ViewDocument document = view.getViewDocument(); |
|
50 |
if (!document.getMapContext().hasActiveVectorLayers()) { |
|
51 |
return; |
|
52 |
} |
|
53 |
|
|
54 |
if (s.equalsIgnoreCase("layer-properties")) { |
|
55 |
FLayer layer = document.getMapContext().getLayers().getActives()[0]; |
|
56 |
LayerProperties dlg = new LayerProperties(layer); |
|
57 |
WindowManager wm = ToolsSwingLocator.getWindowManager(); |
|
58 |
wm.showWindow( |
|
59 |
dlg.asJComponent(), |
|
60 |
ToolsLocator.getI18nManager().getTranslation("propiedades_de_la_capa"), |
|
61 |
WindowManager.MODE.WINDOW |
|
62 |
); |
|
63 |
} |
|
64 |
} |
|
65 |
|
|
66 |
public boolean isEnabled() { |
|
67 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
68 |
|
|
69 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
70 |
if (view == null) { |
|
71 |
return false; |
|
72 |
} |
|
73 |
ViewDocument document = view.getViewDocument(); |
|
74 |
return document.getMapContext().hasActiveVectorLayers(); |
|
75 |
} |
|
76 |
|
|
77 |
public boolean isVisible() { |
|
78 |
ApplicationManager application = ApplicationLocator.getManager(); |
|
79 |
|
|
80 |
IView view = (IView) application.getActiveComponent(ViewDocument.class); |
|
81 |
if (view == null) { |
|
82 |
return false; |
|
83 |
} |
|
84 |
ViewDocument document = view.getViewDocument(); |
|
85 |
return document.getMapContext().hasVectorLayers(); |
|
86 |
} |
|
87 |
|
|
88 |
} |
|
0 | 89 |
trunk/org.gvsig.desktop/org.gvsig.desktop.plugin/org.gvsig.app/org.gvsig.app.mainplugin/src/main/java/org/gvsig/app/extension/ViewControls.java | ||
---|---|---|
218 | 218 |
ProjectManager projectManager = ApplicationLocator.getProjectManager(); |
219 | 219 |
ViewManager viewManager = (ViewManager) projectManager.getDocumentManager(ViewManager.TYPENAME); |
220 | 220 |
viewManager.addTOCContextAction("view-layer-add"); |
221 |
viewManager.addTOCContextAction("layer-properties","group2",20,0); |
|
221 | 222 |
} |
222 | 223 |
|
223 | 224 |
private void registerIcons() { |
Also available in: Unified diff