Fix naming of rendering style display

This commit is contained in:
Victor Shcherb 2012-10-07 13:57:01 +02:00
parent 1f8ad3f8a5
commit d2b65e4a0f
4 changed files with 15 additions and 9 deletions

View file

@ -54,6 +54,7 @@ public class RenderingRulesStorage {
protected Map<String, String> renderingConstants= new LinkedHashMap<String, String>(); protected Map<String, String> renderingConstants= new LinkedHashMap<String, String>();
private String renderingName; private String renderingName;
private String internalRenderingName;
public static interface RenderingRulesStorageResolver { public static interface RenderingRulesStorageResolver {
@ -61,9 +62,10 @@ public class RenderingRulesStorage {
RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException; RenderingRulesStorage resolve(String name, RenderingRulesStorageResolver ref) throws SAXException;
} }
public RenderingRulesStorage(){ public RenderingRulesStorage(String name){
// register empty string as 0 // register empty string as 0
getDictionaryValue(""); getDictionaryValue("");
this.renderingName = name;
} }
@ -88,6 +90,10 @@ public class RenderingRulesStorage {
return renderingName; return renderingName;
} }
public String getInternalRenderingName() {
return internalRenderingName;
}
public void parseRulesFromXmlInputStream(InputStream is, RenderingRulesStorageResolver resolver) throws SAXException, IOException { public void parseRulesFromXmlInputStream(InputStream is, RenderingRulesStorageResolver resolver) throws SAXException, IOException {
try { try {
@ -220,6 +226,7 @@ public class RenderingRulesStorage {
private RenderingRulesStorage dependsStorage; private RenderingRulesStorage dependsStorage;
public RenderingRulesHandler(SAXParser parser, RenderingRulesStorageResolver resolver){ public RenderingRulesHandler(SAXParser parser, RenderingRulesStorageResolver resolver){
this.parser = parser; this.parser = parser;
this.resolver = resolver; this.resolver = resolver;
@ -326,7 +333,7 @@ public class RenderingRulesStorage {
PROPS = new RenderingRuleStorageProperties(dependsStorage.PROPS); PROPS = new RenderingRuleStorageProperties(dependsStorage.PROPS);
} }
renderingName = attributes.getValue("name"); internalRenderingName = attributes.getValue("name");
} else if("renderer".equals(name)){ //$NON-NLS-1$ } else if("renderer".equals(name)){ //$NON-NLS-1$
throw new SAXException("Rendering style is deprecated and no longer supported."); throw new SAXException("Rendering style is deprecated and no longer supported.");
@ -423,11 +430,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(); RenderingRulesStorage storage = new RenderingRulesStorage("test");
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(); RenderingRulesStorage depends = new RenderingRulesStorage("test");
try { try {
depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"),
ref); ref);

View file

@ -1,4 +1,4 @@
<renderingStyle name="high-contrast-roads" depends="default" defaultColor="#f1eae4" version="1"> <renderingStyle name="High constrast roads" depends="default" defaultColor="#f1eae4" version="1">
<!-- <!--
Depends on All-Purpose Renderer (by Hardy Mueller), based on production version 2012-01-04 Depends on All-Purpose Renderer (by Hardy Mueller), based on production version 2012-01-04

View file

@ -33,12 +33,11 @@ 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 storage2 = new RenderingRulesStorage(); RenderingRulesStorage storage = new RenderingRulesStorage("default");
RenderingRulesStorage storage = new RenderingRulesStorage();
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(); RenderingRulesStorage depends = new RenderingRulesStorage(name);
try { try {
depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"), depends.parseRulesFromXmlInputStream(RenderingRulesStorage.class.getResourceAsStream(name+".render.xml"),
ref); ref);

View file

@ -80,7 +80,7 @@ public class RendererRegistry {
} else { } else {
throw new IllegalArgumentException("Not found " + name); //$NON-NLS-1$ throw new IllegalArgumentException("Not found " + name); //$NON-NLS-1$
} }
RenderingRulesStorage main = new RenderingRulesStorage(); RenderingRulesStorage main = new RenderingRulesStorage(name);
loadedRenderers.add(name); loadedRenderers.add(name);
main.parseRulesFromXmlInputStream(is, new RenderingRulesStorageResolver() { main.parseRulesFromXmlInputStream(is, new RenderingRulesStorageResolver() {