initAddNewEventButton();
HorizontalLayout hl = new HorizontalLayout();
hl.setWidth("100%");
hl.setSpacing(true);
hl.setMargin(new MarginInfo(false, false, true, false));
hl.addComponent(prevButton);
hl.addComponent(captionLabel);
hl.addComponent(monthButton);
hl.addComponent(weekButton);
hl.addComponent(nextButton);
hl.setComponentAlignment(prevButton, Alignment.MIDDLE_LEFT);
hl.setComponentAlignment(captionLabel, Alignment.MIDDLE_CENTER);
hl.setComponentAlignment(monthButton, Alignment.MIDDLE_CENTER);
hl.setComponentAlignment(weekButton, Alignment.MIDDLE_CENTER);
hl.setComponentAlignment(nextButton, Alignment.MIDDLE_RIGHT);
monthButton.setVisible(viewMode == Mode.WEEK);
weekButton.setVisible(viewMode == Mode.DAY);
HorizontalLayout controlPanel = new HorizontalLayout();
controlPanel.setSpacing(true);
controlPanel.setMargin(new MarginInfo(false, false, true, false));
controlPanel.setWidth("100%");
controlPanel.addComponent(localeSelect);
controlPanel.addComponent(timeZoneSelect);
controlPanel.addComponent(formatSelect);
controlPanel.addComponent(hideWeekendsButton);