Search in sources :

Example 1 with DesignRoot

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();
    }
}
Also used : AbstractVaadinChartExample(com.vaadin.addon.charts.examples.AbstractVaadinChartExample) IOException(java.io.IOException) DesignRoot(com.vaadin.annotations.DesignRoot)

Aggregations

AbstractVaadinChartExample (com.vaadin.addon.charts.examples.AbstractVaadinChartExample)1 DesignRoot (com.vaadin.annotations.DesignRoot)1 IOException (java.io.IOException)1