org.vaadin.viritin.layouts.MHorizontalLayout.addComponent() - java examples

Here are the examples of the java api org.vaadin.viritin.layouts.MHorizontalLayout.addComponent() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

31 Examples 7

19 View Complete Implementation : ProjectPreviewFormControlsGenerator.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @param comp
 */
public void insertToControlBlock(Component comp) {
    wrapLayout.addComponent(comp, 0);
}

19 View Complete Implementation : MilestoneListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Component buildBody() {
    CustomLayout bodyContent = CustomLayoutExt.createLayout("milestoneView");
    MHorizontalLayout closedHeaderLayout = new MHorizontalLayout();
    closedHeader = ELabel.html("").withUndefinedWidth();
    closedHeaderLayout.with(closedHeader).withAlign(closedHeader, Alignment.MIDDLE_CENTER);
    bodyContent.addComponent(closedHeaderLayout, "closed-header");
    closeContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
    bodyContent.addComponent(closeContainer, "closed-milestones");
    MHorizontalLayout inProgressHeaderLayout = new MHorizontalLayout();
    inProgressHeader = ELabel.html("").withUndefinedWidth();
    inProgressHeaderLayout.addComponent(inProgressHeader);
    inProgressHeaderLayout.setComponentAlignment(inProgressHeader, Alignment.MIDDLE_CENTER);
    bodyContent.addComponent(inProgressHeaderLayout, "in-progress-header");
    inProgressContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
    bodyContent.addComponent(this.inProgressContainer, "in-progress-milestones");
    MHorizontalLayout futureHeaderLayout = new MHorizontalLayout();
    futureHeader = ELabel.html("").withUndefinedWidth();
    futureHeaderLayout.addComponent(futureHeader);
    futureHeaderLayout.setComponentAlignment(futureHeader, Alignment.MIDDLE_CENTER);
    bodyContent.addComponent(futureHeaderLayout, "future-header");
    futureContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
    bodyContent.addComponent(this.futureContainer, "future-milestones");
    return bodyContent;
}

19 View Complete Implementation : PreviewFormControlsGenerator.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void insertToControlBlock(Component comp) {
    editButtons.addComponent(comp, 0);
}

19 View Complete Implementation : ContainerHorizontalViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void addComponentField(Component component) {
    layout.addComponent(component);
}

19 View Complete Implementation : AbstractToggleSummaryField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void addControl(Component control) {
    buttonControls.addComponent(control);
}

18 View Complete Implementation : ProjectFollowersComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void displayFollowers(final V bean) {
    this.bean = bean;
    try {
        typeId = (Integer) PropertyUtils.getProperty(bean, "id");
    } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
        LOG.error("Error", e);
        return;
    }
    this.removeAllComponents();
    MHorizontalLayout header = new MHorizontalLayout().withStyleName("info-hdr");
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    Label followerHeader = new Label(VaadinIcons.EYE.getHtml() + " " + UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS), ContentMode.HTML);
    header.addComponent(followerHeader);
    if (hasEditPermission()) {
        final PopupView addPopupView = new PopupView(UserUIContext.getMessage(GenericI18Enum.ACTION_MODIFY), new MVerticalLayout());
        addPopupView.addPopupVisibilityListener(popupVisibilityEvent -> {
            PopupView.Content content = addPopupView.getContent();
            if (popupVisibilityEvent.isPopupVisible()) {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                popupComponent.removeAllComponents();
                popupComponent.with(new ELabel(UserUIContext.getMessage(FollowerI18nEnum.OPT_SUB_INFO_WATCHERS)).withStyleName(ValoTheme.LABEL_H3), new ModifyWatcherPopup());
            } else {
                MVerticalLayout popupComponent = (MVerticalLayout) content.getPopupComponent();
                ModifyWatcherPopup popup = (ModifyWatcherPopup) popupComponent.getComponent(1);
                List<MonitorItem> unsavedItems = popup.getUnsavedItems();
                monitorItemService.saveMonitorItems(unsavedItems);
                loadWatchers();
            }
        });
        header.addComponent(addPopupView);
    }
    header.addComponent(ELabel.fontIcon(VaadinIcons.QUESTION_CIRCLE).withStyleName(WebThemes.INLINE_HELP).withDescription(UserUIContext.getMessage(FollowerI18nEnum.FOLLOWER_EXPLAIN_HELP)));
    this.addComponent(header);
    watcherLayout = new MCssLayout().withFullWidth().withStyleName(WebThemes.FLEX_DISPLAY);
    this.addComponent(watcherLayout);
    loadWatchers();
}

18 View Complete Implementation : AddViewLayout.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void addHeaderreplacedle(Component headerContainer) {
    header.addComponent(headerContainer, 0);
    header.withAlign(headerContainer, Alignment.TOP_LEFT).expand(headerContainer);
}

17 View Complete Implementation : MilestoneListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private HorizontalLayout createHeaderRight() {
    MHorizontalLayout layout = new MHorizontalLayout();
    MButton createBtn = new MButton(UserUIContext.getMessage(MilestoneI18nEnum.NEW), clickEvent -> {
        SimpleMilestone milestone = new SimpleMilestone();
        milestone.setSaccountid(AppUI.getAccountId());
        milestone.setProjectid(CurrentProjectVariables.getProjectId());
        UI.getCurrent().addWindow(new MilestoneAddWindow(milestone));
    }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    layout.with(createBtn);
    MButton printBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() {

        @Override
        protected Object doEval() {
            return baseCriteria;
        }
    }))).withIcon(VaadinIcons.PRINT).withStyleName(WebThemes.BUTTON_OPTION).withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
    layout.addComponent(printBtn);
    MButton boardBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_BOARD)).withIcon(VaadinIcons.SERVER).withWidth("100px");
    MButton roadmapBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST), clickEvent -> EventBusFactory.getInstance().post(new MilestoneEvent.GotoRoadmap(MilestoneListViewImpl.this))).withIcon(VaadinIcons.BULLETS).withWidth("100px");
    layout.with(new ButtonGroup(roadmapBtn, boardBtn).withDefaultButton(boardBtn));
    return layout;
}

