comparison flys-artifacts/src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java @ 370:4a8d934e745f

Bugfix: Changed the datastructure of the ThemeList (inner class of FLYSArtifactCollection) to store the theme of a chart in an ordered list -> Q curves of longitudinal section charts are now drawn. flys-artifacts/trunk@1779 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 29 Apr 2011 13:06:49 +0000
parents 8830eecad69e
children fc3cf0ef777e
comparison
equal deleted inserted replaced
369:2ce7b473620e 370:4a8d934e745f
5 import java.util.ArrayList; 5 import java.util.ArrayList;
6 import java.util.Date; 6 import java.util.Date;
7 import java.util.HashMap; 7 import java.util.HashMap;
8 import java.util.List; 8 import java.util.List;
9 import java.util.Map; 9 import java.util.Map;
10 import java.util.Vector;
10 11
11 import javax.xml.xpath.XPathConstants; 12 import javax.xml.xpath.XPathConstants;
12 13
13 import org.apache.log4j.Logger; 14 import org.apache.log4j.Logger;
14 15
179 try { 180 try {
180 for (int i = 0; i < size; i++) { 181 for (int i = 0; i < size; i++) {
181 ManagedFacet theme = themeList.get(i); 182 ManagedFacet theme = themeList.get(i);
182 183
183 if (theme == null) { 184 if (theme == null) {
185 log.debug("Theme is empty - no output is generated.");
184 continue; 186 continue;
185 } 187 }
186 188
187 String art = theme.getArtifact(); 189 String art = theme.getArtifact();
188 190
657 /** 659 /**
658 * Inner class to structure/order the themes of a chart. 660 * Inner class to structure/order the themes of a chart.
659 */ 661 */
660 private class ThemeList { 662 private class ThemeList {
661 private Logger logger = Logger.getLogger(ThemeList.class); 663 private Logger logger = Logger.getLogger(ThemeList.class);
662 protected Map<Integer, ManagedFacet> themes; 664 protected Vector<ManagedFacet> themes;
663 665
664 public ThemeList(Document output) { 666 public ThemeList(Document output) {
665 themes = new HashMap<Integer, ManagedFacet>(); 667 themes = new Vector<ManagedFacet>();
666 parse(output); 668 parse(output);
667 } 669 }
668 670
669 protected void parse(Document output) { 671 protected void parse(Document output) {
670 NodeList themes = (NodeList) XMLUtils.xpath( 672 NodeList themes = (NodeList) XMLUtils.xpath(
713 logger.debug(".. position: " + position); 715 logger.debug(".. position: " + position);
714 logger.debug(".. active: " + active); 716 logger.debug(".. active: " + active);
715 } 717 }
716 718
717 try { 719 try {
718 Integer pos = new Integer(position); 720 int pos = Integer.parseInt(position);
719 Integer act = new Integer(active); 721 int act = Integer.parseInt(active);
720 722
721 themes.put(pos, new ManagedFacet(name, null, uuid, pos, act)); 723 themes.add(pos-1, new ManagedFacet(name, null, uuid, pos, act));
722 } 724 }
723 catch (NumberFormatException nfe) { 725 catch (NumberFormatException nfe) {
724 // do nothing 726 logger.warn(nfe, nfe);
725 } 727 }
726 } 728 }
727 729
728 public ManagedFacet get(int idx) { 730 public ManagedFacet get(int idx) {
729 return themes.get(new Integer(idx)); 731 return themes.get(idx);
730 } 732 }
731 733
732 public int size() { 734 public int size() {
733 return themes.size(); 735 return themes.size();
734 } 736 }

http://dive4elements.wald.intevation.org