use of org.activityinfo.shared.report.model.CategoryProperties in project activityinfo by bedatadriven.
the class ReportJsonFactory method decodeCategories.
public Map<DimensionCategory, CategoryProperties> decodeCategories(JsonElement categories) {
Map<DimensionCategory, CategoryProperties> cats = new HashMap<DimensionCategory, CategoryProperties>();
JsonArray jsonCats = (JsonArray) parser.parse(categories.getAsString());
Iterator<JsonElement> it = jsonCats.iterator();
while (it.hasNext()) {
it.next().getAsJsonObject();
}
return cats;
}
use of org.activityinfo.shared.report.model.CategoryProperties in project activityinfo by bedatadriven.
the class ReportJsonFactory method encodeCategories.
public JsonArray encodeCategories(Map<DimensionCategory, CategoryProperties> categories) {
JsonArray jsonCats = new JsonArray();
for (Entry<DimensionCategory, CategoryProperties> entry : categories.entrySet()) {
JsonObject jsonEntry = new JsonObject();
jsonEntry.addProperty("dimensionCategory", entry.getKey().toString());
jsonEntry.addProperty("categoryProperties", entry.getValue().toString());
jsonCats.add(jsonEntry);
}
return jsonCats;
}
use of org.activityinfo.shared.report.model.CategoryProperties in project activityinfo by bedatadriven.
the class ChartRendererJC method computePaints.
private Paint[] computePaints(List<PivotTableData.Axis> categories) {
Paint[] paints = getDefaultPaints(categories.size());
Dimension dim = categories.get(0).getDimension();
if (dim == null) {
return paints;
}
for (int i = 0; i != categories.size(); ++i) {
CategoryProperties props = dim.getCategories().get(categories.get(i).getCategory());
if (props != null && props.getColor() != null) {
paints[i] = new Color(props.getColor());
}
}
return paints;
}
use of org.activityinfo.shared.report.model.CategoryProperties in project activityinfo by bedatadriven.
the class DimensionAdapter method unmarshal.
@Override
public Dimension unmarshal(DimensionElement element) {
Dimension dim = createDim(element);
for (CategoryElement category : element.categories) {
CategoryProperties props = new CategoryProperties();
props.setLabel(category.label);
if (category.color != null) {
props.setColor(decodeColor(category.color));
}
EntityCategory entityCategory = new EntityCategory(Integer.parseInt(category.name));
dim.getCategories().put(entityCategory, props);
dim.getOrdering().add(entityCategory);
}
return dim;
}
Aggregations