17 View Complete Implementation : UnresolvedTicketByPriorityWidget.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayPlainMode() {
    MVerticalLayout bodyContent = (MVerticalLayout) getContent();
    bodyContent.removeAllComponents();
    TicketPriorityClickListener listener = new TicketPriorityClickListener();
    this.setCaption(String.format("%s (%d)", UserUIContext.getMessage(TaskI18nEnum.WIDGET_UNRESOLVED_BY_PRIORITY_replacedLE), totalCount));
    if (!groupItems.isEmpty()) {
        for (Priority priority : OptionI18nEnum.priorities) {
            boolean isFound = false;
            for (GroupItem item : groupItems) {
                if (priority.name().equals(item.getGroupid())) {
                    isFound = true;
                    MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth();
                    priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                    MButton priorityLink = new ButtonI18nComp(priority.name(), priority, listener).withIcon(ProjectreplacedetsManager.getPriority(priority.name())).withStyleName(WebThemes.BUTTON_LINK, "priority-" + priority.name().toLowerCase()).withWidth("110px");
                    priorityLayout.addComponent(priorityLink);
                    ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, item.getValue().intValue(), false);
                    indicator.setWidth("100%");
                    priorityLayout.with(indicator).expand(indicator);
                    bodyContent.addComponent(priorityLayout);
                }
            }
            if (!isFound) {
                MHorizontalLayout priorityLayout = new MHorizontalLayout().withFullWidth();
                priorityLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
                MButton priorityLink = new ButtonI18nComp(priority.name(), priority, listener).withIcon(ProjectreplacedetsManager.getPriority(priority.name())).withStyleName(WebThemes.BUTTON_LINK, "priority-" + priority.name().toLowerCase()).withWidth("110px");
                priorityLayout.addComponent(priorityLink);
                ProgressBarIndicator indicator = new ProgressBarIndicator(totalCount, 0, false);
                indicator.setWidth("100%");
                priorityLayout.with(indicator).expand(indicator);
                bodyContent.addComponent(priorityLayout);
            }
        }
    }
}

17 View Complete Implementation : RoleListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout();
    MCssLayout layoutWrapper = new MCssLayout(layout).withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);
    selectOptionButton = new SelectionOptionButton(tableItem);
    layout.addComponent(selectOptionButton);
    tableActionControls = new DefaultMreplacedItemActionHandlerContainer();
    if (UserUIContext.canAccess(RolePermissionCollections.ACCOUNT_ROLE)) {
        tableActionControls.addDeleteActionItem();
    }
    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();
    layout.with(tableActionControls, selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_LEFT);
    return layoutWrapper;
}

17 View Complete Implementation : AbstractBeanBlockList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
protected CssLayout createPageControls() {
    this.controlBarWrapper = new CssLayout();
    this.controlBarWrapper.setWidth("100%");
    final HorizontalLayout controlBar = new HorizontalLayout();
    controlBar.setWidth("100%");
    this.controlBarWrapper.addComponent(controlBar);
    pageManagement = new MHorizontalLayout();
    // defined layout here ---------------------------
    if (currentPage > 1) {
        final Button firstLink = new Button("1", new Button.ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(1);
            }
        });
        firstLink.addStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        final Button previous2 = new Button("" + (currentPage - 2), new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(currentPage - 2);
            }
        });
        previous2.addStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        final Button previous1 = new Button("" + (currentPage - 1), new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage - 1);
            }
        });
        previous1.addStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    final Button current = new Button("" + currentPage, new ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final ClickEvent event) {
            AbstractBeanBlockList.this.pageChange(currentPage);
        }
    });
    current.addStyleName("buttonPaging");
    current.addStyleName("current");
    pageManagement.addComponent(current);
    final int range = totalPage - currentPage;
    if (range >= 1) {
        final Button next1 = new Button("" + (currentPage + 1), new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 1);
            }
        });
        next1.addStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        final Button next2 = new Button("" + (currentPage + 2), new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                AbstractBeanBlockList.this.pageChange(currentPage + 2);
            }
        });
        next2.addStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        final Button last = new Button("" + totalPage, new ClickListener() {

            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                pageChange(totalPage);
            }
        });
        last.addStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }
    pageManagement.setWidth(null);
    controlBar.addComponent(pageManagement);
    controlBar.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT);
    return this.controlBarWrapper;
}

17 View Complete Implementation : BuildCriterionComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void buildSaveFilterBox() {
    filterBox.removeAllComponents();
    TextField queryTextField = new TextField();
    filterBox.addComponent(queryTextField);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
        String queryText = queryTextField.getValue();
        saveSearchCriteria(queryText);
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(ShortcutAction.KeyCode.ENTER);
    filterBox.addComponent(saveBtn);
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> buildFilterBox(null)).withStyleName(WebThemes.BUTTON_OPTION);
    filterBox.addComponent(cancelBtn);
}

17 View Complete Implementation : BuildCriterionComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void buildFilterBox(String queryName) {
    filterBox.removeAllComponents();
    SavedSearchResultComboBox filterComboBox = new SavedSearchResultComboBox();
    filterBox.addComponent(filterComboBox);
    MButton saveSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NEW_FILTER), clickEvent -> buildSaveFilterBox()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.PLUS);
    filterBox.addComponent(saveSearchBtn);
}

