use of com.haulmont.cuba.gui.components.calendar.EntityCalendarEventProvider in project cuba by cuba-platform.
the class CalendarLoader method loadDatasource.
protected void loadDatasource(Calendar component, Element element) {
final String datasource = element.attributeValue("datasource");
if (!StringUtils.isEmpty(datasource)) {
CollectionDatasource ds = (CollectionDatasource) context.getDsContext().get(datasource);
if (ds == null) {
throw new GuiDevelopmentException(String.format("Datasource '%s' is not defined", datasource), getContext().getFullFrameId(), "Component ID", component.getId());
}
component.setDatasource(ds);
if (component.getEventProvider() instanceof EntityCalendarEventProvider) {
EntityCalendarEventProvider eventProvider = (EntityCalendarEventProvider) component.getEventProvider();
String startDateProperty = element.attributeValue("startDateProperty");
if (StringUtils.isNotEmpty(startDateProperty)) {
eventProvider.setStartDateProperty(startDateProperty);
}
String endDateProperty = element.attributeValue("endDateProperty");
if (StringUtils.isNotEmpty(endDateProperty)) {
eventProvider.setEndDateProperty(endDateProperty);
}
String captionProperty = element.attributeValue("captionProperty");
if (StringUtils.isNotEmpty(captionProperty)) {
eventProvider.setCaptionProperty(captionProperty);
}
String descriptionProperty = element.attributeValue("descriptionProperty");
if (StringUtils.isNotEmpty(descriptionProperty)) {
eventProvider.setDescriptionProperty(descriptionProperty);
}
String styleNameProperty = element.attributeValue("stylenameProperty");
if (StringUtils.isNotEmpty(styleNameProperty)) {
eventProvider.setStyleNameProperty(styleNameProperty);
}
String allDayProperty = element.attributeValue("isAllDayProperty");
if (StringUtils.isNotEmpty(allDayProperty)) {
eventProvider.setAllDayProperty(allDayProperty);
}
}
}
}
Aggregations