com.mycollab.vaadin.ui.ELabel - java examples

Here are the examples of the java api com.mycollab.vaadin.ui.ELabel taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

41 Examples 7

19 View Complete Implementation : TimeLogComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public void displayTime(B bean) {
    layout.removeAllComponents();
    this.beanItem = bean;
    Double billableHours = getTotalBillableHours(beanItem);
    Double nonBillableHours = getTotalNonBillableHours(beanItem);
    Double remainHours = getRemainedHours(beanItem);
    ELabel billableHoursLbl = new ELabel(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_BILLABLE_HOURS)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth();
    layout.addComponent(billableHoursLbl, 0, 0);
    layout.addComponent(new ELabel(billableHours + ""), 1, 0);
    ELabel nonBillableHoursLbl = new ELabel(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_NON_BILLABLE_HOURS)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth();
    layout.addComponent(nonBillableHoursLbl, 0, 1);
    layout.addComponent(new ELabel(nonBillableHours + ""), 1, 1);
    ELabel remainHoursLbl = new ELabel(UserUIContext.getMessage(TimeTrackingI18nEnum.OPT_REMAIN_HOURS)).withStyleName(WebThemes.META_COLOR).withUndefinedWidth();
    layout.addComponent(remainHoursLbl, 0, 2);
    layout.addComponent(new ELabel(remainHours + ""), 1, 2);
}

19 View Complete Implementation : CurrencyViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.3.1
 */
public clreplaced CurrencyViewField extends CustomField<String> {

    private ELabel label;

    public CurrencyViewField() {
        label = new ELabel().withFullWidth().withStyleName(WebThemes.LABEL_WORD_WRAP);
    }

    @Override
    protected Component initContent() {
        return label;
    }

    @Override
    protected void doSetValue(String value) {
        if (StringUtils.isBlank(value)) {
            label.setValue("");
        } else {
            Currency currency = CurrencyUtils.getInstance(value);
            label.setValue(String.format("%s (%s)", currency.getDisplayName(UserUIContext.getUserLocale()), currency.getCurrencyCode()));
        }
    }

    @Override
    public String getValue() {
        return null;
    }
}

19 View Complete Implementation : DefaultViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.5.3
 */
public final clreplaced DefaultViewField extends CustomField<Object> {

    private static final long serialVersionUID = 1L;

    private ELabel label;

    private String value;

    public DefaultViewField() {
        this("");
    }

    public DefaultViewField(String value) {
        this(value, ContentMode.TEXT);
    }

    public DefaultViewField(String value, ContentMode contentMode) {
        this.value = value;
        label = new ELabel(value, contentMode).withFullWidth().withStyleName(WebThemes.LABEL_WORD_WRAP).withDescription(value);
    }

    public DefaultViewField withStyleName(String styleName) {
        label.addStyleName(styleName);
        return this;
    }

    @Override
    public String getValue() {
        return value;
    }

    @Override
    protected Component initContent() {
        return label;
    }

    @Override
    protected void doSetValue(Object value) {
        label.setValue((value != null) ? value.toString() : "");
    }
}

19 View Complete Implementation : I18nFormViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.5.3
 */
public clreplaced I18nFormViewField extends CustomField<String> {

    private static final long serialVersionUID = 1L;

    private Clreplaced<? extends Enum> enumCls;

    private Enum defaultValue;

    private ELabel label;

    public I18nFormViewField(Clreplaced<? extends Enum> enumCls) {
        this(enumCls, null);
    }

    public I18nFormViewField(Clreplaced<? extends Enum> enumCls, Enum defaultValue) {
        this.enumCls = enumCls;
        this.defaultValue = defaultValue;
        label = new ELabel(UserUIContext.getMessage(defaultValue), ContentMode.TEXT).withUndefinedWidth().withStyleName(WebThemes.LABEL_WORD_WRAP);
    }

    public I18nFormViewField withStyleName(String styleName) {
        label.addStyleName(styleName);
        return this;
    }

    @Override
    protected Component initContent() {
        return label;
    }

    @Override
    protected void doSetValue(String value) {
        if (StringUtils.isNotBlank(value)) {
            label.setValue(UserUIContext.getMessage(enumCls, value));
        } else if (defaultValue != null) {
            label.setValue(UserUIContext.getMessage(defaultValue));
        }
    }

    @Override
    public String getValue() {
        return null;
    }
}

19 View Complete Implementation : RichTextViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.5.3
 */
public clreplaced RichTextViewField extends CustomField<String> {

    private static final long serialVersionUID = 1L;

    private ELabel label;

    public RichTextViewField() {
        label = ELabel.html("").withStyleName(WebThemes.LABEL_WORD_WRAP).withFullWidth();
    }

    @Override
    public String getValue() {
        return null;
    }

    @Override
    protected Component initContent() {
        return label;
    }

    @Override
    protected void doSetValue(String value) {
        label.setValue(StringUtils.formatRichText(value));
    }
}

19 View Complete Implementation : StyleViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 7.0.0
 */
public clreplaced StyleViewField extends CustomField<Object> {

    private ELabel label;

    private String value;

    public StyleViewField(String value) {
        this.value = value;
        label = new ELabel(value, ContentMode.HTML).withFullWidth().withStyleName(WebThemes.LABEL_WORD_WRAP).withUndefinedWidth().withDescription(value);
    }

    public StyleViewField withStyleName(String styleName) {
        label.addStyleName(styleName);
        return this;
    }

    @Override
    public String getValue() {
        return null;
    }

    @Override
    protected Component initContent() {
        return label;
    }

    @Override
    protected void doSetValue(Object value) {
    }
}

19 View Complete Implementation : BlockWidget.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.4.0
 */
public clreplaced BlockWidget extends MVerticalLayout {

    private static final long serialVersionUID = -8503014399083980294L;

    private ELabel replacedleLbl;

    private CssLayout bodyLayout;

    public BlockWidget(String replacedle) {
        replacedleLbl = ELabel.h2("");
        super.addComponent(replacedleLbl);
        bodyLayout = new CssLayout();
        bodyLayout.setWidth("100%");
        super.addComponent(bodyLayout);
        this.setreplacedle(replacedle);
    }

    public void setreplacedle(String replacedle) {
        this.replacedleLbl.setValue(replacedle);
    }

    public void addToBody(Component component) {
        bodyLayout.addComponent(component);
    }

    @Override
    public void addComponent(Component c) {
        this.addToBody(c);
    }

    @Override
    public void addComponentAsFirst(Component c) {
        bodyLayout.addComponentAsFirst(c);
    }

    @Override
    public void addComponent(Component c, int index) {
        bodyLayout.addComponent(c, index);
    }

    @Override
    public void removeComponent(Component c) {
        bodyLayout.removeComponent(c);
    }

    @Override
    public void replaceComponent(Component oldComponent, Component newComponent) {
        bodyLayout.replaceComponent(oldComponent, newComponent);
    }

    @Override
    public int getComponentIndex(Component component) {
        return bodyLayout.getComponentIndex(component);
    }

    @Override
    public Component getComponent(int index) throws IndexOutOfBoundsException {
        return bodyLayout.getComponent(index);
    }

    @Override
    public void addComponents(Component... components) {
        bodyLayout.addComponents(components);
    }

    @Override
    public void removeAllComponents() {
        bodyLayout.removeAllComponents();
    }
}

19 View Complete Implementation : DefaultReadViewLayout.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.6.0
 */
public clreplaced DefaultReadViewLayout extends ReadViewLayout {

    private ELabel replacedleLbl;

    public DefaultReadViewLayout(String replacedle) {
        this.setSizeFull();
        this.addHeader(buildHeader(replacedle));
    }

    private ComponentContainer buildHeader(String replacedle) {
        MHorizontalLayout header = new MHorizontalLayout().withFullWidth();
        replacedleLbl = ELabel.h3(replacedle);
        header.with(replacedleLbl).expand(replacedleLbl);
        return header;
    }

    @Override
    public void addreplacedleStyleName(final String styleName) {
        replacedleLbl.addStyleName(styleName);
    }

    @Override
    public void removereplacedleStyleName(final String styleName) {
        replacedleLbl.removeStyleName(styleName);
    }

    public void setreplacedle(final String replacedle) {
        replacedleLbl.setValue(replacedle);
    }
}

18 View Complete Implementation : AbstractProjectPageView.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.0
 */
public clreplaced AbstractProjectPageView extends AbstractVerticalPageView {

    private static final long serialVersionUID = 1L;

    protected ELabel headerText;

    protected MHorizontalLayout header;

    public AbstractProjectPageView(String headerText, VaadinIcons icon) {
        this.headerText = ELabel.h2(String.format("%s %s", icon.getHtml(), headerText));
        super.with(constructHeader());
    }

    private ComponentContainer constructHeader() {
        header = new MHorizontalLayout().with(headerText).withFullWidth().withMargin(true);
        header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        return header;
    }

    public void addHeaderRightContent(Component component) {
        header.with(component).withAlign(component, Alignment.MIDDLE_RIGHT);
    }
}