17 View Complete Implementation : AbstractPagedBeanTable.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private ComponentContainer createPagingControls() {
    controlBarWrapper = new HorizontalLayout();
    controlBarWrapper.setWidth("100%");
    controlBarWrapper.setStyleName("listControl");
    MHorizontalLayout pageManagement = new MHorizontalLayout();
    // defined layout here ---------------------------
    if (currentPage > 1) {
        MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2)).withStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1)).withStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage)).withStyleName("buttonPaging", "current");
    pageManagement.addComponent(current);
    final int range = totalPage - currentPage;
    if (range >= 1) {
        MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1)).withStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2)).withStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        final Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        MButton last = new MButton("" + totalPage, clickEvent -> pageChange(totalPage)).withStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }
    pageManagement.setWidth(null);
    controlBarWrapper.addComponent(pageManagement);
    controlBarWrapper.setComponentAlignment(pageManagement, Alignment.MIDDLE_RIGHT);
    return controlBarWrapper;
}

16 View Complete Implementation : SubTicketsComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected Component initContent() {
    MHorizontalLayout contentLayout = new MHorizontalLayout().withFullWidth();
    ticketsLayout = new VerticalRemoveInlineComponentMarker().withFullWidth().withMargin(new MarginInfo(false, true, true, false));
    contentLayout.with(ticketsLayout).expand(ticketsLayout);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        MButton addNewTaskBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
            MWindow newTicketWindow = AppContextUtil.getSpringBean(TicketComponentFactory.clreplaced).createNewTicketWindow(null, parentTicket.getProjectId(), parentTicket.getMilestoneId(), true, null);
            UI.getCurrent().addWindow(newTicketWindow);
        }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.PLUS);
        SplitButton splitButton = new SplitButton(addNewTaskBtn);
        splitButton.setWidthUndefined();
        splitButton.addStyleName(WebThemes.BUTTON_ACTION);
        OptionPopupContent popupButtonsControl = new OptionPopupContent();
        Button selectBtn = new Button(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), clickEvent -> {
            splitButton.setPopupVisible(false);
            UI.getCurrent().addWindow(new SelectChildTicketWindow(parentTicket));
        });
        popupButtonsControl.addOption(selectBtn);
        splitButton.setContent(popupButtonsControl);
        contentLayout.addComponent(splitButton);
    }
    ProjectTicketService projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
    List<ProjectTicket> subTickets = projectTicketService.findSubTickets(ProjectTypeConstants.TASK, parentTicket.getTypeId());
    if (CollectionUtils.isNotEmpty(subTickets)) {
        for (ProjectTicket subTicket : subTickets) {
            ticketsLayout.addComponent(generateSubTicketContent(subTicket));
        }
    }
    return contentLayout;
}

16 View Complete Implementation : PreviewFormControlsGenerator.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(WebThemes.BUTTON_OPTION);
    optionBtn.setIcon(VaadinIcons.ELLIPSIS_H);
    if (permissionItem != null) {
        boolean canWrite = UserUIContext.canWrite(permissionItem);
        boolean canAccess = UserUIContext.canAccess(permissionItem);
        boolean canRead = UserUIContext.canRead(permissionItem);
        if (canWrite && (buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
            editButtons.addComponent(addBtn);
        }
        if (canWrite && (buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }).withIcon(VaadinIcons.EDIT).withStyleName(WebThemes.BUTTON_ACTION);
            editButtons.addComponent(editBtn);
        }
        if (canAccess && (buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireDeleteForm(item);
            }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_DANGER);
            editButtons.addComponent(deleteBtn);
        }
        layout.with(editButtons);
        if (canRead && (buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            MButton previousItem = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }).withIcon(VaadinIcons.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_ACTION).withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            navigationBtns.addButton(previousItem);
            MButton nexreplacedemBtn = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoNexreplacedem(item);
            }).withIcon(VaadinIcons.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_ACTION).withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            navigationBtns.addButton(nexreplacedemBtn);
            layout.with(navigationBtns);
        }
        if (canWrite && (buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireCloneForm(item);
            }).withIcon(VaadinIcons.ROAD);
            popupButtonsControl.addOption(cloneBtn);
        }
        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            layout.with(optionBtn);
        }
    }
    return layout;
}

16 View Complete Implementation : AbstractBeanPagedList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
protected MHorizontalLayout createPageControls() {
    controlBarWrapper = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(false, true, false, true)).withStyleName(listControlStyle);
    pageManagement = new MHorizontalLayout();
    // defined layout here ---------------------------
    if (currentPage > 1) {
        MButton firstLink = new MButton("1", clickEvent -> pageChange(1)).withStyleName("buttonPaging");
        pageManagement.addComponent(firstLink);
    }
    if (currentPage >= 5) {
        final Label ss1 = new Label("...");
        ss1.addStyleName("buttonPaging");
        pageManagement.addComponent(ss1);
    }
    if (currentPage > 3) {
        MButton previous2 = new MButton("" + (currentPage - 2), clickEvent -> pageChange(currentPage - 2)).withStyleName("buttonPaging");
        pageManagement.addComponent(previous2);
    }
    if (currentPage > 2) {
        MButton previous1 = new MButton("" + (currentPage - 1), clickEvent -> pageChange(currentPage - 1)).withStyleName("buttonPaging");
        pageManagement.addComponent(previous1);
    }
    // Here add current ButtonLinkLegacy
    MButton current = new MButton("" + currentPage, clickEvent -> pageChange(currentPage)).withStyleName("buttonPaging", "current");
    pageManagement.addComponent(current);
    final int range = this.totalPage - currentPage;
    if (range >= 1) {
        MButton next1 = new MButton("" + (currentPage + 1), clickEvent -> pageChange(currentPage + 1)).withStyleName("buttonPaging");
        pageManagement.addComponent(next1);
    }
    if (range >= 2) {
        MButton next2 = new MButton("" + (currentPage + 2), clickEvent -> pageChange(currentPage + 2)).withStyleName("buttonPaging");
        pageManagement.addComponent(next2);
    }
    if (range >= 4) {
        Label ss2 = new Label("...");
        ss2.addStyleName("buttonPaging");
        pageManagement.addComponent(ss2);
    }
    if (range >= 3) {
        MButton last = new MButton("" + this.totalPage, clickEvent -> pageChange(totalPage)).withStyleName("buttonPaging");
        pageManagement.addComponent(last);
    }
    controlBarWrapper.with(pageManagement).withAlign(pageManagement, Alignment.MIDDLE_RIGHT);
    return controlBarWrapper;
}

