use of com.vaadin.addon.charts.model.AbstractPlotOptions in project charts by vaadin.
the class ConfigurationTest method getPlotOptions_getAfterChartCreation_EmptyCollectionReturned.
@Test
public void getPlotOptions_getAfterChartCreation_EmptyCollectionReturned() {
Chart chart = new Chart();
Collection<AbstractPlotOptions> result = chart.getConfiguration().getPlotOptions();
assertEquals(0, result.size());
}
use of com.vaadin.addon.charts.model.AbstractPlotOptions in project charts by vaadin.
the class ConfigurationTest method getPlotOptionsForType_noPlotOptionFound_ReturnNull.
@Test
public void getPlotOptionsForType_noPlotOptionFound_ReturnNull() {
Chart chart = new Chart();
AbstractPlotOptions result = chart.getConfiguration().getPlotOptions(ChartType.LINE);
assertNull(result);
}
use of com.vaadin.addon.charts.model.AbstractPlotOptions in project charts by vaadin.
the class ConfigurationTest method getPlotOptionsForType_PlotOptionsLineIsCreated_ReturnTheLinePlotOptions.
@Test
public void getPlotOptionsForType_PlotOptionsLineIsCreated_ReturnTheLinePlotOptions() {
Chart chart = new Chart();
PlotOptionsLine expected = new PlotOptionsLine();
chart.getConfiguration().setPlotOptions(expected);
AbstractPlotOptions result = chart.getConfiguration().getPlotOptions(ChartType.LINE);
assertEquals(expected, result);
}
use of com.vaadin.addon.charts.model.AbstractPlotOptions in project charts by vaadin.
the class ChartDesignReader method createPlotOptionsFor.
private static AbstractPlotOptions createPlotOptionsFor(String type) {
String plotOptionsClassName = "com.vaadin.addon.charts.model.PlotOptions" + toClassName(type);
try {
Class<?> plotOptionsClass = Class.forName(plotOptionsClassName);
Object plotOptions = plotOptionsClass.newInstance();
return (AbstractPlotOptions) plotOptions;
} catch (ClassNotFoundException e) {
throw new DesignException("Cannot find plot options class: " + plotOptionsClassName);
} catch (InstantiationException e) {
throw new DesignException("Cannot create options class: " + plotOptionsClassName);
} catch (IllegalAccessException e) {
throw new DesignException("Cannot create options class: " + plotOptionsClassName);
}
}
Aggregations