18 View Complete Implementation : TicketSearchPanel.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected ComponentContainer buildSearchreplacedle() {
    if (canSwitchToAdvanceLayout) {
        savedFilterComboBox = new TicketSavedFilterComboBox();
        savedFilterComboBox.addQuerySelectListener((SavedFilterComboBox.QuerySelectListener) querySelectEvent -> {
            List<SearchFieldInfo<ProjectTicketSearchCriteria>> fieldInfos = querySelectEvent.getSearchFieldInfos();
            ProjectTicketSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(ProjectTicketSearchCriteria.clreplaced, fieldInfos);
            criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            EventBusFactory.getInstance().post(new TicketEvent.SearchRequest(TicketSearchPanel.this, criteria));
        });
        ELabel taskIcon = ELabel.h2(ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.TICKET).getHtml()).withUndefinedWidth();
        return new MHorizontalLayout(taskIcon, savedFilterComboBox).withUndefinedWidth();
    } else
        return null;
}

18 View Complete Implementation : ProjectSearchItemsViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void displayResults(String value) {
    this.removeAllComponents();
    ELabel headerLbl = ELabel.h2("");
    ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
    List<Integer> projectKeys = projectService.getOpenProjectKeysUserInvolved(UserUIContext.getUsername(), AppUI.getAccountId());
    if (projectKeys.size() > 0) {
        ProjectGenericItemSearchCriteria criteria = new ProjectGenericItemSearchCriteria();
        criteria.setPrjKeys(new SetSearchField<>(projectKeys));
        criteria.setTxtValue(StringSearchField.and(value));
        DefaultBeanPagedList<ProjectGenericItemService, ProjectGenericItemSearchCriteria, ProjectGenericItem> searchItemsTable = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(ProjectGenericItemService.clreplaced), new GenericItemRowDisplayHandler());
        int foundNum = searchItemsTable.setSearchCriteria(criteria);
        headerLbl.setValue(String.format(VaadinIcons.SEARCH.getHtml() + " " + UserUIContext.getMessage(ProjectI18nEnum.OPT_SEARCH_TERM), value, foundNum));
        this.with(headerLbl, searchItemsTable).expand(searchItemsTable);
    } else {
        this.with(new MCssLayout(new Label(UserUIContext.getMessage(GenericI18Enum.VIEW_NO_ITEM_replacedLE))).withFullWidth());
    }
}

18 View Complete Implementation : GridFormLayoutHelper.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public GridCellWrapper buildCell(String fieldId, String caption, String contextHelp, int columns, int rows, int colSpan) {
    MHorizontalLayout captionWrapper = null;
    if (!caption.equals("")) {
        ELabel captionLbl = new ELabel(caption).withStyleName(WebThemes.LABEL_WORD_WRAP).withDescription(caption);
        captionWrapper = new MHorizontalLayout(captionLbl).withSpacing(false).withMargin(new MarginInfo(false, true, false, false)).withStyleName("gridform-caption");
        if (StringUtils.isNotBlank(contextHelp)) {
            ELabel contextHelpLbl = ELabel.html(" " + VaadinIcons.QUESTION_CIRCLE.getHtml()).withStyleName(WebThemes.INLINE_HELP).withDescription(contextHelp).withUndefinedWidth();
            captionWrapper.with(contextHelpLbl);
        }
    }
    GridCellWrapper fieldWrapper = new GridCellWrapper(captionWrapper);
    int rowCount = responsiveLayout.getComponentCount();
    for (int i = 0; i < rows - rowCount + 1; i++) {
        responsiveLayout.addRow();
    }
    ResponsiveRow responsiveRow = (ResponsiveRow) responsiveLayout.getComponent(rows);
    if (layoutType == LayoutType.ONE_COLUMN) {
        ResponsiveColumn column = new ResponsiveColumn(12, 12, 12, 12);
        column.setContent(fieldWrapper);
        responsiveRow.addColumn(column);
    } else {
        if (columns == 0) {
            if (responsiveRow.getComponentCount() == 0) {
                ResponsiveColumn column = (colSpan == 1) ? new ResponsiveColumn(12, 12, 6, 6) : new ResponsiveColumn(12, 12, 12, 12);
                column.setContent(fieldWrapper);
                responsiveRow.addColumn(column);
            } else {
                ResponsiveColumn column = (ResponsiveColumn) responsiveRow.getComponent(0);
                column.setContent(fieldWrapper);
            }
        } else if (columns == 1) {
            int columnCount = responsiveRow.getComponentCount();
            for (int i = 0; i < columns - columnCount + 1; i++) {
                ResponsiveColumn column = new ResponsiveColumn(12, 12, 6, 6);
                responsiveRow.addColumn(column);
            }
            ResponsiveColumn column = (ResponsiveColumn) responsiveRow.getComponent(columns);
            column.setContent(fieldWrapper);
        } else {
            throw new MyCollabException("Not support form 2 columns only");
        }
    }
    fieldCaptionMappings.put(fieldId, fieldWrapper);
    return fieldWrapper;
}

17 View Complete Implementation : ProjectItemViewField.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected Component initContent() {
    if (typeId == null || typeId.equals("null")) {
        return new Label();
    }
    SimpleProject project = CurrentProjectVariables.getProject();
    DivLessFormatter div = new DivLessFormatter();
    A milestoneLink = new A().setId("tag" + TooltipHelper.TOOLTIP_ID).setHref(ProjectLinkGenerator.generateProjecreplacedemLink(project.getShortname(), project.getId(), type, typeId + "")).appendText(typeDisplayName);
    milestoneLink.setAttribute("onmouseover", TooltipHelper.projectHoverJsFunction(type, typeId + ""));
    milestoneLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
    div.appendChild(milestoneLink);
    ELabel label = ELabel.html(div.write()).withStyleName(WebThemes.TEXT_ELLIPSIS);
    return new MHorizontalLayout(ELabel.fontIcon(ProjectreplacedetsManager.getreplacedet(type)).withUndefinedWidth(), label).expand(label);
}

17 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;
}

16 View Complete Implementation : ProjectActivityComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.1.4
 */
public clreplaced ProjectActivityComponent extends MVerticalLayout implements ReloadableComponent {

    private static Logger LOG = LoggerFactory.getLogger(ProjectActivityComponent.clreplaced);

    private String type;

    private String typeId;

    private ELabel headerLbl;

    private ProjectCommentInput commentBox;

    private MVerticalLayout activityBox;

    private CommentService commentService;

    private AuditLogService auditLogService;

    private FieldGroupFormatter groupFormatter;

    private boolean isAscending = true;

    private Ordering dateComparator = new Ordering() {

        @Override
        public int compare(Object o1, Object o2) {
            try {
                LocalDateTime createTime1 = (LocalDateTime) PropertyUtils.getProperty(o1, "createdtime");
                LocalDateTime createTime2 = (LocalDateTime) PropertyUtils.getProperty(o2, "createdtime");
                return createTime1.compareTo(createTime2);
            } catch (Exception e) {
                return 0;
            }
        }
    };

    public ProjectActivityComponent(String type, Integer extraTypeId) {
        withMargin(false).withFullWidth();
        this.type = type;
        this.groupFormatter = AuditLogRegistry.getFieldGroupFormatterOfType(type);
        headerLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_HISTORY, 0)).withStyleName(ValoTheme.LABEL_H3);
        RadioButtonGroup<String> sortDirection = new RadioButtonGroup<>();
        sortDirection.addStyleName(ValoTheme.OPTIONGROUP_HORIZONTAL);
        String oldestFirstDirection = UserUIContext.getMessage(GenericI18Enum.OPT_OLDEST_FIRST);
        String newestFirstDirection = UserUIContext.getMessage(GenericI18Enum.OPT_NEWEST_FIRST);
        sortDirection.sereplacedems(newestFirstDirection, oldestFirstDirection);
        sortDirection.setValue(newestFirstDirection);
        sortDirection.addValueChangeListener(valueChangeEvent -> {
            Object value = sortDirection.getValue();
            isAscending = newestFirstDirection.equals(value);
            displayActivities();
        });
        MHorizontalLayout headerPanel = new MHorizontalLayout(headerLbl, sortDirection).withMargin(false).withStyleName(WebThemes.FORM_SECTION).withFullWidth().withAlign(headerLbl, Alignment.MIDDLE_LEFT).withAlign(sortDirection, Alignment.MIDDLE_RIGHT);
        commentBox = new ProjectCommentInput(this, type, extraTypeId);
        activityBox = new MVerticalLayout().withMargin(new MMarginInfo(true, true, true, false));
        this.with(headerPanel, commentBox, activityBox);
        commentService = AppContextUtil.getSpringBean(CommentService.clreplaced);
        auditLogService = AppContextUtil.getSpringBean(AuditLogService.clreplaced);
    }

    public void loadActivities(String typeId) {
        this.typeId = typeId;
        if (commentBox != null) {
            commentBox.setTypeAndId(typeId);
        }
        displayActivities();
    }

    private void displayActivities() {
        activityBox.removeAllComponents();
        if (type == null || typeId == null) {
            return;
        }
        final CommentSearchCriteria commentCriteria = new CommentSearchCriteria();
        commentCriteria.setType(StringSearchField.and(type));
        commentCriteria.setTypeId(StringSearchField.and(typeId));
        final int commentCount = commentService.getTotalCount(commentCriteria);
        final AuditLogSearchCriteria logCriteria = new AuditLogSearchCriteria();
        logCriteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
        logCriteria.setModule(StringSearchField.and(ModuleNameConstants.PRJ));
        logCriteria.setType(StringSearchField.and(type));
        logCriteria.setTypeId(StringSearchField.and(typeId));
        final int logCount = auditLogService.getTotalCount(logCriteria);
        setTotalNums(commentCount + logCount);
        List<SimpleComment> comments = (List<SimpleComment>) commentService.findPageableListByCriteria(new BasicSearchRequest<>(commentCriteria));
        List<SimpleAuditLog> auditLogs = (List<SimpleAuditLog>) auditLogService.findPageableListByCriteria(new BasicSearchRequest<>(logCriteria));
        List activities = new ArrayList(commentCount + logCount);
        activities.addAll(comments);
        activities.addAll(auditLogs);
        if (isAscending) {
            Collections.sort(activities, dateComparator.reverse());
        } else {
            Collections.sort(activities, dateComparator);
        }
        for (Object activity : activities) {
            if (activity instanceof SimpleComment) {
                activityBox.addComponent(buildCommentBlock((SimpleComment) activity));
            } else if (activity instanceof SimpleAuditLog) {
                Component auditBlock = buildAuditBlock((SimpleAuditLog) activity);
                if (auditBlock != null) {
                    activityBox.addComponent(auditBlock);
                }
            } else {
                LOG.error("Do not support activity " + activity);
            }
        }
    }

    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;
    }

    private boolean hasDeletePermission(SimpleComment comment) {
        return (UserUIContext.getUsername().equals(comment.getCreateduser()) || UserUIContext.isAdmin());
    }

    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;
        }
    }

    private void setTotalNums(Integer nums) {
        headerLbl.setValue(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_HISTORY, nums));
    }

    @Override
    public void reload() {
        displayActivities();
    }
}

