Fix name appearance

This commit is contained in:
Victor Shcherb 2012-10-07 14:53:35 +02:00
parent c66c916d18
commit 61a558feb4
3 changed files with 10 additions and 11 deletions

View file

@ -62,13 +62,9 @@ public class RenderingRulesStorage {
RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException; RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException;
} }
public RenderingRulesStorage(String name){ public RenderingRulesStorage(String name, Map<String, String> renderingConstants){
// register empty string as 0
getDictionaryValue(""); getDictionaryValue("");
this.renderingName = name; this.renderingName = name;
}
public RenderingRulesStorage(String name, Map<String, String> renderingConstants){
if(renderingConstants != null) { if(renderingConstants != null) {
this.renderingConstants.putAll(renderingConstants); this.renderingConstants.putAll(renderingConstants);
} }
@ -436,11 +432,11 @@ public class RenderingRulesStorage {
public static void main(String[] args) throws SAXException, IOException { public static void main(String[] args) throws SAXException, IOException {
RenderingRulesStorage storage = new RenderingRulesStorage("test"); RenderingRulesStorage storage = new RenderingRulesStorage("test", null);
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() { final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
@Override @Override
public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException { public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException {
RenderingRulesStorage depends = new RenderingRulesStorage("test"); RenderingRulesStorage depends = new RenderingRulesStorage("test", null);
try { try {
depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"),
ref); ref);

View file

@ -7,6 +7,7 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedHashMap;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import javax.imageio.ImageReader; import javax.imageio.ImageReader;
@ -33,11 +34,12 @@ public class NativeSwingRendering extends NativeLibrary {
private static NativeSwingRendering defaultLoadedLibrary; private static NativeSwingRendering defaultLoadedLibrary;
public void loadRuleStorage(String path, String renderingProperties) throws SAXException, IOException{ public void loadRuleStorage(String path, String renderingProperties) throws SAXException, IOException{
RenderingRulesStorage storage = new RenderingRulesStorage("default"); final LinkedHashMap<String, String> renderingAttributes = new LinkedHashMap<String, String>();
RenderingRulesStorage storage = new RenderingRulesStorage("default", renderingAttributes);
final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() { final RenderingRulesStorageResolver resolver = new RenderingRulesStorageResolver() {
@Override @Override
public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException { public RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException {
RenderingRulesStorage depends = new RenderingRulesStorage(name); RenderingRulesStorage depends = new RenderingRulesStorage(name, renderingAttributes);
try { try {
depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"),
ref); ref);

View file

@ -60,7 +60,9 @@ public class RendererRegistry {
return null; return null;
} }
try { try {
return loadRenderer(name, new LinkedHashMap<String, RenderingRulesStorage>(), new LinkedHashMap<String, String>()); RenderingRulesStorage r = loadRenderer(name, new LinkedHashMap<String, RenderingRulesStorage>(), new LinkedHashMap<String, String>());
renderers.put(name, r);
return r;
} catch (IOException e) { } catch (IOException e) {
log.error("Error loading renderer", e); //$NON-NLS-1$ log.error("Error loading renderer", e); //$NON-NLS-1$
} catch (SAXException e) { } catch (SAXException e) {
@ -124,7 +126,6 @@ public class RendererRegistry {
} finally { } finally {
is.close(); is.close();
} }
renderers.put(name, main);
return main; return main;
} }