16 View Complete Implementation : ProjectSettingViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void showNotificationSettings(ProjectNotificationSetting notification) {
    mainBody.removeAllComponents();
    ProjectNotificationSettingViewComponent component = new ProjectNotificationSettingViewComponent(notification);
    mainBody.addComponent(component);
}

15 View Complete Implementation : ProjectPreviewFormControlsGenerator.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public MHorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    optionBtn = new PopupButton();
    optionBtn.addStyleName(WebThemes.BUTTON_OPTION);
    optionBtn.setIcon(VaadinIcons.ELLIPSIS_H);
    if (permissionItem != null) {
        boolean canWrite = CurrentProjectVariables.canWrite(permissionItem);
        boolean canAccess = CurrentProjectVariables.canAccess(permissionItem);
        boolean canRead = CurrentProjectVariables.canRead(permissionItem);
        if (canWrite && (buttonEnableFlags & replacedIGN_BTN_PRESENTED) == replacedIGN_BTN_PRESENTED) {
            MButton replacedignBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_replacedIGN), clickEvent -> {
                T item = previewForm.getBean();
                previewForm.firereplacedignForm(item);
            }).withIcon(VaadinIcons.SHARE).withStyleName(WebThemes.BUTTON_ACTION);
            editButtons.addComponent(replacedignBtn);
        }
        if (canWrite && (buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
            MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireAddForm(item);
            }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
            editButtons.addComponent(addBtn);
        }
        if (canWrite && (buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
            MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireEditForm(item);
            }).withIcon(VaadinIcons.EDIT).withStyleName(WebThemes.BUTTON_ACTION);
            editButtons.addComponent(editBtn);
        }
        if (canRead && (buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
            final PrintButton printBtn = new PrintButton(UserUIContext.getMessage(GenericI18Enum.ACTION_PRINT));
            printBtn.withListener(clickEvent -> {
                T item = previewForm.getBean();
                previewForm.firePrintForm(printBtn, item);
            }).withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_PRINT));
            popupButtonsControl.addOption(printBtn);
        }
        if (canWrite && (buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
            MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> {
                optionBtn.setPopupVisible(false);
                T item = previewForm.getBean();
                previewForm.fireCloneForm(item);
            }).withIcon(VaadinIcons.ROAD);
            popupButtonsControl.addOption(cloneBtn);
        }
        wrapLayout.withComponent(editButtons);
        if (canRead && (buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
            ButtonGroup navigationBtns = new ButtonGroup();
            MButton previousItem = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }).withIcon(VaadinIcons.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION).withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
            navigationBtns.addButton(previousItem);
            MButton nexreplacedemBtn = new MButton("", clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireGotoNexreplacedem(item);
            }).withIcon(VaadinIcons.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION).withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
            navigationBtns.addButton(nexreplacedemBtn);
            wrapLayout.withComponent(navigationBtns);
        }
        if (canAccess && (buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
            MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
                T item = previewForm.getBean();
                previewForm.fireDeleteForm(item);
            }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_DANGER);
            popupButtonsControl.addDangerOption(deleteBtn);
        }
        if (popupButtonsControl.getComponentCount() > 0) {
            optionBtn.setContent(popupButtonsControl);
            wrapLayout.withComponent(optionBtn);
        }
    }
    return layout.with(wrapLayout).withAlign(wrapLayout, Alignment.MIDDLE_RIGHT);
}

15 View Complete Implementation : UnresolvedTicketsByAssigneeWidget.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayPlainMode() {
    MVerticalLayout bodyContent = (MVerticalLayout) getContent();
    bodyContent.removeAllComponents();
    int totalreplacedignTicketCounts = 0;
    if (CollectionUtils.isNotEmpty(groupItems)) {
        for (GroupItem item : groupItems) {
            MHorizontalLayout replacedigneeLayout = new MHorizontalLayout().withFullWidth();
            replacedigneeLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
            String replacedignUser = item.getGroupid();
            String replacedignUserFullName = item.getGroupid() == null ? "" : item.getGroupname();
            if (StringUtils.isBlank(replacedignUserFullName)) {
                replacedignUserFullName = StringUtils.extractNameFromEmail(item.getGroupid());
            }
            TicketreplacedigneeLink ticketreplacedigneeLink = new TicketreplacedigneeLink(replacedignUser, item.getExtraValue(), replacedignUserFullName);
            replacedigneeLayout.addComponent(new MCssLayout(ticketreplacedigneeLink).withWidth("110px"));
            ProgressBarIndicator indicator = new ProgressBarIndicator(totalCounreplacedems, item.getValue().intValue(), false);
            indicator.setWidth("100%");
            replacedigneeLayout.with(indicator).expand(indicator);
            bodyContent.addComponent(replacedigneeLayout);
            totalreplacedignTicketCounts += item.getValue().intValue();
        }
    }
    int totalUnreplacedignTicketsCount = totalCounreplacedems - totalreplacedignTicketCounts;
    if (totalUnreplacedignTicketsCount > 0) {
        MButton unreplacedignLink = new MButton("No replacedignee").withStyleName(WebThemes.BUTTON_LINK).withIcon(UserAvatarControlFactory.createAvatarResource(null, 16)).withListener(clickEvent -> {
            ProjectTicketSearchCriteria criteria = BeanUtility.deepClone(searchCriteria);
            criteria.setUnreplacedignee(new SearchField());
            EventBusFactory.getInstance().post(new TicketEvent.SearchRequest(UnresolvedTicketsByreplacedigneeWidget.this, criteria));
        });
        MHorizontalLayout replacedigneeLayout = new MHorizontalLayout().withFullWidth();
        replacedigneeLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        replacedigneeLayout.addComponent(new MCssLayout(unreplacedignLink).withWidth("110px"));
        ProgressBarIndicator indicator = new ProgressBarIndicator(totalCounreplacedems, totalUnreplacedignTicketsCount, false);
        indicator.setWidth("100%");
        replacedigneeLayout.with(indicator).expand(indicator);
        bodyContent.addComponent(replacedigneeLayout);
    }
}

