// Is MultiDay?
boolean multiDay = appointment.isMultiDay() || appointment.isAllDay();
//Lookup the style from the map
ThemeAppointmentStyle style = getViewAppointmentStyleForTheme(appointment);
//Determine Style Name
String styleName = APPOINTMENT_STYLE;
if(multiDay) styleName+=APPOINTMENT_STYLE_MULTIDAY;
if(selected) styleName+=APPOINTMENT_STYLE_SELECTED;
widget.setStylePrimaryName(styleName);
//If no style is found, apply the default blue style
//TODO: need to check for a custom style
if(style==null)
style = getDefaultViewAppointmentStyleForTheme();
if (multiDay)
DOM.setStyleAttribute(elem, BACKGROUND_COLOR_STYLE_ATTRIBUTE, style.getBackgroundHeader());
else
DOM.setStyleAttribute(elem, BACKGROUND_COLOR_STYLE_ATTRIBUTE, style.getBackground());
DOM.setStyleAttribute(elem, BORDER_COLOR_STYLE_ATTRIBUTE, style.getBackgroundHeader());
DOM.setStyleAttribute(bodyElem, COLOR_STYLE_ATTRIBUTE, style.getSelectedBorder());
DOM.setStyleAttribute(headerElem, COLOR_STYLE_ATTRIBUTE, style.getHeaderText());
DOM.setStyleAttribute(headerElem, BACKGROUND_COLOR_STYLE_ATTRIBUTE,style.getBackgroundHeader());
if (multiDay)
return;
if (selected && style.getSelectedBackgroundImage() != null) {
DOM.setStyleAttribute(elem, BACKGROUND_IMAGE_STYLE_ATTRIBUTE, "url("+ style.getSelectedBackgroundImage() + ")");
} else {
DOM.setStyleAttribute(elem, BACKGROUND_IMAGE_STYLE_ATTRIBUTE, "none");
}
}