List of usage examples for com.vaadin.ui HorizontalLayout addComponent
@Override public void addComponent(Component c)
From source file:com.mycollab.mobile.module.project.view.message.MessageAttachmentField.java
License:Open Source License
@Override protected void constructUI() { content = new VerticalLayout(); content.setStyleName("attachment-field"); rowWrap = new VerticalLayout(); rowWrap.setWidth("100%"); rowWrap.setStyleName("attachment-row-wrap"); HorizontalLayout compHeader = new HorizontalLayout(); compHeader.setWidth("100%"); compHeader.setStyleName("attachment-field-header"); Label headerLbl = new Label(UserUIContext.getMessage(GenericI18Enum.FORM_ATTACHMENTS)); headerLbl.setStyleName("field-caption"); compHeader.addComponent(headerLbl); compHeader.setExpandRatio(headerLbl, 1.0f); compHeader.addComponent(attachmentBtn); content.addComponent(compHeader);//from w w w .j av a 2 s.c om content.addComponent(rowWrap); }
From source file:com.mycollab.mobile.ui.ConfirmDialog.java
License:Open Source License
private void constructUI(final String message, final String okCaption, final String cancelCaption) { VerticalLayout layout = new VerticalLayout(); layout.setWidth("100%"); layout.setHeightUndefined();//from w ww . j a va2s. c o m layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER); VerticalLayout messageWrapper = new VerticalLayout(); messageWrapper.setStyleName("message-wrapper"); messageWrapper.setWidth("100%"); messageWrapper.setMargin(true); final Label messageDisplay = new Label(message); messageDisplay.setWidth("100%"); messageWrapper.addComponent(messageDisplay); layout.addComponent(messageWrapper); HorizontalLayout controlBtn = new HorizontalLayout(); controlBtn.setWidth("100%"); final Button okBtn = new Button(okCaption); okBtn.setWidth("100%"); okBtn.setHeight("35px"); final Button cancelBtn = new Button(cancelCaption); cancelBtn.setWidth("100%"); cancelBtn.setHeight("35px"); ClickListener listener = (clickEvent) -> { ConfirmDialog.this.setConfirmed(clickEvent.getButton() == okBtn); if (ConfirmDialog.this.getListener() != null) { ConfirmDialog.this.getListener().onClose(ConfirmDialog.this); } close(); }; okBtn.addClickListener(listener); cancelBtn.addClickListener(listener); controlBtn.addComponent(cancelBtn); controlBtn.addComponent(okBtn); layout.addComponent(controlBtn); this.setContent(layout); }
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();/*w ww . j ava 2 s . c o m*/ 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); }
From source file:com.mycollab.module.crm.view.activity.ActivityRelatedItemListComp.java
License:Open Source License
private void initUI() { if (allowCreateNew) { HorizontalLayout buttonLayout = new HorizontalLayout(); buttonLayout.setSpacing(true);/*ww w . j a v a 2 s. c o m*/ final MButton newTaskBtn = new MButton(UserUIContext.getMessage(TaskI18nEnum.NEW), clickEvent -> fireNewRelatedItem("task")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_TASK)); buttonLayout.addComponent(newTaskBtn); final MButton newCallBtn = new MButton(UserUIContext.getMessage(CallI18nEnum.NEW), clickEvent -> fireNewRelatedItem("call")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_CALL)); buttonLayout.addComponent(newCallBtn); final MButton newMeetingBtn = new MButton(UserUIContext.getMessage(MeetingI18nEnum.NEW), clickEvent -> fireNewRelatedItem("meeting")).withIcon(FontAwesome.PLUS) .withStyleName(WebThemes.BUTTON_ACTION) .withVisible(UserUIContext.canWrite(RolePermissionCollections.CRM_MEETING)); buttonLayout.addComponent(newMeetingBtn); this.addComponent(buttonLayout); this.addStyleName("activity-realated-content"); } tableItem = new ActivityTableDisplay(Arrays.asList( new TableViewField(ActivityI18nEnum.FORM_SUBJECT, "subject", WebUIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_STATUS, "status", WebUIConstants.TABLE_S_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_START_DATE, "startDate", WebUIConstants.TABLE_DATE_TIME_WIDTH), new TableViewField(GenericI18Enum.FORM_END_DATE, "endDate", WebUIConstants.TABLE_DATE_TIME_WIDTH))); this.addComponent(tableItem); }
From source file:com.mycollab.module.crm.view.activity.ActivityRootView.java
License:Open Source License
public ActivityRootView() { super();// ww w . java 2s .c o m this.setSizeFull(); final CssLayout contentWrapper = new CssLayout(); contentWrapper.setStyleName("verticalTabView"); contentWrapper.setWidth("100%"); this.addComponent(contentWrapper); HorizontalLayout root = new HorizontalLayout(); root.setStyleName("menuContent"); activityTabs = new VerticalTabsheet(); activityTabs.setSizeFull(); activityTabs.setNavigatorWidth("170px"); activityTabs.setNavigatorStyleName("sidebar-menu"); activityTabs.setHeight(null); root.addComponent(activityTabs); root.setWidth("100%"); buildComponents(); contentWrapper.addComponent(root); }
From source file:com.mycollab.module.crm.view.opportunity.ContactRoleEditViewImpl.java
License:Open Source License
@Override public void display(SimpleOpportunity opportunity) { this.opportunity = opportunity; this.removeAllComponents(); this.setMargin(new MarginInfo(false, true, true, true)); this.addStyleName("oppcontact-role-edit"); AddViewLayout2 previewLayout = new AddViewLayout2( UserUIContext.getMessage(ContactI18nEnum.OPT_ADD_EDIT_CONTACT_ROLES), CrmAssetsManager.getAsset(CrmTypeConstants.CONTACT)); this.addComponent(previewLayout); ComponentContainer actionControls = createButtonControls(); if (actionControls != null) { previewLayout.addControlButtons(actionControls); }/*from ww w .ja va 2 s. co m*/ contactRoleList = new ContactOpportunityList(); previewLayout.addBody(contactRoleList); MButton addMoreContactRolesBtn = new MButton( UserUIContext.getMessage(ContactI18nEnum.ACTION_ADD_CONTACT_ROLES), clickEvent -> { SimpleContactOpportunityRel contactRole = new SimpleContactOpportunityRel(); ContactRoleRowComp row = new ContactRoleRowComp(contactRole); contactRoleList.addRow(row); }).withStyleName(WebThemes.BUTTON_ACTION); HorizontalLayout buttonControls = new HorizontalLayout(); buttonControls.addComponent(addMoreContactRolesBtn); buttonControls.setMargin(new MarginInfo(true, true, true, true)); previewLayout.addBody(buttonControls); }
From source file:com.mycollab.module.project.ui.components.TimeLogComp.java
License:Open Source License
protected TimeLogComp() { this.itemTimeLoggingService = AppContextUtil.getSpringBean(ItemTimeLoggingService.class); this.withMargin(false); HorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr"); header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); Label dateInfoHeader = new Label( FontAwesome.CLOCK_O.getHtml() + " " + UserUIContext.getMessage(TimeTrackingI18nEnum.SUB_INFO_TIME), ContentMode.HTML);//from ww w . j ava2 s . c o m header.addComponent(dateInfoHeader); if (hasEditPermission()) { MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> showEditTimeWindow(beanItem)).withStyleName(WebThemes.BUTTON_LINK); header.addComponent(editBtn); } header.addComponent(ELabel.fontIcon(FontAwesome.QUESTION_CIRCLE) .withDescription(UserUIContext.getMessage(TimeTrackingI18nEnum.TIME_EXPLAIN_HELP)) .withStyleName(WebThemes.INLINE_HELP)); this.addComponent(header); MVerticalLayout layout = new MVerticalLayout().withFullWidth() .withMargin(new MarginInfo(false, false, false, true)); billableHoursLbl = new Label(); nonBillableHoursLbl = new Label(); remainHoursLbl = new Label(); layout.addComponent(billableHoursLbl); layout.addComponent(nonBillableHoursLbl); layout.addComponent(remainHoursLbl); this.addComponent(layout); }
From source file:com.mycollab.module.project.view.settings.ProjectMemberListViewImpl.java
License:Open Source License
private Component generateMemberBlock(final SimpleProjectMember member) { HorizontalLayout blockContent = new HorizontalLayout(); blockContent.setStyleName("member-block"); if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) { blockContent.addStyleName("inactive"); }// w w w . ja va 2 s. co m blockContent.setWidth("350px"); Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100); memberAvatar.addStyleName(UIConstants.CIRCLE_BOX); memberAvatar.setWidthUndefined(); blockContent.addComponent(memberAvatar); MVerticalLayout blockTop = new MVerticalLayout().withMargin(new MarginInfo(false, false, false, true)) .withFullWidth(); MButton editBtn = new MButton("", clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, member))) .withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); editBtn.setDescription("Edit user '" + member.getDisplayName() + "' information"); MButton deleteBtn = new MButton("", clickEvent -> { ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.BUTTON_YES), UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> { if (confirmDialog.isConfirmed()) { ProjectMemberService prjMemberService = AppContextUtil .getSpringBean(ProjectMemberService.class); prjMemberService.removeWithSession(member, UserUIContext.getUsername(), MyCollabUI.getAccountId()); EventBusFactory.getInstance() .post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, null)); } }); }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK) .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)); deleteBtn.setDescription("Remove user '" + member.getDisplayName() + "' out of this project"); MHorizontalLayout buttonControls = new MHorizontalLayout(editBtn, deleteBtn); blockTop.addComponent(buttonControls); blockTop.setComponentAlignment(buttonControls, Alignment.TOP_RIGHT); A memberLink = new A( ProjectLinkBuilder.generateProjectMemberFullLink(member.getProjectid(), member.getUsername())) .appendText(member.getMemberFullName()).setTitle(member.getMemberFullName()); ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(UIConstants.TEXT_ELLIPSIS) .withFullWidth(); blockTop.with(memberNameLbl, ELabel.hr()); String roleLink = String.format("<a href=\"%s%s%s\"", MyCollabUI.getSiteUrl(), GenericLinkUtils.URL_PREFIX_PARAM, ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid())); ELabel memberRole = new ELabel("", ContentMode.HTML).withFullWidth() .withStyleName(UIConstants.TEXT_ELLIPSIS); if (member.isProjectOwner()) { memberRole.setValue(String.format("%sstyle=\"color: #B00000;\">%s</a>", roleLink, UserUIContext.getMessage(ProjectRoleI18nEnum.OPT_ADMIN_ROLE_DISPLAY))); } else { memberRole.setValue( String.format("%sstyle=\"color:gray;font-size:12px;\">%s</a>", roleLink, member.getRoleName())); } blockTop.addComponent(memberRole); if (Boolean.TRUE.equals(MyCollabUI.showEmailPublicly())) { Label memberEmailLabel = ELabel .html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())) .withStyleName(UIConstants.META_INFO).withFullWidth(); blockTop.addComponent(memberEmailLabel); } ELabel memberSinceLabel = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getJoindate()))) .withDescription(UserUIContext.formatDateTime(member.getJoindate())).withFullWidth(); blockTop.addComponent(memberSinceLabel); if (ProjectMemberStatusConstants.ACTIVE.equals(member.getStatus())) { ELabel lastAccessTimeLbl = ELabel .html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_LOGGED_IN, UserUIContext.formatPrettyTime(member.getLastAccessTime()))) .withDescription(UserUIContext.formatDateTime(member.getLastAccessTime())); blockTop.addComponent(lastAccessTimeLbl); } String memberWorksInfo = ProjectAssetsManager.getAsset(ProjectTypeConstants.TASK).getHtml() + " " + new Span().appendText("" + member.getNumOpenTasks()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + " " + ProjectAssetsManager.getAsset(ProjectTypeConstants.BUG).getHtml() + " " + new Span().appendText("" + member.getNumOpenBugs()) .setTitle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + FontAwesome.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + " " + FontAwesome.GIFT.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())) .setTitle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)); blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(UIConstants.META_INFO)); blockContent.addComponent(blockTop); blockContent.setExpandRatio(blockTop, 1.0f); return blockContent; }
From source file:com.mycollab.vaadin.web.ui.DefaultDynaFormLayout.java
License:Open Source License
@Override public Component attachField(Object propertyId, Field<?> field) { AbstractDynaField dynaField = fieldMappings.get(propertyId); if (dynaField != null) { DynaSection section = dynaField.getOwnSection(); GridFormLayoutHelper gridLayout = sectionMappings.get(section); HorizontalLayout componentWrapper = gridLayout .getComponentWrapper(UserUIContext.getMessage(dynaField.getDisplayName())); if (componentWrapper != null) { componentWrapper.addComponent(field); }/*w ww . ja va 2 s . c o m*/ return field; } return null; }
From source file:com.mycollab.vaadin.web.ui.SplitButton.java
License:Open Source License
public SplitButton(Button parentButton) { this.setImmediate(true); HorizontalLayout contentLayout = new HorizontalLayout(); contentLayout.setStyleName("splitbutton"); this.parentButton = parentButton; parentButton.addStyleName("parent-button"); parentButton.setImmediate(true);//from w w w . ja v a 2s . co m parentButton.addClickListener(clickEvent -> fireEvent(new SplitButtonClickEvent(SplitButton.this))); popupButton = new PopupButton(); popupButton.addClickListener(clickEvent -> { isPopupVisible = !isPopupVisible; fireEvent(new SplitButtonPopupVisibilityEvent(SplitButton.this, isPopupVisible)); }); contentLayout.addComponent(parentButton); contentLayout.addComponent(popupButton); this.setCompositionRoot(contentLayout); }