15 View Complete Implementation : FormControlsGenerator.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public static <T> ComponentContainer generateEditFormControls(final AdvancedEditBeanForm<T> editForm, boolean isSaveBtnVisible, boolean isSaveAndNewBtnVisible, boolean isCancelBtnVisible) {
    MHorizontalLayout layout = new MHorizontalLayout();
    if (isCancelBtnVisible) {
        MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> editForm.fireCancelForm()).withStyleName(WebThemes.BUTTON_OPTION);
        layout.addComponent(cancelBtn);
    }
    if (isSaveAndNewBtnVisible) {
        MButton saveAndNewBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE_NEW), clickEvent -> {
            if (editForm.validateForm()) {
                editForm.fireSaveAndNewForm();
            }
        }).withIcon(VaadinIcons.CLIPBOARD_CROSS).withStyleName(WebThemes.BUTTON_ACTION);
        if (!isSaveBtnVisible) {
            saveAndNewBtn.withClickShortcut(KeyCode.ENTER);
        }
        layout.addComponent(saveAndNewBtn);
    }
    if (isSaveBtnVisible) {
        MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
            if (editForm.validateForm()) {
                editForm.fireSaveForm();
            }
        }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);
        layout.addComponent(saveBtn);
    }
    return layout;
}

14 View Complete Implementation : LogoEditWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void editPhoto(byte[] imageData) {
    try {
        originalImage = ImageIO.read(new ByteArrayInputStream(imageData));
    } catch (IOException e) {
        throw new UserInvalidInputException("Invalid image type");
    }
    originalImage = ImageUtil.scaleImage(originalImage, 650, 650);
    MHorizontalLayout previewBox = new MHorizontalLayout().withMargin(new MarginInfo(false, true, true, false)).withFullWidth();
    final String logoPath = AppUI.getBillingAccount().getLogopath();
    Resource defaultPhoto = AccountreplacedetsResolver.createLogoResource(logoPath, 150);
    previewImage = new Embedded(null, defaultPhoto);
    previewImage.setWidth("100px");
    previewBox.addComponent(previewImage);
    previewBox.setComponentAlignment(previewImage, Alignment.TOP_LEFT);
    MVerticalLayout previewBoxRight = new MVerticalLayout().withSpacing(false).withMargin(new MarginInfo(false, true, false, true));
    previewBoxRight.addComponent(ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_IMAGE_EDIT_INSTRUCTION)));
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> EventBusFactory.getInstance().post(new SettingEvent.GotoGeneralSetting(LogoEditWindow.this, null))).withStyleName(WebThemes.BUTTON_OPTION);
    MButton acceptBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ACCEPT), clickEvent -> {
        if (scaleImageData != null && scaleImageData.length > 0) {
            try {
                BufferedImage image = ImageIO.read(new ByteArrayInputStream(scaleImageData));
                AccountLogoService accountLogoService = AppContextUtil.getSpringBean(AccountLogoService.clreplaced);
                accountLogoService.upload(UserUIContext.getUsername(), image, AppUI.getAccountId());
                UIUtils.reloadPage();
            } catch (IOException e) {
                throw new MyCollabException("Error when saving account logo", e);
            }
        }
    }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD).withClickShortcut(ShortcutAction.KeyCode.ENTER);
    MHorizontalLayout controlBtns = new MHorizontalLayout(acceptBtn, cancelBtn);
    previewBoxRight.with(controlBtns).withAlign(controlBtns, Alignment.TOP_LEFT);
    previewBox.with(previewBoxRight).expand(previewBoxRight);
    content.addComponent(previewBox);
    CssLayout cropBox = new CssLayout();
    cropBox.setWidth("100%");
    VerticalLayout currentPhotoBox = new VerticalLayout();
    Resource resource = new ByteArrayImageResource(ImageUtil.convertImageToByteArray(originalImage), "image/png");
    Cropper cropField = new Cropper(resource);
    cropField.setAspectRatio(150 / 28);
    cropField.addCropSelectionChangedListener(valueChangeEvent -> {
        CropSelection newSelection = valueChangeEvent.getSelection();
        int x1 = newSelection.getX();
        int y1 = newSelection.getY();
        int x2 = newSelection.getWidth();
        int y2 = newSelection.getHeight();
        if (x2 > x1 && y2 > y1) {
            BufferedImage subImage = originalImage.getSubimage(x1, y1, x2, y2);
            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
            try {
                ImageIO.write(subImage, "png", outStream);
                scaleImageData = outStream.toByteArray();
                displayPreviewImage();
            } catch (IOException e) {
                LOG.error("Error while scale image: ", e);
            }
        }
    });
    currentPhotoBox.setWidth("650px");
    currentPhotoBox.setHeight("650px");
    currentPhotoBox.addComponent(cropField);
    cropBox.addComponent(currentPhotoBox);
    content.with(previewBox, ELabel.hr(), cropBox);
}

