Customizing Vaadin 7 Calendar

Can anybody tell me how to customize the Vaadin 7 Calender Control to show the Weekdays abbreviated? I want to display Mon, Tue, Wed,… instead of Monday, Tuesday, Wenesday,…
In all the sample screenshots the monthly view displays the short variant, but my calender always displays the long variant.

The day names seem to come from the getDayNamesShort() method in Calendar. It’s protected, so you should be able to override it.

Hi,

you have to extend com.vaadin.addon.calendar.ui.Calendar and override getMonthNamesShort() and getDayNamesShort()


@Override
	protected String[] getDayNamesShort() {
		if(this.languageLocale== null) {
			return super.getDayNamesShort();
		}
		DateFormatSymbols s = new DateFormatSymbols(this.languageLocale);
		String[] names = s.getShortWeekdays();
		List<String> weekNames = new ArrayList<String>(Arrays.asList(names));
		weekNames.remove(0);
		return weekNames.toArray(new String[7]
);
	}
	
	@Override
	protected String[] getMonthNamesShort() {
		if(this.languageLocale == null) {
			return super.getMonthNamesShort();
		}
		DateFormatSymbols s = new DateFormatSymbols(this.languageLocale);
		return s.getShortMonths();
	}

Thanks for the quick responses. Works like expected.

Now i have two other open issues with my calendars:
1.) If i set the startDate and endDate of a calendar to the first/last day displaying a whole month … how can i prevent the calendar showing the extra days from previous/next month.

2.) How can i prevent the calendar from showing the abreviated month name on the 1st day?

Regards
Michael

The same issue with me

I think you might be able to do these with styles; I seem to recall doing it before myself.

-Olli