16 View Complete Implementation : ProjectAssetsUtil.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public static Component clientLogoComp(Client client, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(client.getAvatarid())) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getEnreplacedyLogoPath(AppUI.getAccountId(), client.getAvatarid(), 100)));
    } else {
        String clientName = client.getName();
        clientName = (clientName.length() > 3) ? clientName.substring(0, 3) : clientName;
        ELabel projectIcon = new ELabel(clientName).withStyleName(WebThemes.TEXT_ELLIPSIS, "center");
        wrapper = new VerticalLayout();
        ((VerticalLayout) wrapper).addComponent(projectIcon);
        ((VerticalLayout) wrapper).setComponentAlignment(projectIcon, Alignment.MIDDLE_CENTER);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(WebThemes.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}

16 View Complete Implementation : MilestoneRoadmapViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.2.0
 */
@ViewComponent
public clreplaced MilestoneRoadmapViewImpl extends AbstractLazyPageView implements MilestoneRoadmapView, IBlockContainer {

    private MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.clreplaced);

    private ApplicationEventListener<MilestoneEvent.NewMilestoneAdded> newMilestoneHandler = new ApplicationEventListener<MilestoneEvent.NewMilestoneAdded>() {

        @Override
        @Subscribe
        public void handle(MilestoneEvent.NewMilestoneAdded event) {
            MilestoneRoadmapViewImpl.this.removeAllComponents();
            displayView();
        }
    };

    private ApplicationEventListener<MilestoneEvent.MilestoneDeleted> deletedMilestoneHandler = new ApplicationEventListener<MilestoneEvent.MilestoneDeleted>() {

        @Override
        @Subscribe
        public void handle(MilestoneEvent.MilestoneDeleted event) {
            displayWidget();
        }
    };

    private MVerticalLayout roadMapView;

    private MVerticalLayout filterLayout;

    private ELabel headerText;

    private CheckBox closeMilestoneSelection, inProgressMilestoneSelection, futureMilestoneSelection;

    private MilestoneSearchCriteria baseCriteria;

    @Override
    public void attach() {
        EventBusFactory.getInstance().register(newMilestoneHandler);
        EventBusFactory.getInstance().register(deletedMilestoneHandler);
        super.attach();
    }

    @Override
    public void detach() {
        EventBusFactory.getInstance().unregister(newMilestoneHandler);
        EventBusFactory.getInstance().unregister(deletedMilestoneHandler);
        super.detach();
    }

    @Override
    protected void displayView() {
        initUI();
        baseCriteria = new MilestoneSearchCriteria();
        baseCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
        baseCriteria.setOrderFields(Arrays.asList(new SearchCriteria.OrderField("startdate", SearchCriteria.DESC), new SearchCriteria.OrderField("enddate", SearchCriteria.DESC)));
        displayMilestones();
        closeMilestoneSelection = new CheckBox("", true);
        inProgressMilestoneSelection = new CheckBox("", true);
        futureMilestoneSelection = new CheckBox("", true);
        closeMilestoneSelection.addValueChangeListener(valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
        inProgressMilestoneSelection.addValueChangeListener(valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
        futureMilestoneSelection.addValueChangeListener(valueChangeEvent -> displayMilestones(baseCriteria, closeMilestoneSelection.getValue(), inProgressMilestoneSelection.getValue(), futureMilestoneSelection.getValue()));
        futureMilestoneSelection.setIcon(VaadinIcons.CLOCK);
        filterLayout.with(closeMilestoneSelection, inProgressMilestoneSelection, futureMilestoneSelection);
        displayWidget();
    }

    private void displayWidget() {
        MilestoneSearchCriteria tmpCriteria = BeanUtility.deepClone(baseCriteria);
        tmpCriteria.setStatuses(new SetSearchField<>(MilestoneStatus.Closed.name()));
        int totalCloseCount = milestoneService.getTotalCount(tmpCriteria);
        closeMilestoneSelection.setCaption(String.format("%s (%d)", UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_replacedLE), totalCloseCount));
        closeMilestoneSelection.setIcon(VaadinIcons.MINUS_CIRCLE);
        filterLayout.addComponent(closeMilestoneSelection);
        tmpCriteria.setStatuses(new SetSearchField<>(MilestoneStatus.InProgress.name()));
        int totalInProgressCount = milestoneService.getTotalCount(tmpCriteria);
        inProgressMilestoneSelection.setCaption(String.format("%s (%d)", UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_replacedLE), totalInProgressCount));
        inProgressMilestoneSelection.setIcon(VaadinIcons.SPINNER);
        filterLayout.addComponent(inProgressMilestoneSelection);
        tmpCriteria.setStatuses(new SetSearchField<>(MilestoneStatus.Future.name()));
        int totalFutureCount = milestoneService.getTotalCount(tmpCriteria);
        futureMilestoneSelection.setCaption(String.format("%s (%d)", UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_replacedLE), totalFutureCount));
    }

    private void displayMilestones(MilestoneSearchCriteria milestoneSearchCriteria, boolean closeSelection, boolean inProgressSelection, boolean futureSelection) {
        baseCriteria = milestoneSearchCriteria;
        List<String> statuses = new ArrayList<>();
        if (closeSelection) {
            statuses.add(MilestoneStatus.Closed.name());
        }
        if (inProgressSelection) {
            statuses.add(MilestoneStatus.InProgress.name());
        }
        if (futureSelection) {
            statuses.add(MilestoneStatus.Future.name());
        }
        if (statuses.size() > 0) {
            baseCriteria.setStatuses(new SetSearchField<>(statuses));
            displayMilestones();
        } else {
            roadMapView.removeAllComponents();
        }
    }

    private void displayMilestones() {
        roadMapView.removeAllComponents();
        List<SimpleMilestone> milestones = (List<SimpleMilestone>) milestoneService.findPageableListByCriteria(new BasicSearchRequest<>(baseCriteria));
        milestones.forEach(milestone -> roadMapView.addComponent(new MilestoneBlock(milestone)));
        headerText.setValue(String.format("%s %s", ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.MILESTONE).getHtml(), UserUIContext.getMessage(MilestoneI18nEnum.OPT_ROADMAP_VALUE, milestones.size())));
    }

    @Override
    public void refresh() {
        headerText.setValue(String.format("%s %s", ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.MILESTONE).getHtml(), UserUIContext.getMessage(MilestoneI18nEnum.OPT_ROADMAP_VALUE, roadMapView.getComponentCount())));
    }

    private void initUI() {
        headerText = ELabel.h2("");
        MHorizontalLayout headerComp = new MHorizontalLayout().withFullWidth().withMargin(true).with(headerText, createHeaderRight()).withAlign(headerText, Alignment.MIDDLE_LEFT).expand(headerText);
        this.addComponent(headerComp);
        roadMapView = new MVerticalLayout().withSpacing(false).withMargin(false);
        filterLayout = new MVerticalLayout();
        MHorizontalLayout bodyComp = new MHorizontalLayout(roadMapView).withFullWidth().withMargin(true).expand(roadMapView);
        this.with(headerComp, bodyComp).expand(bodyComp);
        ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
        Panel filterPanel = new Panel("Filter by status", filterLayout);
        StackPanel.extend(filterPanel);
        projectView.addComponentToRightBar(filterPanel);
    }

    private HorizontalLayout createHeaderRight() {
        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));
        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));
        MButton boardBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_BOARD), clickEvent -> EventBusFactory.getInstance().post(new MilestoneEvent.GotoList(this, null))).withIcon(VaadinIcons.SERVER).withWidth("100px");
        MButton roadmapBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_LIST)).withIcon(VaadinIcons.BULLETS).withWidth("100px");
        return new MHorizontalLayout(createBtn, printBtn, new ButtonGroup(roadmapBtn, boardBtn).withDefaultButton(roadmapBtn));
    }

    private static clreplaced MilestoneBlock extends TicketRowRender {

        private boolean showIssues = false;

        MilestoneBlock(SimpleMilestone milestone) {
            this.withMargin(new MarginInfo(true, false, true, false)).withStyleName("roadmap-block");
            VaadinIcons statusIcon = ProjectreplacedetsUtil.getPhaseIcon(milestone.getStatus());
            ELabel statusLbl = ELabel.html(statusIcon.getHtml() + " " + UserUIContext.getMessage(MilestoneStatus.clreplaced, milestone.getStatus())).withStyleName(WebThemes.BLOCK).withUndefinedWidth();
            ToggleMilestoneSummaryField toggleMilestoneSummaryField = new ToggleMilestoneSummaryField(milestone, false, true);
            MHorizontalLayout headerLayout = new MHorizontalLayout(statusLbl, toggleMilestoneSummaryField).expand(toggleMilestoneSummaryField).withFullWidth();
            this.with(headerLayout);
            CssLayout metaBlock = new CssLayout();
            MilestoneComponentFactory popupFieldFactory = AppContextUtil.getSpringBean(MilestoneComponentFactory.clreplaced);
            metaBlock.addComponent(popupFieldFactory.createMilestonereplacedigneePopupField(milestone, true));
            metaBlock.addComponent(popupFieldFactory.createStartDatePopupField(milestone));
            metaBlock.addComponent(popupFieldFactory.createEndDatePopupField(milestone));
            if (!SiteConfiguration.isCommunityEdition()) {
                metaBlock.addComponent(popupFieldFactory.createBillableHoursPopupField(milestone));
                metaBlock.addComponent(popupFieldFactory.createNonBillableHoursPopupField(milestone));
            }
            this.with(metaBlock);
            if (StringUtils.isNotBlank(milestone.getDescription())) {
                this.addComponent(ELabel.html(StringUtils.formatRichText(milestone.getDescription())));
            }
            MHorizontalLayout progressLayout = new MHorizontalLayout();
            progressLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
            int openreplacedignments = milestone.getNumOpenBugs() + milestone.getNumOpenTasks() + milestone.getNumOpenRisks();
            int totalreplacedignments = milestone.getNumBugs() + milestone.getNumTasks() + milestone.getNumRisks();
            ELabel progressInfoLbl;
            if (totalreplacedignments > 0) {
                progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_PROJECT_TICKET, (totalreplacedignments - openreplacedignments), totalreplacedignments, (totalreplacedignments - openreplacedignments) * 100 / totalreplacedignments)).withStyleName(WebThemes.META_INFO);
            } else {
                progressInfoLbl = new ELabel(UserUIContext.getMessage(ProjectI18nEnum.OPT_NO_TICKET)).withStyleName(WebThemes.META_INFO);
            }
            final MVerticalLayout issueLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, false, true));
            issueLayout.setVisible(false);
            progressLayout.with(progressInfoLbl);
            if (totalreplacedignments > 0) {
                MButton viewIssuesBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.ACTION_VIEW_TICKETS)).withStyleName(WebThemes.BUTTON_LINK);
                viewIssuesBtn.addClickListener(clickEvent -> {
                    showIssues = !showIssues;
                    if (showIssues) {
                        issueLayout.setVisible(true);
                        viewIssuesBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_HIDE_TICKETS));
                        ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria();
                        searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
                        searchCriteria.setTypes(CurrentProjectVariables.getRestrictedTicketTypes());
                        searchCriteria.setMilestoneId(new NumberSearchField(milestone.getId()));
                        ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
                        List<ProjectTicket> tickets = (List<ProjectTicket>) genericTaskService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));
                        for (ProjectTicket ticket : tickets) {
                            ToggleTicketSummaryField toggleTicketSummaryField = new ToggleTicketSummaryField(ticket);
                            MHorizontalLayout rowComp = new MHorizontalLayout(ELabel.EMPTY_SPACE());
                            rowComp.setDefaultComponentAlignment(Alignment.TOP_LEFT);
                            rowComp.with(ELabel.fontIcon(ProjectreplacedetsManager.getreplacedet(ticket.getType())).withUndefinedWidth());
                            String status = "";
                            if (ticket.isMilestone()) {
                                status = UserUIContext.getMessage(MilestoneStatus.clreplaced, ticket.getStatus());
                            } else {
                                status = UserUIContext.getMessage(StatusI18nEnum.clreplaced, ticket.getStatus());
                            }
                            rowComp.with(new ELabel(status).withStyleName(WebThemes.BLOCK).withUndefinedWidth());
                            String avatarLink = StorageUtils.getAvatarPath(ticket.getreplacedignUserAvatarId(), 16);
                            Img img = new Img(ticket.getreplacedignUserFullName(), avatarLink).setCSSClreplaced(WebThemes.CIRCLE_BOX).setreplacedle(ticket.getreplacedignUserFullName());
                            rowComp.with(ELabel.html(img.write()).withUndefinedWidth());
                            rowComp.with(toggleTicketSummaryField).expand(toggleTicketSummaryField);
                            issueLayout.addComponent(rowComp);
                        }
                    } else {
                        viewIssuesBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_VIEW_TICKETS));
                        issueLayout.removeAllComponents();
                        issueLayout.setVisible(false);
                    }
                });
                progressLayout.with(viewIssuesBtn);
            }
            this.with(progressLayout, issueLayout);
        }
    }
}