13 View Complete Implementation : CommentRowDisplayHandler.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false)).withFullWidth();
    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);
    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
    MHorizontalLayout messageHeader = new MHorizontalLayout().withMargin(false).withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime()));
    timePostLbl.setStyleName(WebThemes.META_INFO);
    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_ICON_ONLY).withListener(clickEvent -> ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
            if (confirmDialog.isConfirmed()) {
                CommentService commentService = AppContextUtil.getSpringBean(CommentService.clreplaced);
                commentService.removeWithSession(comment, UserUIContext.getUsername(), AppUI.getAccountId());
                ((BeanList) host).removeRow(layout);
            }
        }));
        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }
    rowLayout.addComponent(messageHeader);
    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);
    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }
    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

12 View Complete Implementation : StandupReportFormLayoutFactory.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public AbstractComponent getLayout() {
    AddViewLayout reportAddLayout = new AddViewLayout(replacedle, ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.STANDUP));
    reportAddLayout.addHeaderRight(this.createTopPanel());
    MHorizontalLayout mainLayout = new MHorizontalLayout().withFullWidth();
    final MVerticalLayout layoutField = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false)).withFullWidth();
    final ELabel whatYesterdayLbl = ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_LASTDAY));
    layoutField.addComponent(whatYesterdayLbl);
    whatYesterdayField = new StandupCustomField();
    layoutField.addComponent(whatYesterdayField);
    final ELabel whatTodayLbl = ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_TODAY));
    layoutField.with(whatTodayLbl);
    whatTodayField = new StandupCustomField();
    layoutField.addComponent(whatTodayField);
    final ELabel roadblockLbl = ELabel.h3(UserUIContext.getMessage(StandupI18nEnum.STANDUP_ISSUE)).withStyleName(WebThemes.LABEL_WORD_WRAP);
    layoutField.with(roadblockLbl);
    whatProblemField = new StandupCustomField();
    layoutField.addComponent(whatProblemField);
    mainLayout.addComponent(layoutField);
    mainLayout.setExpandRatio(layoutField, 2.0f);
    MVerticalLayout instructionLayout = new MVerticalLayout(ELabel.html(UserUIContext.getMessage(StandupI18nEnum.HINT1_MSG)).withFullWidth(), ELabel.html(UserUIContext.getMessage(StandupI18nEnum.HINT2_MG)).withFullWidth()).withStyleName("instruction-box").withWidth("300px");
    mainLayout.addComponent(instructionLayout);
    mainLayout.setExpandRatio(instructionLayout, 1.0f);
    mainLayout.setComponentAlignment(instructionLayout, Alignment.TOP_CENTER);
    reportAddLayout.addBody(mainLayout);
    return reportAddLayout;
}

12 View Complete Implementation : ProjectPagedList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected MHorizontalLayout createPageControls() {
    MHorizontalLayout pageControls = super.createPageControls();
    if (pageControls != null) {
        Button browseProjectsBtn = new Button(UserUIContext.getMessage(ProjectI18nEnum.ACTION_BROWSE), clickEvent -> EventBusFactory.getInstance().post(new ProjectEvent.GotoList(this, null)));
        browseProjectsBtn.addStyleName(WebThemes.BUTTON_LINK);
        pageControls.addComponent(browseProjectsBtn, 0);
        pageControls.setComponentAlignment(browseProjectsBtn, Alignment.MIDDLE_LEFT);
    }
    return pageControls;
}

9 View Complete Implementation : ProjectListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private ComponentContainer constructTableActionControls() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);
    selectOptionButton = new SelectionOptionButton(tableItem);
    selectOptionButton.setWidthUndefined();
    layout.addComponent(selectOptionButton);
    tableActionControls = new DefaultMreplacedItemActionHandlerContainer();
    tableActionControls.addDownloadPdfActionItem();
    tableActionControls.addDownloadExcelActionItem();
    tableActionControls.addDownloadCsvActionItem();
    tableActionControls.setVisible(false);
    tableActionControls.setWidthUndefined();
    layout.addComponent(tableActionControls);
    selectedItemsNumberLabel.setWidth("100%");
    layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER).expand(selectedItemsNumberLabel);
    MButton customizeViewBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem))).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ADJUST);
    customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS));
    layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);
    return layout;
}

7 View Complete Implementation : UserReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayUserAvatar() {
    header.removeAllComponents();
    MHorizontalLayout avatarAndPreplaced = new MHorizontalLayout().withFullWidth();
    Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(user.getAvatarid(), 100);
    cropField.addStyleName(WebThemes.CIRCLE_BOX);
    CssLayout userAvatar = new CssLayout();
    userAvatar.addComponent(cropField);
    avatarAndPreplaced.addComponent(userAvatar);
    MVerticalLayout basicLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true));
    CssLayout userWrapper = new CssLayout();
    String nickName = user.getNickname();
    ELabel userName = ELabel.h2(user.getDisplayName() + (StringUtils.isEmpty(nickName) ? "" : (String.format(" ( %s )", nickName))));
    userWrapper.addComponent(userName);
    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);
    GridFormLayoutHelper userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS);
    basicLayout.addComponent(userFormLayout.getLayout());
    Node roleDiv;
    if (Boolean.TRUE.equals(user.isAccountOwner())) {
        roleDiv = new Div().appendText(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
    } else {
        roleDiv = new A(AccountLinkGenerator.generateRoleLink(user.getRoleId())).appendText(user.getRoleName());
    }
    userFormLayout.addComponent(ELabel.html(roleDiv.write()), UserUIContext.getMessage(UserI18nEnum.FORM_ROLE), 0, 0);
    userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getBirthday())), UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 1);
    if (Boolean.TRUE.equals(AppUI.showEmailPublicly())) {
        userFormLayout.addComponent(ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).write()), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    } else {
        userFormLayout.addComponent(ELabel.html("******"), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 2);
    }
    userFormLayout.addComponent(new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())), UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 3);
    userFormLayout.addComponent(new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()).getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), 0, 4);
    if (UserUIContext.isAdmin()) {
        MButton btnChangePreplacedword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE), clickEvent -> UI.getCurrent().addWindow(new PreplacedwordChangeWindow(user))).withStyleName(WebThemes.BUTTON_LINK);
        ELabel label = ELabel.EMPTY_SPACE();
        userFormLayout.addComponent(new MHorizontalLayout(new ELabel("***********"), btnChangePreplacedword, label).expand(label), UserUIContext.getMessage(ShellI18nEnum.FORM_PreplacedWORD), 0, 5);
    }
    avatarAndPreplaced.with(basicLayout).withAlign(basicLayout, Alignment.TOP_LEFT).expand(basicLayout);
    Layout controlButtons = createTopPanel();
    CssLayout avatarAndPreplacedWrapper = new CssLayout();
    avatarAndPreplaced.setWidthUndefined();
    avatarAndPreplacedWrapper.addComponent(avatarAndPreplaced);
    header.with(avatarAndPreplaced, controlButtons).withAlign(avatarAndPreplaced, Alignment.TOP_LEFT).withAlign(controlButtons, Alignment.TOP_RIGHT);
}

