Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java @ 2206:e2124ca11adb
Add manual point handling for many different chart types.
flys-artifacts/trunk@3830 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 30 Jan 2012 13:33:18 +0000 |
parents | 9317863e867b |
children | 5642a83420f2 |
comparison
equal
deleted
inserted
replaced
2205:a22e0cb6eace | 2206:e2124ca11adb |
---|---|
30 private static Logger logger = Logger.getLogger(ManualPointsArtifact.class); | 30 private static Logger logger = Logger.getLogger(ManualPointsArtifact.class); |
31 | 31 |
32 /** The name of the artifact. */ | 32 /** The name of the artifact. */ |
33 public static final String ARTIFACT_NAME = "manualpoints"; | 33 public static final String ARTIFACT_NAME = "manualpoints"; |
34 | 34 |
35 /** Name of data item where points are stored (jsonized). */ | |
36 public static final String POINT_DATA = "manualpoints.data"; | |
37 | 35 |
38 /** | 36 /** |
39 * Trivial Constructor. | 37 * Trivial Constructor. |
40 */ | 38 */ |
41 public ManualPointsArtifact() { | 39 public ManualPointsArtifact() { |
42 logger.debug("ManualPointsArtifact.ManualPointsartifact()"); | 40 logger.debug("ManualPointsArtifact.ManualPointsArtifact()"); |
43 } | 41 } |
44 | 42 |
45 | 43 |
46 /** | 44 /** |
47 * Gets called from factory, to set things up. | 45 * Gets called from factory, to set things up. |
65 return ARTIFACT_NAME; | 63 return ARTIFACT_NAME; |
66 } | 64 } |
67 | 65 |
68 | 66 |
69 /** Access state data storing the jsonstring with points. */ | 67 /** Access state data storing the jsonstring with points. */ |
70 public String getPointsData() { | 68 public String getPointsData(String facetName) { |
71 // TODO probably revive and deliver NamedDoubles. | 69 return getDataAsString(facetName + ".data"); |
72 return getDataAsString(POINT_DATA); | |
73 } | 70 } |
74 | 71 |
75 | 72 |
76 /** Setup state and facet. */ | 73 /** Setup state and facet. */ |
77 @Override | 74 @Override |
78 protected void initialize(Artifact artifact, Object context, CallMeta meta) { | 75 protected void initialize(Artifact artifact, Object context, CallMeta meta) { |
79 logger.debug("ManualPointsArtifact.initialize"); | 76 logger.debug("ManualPointsArtifact.initialize"); |
80 List<Facet> fs = new ArrayList<Facet>(); | 77 List<Facet> fs = new ArrayList<Facet>(); |
81 addStringData(POINT_DATA, "[]"); | |
82 | 78 |
83 DefaultState state = (DefaultState) getCurrentState(context); | 79 DefaultState state = (DefaultState) getCurrentState(context); |
84 state.computeInit(this, hash(), context, meta, fs); | 80 state.computeInit(this, hash(), context, meta, fs); |
85 if (!fs.isEmpty()) { | 81 if (!fs.isEmpty()) { |
86 logger.debug("Facets to add in ManualPointsArtifact.initialize ."); | 82 logger.debug("Facets to add in ManualPointsArtifact.initialize ."); |