comparison flys-artifacts/src/main/java/de/intevation/flys/exports/sq/SQRelationGenerator.java @ 3077:5c87d4ca1bd3

Added chart and export generator stubs for SQ relation. flys-artifacts/trunk@4672 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 15 Jun 2012 10:17:22 +0000
parents
children 8ad8a227d983
comparison
equal deleted inserted replaced
3076:5642a83420f2 3077:5c87d4ca1bd3
1 package de.intevation.flys.exports.sq;
2
3 import org.apache.log4j.Logger;
4
5 import org.jfree.chart.axis.LogarithmicAxis;
6 import org.jfree.chart.axis.NumberAxis;
7
8 import org.w3c.dom.Document;
9
10 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
11 import de.intevation.artifactdatabase.state.Facet;
12
13 import de.intevation.flys.artifacts.model.FacetTypes;
14 import de.intevation.flys.exports.XYChartGenerator;
15
16 /**
17 * An OutGenerator that generates charts for MINFO sq relation.
18 *
19 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
20 */
21 public class SQRelationGenerator
22 extends XYChartGenerator
23 implements FacetTypes
24 {
25 public enum YAXIS {
26 S(0);
27 protected int idx;
28 private YAXIS(int c) {
29 idx = c;
30 }
31 }
32
33 /** The logger that is used in this generator. */
34 private static Logger logger = Logger.getLogger(SQRelationGenerator.class);
35
36
37 @Override
38 protected YAxisWalker getYAxisWalker() {
39 return new YAxisWalker() {
40 @Override
41 public int length() {
42 return YAXIS.values().length;
43 }
44
45 @Override
46 public String getId(int idx) {
47 YAXIS[] yaxes = YAXIS.values();
48 return yaxes[idx].toString();
49 }
50 };
51 }
52
53
54 @Override
55 public String getDefaultChartTitle() {
56 return "TODO: CHART TITLE";
57 }
58
59
60 @Override
61 protected String getDefaultXAxisLabel() {
62 return "TODO: XAXIS LABEL";
63 }
64
65
66 @Override
67 protected String getDefaultYAxisLabel(int index) {
68 return "TODO: YAXIS LABEL " + index;
69 }
70
71
72 @Override
73 protected NumberAxis createYAxis(int index) {
74 return new LogarithmicAxis("TODO: LABEL " + index);
75 }
76
77
78 @Override
79 public void doOut(
80 ArtifactAndFacet artifactAndFacet,
81 Document attr,
82 boolean visible
83 ) {
84 logger.debug("doOut");
85
86 Facet facet = artifactAndFacet.getFacet();
87 String name = facet != null ? facet.getName() : null;
88
89 if (name == null || name.length() == 0) {
90 logger.warn("Invalid facet with no name given!");
91 return;
92 }
93
94 if (IS.SQ_CURVE(name)) {
95 doSQCurveOut(artifactAndFacet, attr, visible);
96 }
97 else if (IS.SQ_MEASUREMENT(name)) {
98 doSQMeasurementsOut(artifactAndFacet, attr, visible);
99 }
100 else if (IS.SQ_OUTLIER(name)) {
101 doSQOutliersOut(artifactAndFacet, attr, visible);
102 }
103 }
104
105
106 protected void doSQCurveOut(
107 ArtifactAndFacet artifactAndFacet,
108 Document attr,
109 boolean visible
110 ) {
111 logger.debug("doSQCurveOut");
112 logger.error("NOT IMPLEMENTED: doSQCurveOut");
113 }
114
115
116 protected void doSQMeasurementsOut(
117 ArtifactAndFacet artifactAndFacet,
118 Document attr,
119 boolean visible
120 ) {
121 logger.debug("doSQMeasurementsOut");
122 logger.error("NOT IMPLEMENTED: doSQMeasurementsOut");
123 }
124
125
126 protected void doSQOutliersOut(
127 ArtifactAndFacet artifactAndFacet,
128 Document attr,
129 boolean visible
130 ) {
131 logger.debug("doSQOutliersOut");
132 logger.error("NOT IMPLEMENTED: doSQOutliersOut");
133 }
134 }
135 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org