4 View Complete Implementation : ProjectActivityComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Component buildAuditBlock(SimpleAuditLog auditLog) {
    List<AuditChangeItem> changeItems = auditLog.getChangeItems();
    if (CollectionUtils.isNotEmpty(changeItems)) {
        MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth();
        ProjectMemberBlock memberBlock = new ProjectMemberBlock(auditLog.getCreateduser(), auditLog.getPostedUserAvatarId(), auditLog.getPostedUserFullName());
        layout.addComponent(memberBlock);
        MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
        MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
        messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_MODIFIED_ITEM, auditLog.getPostedUserFullName(), UserUIContext.formatPrettyTime(auditLog.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(auditLog.getCreatedtime()));
        timePostLbl.setStyleName(WebThemes.META_INFO);
        messageHeader.with(timePostLbl).expand(timePostLbl);
        rowLayout.addComponent(messageHeader);
        for (AuditChangeItem item : changeItems) {
            String fieldName = item.getField();
            DefaultFieldDisplayHandler fieldDisplayHandler = groupFormatter.getFieldDisplayHandler(fieldName);
            if (fieldDisplayHandler != null) {
                Span fieldBlock = new Span().appendText(UserUIContext.getMessage(fieldDisplayHandler.getDisplayName())).setCSSClreplaced(WebThemes.BLOCK);
                Div historyDiv = new Div().appendChild(fieldBlock).appendText(fieldDisplayHandler.getFormat().toString(item.getOldvalue())).appendText(" " + VaadinIcons.ARROW_RIGHT.getHtml() + " ").appendText(fieldDisplayHandler.getFormat().toString(item.getNewvalue()));
                rowLayout.addComponent(new MCssLayout(ELabel.html(historyDiv.write()).withFullWidth()).withFullWidth());
            }
        }
        layout.with(rowLayout).expand(rowLayout);
        return layout;
    } else {
        return null;
    }
}

3 View Complete Implementation : ProjectActivityComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Component buildCommentBlock(final SimpleComment comment) {
    MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth();
    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(), comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);
    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
    MHorizontalLayout messageHeader = new MHorizontalLayout().withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    ELabel timePostLbl = ELabel.html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(), UserUIContext.formatPrettyTime(comment.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(comment.getCreatedtime())).withStyleName(WebThemes.META_INFO);
    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(VaadinIcons.TRASH).withListener(clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                if (confirmDialog.isConfirmed()) {
                    CommentService commentService = AppContextUtil.getSpringBean(CommentService.clreplaced);
                    commentService.removeWithSession(comment, UserUIContext.getUsername(), AppUI.getAccountId());
                    activityBox.removeComponent(layout);
                }
            });
        }).withStyleName(WebThemes.BUTTON_ICON_ONLY);
        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }
    rowLayout.addComponent(messageHeader);
    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);
    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withMargin(false).withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay);
        rowLayout.addComponent(messageFooter);
    }
    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

