List of usage examples for com.vaadin.ui Button addStyleName
@Override public void addStyleName(String style)
From source file:com.klwork.flow.act.MyTaskRelatedContentComponent.java
License:Apache License
protected Button getAddButton() { // Add content button Button addRelatedContentButton = new Button(); ////from w w w. java 2 s. c o m addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD); addRelatedContentButton.addClickListener(new com.vaadin.ui.Button.ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(com.vaadin.ui.Button.ClickEvent event) { CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow(); //?? if (task.getProcessInstanceId() != null) { popup.setProcessInstanceId(task.getProcessInstanceId()); } // Add listener to update attachments when added popup.addListener(new SubmitEventListener() { private static final long serialVersionUID = 1L; @Override protected void submitted(SubmitEvent event) { taskForm.notifyRelatedContentChanged(); } @Override protected void cancelled(SubmitEvent event) { // No attachment was added so updating UI isn't // needed. } }); ViewToolManager.showPopupWindow(popup); } }); return addRelatedContentButton; }
From source file:com.kpg.diary.ui.MenuLayout.java
License:Apache License
/** * Builds the menu.//from ww w .ja v a 2s . com * * @param navigator * the navigator * @return the css layout */ private CssLayout buildMenu(Navigator navigator) { // Add items menuItemsMap(); HorizontalLayout top = new HorizontalLayout(); top.setWidth("100%"); top.addStyleName(ValoTheme.MENU_TITLE); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); menu.addComponent(top); // menu.addComponent(createThemeSelect()); menu.addComponent(top); Button showMenu = new Button("Menu", new ClickListener() { @Override public void buttonClick(ClickEvent event) { if (menu.getStyleName().contains("valo-menu-visible")) { menu.removeStyleName("valo-menu-visible"); } else { menu.addStyleName("valo-menu-visible"); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName("valo-menu-toggle"); showMenu.setIcon(FontAwesome.LIST); menu.addComponent(showMenu); Label title = new Label("<h2>Diary</h2>", ContentMode.HTML); title.setSizeUndefined(); top.addComponent(title); top.setExpandRatio(title, 1); menuItemsLayout.setPrimaryStyleName("valo-menuitems"); menu.addComponent(menuItemsLayout); for (final Entry<String, String> item : menuItems.entrySet()) { Button b = new Button(item.getValue(), new ClickListener() { @Override public void buttonClick(ClickEvent event) { navigator.navigateTo(item.getKey()); } }); b.setHtmlContentAllowed(true); b.setPrimaryStyleName(ValoTheme.MENU_ITEM); if (IConstants.NavigationMenu.ADDRESS.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.BOOK); } else if (IConstants.NavigationMenu.PERSON.getKey().equals(item.getKey())) { b.setIcon(FontAwesome.USER); } else { b.setIcon(FontAwesome.APPLE); } menuItemsLayout.addComponent(b); } return menu; }
From source file:com.lst.deploymentautomation.vaadin.core.AppLayout.java
License:Open Source License
private void initLayout() { addStyleName("app-layout"); setSizeFull();/*w w w . jav a2 s . co m*/ //main page layout layout = new CustomLayout("page"); layout.setSizeFull(); setCompositionRoot(layout); //navigation menu VerticalLayout navLayout = new VerticalLayout(); navLayout.setSizeFull(); layout.addComponent(navLayout, "usermenu"); navigation = new NavigationMenu(); navigation.addStyleName("navigation-menu"); layout.addComponent(navigation, "navigation"); final UserInfo user = ((LspsUI) UI.getCurrent()).getUser(); LspsUI ui = (LspsUI) UI.getCurrent(); if (user.hasRight(HumanRights.READ_ALL_TODO) || user.hasRight(HumanRights.READ_OWN_TODO)) { addViewItem(navigation, TodoListView.TITLE, TodoListView.ID, FontAwesome.LIST); } /*if (user.hasRight(HumanRights.ACCESS_DOCUMENTS)) { addViewItem(navigation, DocumentsView.TITLE, DocumentsView.ID, FontAwesome.FILE_TEXT_O); } if (user.hasRight(EngineRights.READ_MODEL) && user.hasRight(EngineRights.CREATE_MODEL_INSTANCE)) { addViewItem(navigation, RunModelView.TITLE, RunModelView.ID, FontAwesome.CARET_SQUARE_O_RIGHT); }*/ addNavigationCommandItem(navigation, "Initialize deployment", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::InitiateDeploymentDoc", null), FontAwesome.PLAY); addNavigationCommandItem(navigation, "Deployments list", new NavigationMenu.OpenDocumentCommand(ui, "", "'deployment-automation-ui'::DeploymentsList", null), FontAwesome.LIST_OL); //user menu userMenu = new NavigationMenu(); userMenu.addStyleName("navigation-menu"); navLayout.addComponent(userMenu); addViewItem(userMenu, SettingsView.TITLE, SettingsView.ID, FontAwesome.COG); NavigationCommand logoutCmd = new LogoutCommand((LspsUI) getUI()); MenuItem logout = addNavigationCommandItem(userMenu, logoutCmd.getTitle(), logoutCmd, FontAwesome.POWER_OFF); String fullName = user.getPerson().getFullName(); logout.setDescription(ui.getMessage("nav.logout", fullName)); boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed == true) { UI.getCurrent().addStyleName("l-menu-collapsed"); } Button button = new Button(""); button.addStyleName("l-menu-expander"); button.addStyleName("link"); navLayout.addComponent(button); button.addClickListener(new ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { boolean collapsed = user.getSettingBoolean("collapsedMenu", false); if (collapsed) { UI.getCurrent().removeStyleName("l-menu-collapsed"); } else { UI.getCurrent().addStyleName("l-menu-collapsed"); } user.setSetting("collapsedMenu", !collapsed); } }); }
From source file:com.mcparland.john.vaadin_mvn_arch.samples.Menu.java
License:Apache License
public Menu(Navigator navigator) { this.navigator = navigator; setPrimaryStyleName(ValoTheme.MENU_ROOT); menuPart = new CssLayout(); menuPart.addStyleName(ValoTheme.MENU_PART); // header of the menu final HorizontalLayout top = new HorizontalLayout(); top.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); top.addStyleName(ValoTheme.MENU_TITLE); top.setSpacing(true);//w w w . j a va 2s. c o m Label title = new Label("My CRUD"); title.addStyleName(ValoTheme.LABEL_H3); title.setSizeUndefined(); Image image = new Image(null, new ThemeResource("img/table-logo.png")); image.setStyleName("logo"); top.addComponent(image); top.addComponent(title); menuPart.addComponent(top); // logout menu item MenuBar logoutMenu = new MenuBar(); logoutMenu.addItem("Logout", FontAwesome.SIGN_OUT, new Command() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void menuSelected(MenuItem selectedItem) { VaadinSession.getCurrent().getSession().invalidate(); Page.getCurrent().reload(); } }); logoutMenu.addStyleName("user-menu"); menuPart.addComponent(logoutMenu); // button for toggling the visibility of the menu when on a small screen final Button showMenu = new Button("Menu", new ClickListener() { /** * The serialVersionUID. */ private static final long serialVersionUID = 1L; @Override public void buttonClick(final ClickEvent event) { if (menuPart.getStyleName().contains(VALO_MENU_VISIBLE)) { menuPart.removeStyleName(VALO_MENU_VISIBLE); } else { menuPart.addStyleName(VALO_MENU_VISIBLE); } } }); showMenu.addStyleName(ValoTheme.BUTTON_PRIMARY); showMenu.addStyleName(ValoTheme.BUTTON_SMALL); showMenu.addStyleName(VALO_MENU_TOGGLE); showMenu.setIcon(FontAwesome.NAVICON); menuPart.addComponent(showMenu); // container for the navigation buttons, which are added by addView() menuItemsLayout = new CssLayout(); menuItemsLayout.setPrimaryStyleName(VALO_MENUITEMS); menuPart.addComponent(menuItemsLayout); addComponent(menuPart); }
From source file:com.mechanicshop.components.MaintenanceLayout.java
private void customizeTable() { table.setSizeFull();//from ww w . j a v a2 s. c om table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); showDataEntryWindow(item); } }); return icon; } }); }
From source file:com.mechanicshop.components.TableLayout.java
private void buildLayout() { HorizontalLayout layoutTitle = new HorizontalLayout(); layoutTitle.setSizeUndefined();/*ww w . jav a2 s . c om*/ layoutTitle.setWidth("100%"); layoutTitle.setSpacing(false); layoutTitle.setMargin(false); titleLabel.addStyleName(ValoTheme.LABEL_H2); titleLabel.addStyleName(ValoTheme.LABEL_COLORED); titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN); titleLabel.addStyleName(ValoTheme.LABEL_BOLD); titleLabel.setSizeUndefined(); layoutTitle.addComponent(titleLabel); layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER); VerticalLayout layoutTable = new VerticalLayout(); layoutTable.addComponent(table); layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER); layoutTable.setSizeFull(); layoutTable.setSpacing(true); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); layoutButtons.setSpacing(true); layoutButtons.setSizeUndefined(); layoutButtons.setWidth("100%"); Button addBtn = new Button("Add new Car"); addBtn.addClickListener(addBtnListener); addBtn.setImmediate(true); addBtn.setStyleName(ValoTheme.BUTTON_TINY); addBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button deleteBtn = new Button("Delete Selected"); deleteBtn.setStyleName(ValoTheme.BUTTON_TINY); deleteBtn.addStyleName(ValoTheme.BUTTON_DANGER); deleteBtn.setImmediate(true); deleteBtn.addClickListener(removeListener); btnSendSMS.setStyleName(ValoTheme.BUTTON_TINY); btnSendSMS.addStyleName(ValoTheme.BUTTON_FRIENDLY); btnSendSMS.setImmediate(true); btnSendSMS.addClickListener(sendSMSBtnListener); searchTextField.setImmediate(true); searchTextField.addStyleName(ValoTheme.TEXTFIELD_TINY); searchTextField.addTextChangeListener(filterChangeListener); Label lbSearch = new Label("Search"); lbSearch.addStyleName(ValoTheme.LABEL_TINY); lbSearch.setSizeUndefined(); layoutButtons.addComponents(lbSearch, searchTextField, addBtn, deleteBtn, btnSendSMS); layoutButtons.setComponentAlignment(lbSearch, Alignment.MIDDLE_LEFT); layoutButtons.setComponentAlignment(searchTextField, Alignment.BOTTOM_LEFT); layoutButtons.setComponentAlignment(addBtn, Alignment.BOTTOM_RIGHT); layoutButtons.setComponentAlignment(deleteBtn, Alignment.BOTTOM_RIGHT); layoutButtons.setComponentAlignment(btnSendSMS, Alignment.BOTTOM_RIGHT); layoutButtons.setExpandRatio(addBtn, 3); addComponent(layoutTitle); addComponent(layoutTable); layoutTable.addComponent(layoutButtons); layoutTable.setExpandRatio(table, 3); setComponentAlignment(layoutTitle, Alignment.TOP_CENTER); setComponentAlignment(layoutTable, Alignment.TOP_CENTER); setExpandRatio(layoutTable, 3); setSpacing(true); setMargin(true); }
From source file:com.mechanicshop.components.TableLayout.java
private void customizeTable() { table.setSizeFull();/*from w w w. j a v a 2 s .com*/ table.setSortEnabled(true); table.setStyleName(ValoTheme.TABLE_NO_HORIZONTAL_LINES); table.addStyleName(ValoTheme.TABLE_SMALL); table.setEditable(true); table.setImmediate(true); table.setSizeFull(); table.addGeneratedColumn("", new Table.ColumnGenerator() { @Override public Object generateCell(Table source, final Object itemId, Object columnId) { boolean selected = false; final CheckBox cb = new CheckBox("", selected); cb.addValueChangeListener(new Property.ValueChangeListener() { public void valueChange(ValueChangeEvent event) { if (selectedItemIds.contains(itemId)) { selectedItemIds.remove(itemId); } else { if (cb.getValue() != false) { selectedItemIds.add(itemId); } } } }); return cb; } }); table.addGeneratedColumn(" ", new Table.ColumnGenerator() { @Override public Object generateCell(final Table source, final Object itemId, Object columnId) { Button icon = new Button(); icon.setStyleName(ValoTheme.BUTTON_ICON_ONLY); icon.addStyleName(ValoTheme.BUTTON_TINY); icon.addStyleName(ValoTheme.BUTTON_BORDERLESS); icon.setVisible(true); icon.setImmediate(true); icon.setDescription("Details"); icon.setIcon(FontAwesome.PENCIL); icon.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { Item item = source.getItem(itemId); dataEntryLayout.fillDataEntry(item, titleLabel.getValue()); getUI().addWindow(dataEntryLayout); } }); return icon; } }); }
From source file:com.mechanicshop.components.TableLayout.java
public void createCustomMessage() { final TextArea textArea = new TextArea(); textArea.setImmediate(true);//from w ww . j av a2s. c o m textArea.setColumns(30); textArea.setRows(10); textArea.addStyleName(ValoTheme.TEXTAREA_SMALL); textArea.setRequired(true); final Window subWindow = new Window(); subWindow.setModal(true); subWindow.setHeight("350px"); subWindow.setWidth("500px"); subWindow.setCaption("Insert Message"); subWindow.setStyleName(ValoTheme.WINDOW_TOP_TOOLBAR); subWindow.setClosable(false); subWindow.setResizable(false); HorizontalLayout layoutButtons = new HorizontalLayout(); layoutButtons.setMargin(false); Button sendBtn = new Button("Send"); sendBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { try { textArea.validate(); String message = textArea.getValue(); smsSenderService.sendMessageMassive(message); subWindow.close(); Notification.show("Message Sent"); } catch (Exception e) { } } }); sendBtn.setImmediate(true); sendBtn.setStyleName(ValoTheme.BUTTON_TINY); sendBtn.addStyleName(ValoTheme.BUTTON_FRIENDLY); Button cancelBtn = new Button("Cancel"); cancelBtn.setStyleName(ValoTheme.BUTTON_TINY); cancelBtn.addStyleName(ValoTheme.BUTTON_DANGER); cancelBtn.setImmediate(true); cancelBtn.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { subWindow.close(); } }); layoutButtons.setSizeUndefined(); layoutButtons.setSpacing(true); layoutButtons.addComponents(cancelBtn, sendBtn); VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true); layout.setMargin(true); layout.addComponent(textArea); layout.addComponent(layoutButtons); layout.setComponentAlignment(textArea, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(layoutButtons, Alignment.MIDDLE_RIGHT); layout.setExpandRatio(textArea, 3); layout.setSizeFull(); subWindow.setContent(layout); subWindow.center(); getUI().addWindow(subWindow); }
From source file:com.mycollab.mobile.shell.view.MainView.java
License:Open Source License
public MainView() { super();/*from w w w .j a v a 2 s . co m*/ this.setSizeFull(); MVerticalLayout contentLayout = new MVerticalLayout().withStyleName("content-wrapper").withFullWidth(); contentLayout.setDefaultComponentAlignment(Alignment.TOP_CENTER); Image mainLogo = new Image(null, new ThemeResource("icons/logo_m.png")); contentLayout.addComponent(mainLogo); Label introText = new Label( "MyCollab helps you do all your office jobs on the computers, phones and tablets you use"); introText.setStyleName("intro-text"); contentLayout.addComponent(introText); CssLayout welcomeTextWrapper = new CssLayout(); welcomeTextWrapper.setStyleName("welcometext-wrapper"); welcomeTextWrapper.setWidth("100%"); welcomeTextWrapper.setHeight("15px"); contentLayout.addComponent(welcomeTextWrapper); Button crmButton = new Button(UserUIContext.getMessage(GenericI18Enum.MODULE_CRM), clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoCrmModule(this, null))); crmButton.addStyleName(MobileUIConstants.BUTTON_ACTION); crmButton.setWidth("100%"); contentLayout.addComponent(crmButton); Button pmButton = new Button(UserUIContext.getMessage(GenericI18Enum.MODULE_PROJECT), clickEvent -> EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null))); pmButton.setWidth("100%"); pmButton.addStyleName(MobileUIConstants.BUTTON_ACTION); contentLayout.addComponent(pmButton); this.addComponent(contentLayout); }
From source file:com.mycollab.module.crm.view.activity.ActivityCalendarViewImpl.java
License:Open Source License
private void initContent() { MHorizontalLayout contentWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth(); this.addComponent(contentWrapper); /* Content cheat */ MVerticalLayout mainContent = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true)) .withFullWidth().withStyleName("readview-layout"); contentWrapper.with(mainContent).expand(mainContent); MVerticalLayout rightColumn = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false)) .withWidth("250px"); rightColumn.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); contentWrapper.addComponent(rightColumn); MHorizontalLayout actionPanel = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)) .withFullWidth().withStyleName(WebThemes.HEADER_VIEW); actionPanel.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Component headerText = ComponentUtils.header(CrmTypeConstants.ACTIVITY, "Calendar"); actionPanel.with(headerText).expand(headerText); mainContent.addComponent(actionPanel); dateHdr = new Label(); dateHdr.setSizeUndefined();//from w ww . ja v a2s . com dateHdr.setStyleName(ValoTheme.LABEL_H3); mainContent.addComponent(this.dateHdr); mainContent.setComponentAlignment(this.dateHdr, Alignment.MIDDLE_CENTER); toggleViewBtn = new PopupButton(UserUIContext.getMessage(DayI18nEnum.OPT_MONTHLY)); toggleViewBtn.setWidth("200px"); toggleViewBtn.addStyleName("calendar-view-switcher"); MVerticalLayout popupLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true)) .withWidth("190px"); monthViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_MONTHLY), clickEvent -> { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(monthViewBtn.getCaption()); calendarComponent.switchToMonthView(new Date(), true); datePicker.selectDate(new Date()); monthViewBtn.addStyleName("selected-style"); initLabelCaption(); }); monthViewBtn.setStyleName(WebThemes.BUTTON_LINK); popupLayout.addComponent(monthViewBtn); weekViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_WEEKLY), clickEvent -> { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(weekViewBtn.getCaption()); calendarComponent.switchToWeekView(new Date()); datePicker.selectWeek(new Date()); }); weekViewBtn.setStyleName(WebThemes.BUTTON_LINK); popupLayout.addComponent(weekViewBtn); dailyViewBtn = new Button(UserUIContext.getMessage(DayI18nEnum.OPT_DAILY), clickEvent -> { toggleViewBtn.setPopupVisible(false); toggleViewBtn.setCaption(dailyViewBtn.getCaption()); Date currentDate = new Date(); datePicker.selectDate(currentDate); calendarComponent.switchToDateView(currentDate); }); dailyViewBtn.setStyleName(WebThemes.BUTTON_LINK); popupLayout.addComponent(dailyViewBtn); toggleViewBtn.setContent(popupLayout); CssLayout toggleBtnWrap = new CssLayout(); toggleBtnWrap.setStyleName("switcher-wrap"); toggleBtnWrap.addComponent(toggleViewBtn); rightColumn.addComponent(toggleBtnWrap); rightColumn.setComponentAlignment(toggleBtnWrap, Alignment.MIDDLE_CENTER); rightColumn.addComponent(this.datePicker); initLabelCaption(); addCalendarEvent(); actionPanel.addComponent(calendarActionBtn); actionPanel.setComponentAlignment(calendarActionBtn, Alignment.MIDDLE_RIGHT); OptionPopupContent actionBtnLayout = new OptionPopupContent(); Button.ClickListener listener = new Button.ClickListener() { private static final long serialVersionUID = 1L; @Override public void buttonClick(ClickEvent event) { calendarActionBtn.setPopupVisible(false); String caption = event.getButton().getCaption(); if (caption.equals("New Task")) { EventBusFactory.getInstance().post(new ActivityEvent.TaskAdd(this, null)); } else if (caption.equals("New Call")) { EventBusFactory.getInstance().post(new ActivityEvent.CallAdd(this, null)); } else if (caption.equals("New Meeting")) { EventBusFactory.getInstance().post(new ActivityEvent.MeetingAdd(this, null)); } } }; MButton todoBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.NEW), listener) .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.TASK)) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_TASK)); actionBtnLayout.addOption(todoBtn); MButton callBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), listener) .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.CALL)) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_CALL)); actionBtnLayout.addOption(callBtn); MButton meetingBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), listener) .withStyleName(WebThemes.BUTTON_LINK).withIcon(CrmAssetsManager.getAsset(CrmTypeConstants.MEETING)) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_MEETING)); actionBtnLayout.addOption(meetingBtn); calendarActionBtn.setContent(actionBtnLayout); ButtonGroup viewSwitcher = new ButtonGroup(); Button calendarViewBtn = new Button("Calendar"); calendarViewBtn.setStyleName("selected"); calendarViewBtn.addStyleName(WebThemes.BUTTON_ACTION); viewSwitcher.addButton(calendarViewBtn); Button activityListBtn = new Button("Activities", event -> { ActivitySearchCriteria criteria = new ActivitySearchCriteria(); criteria.setSaccountid(new NumberSearchField(MyCollabUI.getAccountId())); EventBusFactory.getInstance().post(new ActivityEvent.GotoTodoList(this, null)); }); activityListBtn.addStyleName(WebThemes.BUTTON_ACTION); viewSwitcher.addButton(activityListBtn); actionPanel.addComponent(viewSwitcher); actionPanel.setComponentAlignment(viewSwitcher, Alignment.MIDDLE_RIGHT); calendarComponent = new CalendarDisplay(); mainContent.addComponent(calendarComponent); mainContent.setExpandRatio(calendarComponent, 1); mainContent.setComponentAlignment(calendarComponent, Alignment.MIDDLE_CENTER); HorizontalLayout spacing = new HorizontalLayout(); spacing.setHeight("30px"); mainContent.addComponent(spacing); HorizontalLayout noteInfoLayout = new HorizontalLayout(); noteInfoLayout.setSpacing(true); HorizontalLayout noteWapper = new HorizontalLayout(); noteWapper.setHeight("30px"); Label noteLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_NOTE)); noteWapper.addComponent(noteLbl); noteWapper.setComponentAlignment(noteLbl, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(noteWapper); HorizontalLayout completeWapper = new HorizontalLayout(); completeWapper.setWidth("100px"); completeWapper.setHeight("30px"); completeWapper.addStyleName("eventLblcompleted"); Label completeLabel = new Label("Completed"); completeWapper.addComponent(completeLabel); completeWapper.setComponentAlignment(completeLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(completeWapper); HorizontalLayout overdueWapper = new HorizontalLayout(); overdueWapper.setWidth("100px"); overdueWapper.setHeight("30px"); overdueWapper.addStyleName("eventLbloverdue"); Label overdueLabel = new Label("Overdue"); overdueWapper.addComponent(overdueLabel); overdueWapper.setComponentAlignment(overdueLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(overdueWapper); HorizontalLayout futureWapper = new HorizontalLayout(); futureWapper.setWidth("100px"); futureWapper.setHeight("30px"); futureWapper.addStyleName("eventLblfuture"); Label futureLabel = new Label("Future"); futureWapper.addComponent(futureLabel); futureWapper.setComponentAlignment(futureLabel, Alignment.MIDDLE_CENTER); noteInfoLayout.addComponent(futureWapper); mainContent.addComponent(noteInfoLayout); mainContent.setComponentAlignment(noteInfoLayout, Alignment.MIDDLE_CENTER); }