Search in sources :

Example 6 with AbstractConfigurationObject

use of com.vaadin.addon.charts.model.AbstractConfigurationObject in project charts by vaadin.

the class ChartDesignWriter method writeCollection.

private static void writeCollection(AbstractConfigurationObject configuration, Element parent, Field field, Collection collection, DesignContext context) {
    if (!collection.isEmpty()) {
        if (containsConfigurationObjects(collection)) {
            for (Object o : collection) {
                String tagName = o.getClass().getSimpleName() + "s";
                createElementForConfigurationObject((AbstractConfigurationObject) o, parent, tagName, context);
            }
        } else {
            writeCollectionElement(configuration, parent, field, collection);
        }
    }
}
Also used : AbstractConfigurationObject(com.vaadin.addon.charts.model.AbstractConfigurationObject)

Example 7 with AbstractConfigurationObject

use of com.vaadin.addon.charts.model.AbstractConfigurationObject in project charts by vaadin.

the class ChartDesignWriter method readFieldValue.

private static Object readFieldValue(AbstractConfigurationObject configuration, Field field) {
    Object value = null;
    try {
        field.setAccessible(true);
        value = field.get(configuration);
    } catch (IllegalAccessException e) {
        logger.log(Level.WARNING, "Could not get value from field " + field.getName() + " in " + configuration.getClass().getName());
    }
    return value;
}
Also used : AbstractConfigurationObject(com.vaadin.addon.charts.model.AbstractConfigurationObject)

Aggregations

AbstractConfigurationObject (com.vaadin.addon.charts.model.AbstractConfigurationObject)7 DesignException (com.vaadin.ui.declarative.DesignException)1 Field (java.lang.reflect.Field)1 ArrayList (java.util.ArrayList)1 Attribute (org.jsoup.nodes.Attribute)1 Element (org.jsoup.nodes.Element)1