Revision 43599
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/legendactions/SaveLegendAction.java | ||
---|---|---|
3 | 3 |
import java.awt.event.ActionEvent; |
4 | 4 |
import java.io.File; |
5 | 5 |
import java.util.List; |
6 |
|
|
6 | 7 |
import javax.swing.Action; |
7 | 8 |
import javax.swing.JFileChooser; |
8 | 9 |
import javax.swing.JOptionPane; |
10 |
|
|
11 |
import org.slf4j.Logger; |
|
12 |
import org.slf4j.LoggerFactory; |
|
13 |
|
|
9 | 14 |
import org.gvsig.andami.PluginServices; |
10 | 15 |
import org.gvsig.app.ApplicationLocator; |
11 | 16 |
import org.gvsig.app.project.documents.view.legend.gui.LegendFileFilter; |
... | ... | |
20 | 25 |
public class SaveLegendAction extends AbstractLoadSaveLegendAction { |
21 | 26 |
|
22 | 27 |
private static final long serialVersionUID = -382469306285635077L; |
28 |
private static final Logger logger = LoggerFactory.getLogger(SaveLegendAction.class); |
|
23 | 29 |
|
24 | 30 |
public SaveLegendAction() { |
25 | 31 |
super(); |
26 | 32 |
this.putValue(Action.NAME, PluginServices.getText(this, "Guardar_leyenda") + "..."); |
27 | 33 |
} |
28 |
|
|
34 |
|
|
29 | 35 |
@Override |
30 | 36 |
public void actionPerformed(ActionEvent e) { |
31 | 37 |
if( ! (e.getSource() instanceof LegendsPanel) ) { |
... | ... | |
34 | 40 |
try { |
35 | 41 |
saveLegend((LegendsPanel) e.getSource()); |
36 | 42 |
} catch (Exception exc) { |
43 |
logger.warn("_Unable_to_save_legend", exc); |
|
37 | 44 |
JOptionPane.showMessageDialog( |
38 | 45 |
ApplicationLocator.getManager().getRootComponent(), |
39 | 46 |
Messages.getText("_Unable_to_save_legend") |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.api/src/main/java/org/gvsig/symbology/SymbologyManager.java | ||
---|---|---|
29 | 29 |
import java.util.Collection; |
30 | 30 |
|
31 | 31 |
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
32 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendReader; |
|
32 | 33 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass; |
33 | 34 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClassFactory; |
34 | 35 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingMethod; |
... | ... | |
50 | 51 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.IMask; |
51 | 52 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.style.ISimpleLineStyle; |
52 | 53 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.text.ISimpleTextSymbol; |
54 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
|
53 | 55 |
|
54 | 56 |
/** |
55 | 57 |
* Basic symbology manager. |
... | ... | |
116 | 118 |
* Creates an instance of a class (provided by this manager) which |
117 | 119 |
* implements ILabelClass. |
118 | 120 |
* |
119 |
* @return
|
|
121 |
* @return |
|
120 | 122 |
*/ |
121 | 123 |
ILabelClass createDefaultLabel(); |
122 |
|
|
124 |
|
|
123 | 125 |
public ILabelClassFactory getDefaultLabelFactory(); |
124 | 126 |
|
125 | 127 |
public void setDefaultLabelFactory(String id); |
126 | 128 |
|
127 | 129 |
public void setDefaultLabelFactory(ILabelClassFactory factory); |
128 |
|
|
130 |
|
|
129 | 131 |
public PathLength createPathLength(Shape path); |
132 |
|
|
133 |
/** |
|
134 |
* @return |
|
135 |
*/ |
|
136 |
ILegendWriter getDefaultLegendWriter(); |
|
130 | 137 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.library/org.gvsig.symbology/org.gvsig.symbology.lib/org.gvsig.symbology.lib.impl/src/main/java/org/gvsig/symbology/impl/DefaultSymbologyManager.java | ||
---|---|---|
25 | 25 |
* |
26 | 26 |
* Copyright (C) 2007-2008 Infrastructures and Transports Department |
27 | 27 |
* of the Valencian Government (CIT) |
28 |
*
|
|
28 |
* |
|
29 | 29 |
* This program is free software; you can redistribute it and/or |
30 | 30 |
* modify it under the terms of the GNU General Public License |
31 | 31 |
* as published by the Free Software Foundation; either version 3 |
32 | 32 |
* of the License, or (at your option) any later version. |
33 |
*
|
|
33 |
* |
|
34 | 34 |
* This program is distributed in the hope that it will be useful, |
35 | 35 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
36 | 36 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
37 | 37 |
* GNU General Public License for more details. |
38 |
*
|
|
38 |
* |
|
39 | 39 |
* You should have received a copy of the GNU General Public License |
40 | 40 |
* along with this program; if not, write to the Free Software |
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
|
41 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
42 | 42 |
* MA 02110-1301, USA. |
43 |
*
|
|
43 |
* |
|
44 | 44 |
*/ |
45 | 45 |
|
46 | 46 |
package org.gvsig.symbology.impl; |
... | ... | |
52 | 52 |
import java.util.Collections; |
53 | 53 |
import java.util.HashMap; |
54 | 54 |
import java.util.Map; |
55 |
|
|
55 | 56 |
import org.apache.batik.ext.awt.geom.DefaultPathLength; |
56 | 57 |
|
57 | 58 |
import org.gvsig.fmap.mapcontext.rendering.legend.IInterval; |
59 |
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter; |
|
58 | 60 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClass; |
59 | 61 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelClassFactory; |
60 | 62 |
import org.gvsig.fmap.mapcontext.rendering.legend.styling.ILabelingMethod; |
... | ... | |
65 | 67 |
import org.gvsig.symbology.PathLength; |
66 | 68 |
import org.gvsig.symbology.SymbologyLocator; |
67 | 69 |
import org.gvsig.symbology.SymbologyManager; |
70 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.driver.impl.PersistenceBasedLegendWriter; |
|
68 | 71 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.FInterval; |
69 | 72 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.AttrInTableLabelingStrategy; |
70 | 73 |
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.styling.DefaultLabelingMethod; |
... | ... | |
102 | 105 |
|
103 | 106 |
/** |
104 | 107 |
* Default {@link SymbologyManager} implementation. |
105 |
*
|
|
108 |
* |
|
106 | 109 |
* @author 2009- <a href="cordinyana@gvsig.org">C?sar Ordi?ana</a> - gvSIG team |
107 | 110 |
*/ |
108 | 111 |
public class DefaultSymbologyManager implements SymbologyManager { |
109 | 112 |
|
110 | 113 |
private Map labelClassFactories = new HashMap(); |
111 | 114 |
private ILabelClassFactory defaultLabelClassFactory; |
112 |
|
|
115 |
|
|
113 | 116 |
public IInterval createInterval(double min, double max) { |
114 | 117 |
return new FInterval(min, max); |
115 | 118 |
} |
... | ... | |
119 | 122 |
public Object call() throws Exception { |
120 | 123 |
|
121 | 124 |
SymbologyLocator.registerSymbologyManager(DefaultSymbologyManager.class); |
122 |
|
|
125 |
|
|
123 | 126 |
return Boolean.TRUE; |
124 | 127 |
} |
125 |
|
|
128 |
|
|
126 | 129 |
} |
127 | 130 |
|
128 | 131 |
public IArrowDecoratorStyle createArrowDecoratorStyle() { |
129 | 132 |
return new ArrowDecoratorStyle(); |
130 | 133 |
} |
131 |
|
|
134 |
|
|
132 | 135 |
// public IMarkerSymbol createMarkerSymbol(){ |
133 | 136 |
// return new SimpleMarkerSymbol(); |
134 | 137 |
// } |
... | ... | |
156 | 159 |
public ISimpleLineStyle createSimpleLineStyle() { |
157 | 160 |
return new SimpleLineStyle(); |
158 | 161 |
} |
159 |
|
|
162 |
|
|
160 | 163 |
public IBackgroundFileStyle createBackgroundFileStyle(URL imgURL) |
161 | 164 |
throws IOException { |
162 | 165 |
return BackgroundFileStyle.createStyleByURL(imgURL); |
... | ... | |
197 | 200 |
public ILabelingStrategy createDefaultLabelingStrategy() { |
198 | 201 |
return new AttrInTableLabelingStrategy(); |
199 | 202 |
} |
200 |
|
|
203 |
|
|
201 | 204 |
public ILabelingMethod createDefaultLabelingMethod() { |
202 | 205 |
return new DefaultLabelingMethod(); |
203 | 206 |
} |
204 |
|
|
207 |
|
|
205 | 208 |
public IZoomConstraints createDefaultZoomConstraints() { |
206 | 209 |
return new ZoomConstraintsImpl(); |
207 | 210 |
} |
... | ... | |
216 | 219 |
this.defaultLabelClassFactory = factory; |
217 | 220 |
} |
218 | 221 |
} |
219 |
|
|
222 |
|
|
220 | 223 |
public Collection<ILabelClassFactory> getLabelClassFactories() { |
221 | 224 |
return Collections.unmodifiableCollection(this.labelClassFactories.values()); |
222 | 225 |
} |
223 |
|
|
226 |
|
|
224 | 227 |
public ILabelClassFactory getLabelClassFactory(String id) { |
225 | 228 |
if( id==null ) { |
226 | 229 |
return null; |
227 | 230 |
} |
228 | 231 |
return (ILabelClassFactory) this.labelClassFactories.get(id.toLowerCase()); |
229 | 232 |
} |
230 |
|
|
233 |
|
|
231 | 234 |
public ILabelClass createDefaultLabel() { |
232 | 235 |
ILabelClassFactory f = this.getDefaultLabelFactory(); |
233 | 236 |
if( f==null ) { |
... | ... | |
235 | 238 |
} |
236 | 239 |
return f.create(); |
237 | 240 |
} |
238 |
|
|
241 |
|
|
239 | 242 |
public ILabelClassFactory getDefaultLabelFactory() { |
240 | 243 |
return this.defaultLabelClassFactory; |
241 | 244 |
} |
242 |
|
|
245 |
|
|
243 | 246 |
public void setDefaultLabelFactory(String id) { |
244 | 247 |
ILabelClassFactory f = this.getLabelClassFactory(id); |
245 | 248 |
if( f==null ) { |
... | ... | |
247 | 250 |
} |
248 | 251 |
this.setDefaultLabelFactory(f); |
249 | 252 |
} |
250 |
|
|
253 |
|
|
251 | 254 |
public void setDefaultLabelFactory(ILabelClassFactory factory) { |
252 | 255 |
if( !this.labelClassFactories.containsValue(factory) ) { |
253 | 256 |
this.labelClassFactories.put(factory.getID().toLowerCase(), factory); |
... | ... | |
259 | 262 |
public PathLength createPathLength(Shape path) { |
260 | 263 |
return new DefaultPathLength(path); |
261 | 264 |
} |
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
public ILegendWriter getDefaultLegendWriter() { |
|
267 |
return new PersistenceBasedLegendWriter(); |
|
268 |
} |
|
269 |
|
|
270 |
|
|
271 |
|
|
265 | 272 |
} |
Also available in: Unified diff