use of com.serotonin.m2m2.web.mvc.rest.v1.model.dataPoint.TimePeriodModel in project ma-modules-public by infiniteautomation.
the class ChartRendererFactory method createModel.
/**
* @param vo
* @return
*/
public static BaseChartRendererModel<?> createModel(DataPointVO vo) {
ChartRenderer renderer = vo.getChartRenderer();
if (renderer == null)
return null;
if (renderer.getTypeName().equals(ImageChartRenderer.getDefinition().getName())) {
ImageChartRenderer r = (ImageChartRenderer) renderer;
TimePeriodModel tp = new TimePeriodModel(r.getNumberOfPeriods(), r.getTimePeriod());
ImageChartRendererModel model = new ImageChartRendererModel(tp);
return model;
} else if (renderer.getTypeName().equals(ImageFlipbookRenderer.getDefinition().getName())) {
ImageFlipbookRenderer r = (ImageFlipbookRenderer) renderer;
ImageFlipbookChartRendererModel model = new ImageFlipbookChartRendererModel(r.getLimit());
return model;
} else if (renderer.getTypeName().equals(StatisticsChartRenderer.getDefinition().getName())) {
StatisticsChartRenderer r = (StatisticsChartRenderer) renderer;
TimePeriodModel tp = new TimePeriodModel(r.getNumberOfPeriods(), r.getTimePeriod());
StatisticsChartRendererModel model = new StatisticsChartRendererModel(tp, r.isIncludeSum());
return model;
} else if (renderer.getTypeName().equals(TableChartRenderer.getDefinition().getName())) {
TableChartRenderer r = (TableChartRenderer) renderer;
TableChartRendererModel model = new TableChartRendererModel(r.getLimit());
return model;
} else {
throw new ShouldNeverHappenException("Unknown Chart Renderer: " + renderer.getDef().getName());
}
}
Aggregations