Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/exports/DiagramAttributes.java @ 7059:f9d5020af0af generator-refactoring
Remove AxisProcessor "glue" class and extend Processor interface
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 10:30:03 +0200 |
parents | 165ea04b1545 |
children | 78ded33f5f5b |
comparison
equal
deleted
inserted
replaced
7058:5c07024cdc24 | 7059:f9d5020af0af |
---|---|
56 public boolean forceAlign() { | 56 public boolean forceAlign() { |
57 return forceAlign; | 57 return forceAlign; |
58 } | 58 } |
59 } // class AxisAttributes | 59 } // class AxisAttributes |
60 | 60 |
61 public static class AxisProcessor { | |
62 private Processor processor; | |
63 private String axisName; | |
64 | |
65 public AxisProcessor() { | |
66 } | |
67 | |
68 public AxisProcessor(Processor processor, String axisName) { | |
69 this.processor = processor; | |
70 this.axisName = axisName; | |
71 } | |
72 | |
73 public Processor getProcessor() { | |
74 return processor; | |
75 } | |
76 | |
77 public String getAxisName() { | |
78 return axisName; | |
79 } | |
80 } // class AxisProcessor | |
81 | |
82 public static class Argument { | 61 public static class Argument { |
83 private String expression; | 62 private String expression; |
84 private String type; | 63 private String type; |
85 | 64 |
86 public Argument() { | 65 public Argument() { |
158 return Resources.getMsg(context.getMeta(), key, def, args); | 137 return Resources.getMsg(context.getMeta(), key, def, args); |
159 } | 138 } |
160 } // class Title | 139 } // class Title |
161 | 140 |
162 private List<AxisAttributes> axesAttrs; | 141 private List<AxisAttributes> axesAttrs; |
163 private List<AxisProcessor> axesProcessors; | 142 private List<Processor> processors; |
164 | 143 |
165 private Title title; | 144 private Title title; |
166 private Title subtitle; | 145 private Title subtitle; |
167 | 146 |
168 public DiagramAttributes() { | 147 public DiagramAttributes() { |
169 axesAttrs = new ArrayList<AxisAttributes>(5); | 148 axesAttrs = new ArrayList<AxisAttributes>(5); |
170 axesProcessors = new ArrayList<AxisProcessor>(5); | 149 processors = new ArrayList<Processor>(5); |
171 } | 150 } |
172 | 151 |
173 public DiagramAttributes(Element config) { | 152 public DiagramAttributes(Element config) { |
174 this(); | 153 this(); |
175 parseAxis(config); | 154 parseAxis(config); |
198 } | 177 } |
199 axesAttrs.add(new AxisAttributes(name, isleftAlign, forceAlign)); | 178 axesAttrs.add(new AxisAttributes(name, isleftAlign, forceAlign)); |
200 } | 179 } |
201 } | 180 } |
202 | 181 |
203 public List<AxisProcessor> getAxesProcessors() { | 182 public List<Processor> getProcessors() { |
204 return axesProcessors; | 183 return processors; |
205 } | 184 } |
206 | 185 |
207 public Title getTitle() { | 186 public Title getTitle() { |
208 return title; | 187 return title; |
209 } | 188 } |
224 } | 203 } |
225 | 204 |
226 try { | 205 try { |
227 Processor processor = | 206 Processor processor = |
228 (Processor)Class.forName(className).newInstance(); | 207 (Processor)Class.forName(className).newInstance(); |
229 axesProcessors.add(new AxisProcessor(processor, axisName)); | 208 processor.setAxisName(axisName); |
209 processors.add(processor); | |
230 } | 210 } |
231 catch (ClassNotFoundException cnfe) { | 211 catch (ClassNotFoundException cnfe) { |
232 log.error(cnfe, cnfe); | 212 log.error(cnfe, cnfe); |
233 } | 213 } |
234 catch (InstantiationException ie) { | 214 catch (InstantiationException ie) { |