16 View Complete Implementation : TaskSearchPanel.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected ComponentContainer buildSearchreplacedle() {
    if (canSwitchToAdvanceLayout) {
        savedFilterComboBox = new TaskSavedFilterComboBox();
        savedFilterComboBox.addQuerySelectListener(new SavedFilterComboBox.QuerySelectListener() {

            @Override
            public void querySelect(SavedFilterComboBox.QuerySelectEvent querySelectEvent) {
                List<SearchFieldInfo<TaskSearchCriteria>> fieldInfos = querySelectEvent.getSearchFieldInfos();
                TaskSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(TaskSearchCriteria.clreplaced, fieldInfos);
                criteria.setProjectId(new NumberSearchField(CurrentProjectVariables.getProjectId()));
                EventBusFactory.getInstance().post(new TaskEvent.SearchRequest(TaskSearchPanel.this, criteria));
                EventBusFactory.getInstance().post(new ShellEvent.AddQueryParam(this, fieldInfos));
            }
        });
        ELabel taskIcon = ELabel.h2(ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.TASK).getHtml()).withUndefinedWidth();
        return new MHorizontalLayout(taskIcon, savedFilterComboBox).expand(savedFilterComboBox).alignAll(Alignment.MIDDLE_LEFT);
    } else {
        return null;
    }
}

15 View Complete Implementation : ProjectAssetsUtil.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public static Component projectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) {
    AbstractComponent wrapper;
    if (!StringUtils.isBlank(projectAvatarId)) {
        wrapper = new Image(null, new ExternalResource(StorageUtils.getResourcePath(String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId), projectAvatarId, size))));
    } else {
        ELabel projectIcon = new ELabel(projectShortname.substring(0, 1)).withStyleName(WebThemes.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center");
        projectIcon.setWidth(size, Sizeable.Unit.PIXELS);
        projectIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper = new MVerticalLayout(projectIcon).withAlign(projectIcon, Alignment.MIDDLE_CENTER).withMargin(false);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    wrapper.addStyleName(WebThemes.CIRCLE_BOX);
    wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
    return wrapper;
}

13 View Complete Implementation : ProjectActivityStreamPagedList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
protected void feedBlocksPut(LocalDate currentDate, LocalDate nextDate, ComponentContainer currentBlock) {
    MHorizontalLayout blockWrapper = new MHorizontalLayout().withSpacing(false).withFullWidth().withStyleName("feed-block-wrap");
    blockWrapper.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    if (currentDate.getYear() != nextDate.getYear()) {
        int currentYear = nextDate.getYear();
        ELabel yearLbl = ELabel.html("<div>" + currentYear + "</div>").withStyleName("year-lbl").withUndefinedWidth();
        this.addComponent(yearLbl);
    } else {
        blockWrapper.setMargin(new MarginInfo(true, false, false, false));
    }
    ELabel dateLbl = new ELabel(UserUIContext.formatShortDate(nextDate)).withStyleName("date-lbl").withUndefinedWidth();
    blockWrapper.with(dateLbl, currentBlock).expand(currentBlock);
    this.addComponent(blockWrapper);
}

12 View Complete Implementation : PageListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void initHeader() {
    HeaderWithIcon headerText = ComponentUtils.headerH2(ProjectTypeConstants.PAGE, UserUIContext.getMessage(PageI18nEnum.LIST));
    MHorizontalLayout rightLayout = new MHorizontalLayout();
    headerLayout.with(headerText, rightLayout).expand(headerText);
    ELabel sortLbl = new ELabel(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_LABEL)).withUndefinedWidth();
    rightLayout.with(sortLbl);
    SortButton sortDateBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_DATE), clickEvent -> {
        dateSourceAscend = !dateSourceAscend;
        if (dateSourceAscend) {
            resources.sort(Ordering.from(dateSort));
        } else {
            resources.sort(Ordering.from(dateSort).reverse());
        }
        displayPages(resources);
    });
    SortButton sortNameBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_NAME), clickEvent -> {
        nameSortAscend = !nameSortAscend;
        if (nameSortAscend) {
            resources.sort(Ordering.from(nameSort));
        } else {
            resources.sort(Ordering.from(nameSort).reverse());
        }
        displayPages(resources);
    });
    SortButton sortKindBtn = new SortButton(UserUIContext.getMessage(PageI18nEnum.OPT_SORT_BY_KIND), clickEvent -> {
        kindSortAscend = !kindSortAscend;
        if (kindSortAscend) {
            resources.sort(Ordering.from(kindSort));
        } else {
            resources.sort(Ordering.from(kindSort).reverse());
        }
        displayPages(resources);
    });
    ButtonGroup sortGroup = new ButtonGroup(sortDateBtn, sortNameBtn, sortKindBtn).withDefaultButton(sortDateBtn);
    rightLayout.with(sortGroup);
    MButton newGroupBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW_GROUP), clickEvent -> UI.getCurrent().addWindow(new GroupPageAddWindow())).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
    newGroupBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    rightLayout.with(newGroupBtn);
    MButton newPageBtn = new MButton(UserUIContext.getMessage(PageI18nEnum.NEW), clickEvent -> EventBusFactory.getInstance().post(new PageEvent.GotoAdd(this, null))).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    rightLayout.with(newPageBtn);
}

