use of com.vaadin.addon.charts.model.ChartType in project charts by vaadin.
the class ChartComponentMapper method tagToComponent.
@Override
public Component tagToComponent(String tagName, Design.ComponentFactory componentFactory, DesignContext context) {
boolean isChartTag = Pattern.matches("^vaadin-.*-chart$", tagName);
if (isChartTag) {
String[] split = tagName.split("-");
if (split.length != 3) {
throw new DesignException("Unknown tag: " + tagName);
}
String typeName = split[1];
ChartType chartType = resolveChartTypeFor(typeName);
if (chartType == null) {
throw new DesignException("Unknown tag: " + tagName);
}
return new Chart(chartType);
}
return super.tagToComponent(tagName, componentFactory, context);
}
Aggregations