0 View Complete Implementation : UserWorkloadReportViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private MHorizontalLayout buildProjectLink(SimpleProject project) {
    Component projectLogo = ProjectreplacedetsUtil.projectLogoComp(project.getShortname(), project.getId(), project.getAvatarid(), 64);
    A projectLink = new A(ProjectLinkGenerator.generateProjectLink(project.getId())).appendText(project.getName());
    projectLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(ProjectTypeConstants.PROJECT, project.getId() + ""));
    projectLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
    Div projectDiv = new Div().appendChild(projectLink);
    ELabel projectLbl = ELabel.html(projectDiv.write()).withStyleName(ValoTheme.LABEL_H2, ValoTheme.LABEL_NO_MARGIN);
    MHorizontalLayout footer = new MHorizontalLayout().withMargin(false).withStyleName(WebThemes.META_INFO, WebThemes.FLEX_DISPLAY);
    footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
    if (StringUtils.isNotBlank(project.getMemlead())) {
        Div leadAvatar = new DivLessFormatter().appendChild(new Img("", StorageUtils.getAvatarPath(project.getLeadAvatarId(), 16)).setCSSClreplaced(WebThemes.CIRCLE_BOX), DivLessFormatter.EMPTY_SPACE, new A(ProjectLinkGenerator.generateProjectMemberLink(project.getId(), project.getMemlead())).appendText(com.mycollab.core.utils.StringUtils.trim(project.getLeadFullName(), 30, true))).setreplacedle(project.getLeadFullName());
        ELabel leadLbl = ELabel.html(UserUIContext.getMessage(ProjectI18nEnum.FORM_LEADER) + ": " + leadAvatar.write()).withUndefinedWidth();
        footer.with(leadLbl);
    }
    if (StringUtils.isNotBlank(project.getHomepage())) {
        ELabel homepageLbl = ELabel.html(VaadinIcons.GLOBE.getHtml() + " " + new A(project.getHomepage()).appendText(project.getHomepage()).setTarget("_blank").write()).withStyleName(ValoTheme.LABEL_SMALL).withUndefinedWidth();
        homepageLbl.setDescription(UserUIContext.getMessage(ProjectI18nEnum.FORM_HOME_PAGE));
        footer.addComponent(homepageLbl);
    }
    if (project.getPlanstartdate() != null) {
        ELabel dateLbl = ELabel.html(VaadinIcons.TIME_FORWARD.getHtml() + " " + UserUIContext.formatDate(project.getPlanstartdate())).withStyleName(ValoTheme.LABEL_SMALL).withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE)).withUndefinedWidth();
        footer.addComponent(dateLbl);
    }
    if (project.getPlanenddate() != null) {
        ELabel dateLbl = ELabel.html(VaadinIcons.TIME_BACKWARD.getHtml() + " " + UserUIContext.formatDate(project.getPlanenddate())).withStyleName(ValoTheme.LABEL_SMALL).withDescription(UserUIContext.getMessage(GenericI18Enum.FORM_END_DATE)).withUndefinedWidth();
        footer.addComponent(dateLbl);
    }
    if (project.getClientid() != null && !SiteConfiguration.isCommunityEdition()) {
        Div clientDiv = new Div();
        if (project.getClientAvatarId() == null) {
            clientDiv.appendText(VaadinIcons.INSreplacedUTION.getHtml() + " ");
        } else {
            Img clientImg = new Img("", StorageUtils.getEnreplacedyLogoPath(AppUI.getAccountId(), project.getClientAvatarId(), 16)).setCSSClreplaced(WebThemes.CIRCLE_BOX);
            clientDiv.appendChild(clientImg).appendChild(DivLessFormatter.EMPTY_SPACE);
        }
        clientDiv.appendChild(new A(ProjectLinkGenerator.generateClientPreviewLink(project.getClientid())).appendText(com.mycollab.core.utils.StringUtils.trim(project.getClientName(), 30, true)));
        ELabel clientLink = ELabel.html(clientDiv.write()).withStyleName(WebThemes.BUTTON_LINK).withUndefinedWidth();
        footer.addComponents(clientLink);
    }
    MVerticalLayout bodyLayout = new MVerticalLayout(projectLbl, footer).withMargin(false).withSpacing(false);
    return new MHorizontalLayout(projectLogo, bodyLayout).expand(bodyLayout).alignAll(Alignment.MIDDLE_LEFT).withMargin(new MarginInfo(true, false, false, false)).withFullWidth();
}

0 View Complete Implementation : ProjectMemberListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Component generateMemberBlock(final SimpleProjectMember member) {
    MHorizontalLayout blockContent = new MHorizontalLayout().withSpacing(false).withStyleName("member-block").withWidth("350px");
    if (ProjectMemberStatusConstants.NOT_ACCESS_YET.equals(member.getStatus())) {
        blockContent.addStyleName("inactive");
    }
    Image memberAvatar = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(member.getMemberAvatarId(), 100);
    memberAvatar.addStyleName(WebThemes.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(VaadinIcons.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_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
            if (confirmDialog.isConfirmed()) {
                ProjectMemberService prjMemberService = AppContextUtil.getSpringBean(ProjectMemberService.clreplaced);
                prjMemberService.removeWithSession(member, UserUIContext.getUsername(), AppUI.getAccountId());
                EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(ProjectMemberListViewImpl.this, CurrentProjectVariables.getProjectId()));
            }
        });
    }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_LINK).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)).withDescription("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(ProjectLinkGenerator.generateProjectMemberLink(member.getProjectid(), member.getUsername())).appendText(member.getMemberFullName()).setreplacedle(member.getMemberFullName());
    ELabel memberNameLbl = ELabel.h3(memberLink.write()).withStyleName(WebThemes.TEXT_ELLIPSIS).withFullWidth();
    blockTop.with(memberNameLbl, ELabel.hr());
    A roleLink = new A(ProjectLinkGenerator.generateRolePreviewLink(member.getProjectid(), member.getProjectroleid())).appendText(member.getRoleName());
    blockTop.addComponent(ELabel.html(roleLink.write()).withFullWidth().withStyleName(WebThemes.TEXT_ELLIPSIS));
    if (Boolean.TRUE.equals(AppUI.showEmailPublicly())) {
        Label memberEmailLabel = ELabel.html(String.format("<a href='mailto:%s'>%s</a>", member.getUsername(), member.getUsername())).withStyleName(WebThemes.META_INFO).withFullWidth();
        blockTop.addComponent(memberEmailLabel);
    }
    ELabel memberSinceLabel = ELabel.html(UserUIContext.getMessage(UserI18nEnum.OPT_MEMBER_SINCE, UserUIContext.formatPrettyTime(member.getCreatedtime()))).withDescription(UserUIContext.formatDateTime(member.getCreatedtime())).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 = ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.TASK).getHtml() + " " + new Span().appendText("" + member.getNumOpenTasks()).setreplacedle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_TASKS)) + "  " + ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.BUG).getHtml() + " " + new Span().appendText("" + member.getNumOpenBugs()).setreplacedle(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_OPEN_BUGS)) + " " + VaadinIcons.MONEY.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalBillableLogTime())).setreplacedle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)) + "  " + VaadinIcons.GIFT.getHtml() + " " + new Span().appendText("" + NumberUtils.roundDouble(2, member.getTotalNonBillableLogTime())).setreplacedle(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS));
    blockTop.addComponent(ELabel.html(memberWorksInfo).withStyleName(WebThemes.META_INFO));
    blockContent.with(blockTop);
    blockContent.setExpandRatio(blockTop, 1.0f);
    return blockContent;
}