12 View Complete Implementation : AttachmentPanel.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayFileName(File file, final String fileName) {
    final MHorizontalLayout fileAttachmentLayout = new MHorizontalLayout().withFullWidth();
    MButton removeBtn = new MButton("", clickEvent -> {
        File tmpFile = fileStores.get(fileName);
        if (tmpFile != null) {
            tmpFile.delete();
        }
        fileStores.remove(fileName);
        AttachmentPanel.this.removeComponent(fileAttachmentLayout);
    }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_ICON_ONLY);
    ELabel fileLbl = ELabel.html(fileName).withDescription(fileName).withStyleName(WebThemes.TEXT_ELLIPSIS);
    fileAttachmentLayout.with(ELabel.fontIcon(FilereplacedetsUtil.getFileIconResource(fileName)).withUndefinedWidth(), fileLbl, new ELabel(" - " + FileUtils.getVolumeDisplay(file.length())).withStyleName(WebThemes.META_INFO).withUndefinedWidth(), removeBtn).expand(fileLbl);
    this.addComponent(fileAttachmentLayout, 0);
}

12 View Complete Implementation : PieChartWrapper.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected final ComponentContainer createLegendBox() {
    final CssLayout mainLayout = new CssLayout();
    mainLayout.addStyleName("legend-box");
    mainLayout.setSizeUndefined();
    final List keys = pieDataSet.getKeys();
    for (int i = 0; i < keys.size(); i++) {
        MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true)).withStyleName("inline-block").withUndefinedWidth();
        layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
        final Comparable key = (Comparable) keys.get(i);
        int colorIndex = i % CHART_COLOR_STR.size();
        final String color = "<div style = \" width:13px;height:13px;background: #" + CHART_COLOR_STR.get(colorIndex) + "\" />";
        final ELabel lblCircle = ELabel.html(color);
        String btnCaption;
        if (enumKeyCls == null) {
            if (key instanceof Key) {
                btnCaption = String.format("%s (%d)", StringUtils.trim(((Key) key).getDisplayName(), 20, true), pieDataSet.getValue(key).intValue());
            } else {
                btnCaption = String.format("%s (%d)", key, pieDataSet.getValue(key).intValue());
            }
        } else {
            btnCaption = String.format("%s(%d)", UserUIContext.getMessage(enumKeyCls, key.toString()), pieDataSet.getValue(key).intValue());
        }
        MButton btnLink = new MButton(StringUtils.trim(btnCaption, 25, true), clickEvent -> {
            if (key instanceof Key) {
                clickLegendItem(((Key) key).getKey());
            } else {
                clickLegendItem(key.toString());
            }
        }).withStyleName(WebThemes.BUTTON_LINK).withDescription(btnCaption);
        layout.with(lblCircle, btnLink);
        mainLayout.addComponent(layout);
    }
    mainLayout.setWidth("100%");
    return mainLayout;
}

9 View Complete Implementation : SubTicketsComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private HorizontalLayout generateSubTicketContent(ProjectTicket subTicket) {
    MHorizontalLayout layout = new MHorizontalLayout().withStyleName(WebThemes.HOVER_EFFECT_NOT_BOX).withMargin(new MarginInfo(false, false, false, true));
    layout.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    layout.with(ELabel.fontIcon(ProjectreplacedetsManager.getreplacedet(subTicket.getType())));
    Span priorityLink = new Span().appendText(ProjectreplacedetsManager.getPriorityHtml(subTicket.getPriority())).setreplacedle(subTicket.getPriority());
    layout.with(ELabel.html(priorityLink.write()).withUndefinedWidth());
    String taskStatus = UserUIContext.getMessage(StatusI18nEnum.clreplaced, subTicket.getStatus());
    ELabel statusLbl = new ELabel(taskStatus).withStyleName(WebThemes.FIELD_NOTE).withUndefinedWidth();
    layout.with(statusLbl);
    String avatarLink = StorageUtils.getAvatarPath(subTicket.getreplacedignUserAvatarId(), 16);
    Img avatarImg = new Img(subTicket.getreplacedignUserFullName(), avatarLink).setCSSClreplaced(WebThemes.CIRCLE_BOX).setreplacedle(subTicket.getreplacedignUserFullName());
    layout.with(ELabel.html(avatarImg.write()).withUndefinedWidth());
    ToggleTicketSummaryWithParentRelationshipField toggleTaskSummaryField = new ToggleTicketSummaryWithParentRelationshipField(parentTicket, subTicket);
    layout.with(toggleTaskSummaryField).expand(toggleTaskSummaryField);
    return layout;
}

9 View Complete Implementation : GeneralSettingViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void buildLanguageUpdatePanel() {
    FormContainer formContainer = new FormContainer();
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
    ELabel languageDownloadDesc = ELabel.html(UserUIContext.getMessage(ShellI18nEnum.OPT_LANGUAGE_DOWNLOAD)).withFullWidth();
    leftPanel.with(languageDownloadDesc).withWidth("250px");
    MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
    MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD)).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.DOWNLOAD);
    ServerConfiguration serverConfiguration = AppContextUtil.getSpringBean(ServerConfiguration.clreplaced);
    BrowserWindowOpener opener = new BrowserWindowOpener(serverConfiguration.getApiUrl("localization/translations"));
    opener.extend(downloadBtn);
    rightPanel.with(downloadBtn, new ELabel(UserUIContext.getMessage(ShellI18nEnum.OPT_UPDATE_LANGUAGE_INSTRUCTION)).withStyleName(WebThemes.META_INFO).withFullWidth());
    layout.with(leftPanel, rightPanel).expand(rightPanel);
    formContainer.addSection("Languages", layout);
    this.with(formContainer);
}

9 View Complete Implementation : UserBulkInviteViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void display() {
    removeAllComponents();
    ELabel replacedleLbl = ELabel.h2(UserUIContext.getMessage(UserI18nEnum.BULK_INVITE));
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), (Button.ClickListener) clickEvent -> {
        EventBusFactory.getInstance().post(new UserEvent.GotoList(this, null));
    }).withStyleName(WebThemes.BUTTON_OPTION);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), (Button.ClickListener) clickEvent -> {
        sendInviteBulkUsers();
    }).withStyleName(WebThemes.BUTTON_ACTION);
    this.with(new MHorizontalLayout(replacedleLbl, cancelBtn, saveBtn).withExpand(replacedleLbl, 1.0f).withFullWidth());
    roleComboBox = new RoleComboBox();
    roleComboBox.addValueChangeListener((HasValue.ValueChangeListener<SimpleRole>) valueChangeEvent -> {
        displayRolePermission(valueChangeEvent.getSource().getValue());
    });
    this.with(new MHorizontalLayout(ELabel.html(UserUIContext.getMessage(RoleI18nEnum.SINGLE)).withStyleName(WebThemes.META_COLOR), roleComboBox).alignAll(Alignment.TOP_LEFT));
    ResponsiveLayout mainLayout = new ResponsiveLayout().withStyleName(WebThemes.MARGIN_TOP);
    ResponsiveRow mainRow = mainLayout.addRow();
    bulkInviteUsersLayout = new GridLayout(3, 1);
    bulkInviteUsersLayout.setSpacing(true);
    ResponsiveColumn column1 = new ResponsiveColumn(12, 12, 6, 6).withComponent(bulkInviteUsersLayout);
    ResponsiveColumn column2 = new ResponsiveColumn(12, 12, 6, 6).withVisibilityRules(false, false, true, true).withComponent(rolePermissionDisplayLayout);
    mainRow.addColumn(column1);
    mainRow.addColumn(column2);
    bulkInviteUsersLayout.addComponent(ELabel.h3(UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL)).withWidth("220px"), 0, 0);
    bulkInviteUsersLayout.addComponent(ELabel.h3(UserUIContext.getMessage(ShellI18nEnum.FORM_PreplacedWORD)), 1, 0);
    this.with(mainLayout);
    displayRolePermission(roleComboBox.getValue());
    buildInviteUserBlock();
}

