use of org.eclipse.scout.rt.client.ui.basic.calendar.AbstractCalendar in project scout.rt by eclipse.
the class AbstractCalendarField method initConfig.
@Override
@SuppressWarnings("unchecked")
protected void initConfig() {
super.initConfig();
List<ICalendar> contributedCalendars = m_contributionHolder.getContributionsByClass(ICalendar.class);
m_calendar = (T) CollectionUtility.firstElement(contributedCalendars);
if (m_calendar == null) {
Class<? extends ICalendar> configuredCalendar = getConfiguredCalendar();
m_calendar = (T) ConfigurationUtility.newInnerInstance(this, configuredCalendar);
}
if (m_calendar != null) {
if (m_calendar instanceof AbstractCalendar) {
((AbstractCalendar) m_calendar).setContainerInternal(this);
}
// restore calendar settings
ClientUIPreferences env = ClientUIPreferences.getInstance();
m_calendar.setDisplayMode(env.getCalendarDisplayMode(ICalendarDisplayMode.MONTH));
m_calendar.setDisplayCondensed(env.getCalendarDisplayCondensed(true));
/*
* add observer for: - selected date sync - persistence of calendar
* settings
*/
m_calendar.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
if (e.getPropertyName().equals(ICalendar.PROP_SELECTED_DATE)) {
syncCalendarToCalendarField();
}
}
});
syncCalendarToCalendarField();
} else {
LOG.warn("there is no inner class of type ICalendar in {}", getClass().getName());
}
}
Aggregations