Revision 23416 trunk/extensions/extSymbology/src/org/gvsig/symbology/gui/styling/editortools/LabelStyleOpenBackgroundFile.java
LabelStyleOpenBackgroundFile.java | ||
---|---|---|
46 | 46 |
import java.awt.event.MouseEvent; |
47 | 47 |
import java.io.File; |
48 | 48 |
import java.io.IOException; |
49 |
import java.net.MalformedURLException; |
|
49 | 50 |
import java.util.Date; |
50 | 51 |
|
51 | 52 |
import javax.swing.AbstractButton; |
... | ... | |
125 | 126 |
|
126 | 127 |
BackgroundFileStyle bgStyle = f.getAbsolutePath().toLowerCase().endsWith("svg") ? |
127 | 128 |
new SVGStyle() : new ImageStyle(); |
129 |
|
|
128 | 130 |
try { |
129 | 131 |
bgStyle.setSource(f.toURL()); |
130 |
XMLEntity xml = style.getXMLEntity(); |
|
131 |
if (xml.firstChild("id", "LabelStyle") != null) { |
|
132 |
xml.removeChild(xml.firstIndexOfChild("id", "LabelStyle")); |
|
133 |
} |
|
134 |
XMLEntity xmlBG = bgStyle.getXMLEntity(); |
|
135 |
xmlBG.putProperty("id", "LabelStyle"); |
|
136 |
xml.addChild(xmlBG); |
|
137 |
((StyleEditor) owner).setStyle((ILabelStyle) SymbologyFactory.createStyleFromXML(xml, style.getDescription())); |
|
138 |
style = (ILabelStyle) ((StyleEditor) owner).getStyle(); |
|
132 |
style.setBackground(bgStyle.getXMLEntity()); |
|
133 |
} catch (MalformedURLException e1) { |
|
134 |
e1.printStackTrace(); |
|
139 | 135 |
} catch (IOException e1) { |
140 |
// TODO Auto-generated catch block |
|
141 |
NotificationManager.addError(PluginServices.getText(this, |
|
142 |
"error_reading_file") + |
|
143 |
" ["+new Date(System.currentTimeMillis()).toString()+"]", |
|
144 |
e1); |
|
145 | 136 |
e1.printStackTrace(); |
146 | 137 |
} |
147 |
|
|
148 |
|
|
149 | 138 |
} |
150 | 139 |
|
151 | 140 |
((StyleEditor) owner).restorePreviousTool(); |
Also available in: Unified diff