7 View Complete Implementation : ProjectAssetsUtil.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public static Component editableProjectLogoComp(String projectShortname, Integer projectId, String projectAvatarId, int size) {
    MCssLayout wrapper = new MCssLayout();
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) {
        wrapper.addStyleName(WebThemes.CURSOR_POINTER);
        wrapper.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_CHANGE_IMAGE));
        wrapper.addLayoutClickListener((LayoutEvents.LayoutClickListener) layoutClickEvent -> UI.getCurrent().addWindow(new ProjectLogoUploadWindow(projectShortname, projectId, projectAvatarId)));
    }
    if (!StringUtils.isBlank(projectAvatarId)) {
        Image image = new Image(null, new ExternalResource(StorageUtils.getResourcePath(String.format("%s/%s_%d.png", PathUtils.getProjectLogoPath(AppUI.getAccountId(), projectId), projectAvatarId, size))));
        image.addStyleName(WebThemes.CIRCLE_BOX);
        wrapper.addComponent(image);
    } else {
        ELabel projectIcon = new ELabel(projectShortname.substring(0, 1)).withStyleName(WebThemes.TEXT_ELLIPSIS, ValoTheme.LABEL_LARGE, "center", WebThemes.CIRCLE_BOX).withDescription(projectShortname);
        projectIcon.setWidth(size, Sizeable.Unit.PIXELS);
        projectIcon.setHeight(size, Sizeable.Unit.PIXELS);
        wrapper.addComponent(projectIcon);
    }
    wrapper.setWidth(size, Sizeable.Unit.PIXELS);
    wrapper.setHeight(size, Sizeable.Unit.PIXELS);
    return wrapper;
}

7 View Complete Implementation : PageListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Layout displayPageBlock(final Page resource) {
    MVerticalLayout container = new MVerticalLayout().withFullWidth().withStyleName("page-item-block");
    A pageHtml = new A(ProjectLinkGenerator.generatePageRead(CurrentProjectVariables.getProjectId(), resource.getPath())).appendText(VaadinIcons.FILE_TEXT.getHtml() + " " + resource.getSubject());
    ELabel pageLink = ELabel.h3(pageHtml.write());
    container.with(pageLink, new SafeHtmlLabel(resource.getContent(), 400));
    Label lastUpdateInfo = ELabel.html(UserUIContext.getMessage(PageI18nEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(CurrentProjectVariables.getProjectId(), resource.getLastUpdatedUser(), true), UserUIContext.formatPrettyTime(DateTimeUtils.toLocalDateTime(resource.getLastUpdatedTime())))).withDescription(UserUIContext.formatDateTime(DateTimeUtils.toLocalDateTime(resource.getLastUpdatedTime()))).withStyleName(WebThemes.META_INFO);
    container.addComponent(lastUpdateInfo);
    MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> EventBusFactory.getInstance().post(new PageEvent.GotoEdit(PageListViewImpl.this, resource))).withIcon(VaadinIcons.EDIT).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), 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()) {
                PageService pageService = AppContextUtil.getSpringBean(PageService.clreplaced);
                pageService.removeResource(resource.getPath());
                resources.remove(resource);
                displayPages(resources);
            }
        });
    }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING).withVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES));
    container.addComponent(new MHorizontalLayout(editBtn, deleteBtn));
    return container;
}

4 View Complete Implementation : GenericItemRowDisplayHandler.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public Component generateRow(IBeanList<ProjectGenericItem> host, ProjectGenericItem item, int rowIndex) {
    MVerticalLayout layout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.BORDER_BOTTOM, WebThemes.HOVER_EFFECT_NOT_BOX);
    ELabel link = ELabel.h3("").withFullWidth();
    if (item.isBug() || item.isTask()) {
        link.setValue(ProjectLinkBuilder.generateProjecreplacedemHtmlLinkAndTooltip(item.getProjectShortName(), item.getProjectId(), item.getName(), item.getType(), item.getExtraTypeId() + ""));
    } else {
        link.setValue(ProjectLinkBuilder.generateProjecreplacedemHtmlLinkAndTooltip(item.getProjectShortName(), item.getProjectId(), item.getName(), item.getType(), item.getTypeId()));
    }
    String desc = (StringUtils.isBlank(item.getDescription())) ? UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED) : item.getDescription();
    SafeHtmlLabel descLbl = new SafeHtmlLabel(desc);
    Div div = new Div().setStyle("width:100%");
    Text createdByTxt = new Text(UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY) + ": ");
    Div lastUpdatedOn = new Div().appendChild(new Text(UserUIContext.getMessage(GenericI18Enum.OPT_LAST_MODIFIED, UserUIContext.formatPrettyTime(item.getLastUpdatedTime())))).setreplacedle(UserUIContext.formatDateTime(item.getLastUpdatedTime())).setStyle("float:right;margin-right:5px");
    if (StringUtils.isBlank(item.getCreatedUser())) {
        div.appendChild(createdByTxt, DivLessFormatter.EMPTY_SPACE, new Text(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED)), lastUpdatedOn);
    } else {
        Img userAvatar = new Img("", StorageUtils.getAvatarPath(item.getCreatedUserAvatarId(), 16)).setCSSClreplaced(WebThemes.CIRCLE_BOX);
        A userLink = new A().setId("tag" + TooltipHelper.TOOLTIP_ID).setHref(ProjectLinkGenerator.generateProjectMemberLink(item.getProjectId(), item.getCreatedUser())).appendText(item.getCreatedUserDisplayName());
        userLink.setAttribute("onmouseover", TooltipHelper.userHoverJsFunction(item.getCreatedUser()));
        userLink.setAttribute("onmouseleave", TooltipHelper.itemMouseLeaveJsFunction());
        div.appendChild(createdByTxt, DivLessFormatter.EMPTY_SPACE, userAvatar, DivLessFormatter.EMPTY_SPACE, userLink, lastUpdatedOn);
    }
    ELabel footer = ELabel.html(div.write()).withStyleName(WebThemes.META_INFO).withFullWidth();
    layout.with(link, descLbl, footer);
    return layout;
}

4 View Complete Implementation : PageListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private Layout displayFolderBlock(final Folder resource) {
    MVerticalLayout container = new MVerticalLayout().withFullWidth().withStyleName("page-item-block");
    A folderHtml = new A(ProjectLinkGenerator.generatePagesLink(CurrentProjectVariables.getProjectId(), resource.getPath())).appendText(VaadinIcons.FOLDER_OPEN.getHtml() + " " + resource.getName());
    ELabel folderLink = ELabel.h3(folderHtml.write());
    container.addComponent(folderLink);
    if (StringUtils.isNotBlank(resource.getDescription())) {
        container.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription())));
    }
    Label lastUpdateInfo = ELabel.html(UserUIContext.getMessage(PageI18nEnum.LABEL_LAST_UPDATE, ProjectLinkBuilder.generateProjectMemberHtmlLink(CurrentProjectVariables.getProjectId(), resource.getCreatedUser(), true), UserUIContext.formatPrettyTime(DateTimeUtils.toLocalDateTime(resource.getCreatedTime())))).withDescription(UserUIContext.formatDateTime(DateTimeUtils.toLocalDateTime(resource.getCreatedTime()))).withStyleName(WebThemes.META_INFO);
    container.addComponent(lastUpdateInfo);
    MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new GroupPageAddWindow(resource))).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING).withIcon(VaadinIcons.EDIT).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));
    MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), 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()) {
            PageService pageService = AppContextUtil.getSpringBean(PageService.clreplaced);
            pageService.removeResource(resource.getPath());
            resources.remove(resource);
            displayPages(resources);
        }
    })).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING).withVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES));
    container.addComponent(new MHorizontalLayout(editBtn, deleteBtn));
    return container;
}

4 View Complete Implementation : GeneralSettingViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void buildShortcutIconPanel() {
    FormContainer formContainer = new FormContainer();
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
    ELabel logoDesc = ELabel.html(UserUIContext.getMessage(FileI18nEnum.OPT_FAVICON_FORMAT_DESCRIPTION)).withFullWidth();
    leftPanel.with(logoDesc).withWidth("250px");
    MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
    final Image favIconRes = new Image("", new ExternalResource(StorageUtils.getFavIconPath(billingAccount.getId(), billingAccount.getFaviconpath())));
    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(true, false, false, false));
    buttonControls.setDefaultComponentAlignment(Alignment.BOTTOM_LEFT);
    final UploadField favIconUploadField = new UploadField() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void updateDisplayComponent() {
            byte[] imageData = this.getValue();
            String mimeType = this.getLastMimeType();
            if (mimeType.equals("image/jpeg")) {
                imageData = ImageUtil.convertJpgToPngFormat(imageData);
                if (imageData == null) {
                    throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_INVALID_SUPPORTED_IMAGE_FORMAT));
                } else {
                    mimeType = "image/png";
                }
            }
            if (mimeType.equals("image/png")) {
                try {
                    AccountFavIconService favIconService = AppContextUtil.getSpringBean(AccountFavIconService.clreplaced);
                    BufferedImage image = ImageIO.read(new ByteArrayInputStream(imageData));
                    String newFavIconPath = favIconService.upload(UserUIContext.getUsername(), image, AppUI.getAccountId());
                    favIconRes.setSource(new ExternalResource(StorageUtils.getFavIconPath(billingAccount.getId(), newFavIconPath)));
                    UIUtils.reloadPage();
                } catch (IOException e) {
                    throw new MyCollabException(e);
                }
            } else {
                throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_UPLOAD_INVALID_SUPPORTED_IMAGE_FORMAT));
            }
        }
    };
    favIconUploadField.setButtonCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE));
    favIconUploadField.addStyleName("upload-field");
    favIconUploadField.setSizeUndefined();
    favIconUploadField.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));
    MButton resetButton = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> {
        BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.clreplaced);
        billingAccount.setFaviconpath(null);
        billingAccountService.updateWithSession(billingAccount, UserUIContext.getUsername());
        UIUtils.reloadPage();
    }).withStyleName(WebThemes.BUTTON_OPTION);
    resetButton.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));
    buttonControls.with(resetButton, favIconUploadField);
    rightPanel.with(favIconRes, buttonControls);
    layout.with(leftPanel, rightPanel).expand(rightPanel);
    formContainer.addSection("Favicon", layout);
    this.with(formContainer);
}

