use of com.vaadin.annotations.DesignRoot in project charts by vaadin.
the class ChartsDemoUI method updateTabSheet.
/**
* Updates main tabSheet
* <p>
* Adds one tab with one example instance, one with the java source and
* another one with html source in case of declarative example
*
* @param chartExample
*/
private void updateTabSheet(Class chartExample) {
try {
tabSheet.removeAllComponents();
AbstractVaadinChartExample newInstance = (AbstractVaadinChartExample) chartExample.newInstance();
tabSheet.addTab(newInstance, "Example");
addResourceTab(chartExample, chartExample.getSimpleName() + ".java", "Java Source");
if (chartExample.isAnnotationPresent(DesignRoot.class)) {
String designRoot = ((DesignRoot) chartExample.getAnnotation(DesignRoot.class)).value();
addResourceTab(chartExample, designRoot, "HTML Source");
}
Page.getCurrent().setUriFragment(chartExample.getSimpleName(), false);
} catch (Exception e) {
e.printStackTrace();
}
}
Aggregations