3 View Complete Implementation : TicketSelectionWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private DefaultPagedBeanTable<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket> createTicketTable() {
    DefaultPagedBeanTable<ProjectTicketService, ProjectTicketSearchCriteria, ProjectTicket> tableDisplay = new TicketTableDisplay(Arrays.asList(TicketTableFieldDef.name, TicketTableFieldDef.priority, TicketTableFieldDef.status, TicketTableFieldDef.id));
    tableDisplay.setWidth("100%");
    tableDisplay.setDisplayNumItems(10);
    tableDisplay.addGeneratedColumn("name", (source, itemId, columnId) -> {
        ProjectTicket ticket = tableDisplay.getBeanByIndex(itemId);
        A ticketLink = new A("#").appendText(ProjectreplacedetsManager.getreplacedet(ticket.getType()).getHtml() + " " + ticket.getName());
        ELabel ticketLbl = ELabel.html(ticketLink.write());
        if (ticket.isClosed()) {
            ticketLbl.addStyleName(WebThemes.LINK_COMPLETED);
        } else if (ticket.isOverdue()) {
            ticketLbl.addStyleName(WebThemes.LINK_OVERDUE);
        }
        ticketLbl.setDescription(ProjectTooltipGenerator.generateTooltipEnreplacedy(UserUIContext.getUserLocale(), AppUI.getDateFormat(), ticket.getType(), ticket.getTypeId(), AppUI.getAccountId(), AppUI.getSiteUrl(), UserUIContext.getUserTimeZone(), false), ContentMode.HTML);
        ticketLbl.addStyleName(WebThemes.TEXT_ELLIPSIS);
        return ticketLbl;
    });
    tableDisplay.addGeneratedColumn("id", (source, itemId, columnId) -> {
        ProjectTicket ticket = tableDisplay.getBeanByIndex(itemId);
        MButton selectBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SELECT), (Button.ClickListener) clickEvent -> {
            fieldSelection.fireValueChange(ticket);
            close();
        }).withStyleName(WebThemes.BUTTON_ACTION);
        return selectBtn;
    });
    return tableDisplay;
}

0 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;
    }
}

0 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 : ProjectListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void generateDisplayTable() {
    tableItem = new DefaultPagedBeanTable<>(AppContextUtil.getSpringBean(ProjectService.clreplaced), SimpleProject.clreplaced, ProjectTypeConstants.PROJECT, ProjectTableFieldDef.selected, Arrays.asList(ProjectTableFieldDef.projectName, ProjectTableFieldDef.lead, ProjectTableFieldDef.client, ProjectTableFieldDef.startDate, ProjectTableFieldDef.status));
    tableItem.addGeneratedColumn("selected", (source, itemId, columnId) -> {
        final SimpleProject item = tableItem.getBeanByIndex(itemId);
        final CheckBoxDecor cb = new CheckBoxDecor("", item.isSelected());
        cb.addValueChangeListener(valueChangeEvent -> tableItem.fireSelecreplacedemEvent(item));
        item.setExtraData(cb);
        return cb;
    });
    tableItem.addGeneratedColumn(Project.Field.name.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        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());
        A homepageUrl;
        if (StringUtils.isNotBlank(project.getHomepage())) {
            homepageUrl = new A(project.getHomepage(), "_blank").appendText(project.getHomepage()).setCSSClreplaced(WebThemes.META_INFO);
        } else {
            homepageUrl = new A("").appendText(UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED));
        }
        Div projectDiv = new Div().appendChild(projectLink, new Br(), homepageUrl);
        ELabel projectLbl = ELabel.html(projectDiv.write());
        return new MHorizontalLayout(ProjectreplacedetsUtil.projectLogoComp(project.getShortname(), project.getId(), project.getAvatarid(), 32), projectLbl).expand(projectLbl).alignAll(Alignment.MIDDLE_LEFT).withMargin(false);
    });
    tableItem.addGeneratedColumn(Project.Field.memlead.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return ELabel.html(ProjectLinkBuilder.generateProjectMemberHtmlLink(project.getId(), project.getMemlead(), project.getLeadFullName(), project.getLeadAvatarId(), true));
    });
    tableItem.addGeneratedColumn(Project.Field.clientid.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        if (project.getClientid() != null) {
            LabelLink clientLink = new LabelLink(project.getClientName(), ProjectLinkGenerator.generateClientPreviewLink(project.getClientid()));
            clientLink.setIconLink(ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.CLIENT));
            return clientLink;
        } else {
            return new Label();
        }
    });
    tableItem.addGeneratedColumn(Project.Field.planstartdate.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getPlanstartdate()));
    });
    tableItem.addGeneratedColumn(Project.Field.planenddate.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getPlanenddate()));
    });
    tableItem.addGeneratedColumn(Project.Field.status.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return ELabel.i18n(project.getStatus(), StatusI18nEnum.clreplaced);
    });
    tableItem.addGeneratedColumn(Project.Field.createdtime.name(), (source, itemId, columnId) -> {
        SimpleProject project = tableItem.getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDate(project.getCreatedtime()));
    });
    tableItem.setWidth("100%");
    bodyLayout.with(constructTableActionControls(), tableItem).expand(tableItem);
}

0 View Complete Implementation : GeneralSettingViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void buildLogoPanel() {
    FormContainer formContainer = new FormContainer();
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    MVerticalLayout leftPanel = new MVerticalLayout().withMargin(false);
    ELabel logoDesc = ELabel.html(UserUIContext.getMessage(AdminI18nEnum.OPT_LOGO_FORMAT_DESCRIPTION)).withFullWidth();
    leftPanel.with(logoDesc).withWidth("250px");
    MVerticalLayout rightPanel = new MVerticalLayout().withMargin(false);
    CustomLayout previewLayout = CustomLayoutExt.createLayout("topNavigation");
    previewLayout.setStyleName("example-block");
    previewLayout.setHeight("40px");
    previewLayout.setWidth("520px");
    Button currentLogo = AccountreplacedetsResolver.createAccountLogoImageComponent(billingAccount.getLogopath(), 150);
    previewLayout.addComponent(currentLogo, "mainLogo");
    final ServiceMenu serviceMenu = new ServiceMenu();
    Button.ClickListener clickListener = new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        @Override
        public void buttonClick(final Button.ClickEvent event) {
            for (Component comp : serviceMenu) {
                if (comp != event.getButton()) {
                    comp.removeStyleName("selected");
                }
            }
            event.getButton().addStyleName("selected");
        }
    };
    serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_CRM), VaadinIcons.MONEY, clickListener);
    serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_PROJECT), VaadinIcons.TASKS, clickListener);
    serviceMenu.addService(UserUIContext.getMessage(GenericI18Enum.MODULE_DOreplacedENT), VaadinIcons.SUITCASE, clickListener);
    serviceMenu.selectService(0);
    previewLayout.addComponent(serviceMenu, "serviceMenu");
    MHorizontalLayout buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(true, false, false, false));
    buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT);
    final UploadField logoUploadField = new UploadField() {

        private static final long serialVersionUID = 1L;

        @Override
        protected void updateDisplayComponent() {
            byte[] imageData = this.getValue();
            String mimeType = this.getLastMimeType();
            if (mimeType.equals("image/jpeg")) {
                imageData = ImageUtil.convertJpgToPngFormat(imageData);
                if (imageData == null) {
                    throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_INVALID_SUPPORTED_IMAGE_FORMAT));
                } else {
                    mimeType = "image/png";
                }
            }
            if (mimeType.equals("image/png")) {
                UI.getCurrent().addWindow(new LogoEditWindow(imageData));
            } else {
                throw new UserInvalidInputException(UserUIContext.getMessage(FileI18nEnum.ERROR_UPLOAD_INVALID_SUPPORTED_IMAGE_FORMAT));
            }
        }
    };
    logoUploadField.setButtonCaption(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE));
    logoUploadField.addStyleName("upload-field");
    logoUploadField.setSizeUndefined();
    logoUploadField.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));
    MButton resetButton = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_RESET), clickEvent -> {
        BillingAccountService billingAccountService = AppContextUtil.getSpringBean(BillingAccountService.clreplaced);
        billingAccount.setLogopath(null);
        billingAccountService.updateWithSession(billingAccount, UserUIContext.getUsername());
        UIUtils.reloadPage();
    }).withStyleName(WebThemes.BUTTON_OPTION);
    resetButton.setVisible(UserUIContext.canBeYes(RolePermissionCollections.ACCOUNT_THEME));
    buttonControls.with(resetButton, logoUploadField);
    rightPanel.with(previewLayout, buttonControls);
    layout.with(leftPanel, rightPanel).expand(rightPanel);
    formContainer.addSection("Logo", layout);
    this.with(formContainer);
}

0 View Complete Implementation : GeneralSettingViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void displayView() {
    removeAllComponents();
    billingAccount = AppUI.getBillingAccount();
    FormContainer formContainer = new FormContainer();
    this.addComponent(formContainer);
    MHorizontalLayout generalSettingHeader = new MHorizontalLayout();
    ELabel headerLbl = new ELabel(UserUIContext.getMessage(AdminI18nEnum.OPT_GENERAL_SETTINGS)).withStyleName(WebThemes.BUTTON_LINK, ValoTheme.LABEL_H3, ValoTheme.LABEL_NO_MARGIN);
    MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new AccountInfoChangeWindow())).withStyleName(WebThemes.BUTTON_LINK);
    generalSettingHeader.with(headerLbl, editBtn).alignAll(Alignment.MIDDLE_LEFT);
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);
    gridFormLayoutHelper.addComponent(new Label(billingAccount.getSitename()), UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_NAME), 0, 0);
    gridFormLayoutHelper.addComponent(new Label(String.format("https://%s.mycollab.com", billingAccount.getSubdomain())), UserUIContext.getMessage(AdminI18nEnum.FORM_SITE_ADDRESS), 0, 1);
    gridFormLayoutHelper.addComponent(new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), billingAccount.getDefaulttimezone())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_TIMEZONE), 0, 2);
    Currency defaultCurrency = billingAccount.getCurrencyInstance();
    gridFormLayoutHelper.addComponent(new ELabel(defaultCurrency.getDisplayName(UserUIContext.getUserLocale())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_CURRENCY), 0, 3);
    LocalDateTime now = LocalDateTime.now();
    String defaultFullDateFormat = billingAccount.getDateFormatInstance();
    gridFormLayoutHelper.addComponent(new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getDateFormatInstance(), UserUIContext.getUserLocale()), defaultFullDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_YYMMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 0);
    String defaultShortDateFormat = billingAccount.getShortDateFormatInstance();
    gridFormLayoutHelper.addComponent(new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getShortDateFormatInstance(), UserUIContext.getUserLocale()), defaultShortDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_MMDD_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 1);
    String defaultLongDateFormat = billingAccount.getLongDateFormatInstance();
    gridFormLayoutHelper.addComponent(new Label(String.format("%s (%s)", DateTimeUtils.formatDate(now, billingAccount.getLongDateFormatInstance(), UserUIContext.getUserLocale()), defaultLongDateFormat)), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_HUMAN_DATE_FORMAT), UserUIContext.getMessage(GenericI18Enum.FORM_DATE_FORMAT_HELP), 1, 2);
    gridFormLayoutHelper.addComponent(new Label(LocalizationHelper.getLocaleInstance(billingAccount.getDefaultlanguagetag()).getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(AdminI18nEnum.FORM_DEFAULT_LANGUAGE), 1, 3);
    gridFormLayoutHelper.addComponent(new Label(UserUIContext.getMessage(LocalizationHelper.localizeYesNo(billingAccount.getDisplayemailpublicly()))), UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY), UserUIContext.getMessage(AdminI18nEnum.FORM_SHOW_EMAIL_PUBLICLY_HELP), 0, 4, 2);
    formContainer.addSection(new CssLayout(generalSettingHeader), gridFormLayoutHelper.getLayout());
    buildLogoPanel();
    buildShortcutIconPanel();
    if (!SiteConfiguration.isDemandEdition()) {
        buildLanguageUpdatePanel();
    }
}

0 View Complete Implementation : FileDownloadWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void constructBody() {
    final MVerticalLayout layout = new MVerticalLayout().withFullWidth();
    CssLayout iconWrapper = new CssLayout();
    final ELabel iconEmbed = ELabel.fontIcon(FilereplacedetsUtil.getFileIconResource(content.getName()));
    iconEmbed.addStyleName("icon-48px");
    iconWrapper.addComponent(iconEmbed);
    layout.with(iconWrapper).withAlign(iconWrapper, Alignment.MIDDLE_CENTER);
    final GridFormLayoutHelper infoLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    if (content.getDescription() != null) {
        final Label descLbl = new Label();
        if (!content.getDescription().equals("")) {
            descLbl.setData(content.getDescription());
        } else {
            descLbl.setValue(" ");
            descLbl.setContentMode(ContentMode.HTML);
        }
        infoLayout.addComponent(descLbl, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 0);
    }
    UserService userService = AppContextUtil.getSpringBean(UserService.clreplaced);
    SimpleUser user = userService.findUserByUserNameInAccount(content.getCreatedUser(), AppUI.getAccountId());
    if (user == null) {
        infoLayout.addComponent(new UserLink(UserUIContext.getUsername(), UserUIContext.getUserAvatarId(), UserUIContext.getUserDisplayName()), UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY), 0, 1);
    } else {
        infoLayout.addComponent(new UserLink(user.getUsername(), user.getAvatarid(), user.getDisplayName()), UserUIContext.getMessage(GenericI18Enum.OPT_CREATED_BY), 0, 1);
    }
    final Label size = new Label(FileUtils.getVolumeDisplay(content.getSize()));
    infoLayout.addComponent(size, UserUIContext.getMessage(FileI18nEnum.OPT_SIZE), 0, 2);
    ELabel dateCreate = new ELabel().prettyDateTime(DateTimeUtils.toLocalDateTime(content.getCreated()));
    infoLayout.addComponent(dateCreate, UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME), 0, 3);
    layout.addComponent(infoLayout.getLayout());
    MButton downloadBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DOWNLOAD)).withIcon(VaadinIcons.DOWNLOAD).withStyleName(WebThemes.BUTTON_ACTION);
    List<Resource> resources = new ArrayList<>();
    resources.add(content);
    StreamResource downloadResource = StreamDownloadResourceUtil.getStreamResourceSupportExtDrive(resources);
    FileDownloader fileDownloader = new FileDownloader(downloadResource);
    fileDownloader.extend(downloadBtn);
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, downloadBtn);
    layout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
    this.setContent(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 : ProjectActivityStreamPagedList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void doSearch() {
    totalCount = projectActivityStreamService.getTotalActivityStream(((BasicSearchRequest<ActivityStreamSearchCriteria>) searchRequest).getSearchCriteria());
    totalPage = (totalCount - 1) / searchRequest.getNumberOfItems() + 1;
    if (searchRequest.getCurrentPage() > totalPage) {
        searchRequest.setCurrentPage(totalPage);
    }
    if (totalPage > 1) {
        if (controlBarWrapper != null) {
            removeComponent(controlBarWrapper);
        }
        this.addComponent(createPageControls());
    } else {
        if (getComponentCount() == 2) {
            removeComponent(getComponent(1));
        }
    }
    List<ProjectActivityStream> projectActivities = projectActivityStreamService.getProjectActivityStreams((BasicSearchRequest<ActivityStreamSearchCriteria>) searchRequest);
    this.removeAllComponents();
    LocalDate currentDate = LocalDate.of(2100, 1, 1);
    CssLayout currentFeedBlock = new CssLayout();
    AuditLogRegistry auditLogRegistry = AppContextUtil.getSpringBean(AuditLogRegistry.clreplaced);
    try {
        for (ProjectActivityStream activity : projectActivities) {
            if (ProjectTypeConstants.PAGE.equals(activity.getType())) {
                ProjectPageService pageService = AppContextUtil.getSpringBean(ProjectPageService.clreplaced);
                Page page = pageService.getPage(activity.getTypeid(), UserUIContext.getUsername());
                if (page != null) {
                    activity.setNamefield(page.getSubject());
                }
            }
            LocalDate itemCreatedDate = activity.getCreatedtime().toLocalDate();
            if (!currentDate.isEqual(itemCreatedDate)) {
                currentFeedBlock = new CssLayout();
                currentFeedBlock.setStyleName("feed-block");
                feedBlocksPut(currentDate, itemCreatedDate, currentFeedBlock);
                currentDate = itemCreatedDate;
            }
            StringBuilder content = new StringBuilder();
            String itemType = ProjectLocalizationTypeMap.getType(activity.getType());
            String replacedigneeParam = buildreplacedigneeValue(activity);
            String itemParam = buildItemValue(activity);
            if (ActivityStreamConstants.ACTION_CREATE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_CREATE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
            } else if (ActivityStreamConstants.ACTION_UPDATE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_UPDATE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
                if (activity.getreplacedoAuditLog() != null) {
                    content.append(auditLogRegistry.generatorDetailChangeOfActivity(activity));
                }
            } else if (ActivityStreamConstants.ACTION_COMMENT.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_COMMENT_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
                if (activity.getreplacedoAuditLog() != null) {
                    content.append("<ul><li>\"").append(StringUtils.trimHtmlTags(activity.getreplacedoAuditLog().getChangeset(), 200)).append("\"</li></ul>");
                }
            } else if (ActivityStreamConstants.ACTION_DELETE.equals(activity.getAction())) {
                content.append(UserUIContext.getMessage(ProjectCommonI18nEnum.FEED_USER_ACTIVITY_DELETE_ACTION_replacedLE, replacedigneeParam, itemType, itemParam));
            }
            ELabel actionLbl = ELabel.html(content.toString()).withFullWidth();
            MCssLayout streamWrapper = new MCssLayout(actionLbl).withFullWidth().withStyleName("stream-wrapper");
            currentFeedBlock.addComponent(streamWrapper);
        }
    } catch (Exception e) {
        throw new MyCollabException(e);
    }
}

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;
}