org.vaadin.viritin.layouts.MVerticalLayout - java examples

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

62 Examples 7

19 View Complete Implementation : DisclosurePanel.java
Copyright Apache License 2.0
Author : viritin
/**
 */
public clreplaced DisclosurePanel extends VerticalLayout {

    private static final long serialVersionUID = 6509419456771505782L;

    private FontIcon closedIcon = VaadinIcons.PLUS_CIRCLE;

    private FontIcon openIcon = VaadinIcons.MINUS_CIRCLE;

    private final MButton toggle = new MButton(closedIcon);

    private final MVerticalLayout contentWrapper = new MVerticalLayout();

    public DisclosurePanel() {
        setMargin(false);
        setSpacing(false);
        toggle.setStyleName(ValoTheme.BUTTON_BORDERLESS);
        contentWrapper.setVisible(false);
        addComponents(toggle, contentWrapper);
        toggle.addClickListener(new Button.ClickListener() {

            private static final long serialVersionUID = -3471451934465654395L;

            @Override
            public void buttonClick(Button.ClickEvent event) {
                setOpen(!isOpen());
            }
        });
    }

    public DisclosurePanel(String caption, Component... content) {
        this();
        setCaption(caption);
        contentWrapper.add(content);
    }

    public boolean isOpen() {
        return contentWrapper.isVisible();
    }

    public DisclosurePanel setOpen(boolean open) {
        contentWrapper.setVisible(open);
        toggle.setIcon(open ? getOpenIcon() : getClosedIcon());
        return this;
    }

    public DisclosurePanel setContent(Component... content) {
        this.contentWrapper.removeAllComponents();
        this.contentWrapper.add(content);
        return this;
    }

    @Override
    public void setCaption(String caption) {
        toggle.setCaption(caption);
    }

    public MVerticalLayout getContentWrapper() {
        return contentWrapper;
    }

    public FontIcon getClosedIcon() {
        return closedIcon;
    }

    public DisclosurePanel setClosedIcon(FontIcon closedIcon) {
        this.closedIcon = closedIcon;
        return setOpen(isOpen());
    }

    public FontIcon getOpenIcon() {
        return openIcon;
    }

    public DisclosurePanel setOpenIcon(FontIcon openIcon) {
        this.openIcon = openIcon;
        return setOpen(isOpen());
    }
}

19 View Complete Implementation : SubSetSelector.java
Copyright Apache License 2.0
Author : viritin
/**
 * Selects a set of beans from a larger set of choices. Bit similar UI component
 * as "TwinColSelect", but available options are in a combobox for easy picking,
 * and selected entries are displayed in a Table. Should work with virtually any
 * collection type - not just with sets, but same bean can be only once in the
 * collection. If a null is preplaceded for the field value, it is "converted" into
 * and empty Set or list List.
 * <p>
 * The component can be configured to create new enreplacedies as well on demand,
 * either by hitting enter with ComboBox or with a new entry form, or combined.
 *
 * @param <ET> the type of items in from which the selection is build
 */
@SuppressWarnings({ "rawtypes", "serial", "unchecked" })
public clreplaced SubSetSelector<ET> extends CustomField<Collection> implements AbstractForm.SavedHandler<ET>, AbstractForm.ResetHandler<ET> {

    private Clreplaced<?> type;

    private TypedSelect<ET> cb;

    private MTable<ET> table;

    private Collection selected;

    private Button newInstanceBtn;

    private final Clreplaced<ET> elementType;

    private MHorizontalLayout toprow;

    private MVerticalLayout verticalLayout;

    private AbstractForm<ET> newInstanceForm;

    private List<ET> availableOptions;

    private int limit = Integer.MAX_VALUE;

    public SubSetSelector(Clreplaced<ET> elementType) {
        this.elementType = elementType;
        cb = new TypedSelect<>(elementType).withSelectType(ComboBox.clreplaced);
        table = new MTable<>(elementType).withFullWidth();
        setHeight("300px");
        toprow = new MHorizontalLayout(cb);
        verticalLayout = new MVerticalLayout(toprow).expand(table);
        table.setPageLength(5);
        table.withGeneratedColumn("Remove", new MTable.SimpleColumnGenerator<ET>() {

            @Override
            public Object generate(final ET enreplacedy) {
                return getToolColumnContent(enreplacedy);
            }
        });
        table.setColumnHeader("Remove", "");
        cb.setInputPrompt("Add to selection...");
        cb.addValueChangeListener(new ValueChangeListener() {

            @Override
            public void valueChange(com.vaadin.v7.data.Property.ValueChangeEvent event) {
                if (event.getProperty().getValue() != null) {
                    Object pojo = event.getProperty().getValue();
                    cb.getBic().removeItem(pojo);
                    cb.setValue(null);
                    table.addItem(pojo);
                    selected.add(pojo);
                    cb.setEnabled(selected.size() < limit);
                    // fire value change
                    fireValueChange(true);
                }
            }
        });
    }

    /**
     * Generates the tool cell content in the listing of selected items. By
     * default contains button to remove selection. Overridden implementation
     * can add other stuff there as well, like edit button.
     *
     * @param enreplacedy the enreplacedy for which the cell content is created
     * @return the content (String or Component)
     */
    protected Object getToolColumnContent(final ET enreplacedy) {
        Button button = new Button(VaadinIcons.MINUS);
        button.setDescription("Removes the selection from the list");
        button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        button.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                removeSelectedOption(enreplacedy);
            }
        });
        button.setStyleName(ValoTheme.BUTTON_SMALL);
        return button;
    }

    /**
     * @param enreplacedy the enreplacedy to be removed from the selection
     */
    public void removeSelectedOption(ET enreplacedy) {
        cb.addOption(enreplacedy);
        table.removeItem(enreplacedy);
        selected.remove(enreplacedy);
        cb.setEnabled(selected.size() < limit);
        // fire value change
        fireValueChange(true);
    }

    public String getAddInputPrompt() {
        return ((ComboBox) cb.getSelect()).getInputPrompt();
    }

    public void setAddInputPrompt(String inputPrompt) {
        cb.setInputPrompt(inputPrompt);
    }

    /**
     * Sets a form which can be used to add new items to the selection. A button
     * to add new instances is displayed if this method is called.
     *
     * @param newInstanceForm the form
     */
    public void setNewInstanceForm(AbstractForm<ET> newInstanceForm) {
        this.newInstanceForm = newInstanceForm;
        if (newInstanceForm != null) {
            if (newInstanceBtn == null) {
                newInstanceBtn = new MButton(VaadinIcons.PLUS).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
                newInstanceBtn.addClickListener(new Button.ClickListener() {

                    @Override
                    public void buttonClick(ClickEvent clickEvent) {
                        addEnreplacedy(null);
                    }
                });
                toprow.add(newInstanceBtn);
            }
        } else if (newInstanceBtn != null) {
            toprow.removeComponent(newInstanceBtn);
            newInstanceBtn = null;
        }
    }

    public AbstractForm<ET> getNewInstanceForm() {
        return newInstanceForm;
    }

    protected String getDeleteButtonCaption() {
        return "-";
    }

    /**
     * @param headers the headers to be used for the table containing the
     * selected items in the display order of the columns
     * @see Table#setColumnHeaders(String[])
     */
    public void setColumnHeaders(String... headers) {
        table.setColumnHeaders(headers);
    }

    /**
     * @param propertyId the id of the property whose columen header is to be
     * set
     * @param header the columen header
     * @see Table#setColumnHeader(Object, String)
     */
    public void setColumnHeader(Object propertyId, String header) {
        table.setColumnHeader(propertyId, header);
    }

    /**
     * @return the reference to the Table used by this field internally.
     * Modifying this object directly might cause odd behavior.
     */
    public MTable getTable() {
        return table;
    }

    protected void addEnreplacedy(String stringInput) {
        final ET newInstance = instantiateOption(stringInput);
        if (newInstanceForm != null) {
            String caption = "Add new " + elementType.getSimpleName();
            newInstanceForm.setEnreplacedy(newInstance);
            newInstanceForm.setSavedHandler(this);
            newInstanceForm.setResetHandler(this);
            Window w = newInstanceForm.openInModalPopup();
            w.setWidth("70%");
            w.setCaption(caption);
        } else {
            onSave(newInstance);
        }
    }

    protected ET instantiateOption(String stringInput) {
        try {
            return elementType.getConstructor().newInstance();
        } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | NoSuchMethodException | SecurityException | InvocationTargetException e) {
            throw new RuntimeException(e);
        }
    }

    @Override
    public Clreplaced<Collection> getType() {
        return (Clreplaced<Collection>) type;
    }

    /**
     * @param options the list of options from which the sub set is selected
     * @return this
     */
    public SubSetSelector<ET> setOptions(List<ET> options) {
        availableOptions = options;
        cb.setOptions(new ArrayList<>(options));
        return this;
    }

    @Override
    public void setPropertyDataSource(Property newDataSource) {
        if (newDataSource != null) {
            type = newDataSource.getType();
        }
        super.setPropertyDataSource(newDataSource);
    }

    @Override
    protected void setInternalValue(Collection newValue) {
        selected = newValue;
        if (selected == null) {
            Clreplaced<Collection> clazz = getType();
            if (clazz != null && List.clreplaced.isreplacedignableFrom(clazz)) {
                selected = new ArrayList();
            } else {
                selected = new HashSet();
            }
            setValue(selected);
            return;
        }
        final ArrayList<ET> arrayList = new ArrayList<>(availableOptions);
        arrayList.removeAll(selected);
        cb.setOptions(arrayList);
        cb.getBic().fireItemSetChange();
        cb.setEnabled(selected.size() < limit);
        table.setBeans(new ArrayList(selected));
        super.setInternalValue(newValue);
    }

    @Override
    protected void fireValueChange(boolean repaintIsNotNeeded) {
        super.fireValueChange(repaintIsNotNeeded);
    }

    public void setVisibleProperties(String... visible) {
        List<String> a = new ArrayList(Arrays.asList(visible));
        a.add("Remove");
        table.withProperties(a);
        table.setColumnHeader("Remove", "");
    }

    public String getNewEnreplacedyCaption() {
        return newInstanceBtn.getCaption();
    }

    public void setNewEnreplacedyCaption(String newEnreplacedyCaption) {
        newInstanceBtn.setCaption(newEnreplacedyCaption);
    }

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

    public void setCaptionGenerator(CaptionGenerator<ET> cg) {
        cb.setCaptionGenerator(cg);
    }

    @Override
    public void onSave(ET enreplacedy) {
        // TODO, figure out something here, needs a listener/handler
        // getProvider().persist(elementType, newInstance);
        table.addItem(enreplacedy);
        selected.add(enreplacedy);
        /*
         * Here we check the table for limit because the added enreplacedy could be equal to another added previously.
         * Since the table has a list container and selected has a map, they do not have the same behavior for equality.
         */
        cb.setEnabled(table.size() < limit);
        if (newInstanceForm != null) {
            newInstanceForm.closePopup();
        }
        // fire value change
        fireValueChange(true);
    }

    @Override
    public void onReset(ET enreplacedy) {
        newInstanceForm.closePopup();
    }

    /**
     * With this method users can be allowed to add new enreplacedies directly via
     * the combobox used to select enreplacedies from the existing set.
     * <p>
     * Developer can decide what to do with the input string, by overriding the
     * instantiateOption method. Also override onSave method if you need to do
     * something specific with new enreplacedies (e.g. save to persistency context
     * and preplaced the persisted instance to the default action that adds it to
     * select and available options).
     * <p>
     * If a newInstanceForm is set, the created the enreplacedy is then shown for
     * further editing in the form.
     *
     * @param allowAddingNewItems true if hitting enter without suggestions
     * should add a new item.
     */
    public void setNewItemsAllowed(boolean allowAddingNewItems) {
        cb.getSelect().setNewItemsAllowed(allowAddingNewItems);
        if (allowAddingNewItems) {
            cb.getSelect().setNewItemHandler(new AbstractSelect.NewItemHandler() {

                @Override
                public void addNewItem(String s) {
                    addEnreplacedy(s);
                }
            });
        } else {
            cb.getSelect().setNewItemHandler(null);
        }
    }

    public int getLimit() {
        return limit;
    }

    /**
     * Sets the limit of elements added to the SubSetSelector. Setting the limit
     * or adding elements will trigger the combo box availability.
     *
     * @param limit the maximum number of selected elements (collection size)
     */
    public void setLimit(int limit) {
        if (limit < 0) {
            this.limit = Integer.MAX_VALUE;
        } else {
            this.limit = limit;
        }
        cb.setEnabled(selected.size() < limit);
    }
}

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

    private static final long serialVersionUID = 1L;

    private ApplicationEventListener<TicketEvent.SubTicketAdded> subTicketAddedEvent = new ApplicationEventListener<TicketEvent.SubTicketAdded>() {

        @Override
        @Subscribe
        public void handle(TicketEvent.SubTicketAdded event) {
            ProjectTicketService ticketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
            ProjectTicket ticket = ticketService.findTicket(event.getTicketType(), event.getTicketId());
            if (ticket != null) {
                ticketsLayout.addComponent(generateSubTicketContent(ticket), 0);
            }
        }
    };

    private MVerticalLayout ticketsLayout;

    private ProjectTicket parentTicket;

    public SubTicketsComp(ProjectTicket parentTicket) {
        this.parentTicket = parentTicket;
    }

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

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

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

    @Override
    protected void doSetValue(Object o) {
    }

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

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

19 View Complete Implementation : BuildCriterionComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.0
 */
public clreplaced BuildCriterionComponent<S extends SearchCriteria> extends MVerticalLayout implements CriteriaBuilderComponent<S> {

    private static final long serialVersionUID = 1L;

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

    private SearchLayout<S> hostSearchLayout;

    private Param[] paramFields;

    private String searchCategory;

    private MHorizontalLayout filterBox;

    private MVerticalLayout searchContainer;

    public BuildCriterionComponent(SearchLayout<S> searchLayout, Param[] paramFields, String searchCategory) {
        this.hostSearchLayout = searchLayout;
        this.paramFields = paramFields;
        this.searchCategory = searchCategory;
        MHorizontalLayout headerBox = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, true));
        headerBox.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        addComponent(headerBox);
        Label filterLbl = new Label(UserUIContext.getMessage(GenericI18Enum.OPT_SAVED_FILTER));
        headerBox.with(filterLbl).withAlign(filterLbl, Alignment.TOP_LEFT);
        filterBox = new MHorizontalLayout();
        headerBox.with(filterBox).withAlign(filterBox, Alignment.TOP_LEFT);
        buildFilterBox(null);
        searchContainer = new MVerticalLayout().withMargin(false);
        searchContainer.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        MButton addCriteriaBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD_CRITERIA), clickEvent -> {
            CriteriaSelectionLayout newCriteriaBar = new CriteriaSelectionLayout(searchContainer.getComponentCount() + 1);
            searchContainer.addComponent(newCriteriaBar);
        }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION);
        this.with(searchContainer, new MHorizontalLayout(addCriteriaBtn).withMargin(true));
    }

    private void buildFilterBox(String queryName) {
        filterBox.removeAllComponents();
        SavedSearchResultComboBox filterComboBox = new SavedSearchResultComboBox();
        filterBox.addComponent(filterComboBox);
        MButton saveSearchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_NEW_FILTER), clickEvent -> buildSaveFilterBox()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.PLUS);
        filterBox.addComponent(saveSearchBtn);
    }

    private void buildSaveFilterBox() {
        filterBox.removeAllComponents();
        TextField queryTextField = new TextField();
        filterBox.addComponent(queryTextField);
        MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> {
            String queryText = queryTextField.getValue();
            saveSearchCriteria(queryText);
        }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(ShortcutAction.KeyCode.ENTER);
        filterBox.addComponent(saveBtn);
        MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> buildFilterBox(null)).withStyleName(WebThemes.BUTTON_OPTION);
        filterBox.addComponent(cancelBtn);
    }

    private void saveSearchCriteria(String queryText) {
        List<SearchFieldInfo<S>> fieldInfos = buildSearchFieldInfos();
        if (CollectionUtils.isEmpty(fieldInfos)) {
            throw new UserInvalidInputException(UserUIContext.getMessage(ErrorI18nEnum.SELECT_AT_LEAST_ONE_CRITERIA));
        }
        SaveSearchResultService saveSearchResultService = AppContextUtil.getSpringBean(SaveSearchResultService.clreplaced);
        SaveSearchResult searchResult = new SaveSearchResult();
        searchResult.setSaveuser(UserUIContext.getUsername());
        searchResult.setSaccountid(AppUI.getAccountId());
        searchResult.setQuerytext(Queryreplacedyzer.toQueryParams(fieldInfos));
        searchResult.setType(searchCategory);
        searchResult.setQueryname(queryText);
        saveSearchResultService.saveWithSession(searchResult, UserUIContext.getUsername());
        buildFilterBox(queryText);
    }

    @Override
    public List<SearchFieldInfo<S>> buildSearchFieldInfos() {
        Iterator<Component> iterator = searchContainer.iterator();
        List<SearchFieldInfo<S>> fieldInfos = new ArrayList<>();
        while (iterator.hasNext()) {
            CriteriaSelectionLayout criteriaSelectionLayout = (CriteriaSelectionLayout) iterator.next();
            SearchFieldInfo searchFieldInfo = criteriaSelectionLayout.buildSearchFieldInfo();
            if (searchFieldInfo != null) {
                fieldInfos.add(searchFieldInfo);
            }
        }
        return fieldInfos;
    }

    void clearAllFields() {
        searchContainer.removeAllComponents();
    }

    protected Component buildPropertySearchComp(String fieldId) {
        return null;
    }

    void fillSearchFieldInfoAndInvokeSearchRequest(List<SearchFieldInfo<S>> searchFieldInfos) {
        searchContainer.removeAllComponents();
        try {
            searchFieldInfos.forEach(fieldInfo -> {
                CriteriaSelectionLayout criteriaSelectionLayout = new CriteriaSelectionLayout(searchContainer.getComponentCount() + 1);
                criteriaSelectionLayout.fillSearchFieldInfo(fieldInfo);
                searchContainer.addComponent(criteriaSelectionLayout);
            });
        } catch (Exception e) {
            LOG.error("Error while build criterion", e);
        }
    }

    private clreplaced CriteriaSelectionLayout extends GridLayout {

        private static final long serialVersionUID = 1L;

        private int index;

        private Label indexLbl;

        private StringValueComboBox operatorSelectionBox;

        private ComboBox fieldSelectionBox;

        private I18nValueComboBox<QueryI18nEnum> compareSelectionBox;

        private MVerticalLayout valueBox;

        private Button deleteBtn;

        CriteriaSelectionLayout(int index) {
            super(6, 1);
            this.index = index;
            this.setSpacing(true);
            this.setMargin(new MarginInfo(false, true, false, true));
            this.setDefaultComponentAlignment(Alignment.TOP_LEFT);
            indexLbl = new Label(index + "");
            indexLbl.setWidth("70px");
            this.addComponent(indexLbl, 0, 0);
            if (index == 1) {
                this.addComponent(ELabel.html(" ").withWidth("80px"), 1, 0);
            } else {
                operatorSelectionBox = new StringValueComboBox(false, SearchField.AND, SearchField.OR);
                operatorSelectionBox.setWidth("80px");
                this.addComponent(operatorSelectionBox, 1, 0);
            }
            buildFieldSelectionBox();
            valueBox = new MVerticalLayout().withMargin(false).withWidth("250px");
            deleteBtn = new MButton("", event -> {
                int compIndex = searchContainer.getComponentIndex(CriteriaSelectionLayout.this);
                searchContainer.removeComponent(CriteriaSelectionLayout.this);
                for (int i = compIndex; i < searchContainer.getComponentCount(); i++) {
                    CriteriaSelectionLayout searchCriteriaLayout = (CriteriaSelectionLayout) searchContainer.getComponent(i);
                    searchCriteriaLayout.updateIndex();
                }
            }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_ICON_ONLY);
            this.addComponent(fieldSelectionBox, 2, 0);
            this.addComponent(compareSelectionBox, 3, 0);
            this.addComponent(valueBox, 4, 0);
            this.addComponent(deleteBtn, 5, 0);
        }

        private void updateIndex() {
            index--;
            indexLbl.setValue(index + "");
            if (index == 1) {
                removeComponent(operatorSelectionBox);
                this.addComponent(ELabel.html(" ").withWidth("80px"), 1, 0);
            }
        }

        private void fillSearchFieldInfo(SearchFieldInfo searchFieldInfo) {
            String width = "250px";
            if (operatorSelectionBox != null) {
                operatorSelectionBox.setValue(searchFieldInfo.getPrefixOper());
            }
            Param param = searchFieldInfo.getParam();
            Collection<?> itemIds = ((ListDataProvider) fieldSelectionBox.getDataProvider()).gereplacedems();
            for (Object item : itemIds) {
                if (param.equals(item)) {
                    fieldSelectionBox.setValue(item);
                    break;
                }
            }
            compareSelectionBox.setValueByString(searchFieldInfo.getCompareOper());
            valueBox.removeAllComponents();
            if (param instanceof StringParam || param instanceof ConcatStringParam) {
                TextField valueField = new TextField();
                valueField.setValue((String) searchFieldInfo.eval());
                valueField.setWidth(width);
                valueBox.addComponent(valueField);
            } else if (param instanceof NumberParam) {
                TextField valueField = new TextField();
                valueField.setValue(String.valueOf(searchFieldInfo.eval()));
                valueField.setWidth(width);
                valueBox.addComponent(valueField);
            } else if (param instanceof BooleanParam) {
                I18nValueComboBox<GenericI18Enum> valueField = new I18nValueComboBox<>(GenericI18Enum.clreplaced, GenericI18Enum.ACTION_YES, GenericI18Enum.ACTION_NO);
                valueField.setValueByString(String.valueOf(searchFieldInfo.eval()));
                valueField.setWidth(width);
                valueBox.addComponent(valueField);
            } else if (param instanceof DateParam) {
                QueryI18nEnum compareItem = compareSelectionBox.getValue();
                if (QueryI18nEnum.BETWEEN == compareItem || QueryI18nEnum.NOT_BETWEEN == compareItem) {
                    DateField field1 = new DateField();
                    field1.setValue((LocalDate) Array.get(searchFieldInfo.eval(), 0));
                    field1.setWidth(width);
                    DateField field2 = new DateField();
                    field2.setValue((LocalDate) Array.get(searchFieldInfo.eval(), 1));
                    field2.setWidth(width);
                    valueBox.with(field1, field2);
                } else {
                    DateField field = new DateField();
                    field.setValue((LocalDate) searchFieldInfo.eval());
                    field.setWidth(width);
                    valueBox.addComponent(field);
                }
            } else if (param instanceof PropertyParam || param instanceof PropertyListParam || param instanceof CustomSqlParam || param instanceof SearchCriteriaBridgeParam) {
                Component comp = buildPropertySearchComp(param.getId());
                if (comp != null) {
                    comp.setWidth(width);
                    valueBox.addComponent(comp);
                    ((HasValue) comp).setValue(searchFieldInfo.eval());
                }
            } else if (param instanceof StringListParam) {
                ValueListSelect listSelect = new ValueListSelect();
                listSelect.setCaption(null);
                listSelect.loadData(((StringListParam) param).getValues().toArray(new String[0]));
                listSelect.setValue((Set<?>) searchFieldInfo.eval());
                listSelect.setWidth(width);
                valueBox.addComponent(listSelect);
            } else if (param instanceof I18nStringListParam) {
                Collection<? extends Enum<?>> values = ((I18nStringListParam) param).getValues();
                if (CollectionUtils.isNotEmpty(values)) {
                    I18nValueListSelect listSelect = new I18nValueListSelect();
                    listSelect.setCaption(null);
                    listSelect.loadData(((I18nStringListParam) param).getValues());
                    listSelect.setValue((Set<?>) searchFieldInfo.eval());
                    listSelect.setWidth(width);
                    valueBox.addComponent(listSelect);
                }
            } else if (param instanceof CompositionStringParam) {
                TextField tempTextField = new TextField();
                tempTextField.setValue(String.valueOf(searchFieldInfo.eval()));
                tempTextField.setWidth(width);
                valueBox.addComponent(tempTextField);
            }
        }

        private void buildFieldSelectionBox() {
            fieldSelectionBox = new ComboBox();
            fieldSelectionBox.setWidth("160px");
            fieldSelectionBox.setEmptySelectionAllowed(false);
            fieldSelectionBox.sereplacedems(paramFields);
            fieldSelectionBox.sereplacedemCaptionGenerator((ItemCaptionGenerator<Param>) item -> {
                CacheParamMapper.ValueParam valueParam = CacheParamMapper.getValueParam(searchCategory, item.getId());
                return UserUIContext.getMessage(valueParam.getDisplayName());
            });
            fieldSelectionBox.addValueChangeListener(valueChangeEvent -> {
                compareSelectionBox.clear();
                Param field = (Param) fieldSelectionBox.getValue();
                if (field != null) {
                    if (field instanceof StringParam) {
                        compareSelectionBox.loadData(Arrays.asList(StringParam.OPTIONS));
                    } else if (field instanceof NumberParam) {
                        compareSelectionBox.loadData(Arrays.asList(NumberParam.OPTIONS));
                    } else if (field instanceof BooleanParam) {
                        compareSelectionBox.loadData(Arrays.asList(BooleanParam.OPTIONS));
                    } else if (field instanceof DateParam) {
                        compareSelectionBox.loadData(Arrays.asList(DateParam.OPTIONS));
                    } else if (field instanceof PropertyParam) {
                        compareSelectionBox.loadData(Arrays.asList(PropertyParam.OPTIONS));
                    } else if (field instanceof PropertyListParam || field instanceof CustomSqlParam || field instanceof SearchCriteriaBridgeParam) {
                        compareSelectionBox.loadData(Arrays.asList(PropertyListParam.OPTIONS));
                    } else if (field instanceof StringListParam) {
                        compareSelectionBox.loadData(Arrays.asList(StringListParam.OPTIONS));
                    } else if (field instanceof I18nStringListParam) {
                        compareSelectionBox.loadData(Arrays.asList(I18nStringListParam.OPTIONS));
                    } else if (field instanceof CompositionStringParam) {
                        compareSelectionBox.loadData(Arrays.asList(StringParam.OPTIONS));
                    } else if (field instanceof ConcatStringParam) {
                        compareSelectionBox.loadData(Arrays.asList(ConcatStringParam.OPTIONS));
                    }
                }
            });
            compareSelectionBox = new I18nValueComboBox(QueryI18nEnum.clreplaced, false);
            compareSelectionBox.setWidth("130px");
            compareSelectionBox.addValueChangeListener(valueChangeEvent -> displayreplacedociateInputField((Param) fieldSelectionBox.getValue()));
        }

        private void displayreplacedociateInputField(Param field) {
            String width = "250px";
            QueryI18nEnum compareItem = compareSelectionBox.getValue();
            valueBox.removeAllComponents();
            if (field instanceof StringParam || field instanceof ConcatStringParam) {
                TextField tempTextField = new TextField();
                tempTextField.setWidth(width);
                valueBox.addComponent(tempTextField);
            } else if (field instanceof NumberParam) {
                TextField tempTextField = new TextField();
                tempTextField.setWidth(width);
                valueBox.addComponent(tempTextField);
            } else if (field instanceof BooleanParam) {
                I18nValueComboBox yesNoBox = new I18nValueComboBox<>(GenericI18Enum.clreplaced, GenericI18Enum.ACTION_YES, GenericI18Enum.ACTION_NO);
                yesNoBox.setWidth(width);
                valueBox.addComponent(yesNoBox);
            } else if (field instanceof DateParam) {
                if (QueryI18nEnum.BETWEEN.equals(compareItem) || QueryI18nEnum.NOT_BETWEEN.equals(compareItem)) {
                    DateField field1 = new DateField();
                    field1.setWidth(width);
                    DateField field2 = new DateField();
                    field2.setWidth(width);
                    valueBox.with(field1, field2);
                } else {
                    DateField tempDateField = new DateField();
                    tempDateField.setWidth(width);
                    valueBox.addComponent(tempDateField);
                }
            } else if (field instanceof PropertyParam || field instanceof PropertyListParam || field instanceof CustomSqlParam || field instanceof SearchCriteriaBridgeParam) {
                Component comp = buildPropertySearchComp(field.getId());
                if (comp != null) {
                    comp.setWidth(width);
                    valueBox.addComponent(comp);
                }
            } else if (field instanceof StringListParam) {
                ValueListSelect listSelect = new ValueListSelect();
                listSelect.setCaption(null);
                listSelect.loadData(((StringListParam) field).getValues().toArray(new String[0]));
                listSelect.setWidth(width);
                valueBox.addComponent(listSelect);
            } else if (field instanceof I18nStringListParam) {
                I18nValueListSelect listSelect = new I18nValueListSelect();
                listSelect.setCaption(null);
                listSelect.loadData(((I18nStringListParam) field).getValues());
                listSelect.setWidth(width);
                valueBox.addComponent(listSelect);
            } else if (field instanceof CompositionStringParam) {
                TextField tempTextField = new TextField();
                tempTextField.setWidth(width);
                valueBox.addComponent(tempTextField);
            }
        }

        private SearchFieldInfo buildSearchFieldInfo() {
            String prefixOper = (operatorSelectionBox != null) ? operatorSelectionBox.getValue() : "AND";
            Param param = (Param) fieldSelectionBox.getValue();
            QueryI18nEnum compareOper = compareSelectionBox.getValue();
            Object value = constructObject(valueBox);
            if (value != null) {
                if (value.getClreplaced().isArray()) {
                    if (Array.getLength(value) == 0) {
                        return null;
                    }
                } else if (Collection.clreplaced.isreplacedignableFrom(value.getClreplaced())) {
                    if (((Collection) value).size() == 0) {
                        return null;
                    }
                }
                if (value instanceof Enum) {
                    value = ((Enum) value).name();
                }
                return new SearchFieldInfo(prefixOper, param, compareOper.name(), ConstantValueInjector.valueOf(value));
            } else {
                return null;
            }
        }

        private Object constructObject(AbstractOrderedLayout valueBox) {
            int componentCount = valueBox.getComponentCount();
            if (componentCount == 1) {
                HasValue<?> component = (HasValue<?>) valueBox.getComponent(0);
                return getConvertedValue(component);
            } else if (componentCount > 1) {
                Object[] value = new Object[componentCount];
                for (int i = 0; i < componentCount; i++) {
                    Array.set(value, i, getConvertedValue(((HasValue<?>) valueBox.getComponent(i))));
                }
                return value;
            } else {
                return null;
            }
        }

        private Object getConvertedValue(HasValue<?> component) {
            if (component instanceof Converter) {
                Converter converter = (Converter) component;
                Result result = converter.convertToModel(component.getValue(), null);
                try {
                    return result.getOrThrow(SerializableFunction.idenreplacedy());
                } catch (Throwable throwable) {
                    throw new MyCollabException(throwable);
                }
            }
            return component.getValue();
        }
    }

    private clreplaced SavedSearchResultComboBox extends ComboBox<SaveSearchResult> {

        private static final long serialVersionUID = 1L;

        SavedSearchResultComboBox() {
            buildQuerySelectComponent();
            this.addValueChangeListener(event -> {
                Object itemId = SavedSearchResultComboBox.this.getValue();
                if (itemId != null) {
                    final SaveSearchResult data = getValue();
                    String queryText = data.getQuerytext();
                    try {
                        List<SearchFieldInfo<S>> fieldInfos = Queryreplacedyzer.toSearchFieldInfos(queryText, searchCategory);
                        fillSearchFieldInfoAndInvokeSearchRequest(fieldInfos);
                        hostSearchLayout.callSearchAction();
                    } catch (Exception e) {
                        LOG.error("Error of invalid query", e);
                        NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.QUERY_SEARCH_IS_INVALID));
                    }
                    if (filterBox.getComponentCount() <= 3) {
                        MButton updateBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_UPDATE_LABEL), clickEvent -> {
                            List<SearchFieldInfo<S>> fieldInfos = buildSearchFieldInfos();
                            SaveSearchResultService saveSearchResultService = AppContextUtil.getSpringBean(SaveSearchResultService.clreplaced);
                            data.setSaveuser(UserUIContext.getUsername());
                            data.setSaccountid(AppUI.getAccountId());
                            data.setQuerytext(Queryreplacedyzer.toQueryParams(fieldInfos));
                            saveSearchResultService.updateWithSession(data, UserUIContext.getUsername());
                        }).withIcon(VaadinIcons.REFRESH).withStyleName(WebThemes.BUTTON_ACTION);
                        MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
                            SaveSearchResultService saveSearchResultService = AppContextUtil.getSpringBean(SaveSearchResultService.clreplaced);
                            saveSearchResultService.removeWithSession(data, UserUIContext.getUsername(), AppUI.getAccountId());
                            searchContainer.removeAllComponents();
                            if (filterBox.getComponentCount() > 2) {
                                filterBox.removeComponent(filterBox.getComponent(1));
                            }
                            buildQuerySelectComponent();
                        }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_DANGER);
                        filterBox.addComponent(deleteBtn, 1);
                        filterBox.addComponent(updateBtn, 1);
                    }
                } else {
                    searchContainer.removeAllComponents();
                    if (filterBox.getComponentCount() > 3) {
                        filterBox.removeComponent(filterBox.getComponent(1));
                        filterBox.removeComponent(filterBox.getComponent(1));
                    }
                }
            });
        }

        private void buildQuerySelectComponent() {
            SaveSearchResultCriteria searchCriteria = new SaveSearchResultCriteria();
            searchCriteria.setType(StringSearchField.and(searchCategory));
            searchCriteria.setCreateUser(StringSearchField.and(UserUIContext.getUsername()));
            searchCriteria.setSaccountid(new NumberSearchField(AppUI.getAccountId()));
            SaveSearchResultService saveSearchResultService = AppContextUtil.getSpringBean(SaveSearchResultService.clreplaced);
            List<SaveSearchResult> saveSearchResults = (List<SaveSearchResult>) saveSearchResultService.findPageableListByCriteria(new BasicSearchRequest<>(searchCriteria));
            this.sereplacedems(saveSearchResults);
            this.sereplacedemCaptionGenerator((ItemCaptionGenerator<SaveSearchResult>) SaveSearchResult::getQueryname);
        }
    }
}

19 View Complete Implementation : GetStartedInstructionWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.2.7
 */
clreplaced GetStartedInstructionWindow extends MWindow {

    private MVerticalLayout contentLayout;

    public GetStartedInstructionWindow(SimpleUser user) {
        super("Getting started instructions");
        contentLayout = new MVerticalLayout();
        this.withResizable(false).withModal(true).withWidth("600px").withContent(contentLayout).withCenter();
        displayInfo(user);
    }

    private void displayInfo(SimpleUser user) {
        Div infoDiv = new Div().appendText("You have not setup SMTP account properly. So we can not send the invitation by email automatically. Please copy/paste below paragraph and inform to the user by yourself").setStyle("font-weight:bold;color:red");
        Label infoLbl = new Label(infoDiv.write(), ContentMode.HTML);
        Div userInfoDiv = new Div().appendText("Your username is ").appendChild(new B().appendText(user.getEmail()));
        Label userInfoLbl = ELabel.html(userInfoDiv.write());
        if (Boolean.TRUE.equals(user.isAccountOwner())) {
            user.setRoleName(UserUIContext.getMessage(RoleI18nEnum.OPT_ACCOUNT_OWNER));
        }
        Div roleInfoDiv = new Div().appendText("Your role is ").appendChild(new B().appendText(user.getRoleName()));
        Label roleInfoLbl = new Label(roleInfoDiv.write(), ContentMode.HTML);
        contentLayout.with(infoLbl, userInfoLbl, roleInfoLbl);
        final Button addNewBtn = new Button("Create another user", clickEvent -> {
            EventBusFactory.getInstance().post(new UserEvent.GotoAdd(GetStartedInstructionWindow.this, null));
            close();
        });
        addNewBtn.setStyleName(WebThemes.BUTTON_ACTION);
        Button doneBtn = new Button(UserUIContext.getMessage(GenericI18Enum.ACTION_DONE), clickEvent -> close());
        doneBtn.setStyleName(WebThemes.BUTTON_ACTION);
        final MHorizontalLayout controlsBtn = new MHorizontalLayout(addNewBtn, doneBtn).withMargin(true);
        contentLayout.with(controlsBtn).withAlign(controlsBtn, Alignment.MIDDLE_RIGHT);
    }
}

19 View Complete Implementation : TaskReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void initRelatedComponents() {
    activityComponent = new ProjectActivityComponent(ProjectTypeConstants.TASK, CurrentProjectVariables.getProjectId());
    dateInfoComp = new DateInfoComp();
    peopleInfoComp = new PeopleInfoComp();
    followerSheet = new ProjectFollowersComp<>(ProjectTypeConstants.TASK, ProjectRolePermissionCollections.TASKS);
    planningInfoComp = new PlanningInfoComp();
    ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
    MVerticalLayout detailLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));
    if (SiteConfiguration.isCommunityEdition()) {
        detailLayout.with(peopleInfoComp, planningInfoComp, followerSheet, dateInfoComp);
    } else {
        timeLogComp = ViewManager.getCacheComponent(TaskTimeLogSheet.clreplaced);
        detailLayout.with(peopleInfoComp, planningInfoComp, timeLogComp, followerSheet, dateInfoComp);
    }
    Panel detailPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_DETAILS), detailLayout);
    UIUtils.makeStackPanel(detailPanel);
    projectView.addComponentToRightBar(detailPanel);
}

19 View Complete Implementation : MNotificationExapmle.java
Copyright Apache License 2.0
Author : viritin
@Override
public Component getTestComponent() {
    MVerticalLayout layout = new MVerticalLayout(new MLabel("MNotification Examples").withStyleName("h1"), new MHorizontalLayout(new MButton(VaadinIcons.COMMENT, "Humanized", new Button.ClickListener() {

        private static final long serialVersionUID = 5019806363620874205L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            MNotification.humanized("Humanized", "This is a humanized notification!").withIcon(VaadinIcons.COMMENT);
        }
    }).withStyleName("primary"), new MButton(VaadinIcons.CLOSE, "Error", new Button.ClickListener() {

        private static final long serialVersionUID = 5019806363620874205L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            MNotification.error("Error", "This is an error notification!").withIcon(VaadinIcons.CLOSE);
        }
    }).withStyleName("danger"), new MButton(VaadinIcons.EXCLAMATION, "Warning", new Button.ClickListener() {

        private static final long serialVersionUID = 5019806363620874205L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            MNotification.warning("Warning", "This is a warning notification!").withIcon(VaadinIcons.EXCLAMATION);
        }
    }), new MButton(VaadinIcons.DOWNLOAD, "Tray", new Button.ClickListener() {

        private static final long serialVersionUID = 5019806363620874205L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            MNotification.tray("Tray", "This is a tray notification!").withIcon(VaadinIcons.DOWNLOAD);
        }
    }).withStyleName("friendly"), new MButton(VaadinIcons.ACCESSIBILITY, "replacedistive", new Button.ClickListener() {

        private static final long serialVersionUID = 5019806363620874205L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            MNotification.replacedistive("replacedistive", "This is an replacedistive notification!");
        }
    }).withStyleName("quiet"))).withFullWidth();
    return layout;
}

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

    private SimpleProject project;

    private Button toggleButton;

    private MVerticalLayout modulePanel;

    private Boolean retainVisibility = true;

    public ProjectRightBarContainer(SimpleProject project) {
        this.project = project;
        this.withFullHeight().withMargin(false).withStyleName("project-right-bar");
        modulePanel = new MVerticalLayout().withMargin(false);
        toggleButton = new Button();
        toggleButton.addStyleName("toggle-button");
        toggleButton.addStyleName(WebThemes.BUTTON_ICON_ONLY);
        setToggleVisibility(retainVisibility);
        toggleButton.addClickListener(clickEvent -> {
            retainVisibility = !retainVisibility;
            setToggleVisibility(retainVisibility);
        });
        this.with(toggleButton, buildProjectActionPanel(), modulePanel).withAlign(toggleButton, Alignment.TOP_LEFT).expand(modulePanel);
    }

    private void setToggleVisibility(boolean visibility) {
        if (visibility) {
            toggleButton.setIcon(VaadinIcons.CLOSE_SMALL);
            toggleButton.setDescription(UserUIContext.getMessage(ShellI18nEnum.ACTION_COLLAPSE_MENU));
            showComponents();
        } else {
            toggleButton.setIcon(VaadinIcons.ANGLE_DOUBLE_LEFT);
            toggleButton.setDescription(UserUIContext.getMessage(ShellI18nEnum.ACTION_EXPAND_MENU));
            hideComponents();
        }
    }

    private void showComponents() {
        this.setWidth("300px");
        toggleButton.setWidth("300px");
        for (int i = 1; i < getComponentCount(); i++) {
            Component component = getComponent(i);
            component.removeStyleName(WebThemes.HIDE_ELEMENT);
        }
    }

    private void hideComponents() {
        this.setWidth("30px");
        toggleButton.setWidth("30px");
        for (int i = 1; i < getComponentCount(); i++) {
            Component component = getComponent(i);
            component.addStyleName(WebThemes.HIDE_ELEMENT);
        }
    }

    private Panel buildProjectActionPanel() {
        Panel projectActionPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_ACTIONS));
        MVerticalLayout projectActionLayout = new MVerticalLayout();
        if (project.isProjectArchived()) {
            MButton activeProjectBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ACTIVE_PROJECT), clickEvent -> {
                ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
                project.setStatus(OptionI18nEnum.StatusI18nEnum.Open.name());
                projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());
                PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId()));
                EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain));
            }).withIcon(VaadinIcons.ASTERISK).withStyleName(WebThemes.BUTTON_LINK);
            projectActionLayout.with(activeProjectBtn);
        }
        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS)) {
            MButton inviteMemberBtn = new MButton(UserUIContext.getMessage(ProjectMemberI18nEnum.BUTTON_NEW_INVITEES), clickEvent -> {
                EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoInviteMembers(this, null));
            }).withIcon(VaadinIcons.PAPERPLANE).withStyleName(WebThemes.BUTTON_LINK);
            projectActionLayout.with(inviteMemberBtn);
        }
        MButton settingBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_SETTINGS), clickEvent -> {
            EventBusFactory.getInstance().post(new ProjectNotificationEvent.GotoList(this, null));
        }).withIcon(VaadinIcons.COG).withStyleName(WebThemes.BUTTON_LINK);
        projectActionLayout.with(settingBtn);
        if (UserUIContext.canAccess(RolePermissionCollections.CREATE_NEW_PROJECT)) {
            final MButton markProjectTemplateBtn = new MButton().withIcon(VaadinIcons.ANCHOR).withStyleName(WebThemes.BUTTON_LINK);
            markProjectTemplateBtn.addClickListener(clickEvent -> {
                Boolean isTemplate = !MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
                project.setIstemplate(isTemplate);
                ProjectService prjService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
                prjService.updateWithSession(project, UserUIContext.getUsername());
                if (project.getIstemplate()) {
                    markProjectTemplateBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
                } else {
                    markProjectTemplateBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
                }
            });
            Boolean isTemplate = MoreObjects.firstNonNull(project.getIstemplate(), Boolean.FALSE);
            if (isTemplate) {
                markProjectTemplateBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_UNMARK_TEMPLATE));
            } else {
                markProjectTemplateBtn.setCaption(UserUIContext.getMessage(ProjectI18nEnum.ACTION_MARK_TEMPLATE));
            }
            projectActionLayout.with(markProjectTemplateBtn);
        }
        if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PROJECT)) {
            MButton editProjectBtn = new MButton(UserUIContext.getMessage(ProjectI18nEnum.EDIT), clickEvent -> {
                EventBusFactory.getInstance().post(new ProjectEvent.GotoEdit(ProjectRightBarContainer.this, project));
            }).withIcon(VaadinIcons.EDIT).withStyleName(WebThemes.BUTTON_LINK);
            projectActionLayout.with(editProjectBtn);
        }
        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            MButton archiveProjectBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_ARCHIVE_PROJECT), clickEvent -> {
                ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.WINDOW_WARNING_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_ARCHIVE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
                        project.setStatus(OptionI18nEnum.StatusI18nEnum.Archived.name());
                        projectService.updateSelectiveWithSession(project, UserUIContext.getUsername());
                        PageActionChain chain = new PageActionChain(new ProjectScreenData.Goto(CurrentProjectVariables.getProjectId()));
                        EventBusFactory.getInstance().post(new ProjectEvent.GotoMyProject(this, chain));
                    }
                });
            }).withIcon(VaadinIcons.ARCHIVE).withStyleName(WebThemes.BUTTON_LINK);
            projectActionLayout.with(archiveProjectBtn);
        }
        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PROJECT)) {
            MButton deleteProjectBtn = new MButton(UserUIContext.getMessage(ProjectCommonI18nEnum.BUTTON_DELETE_PROJECT), clickEvent -> {
                ConfirmDialogExt.show(UI.getCurrent(), UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_replacedLE, AppUI.getSiteName()), UserUIContext.getMessage(ProjectCommonI18nEnum.DIALOG_CONFIRM_PROJECT_DELETE_MESSAGE), UserUIContext.getMessage(GenericI18Enum.ACTION_YES), UserUIContext.getMessage(GenericI18Enum.ACTION_NO), confirmDialog -> {
                    if (confirmDialog.isConfirmed()) {
                        ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
                        projectService.removeWithSession(CurrentProjectVariables.getProject(), UserUIContext.getUsername(), AppUI.getAccountId());
                        EventBusFactory.getInstance().post(new ShellEvent.GotoProjectModule(this, null));
                    }
                });
            }).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_LINK, WebThemes.DANGER);
            projectActionLayout.with(deleteProjectBtn);
        }
        projectActionPanel.setContent(projectActionLayout);
        UIUtils.makeStackPanel(projectActionPanel);
        return projectActionPanel;
    }

    public void clearViewComponents() {
        modulePanel.removeAllComponents();
    }

    public void addViewComponent(Component component) {
        modulePanel.removeAllComponents();
        modulePanel.add(component);
    }
}

19 View Complete Implementation : V7VaadinLocaleDemo.java
Copyright Apache License 2.0
Author : viritin
@Override
public Component getTestComponent() {
    dateField.setValue(new Date());
    localeSelect.setId("language-selection");
    localeSelect.addMValueChangeListener(new MValueChangeListener<Locale>() {

        @Override
        public void valueChange(MValueChangeEvent<Locale> event) {
            vaadinLocale.setLocale(event.getValue());
        }
    });
    Button addNewComponent = new Button("Create new component");
    final MVerticalLayout layout = new MVerticalLayout(localeSelect, dateField, new VaadinLocaleDemoComponent(), addNewComponent);
    addNewComponent.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            layout.add(new VaadinLocaleDemoComponent());
        }
    });
    return layout;
}

19 View Complete Implementation : AbstractPreviewItemComp.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.3.3
 */
public abstract clreplaced AbstractPreviewItemComp<B> extends AbstractVerticalPageView {

    private static final long serialVersionUID = 1L;

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

    protected B beanItem;

    protected AdvancedPreviewBeanForm<B> previewForm;

    protected ReadViewLayout previewLayout;

    protected MHorizontalLayout headerLayout;

    private MVerticalLayout bodyContent;

    private MButton favoriteBtn;

    public AbstractPreviewItemComp(String headerText, VaadinIcons iconResource) {
        this(headerText, iconResource, null);
    }

    public AbstractPreviewItemComp(String headerText, VaadinIcons iconResource, ReadViewLayout layout) {
        this.setMargin(true);
        ELabel headerLbl = ELabel.h2("").withUndefinedWidth();
        this.previewLayout = layout;
        headerLayout = new MHorizontalLayout().withFullWidth();
        headerLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        if (iconResource != null) {
            String replacedle = iconResource.getHtml() + " " + headerText;
            headerLbl.setValue(replacedle);
        } else {
            headerLbl.setValue(headerText);
        }
        if (SiteConfiguration.isCommunityEdition()) {
            headerLayout.with(headerLbl);
        } else {
            favoriteBtn = new MButton("", clickEvent -> toggleFavorite()).withIcon(VaadinIcons.HEART);
            headerLayout.with(new MCssLayout(headerLbl, favoriteBtn));
        }
        this.addComponent(headerLayout);
        ComponentContainer extraComp;
        if ((extraComp = createExtraControls()) != null) {
            this.addComponent(extraComp);
        }
        initContent();
    }

    private void initContent() {
        previewForm = initPreviewForm();
        HorizontalLayout actionControls = createButtonControls();
        if (actionControls != null) {
            headerLayout.with(actionControls).expand(actionControls).withAlign(actionControls, Alignment.TOP_RIGHT);
        }
        MCssLayout contentWrapper = new MCssLayout().withFullSize();
        if (previewLayout == null)
            previewLayout = new DefaultReadViewLayout("");
        contentWrapper.addComponent(previewLayout);
        bodyContent = new MVerticalLayout(previewForm).withSpacing(false).withMargin(false).withFullSize();
        previewLayout.addBody(bodyContent);
        this.addComponent(contentWrapper);
    }

    abstract protected void initRelatedComponents();

    abstract protected String getType();

    private void toggleFavorite() {
        try {
            if (isFavorite()) {
                favoriteBtn.removeStyleName("favorite-btn-selected");
                favoriteBtn.addStyleName("favorite-btn");
            } else {
                favoriteBtn.addStyleName("favorite-btn-selected");
                favoriteBtn.removeStyleName("favorite-btn");
            }
            FavoriteItem favoriteItem = new FavoriteItem();
            favoriteItem.setExtratypeid(CurrentProjectVariables.getProjectId());
            favoriteItem.setType(getType());
            favoriteItem.setTypeid(PropertyUtils.getProperty(beanItem, "id").toString());
            favoriteItem.setSaccountid(AppUI.getAccountId());
            favoriteItem.setCreateduser(UserUIContext.getUsername());
            FavoriteItemService favoriteItemService = AppContextUtil.getSpringBean(FavoriteItemService.clreplaced);
            favoriteItemService.saveOrDelete(favoriteItem);
        } catch (Exception e) {
            LOG.error("Error while set favorite flag to bean", e);
        }
    }

    private boolean isFavorite() {
        try {
            FavoriteItemService favoriteItemService = AppContextUtil.getSpringBean(FavoriteItemService.clreplaced);
            return favoriteItemService.isUserFavorite(UserUIContext.getUsername(), getType(), PropertyUtils.getProperty(beanItem, "id").toString());
        } catch (Exception e) {
            return false;
        }
    }

    public void previewItem(final B item) {
        this.beanItem = item;
        initLayout();
        if (previewLayout instanceof DefaultReadViewLayout) {
            ((DefaultReadViewLayout) previewLayout).setreplacedle(initFormreplacedle());
        }
        previewForm.setBean(item);
        if (favoriteBtn != null) {
            String favStyle = isFavorite() ? "favorite-btn-selected" : "favorite-btn";
            favoriteBtn.addStyleName(favStyle);
        }
        onPreviewItem();
    }

    private void initLayout() {
        initRelatedComponents();
        ComponentContainer bottomPanel = createBottomPanel();
        if (bottomPanel != null) {
            if (bodyContent.getComponentCount() >= 2) {
                bodyContent.replaceComponent(bodyContent.getComponent(bodyContent.getComponentCount() - 1), bottomPanel);
            } else {
                bodyContent.addComponent(bottomPanel);
            }
        }
    }

    public B getBeanItem() {
        return beanItem;
    }

    public AdvancedPreviewBeanForm<B> getPreviewForm() {
        return previewForm;
    }

    protected void addLayoutStyleName(String styleName) {
        previewLayout.addreplacedleStyleName(styleName);
    }

    protected void removeLayoutStyleName(String styleName) {
        previewLayout.removereplacedleStyleName(styleName);
    }

    abstract protected void onPreviewItem();

    abstract protected String initFormreplacedle();

    abstract protected AdvancedPreviewBeanForm<B> initPreviewForm();

    protected ComponentContainer createExtraControls() {
        return null;
    }

    abstract protected HorizontalLayout createButtonControls();

    abstract protected ComponentContainer createBottomPanel();
}

19 View Complete Implementation : ComponentReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void initRelatedComponents() {
    activityComponent = new ProjectActivityComponent(ProjectTypeConstants.COMPONENT, CurrentProjectVariables.getProjectId());
    dateInfoComp = new DateInfoComp();
    peopleInfoComp = new PeopleInfoComp();
    ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
    MVerticalLayout detailLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));
    if (SiteConfiguration.isCommunityEdition()) {
        detailLayout.with(dateInfoComp, peopleInfoComp);
    } else {
        componentTimeLogComp = new ComponentTimeLogComp();
        detailLayout.with(dateInfoComp, peopleInfoComp, componentTimeLogComp);
    }
    Panel detailPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_DETAILS), detailLayout);
    UIUtils.makeStackPanel(detailPanel);
    projectView.addComponentToRightBar(detailPanel);
}

19 View Complete Implementation : RolePermissionContainer.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
public clreplaced RolePermissionContainer extends VerticalLayout {

    private MVerticalLayout permissionLayout;

    RolePermissionContainer() {
        this.setMargin(new MarginInfo(true, false, false, false));
        this.addComponent(ELabel.h2(UserUIContext.getMessage(RolePermissionI18nEnum.LIST)));
        permissionLayout = new MVerticalLayout().withMargin(false);
        this.addComponent(permissionLayout);
    }

    public void displayRolePermission(SimpleRole role) {
        permissionLayout.removeAllComponents();
        PermissionMap permissionMap = (role != null) ? role.getPermissionMap() : PermissionMap.ADMIN_ROLE_MAP;
        if (permissionMap != null) {
            permissionLayout.addComponent(constructPermissionSectionView(UserUIContext.getMessage(RoleI18nEnum.SECTION_PROJECT_MANAGEMENT_replacedLE), permissionMap, RolePermissionCollections.PROJECT_PERMISSION_ARR));
            permissionLayout.addComponent(constructPermissionSectionView(UserUIContext.getMessage(RoleI18nEnum.SECTION_ACCOUNT_MANAGEMENT_replacedLE), permissionMap, RolePermissionCollections.ACCOUNT_PERMISSION_ARR));
        }
    }

    private ComponentContainer constructPermissionSectionView(String depotreplacedle, PermissionMap permissionMap, List<PermissionDefItem> defItems) {
        GridFormLayoutHelper formHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.TWO_COLUMN);
        FormContainer permissionsPanel = new FormContainer();
        for (int i = 0; i < defItems.size(); i++) {
            PermissionDefItem permissionDefItem = defItems.get(i);
            Integer flag = permissionMap.getPermissionFlag(permissionDefItem.getKey());
            SecurityI18nEnum permissionVal = PermissionFlag.toVal(flag);
            formHelper.addComponent(new Label(UserUIContext.getMessage(permissionVal)), UserUIContext.getMessage(permissionDefItem.getCaption()), UserUIContext.getMessage(permissionVal.desc()), i % 2, i / 2);
        }
        permissionsPanel.addSection(depotreplacedle, formHelper.getLayout());
        return permissionsPanel;
    }
}

19 View Complete Implementation : MilestoneReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void initRelatedComponents() {
    activityComponent = new ProjectActivityComponent(ProjectTypeConstants.MILESTONE, CurrentProjectVariables.getProjectId());
    dateInfoComp = new DateInfoComp();
    peopleInfoComp = new PeopleInfoComp();
    planningInfoComp = new PlanningInfoComp();
    ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
    MVerticalLayout detailLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));
    if (SiteConfiguration.isCommunityEdition()) {
        detailLayout.with(peopleInfoComp, planningInfoComp, dateInfoComp);
    } else {
        milestoneTimeLogComp = new MilestoneTimeLogComp();
        detailLayout.with(peopleInfoComp, planningInfoComp, milestoneTimeLogComp, dateInfoComp);
    }
    Panel detailPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_DETAILS), detailLayout);
    UIUtils.makeStackPanel(detailPanel);
    projectView.addComponentToRightBar(detailPanel);
}

19 View Complete Implementation : MailFormWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();
    inputLayout = new GridLayout(3, 4);
    inputLayout.setSpacing(true);
    inputLayout.setWidth("100%");
    inputLayout.setColumnExpandRatio(0, 1.0f);
    mainLayout.addComponent(inputLayout);
    tokenFieldMailTo = new EmailTokenField();
    inputLayout.addComponent(createTextFieldMailWithHelp("To:", tokenFieldMailTo), 0, 0);
    if (mails != null) {
        mails.stream().filter(mail -> mail.indexOf("<") > 0).map(mail -> {
            String strMail = mail.substring(mail.indexOf("<") + 1, mail.lastIndexOf(">"));
            if (strMail != null && !strMail.equalsIgnoreCase("null")) {
                return strMail;
            } else {
                return "";
            }
        });
    }
    final MTextField subject = new MTextField().withRequiredIndicatorVisible(true).withFullWidth();
    subjectField = createTextFieldMail("Subject:", subject);
    inputLayout.addComponent(subjectField, 0, 1);
    initButtonLinkCcBcc();
    ccField = createTextFieldMailWithHelp("Cc:", tokenFieldMailCc);
    bccField = createTextFieldMailWithHelp("Bcc:", tokenFieldMailBcc);
    final RichTextArea noteArea = new RichTextArea();
    noteArea.setWidth("100%");
    noteArea.setHeight("200px");
    mainLayout.addComponent(noteArea);
    mainLayout.setComponentAlignment(noteArea, Alignment.MIDDLE_CENTER);
    final AttachmentPanel attachments = new AttachmentPanel();
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MButton sendBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_SEND_EMAIL), clickEvent -> {
        if (tokenFieldMailTo.getListRecipients().size() <= 0 || subject.getValue().equals("")) {
            NotificationUtil.showErrorNotification("To Email field and Subject field must be not empty! Please fulfil them before sending email.");
            return;
        }
        if (UserUIContext.getUser().getEmail() != null && UserUIContext.getUser().getEmail().length() > 0) {
            ExtMailService systemMailService = AppContextUtil.getSpringBean(ExtMailService.clreplaced);
            List<File> files = attachments.files();
            List<AttachmentSource> attachmentSource = new ArrayList<>();
            if (CollectionUtils.isNotEmpty(files)) {
                files.forEach(file -> attachmentSource.add(new FileAttachmentSource(file)));
            }
            if (reportTemplateExecutor != null) {
                attachmentSource.add(new FileAttachmentSource(reportTemplateExecutor.getDefaultExportFileName(), reportTemplateExecutor.exportStream()));
            }
            systemMailService.sendHTMLMail(UserUIContext.getUser().getEmail(), UserUIContext.getUser().getDisplayName(), tokenFieldMailTo.getListRecipients(), tokenFieldMailCc.getListRecipients(), tokenFieldMailBcc.getListRecipients(), subject.getValue(), noteArea.getValue(), attachmentSource, true);
            close();
        } else {
            NotificationUtil.showErrorNotification("Your email is empty value, please fulfil it before sending email!");
        }
    }).withIcon(VaadinIcons.PAPERPLANE).withStyleName(WebThemes.BUTTON_ACTION);
    MHorizontalLayout controlsLayout = new MHorizontalLayout(cancelBtn, sendBtn).withMargin(new MarginInfo(false, true, true, false));
    mainLayout.with(attachments);
    mainLayout.addStyleName(WebThemes.SCROLLABLE_CONTAINER);
    this.setContent(new MVerticalLayout(mainLayout, controlsLayout).withMargin(false).withSpacing(false).withAlign(controlsLayout, Alignment.TOP_RIGHT));
}

19 View Complete Implementation : BugReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void initRelatedComponents() {
    activityComponent = new ProjectActivityComponent(ProjectTypeConstants.BUG, CurrentProjectVariables.getProjectId());
    dateInfoComp = new DateInfoComp();
    peopleInfoComp = new PeopleInfoComp();
    planningInfoComp = new PlanningInfoComp();
    bugFollowersList = new ProjectFollowersComp<>(ProjectTypeConstants.BUG, ProjectRolePermissionCollections.BUGS);
    ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
    MVerticalLayout detailLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));
    if (SiteConfiguration.isCommunityEdition()) {
        detailLayout.with(peopleInfoComp, planningInfoComp, bugFollowersList, dateInfoComp);
    } else {
        bugTimeLogList = ViewManager.getCacheComponent(BugTimeLogSheet.clreplaced);
        detailLayout.with(peopleInfoComp, planningInfoComp, bugTimeLogList, bugFollowersList, dateInfoComp);
    }
    Panel detailPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_DETAILS), detailLayout);
    UIUtils.makeStackPanel(detailPanel);
    projectView.addComponentToRightBar(detailPanel);
}

19 View Complete Implementation : VaadinLocaleDemo.java
Copyright Apache License 2.0
Author : viritin
@Override
public Component getTestComponent() {
    dateField.setValue(LocalDate.now());
    localeSelect.setId("language-selection");
    localeSelect.addValueChangeListener(e -> vaadinLocale.setLocale(e.getValue()));
    Button addNewComponent = new Button("Create new component");
    final MVerticalLayout layout = new MVerticalLayout(localeSelect, dateField, new VaadinLocaleDemoComponent(), addNewComponent);
    addNewComponent.addClickListener(new ClickListener() {

        @Override
        public void buttonClick(ClickEvent event) {
            layout.add(new VaadinLocaleDemoComponent());
        }
    });
    return layout;
}

19 View Complete Implementation : DefaultTicketGroupComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.3.5
 */
clreplaced DefaultTicketGroupComponent extends MVerticalLayout implements IGroupComponent, IBlockContainer {

    private Label headerLbl;

    private MVerticalLayout wrapBody;

    private String replacedleValue;

    DefaultTicketGroupComponent(String replacedleValue) {
        this.replacedleValue = replacedleValue;
        this.withMargin(new MarginInfo(true, false, true, false)).withSpacing(false);
        wrapBody = new MVerticalLayout().withSpacing(false).withFullWidth().withStyleName(WebThemes.BORDER_LIST);
        headerLbl = ELabel.h3("").withFullWidth();
        this.with(headerLbl, wrapBody);
        refresh();
    }

    @Override
    public void refresh() {
        if (wrapBody.getComponentCount() > 0) {
            updatereplacedle();
        } else {
            ComponentContainer parent = (ComponentContainer) getParent();
            if (parent != null) {
                parent.removeComponent(this);
            }
        }
    }

    void insertTicketComp(TicketRowRender ticketRowRender) {
        wrapBody.addComponent(ticketRowRender);
        updatereplacedle();
    }

    private void updatereplacedle() {
        headerLbl.setValue(String.format("%s (%d)", replacedleValue, wrapBody.getComponentCount()));
    }
}

19 View Complete Implementation : ElementCollectionTable.java
Copyright Apache License 2.0
Author : viritin
/**
 * A field suitable for editing collection of referenced objects tied to parent
 * object only. E.g. OneToMany/ElementCollection fields in JPA world.
 * <p>
 * Some features/restrictions:
 * <ul>
 * <li>The field is valid when all elements are valid.
 * <li>The field is always non buffered
 * <li>The element type needs to have an empty paremeter constructor or user
 * must provide an Instantiator.
 * </ul>
 *
 * Elements in the edited collection are modified with BeanFieldGroup. Fields
 * should defined in a clreplaced. A simple usage example for editing
 * List>Address< adresses:
 * <pre><code>
 *  public static clreplaced AddressRow {
 *      EnumSelect type = new EnumSelect();
 *      MTextField street = new MTextField();
 *      MTextField city = new MTextField();
 *      MTextField zipCode = new MTextField();
 *  }
 *
 *  public static clreplaced PersonForm<Person> extends AbstractForm {
 *      private final ElementCollectionTable<Address> addresses
 *              = new ElementCollectionTable<Address>(Address.clreplaced,
 *                      AddressRow.clreplaced).withCaption("Addressess");
 *
 * </code></pre>
 *
 * <p>
 * By default the field contains a button to add new elements. If instances are
 * added with some other method (or UI shouldn't add them at all), you can
 * configure this with setAllowNewItems. Deletions can be configured with
 * setAllowRemovingItems.
 * <p>
 *
 * @param <ET> The type in the enreplacedy collection. The type must have empty
 * parameter constructor or you have to provide Instantiator.
 */
public clreplaced ElementCollectionTable<ET> extends AbstractElementCollection<ET> {

    private static final long serialVersionUID = 8055987316151594559L;

    private MTable<ET> table;

    private MButton addButton = new MButton(VaadinIcons.PLUS, new Button.ClickListener() {

        private static final long serialVersionUID = 6115218255676556647L;

        @Override
        public void buttonClick(Button.ClickEvent event) {
            addElement(createInstance());
        }
    });

    private IdenreplacedyHashMap<ET, MButton> elementToDelButton = new IdenreplacedyHashMap<>();

    boolean inited = false;

    private MVerticalLayout layout = new MVerticalLayout();

    private String[] deleteElementStyles;

    private String disabledDeleteThisElementDescription = "Fill this row to add a new element, currently ignored";

    public ElementCollectionTable(Clreplaced<ET> elementType, Clreplaced<?> formType) {
        super(elementType, formType);
    }

    public ElementCollectionTable(Clreplaced<ET> elementType, Instantiator i, Clreplaced<?> formType) {
        super(elementType, i, formType);
    }

    @Override
    public void attach() {
        super.attach();
        ensureInited();
    }

    @Override
    public void addInternalElement(final ET v) {
        ensureInited();
        table.addBeans(v);
    }

    @Override
    public void removeInternalElement(ET v) {
        table.removeItem(v);
        elementToDelButton.remove(v);
    }

    @Override
    public Layout getLayout() {
        return layout;
    }

    public MButton getAddButton() {
        return addButton;
    }

    /**
     * @return the Table used in the implementation. Configure carefully.
     */
    public MTable<ET> getTable() {
        return table;
    }

    @Override
    public void setPersisted(ET v, boolean persisted) {
    // NOP
    }

    private void ensureInited() {
        if (!inited) {
            layout.setMargin(false);
            setHeight("300px");
            table = new MTable<ET>(getElementType()).withFullWidth();
            for (Object propertyId : getVisibleProperties()) {
                table.addGeneratedColumn(propertyId, new Table.ColumnGenerator() {

                    private static final long serialVersionUID = 3637140096807147630L;

                    @Override
                    public Object generateCell(Table source, Object itemId, Object columnId) {
                        MBeanFieldGroup<ET> fg = getFieldGroupFor((ET) itemId);
                        if (!isAllowEdireplacedems()) {
                            fg.setReadOnly(true);
                        }
                        Component component = fg.getField(columnId);
                        if (component == null) {
                            getComponentFor((ET) itemId, columnId.toString());
                        }
                        return component;
                    }
                });
            }
            ArrayList<Object> cols = new ArrayList<Object>(getVisibleProperties());
            if (isAllowRemovingItems()) {
                table.addGeneratedColumn("__ACTIONS", new Table.ColumnGenerator() {

                    private static final long serialVersionUID = 492486828008202547L;

                    @Override
                    public Object generateCell(Table source, final Object itemId, Object columnId) {
                        MButton b = new MButton(VaadinIcons.TRASH).withListener(new Button.ClickListener() {

                            private static final long serialVersionUID = -1257102620834362724L;

                            @Override
                            public void buttonClick(Button.ClickEvent event) {
                                removeElement((ET) itemId);
                            }
                        }).withStyleName(ValoTheme.BUTTON_ICON_ONLY);
                        b.setDescription(getDeleteElementDescription());
                        if (getDeleteElementStyles() != null) {
                            for (String style : getDeleteElementStyles()) {
                                b.addStyleName(style);
                            }
                        }
                        elementToDelButton.put((ET) itemId, b);
                        return b;
                    }
                });
                table.setColumnHeader("__ACTIONS", "");
                cols.add("__ACTIONS");
            }
            table.setVisibleColumns(cols.toArray());
            for (Object property : getVisibleProperties()) {
                table.setColumnHeader(property, getPropertyHeader(property.toString()));
            }
            layout.expand(table);
            if (isAllowNewItems()) {
                layout.addComponent(addButton);
            }
            inited = true;
        }
    }

    @Override
    public void clear() {
        if (inited) {
            table.removeAllItems();
            elementToDelButton.clear();
        }
    }

    public String getDisabledDeleteElementDescription() {
        return disabledDeleteThisElementDescription;
    }

    public void setDisabledDeleteThisElementDescription(String disabledDeleteThisElementDescription) {
        this.disabledDeleteThisElementDescription = disabledDeleteThisElementDescription;
    }

    public String getDeleteElementDescription() {
        return deleteThisElementDescription;
    }

    private String deleteThisElementDescription = "Delete this element";

    public void setDeleteThisElementDescription(String deleteThisElementDescription) {
        this.deleteThisElementDescription = deleteThisElementDescription;
    }

    public String[] getDeleteElementStyles() {
        return deleteElementStyles;
    }

    public void addDeleteElementStyles(String... deleteElementStyles) {
        this.deleteElementStyles = deleteElementStyles;
    }

    @Override
    public void onElementAdded() {
    // NOP
    }

    @Override
    public ElementCollectionTable<ET> setPropertyHeader(String propertyName, String propertyHeader) {
        super.setPropertyHeader(propertyName, propertyHeader);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> setVisibleProperties(List<String> properties, List<String> propertyHeaders) {
        super.setVisibleProperties(properties, propertyHeaders);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> setVisibleProperties(List<String> properties) {
        super.setVisibleProperties(properties);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> setAllowNewElements(boolean allowNewItems) {
        super.setAllowNewElements(allowNewItems);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> setAllowRemovingItems(boolean allowRemovingItems) {
        super.setAllowRemovingItems(allowRemovingItems);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> withCaption(String caption) {
        super.withCaption(caption);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> removeElementRemovedListener(ElementRemovedListener listener) {
        super.removeElementRemovedListener(listener);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> addElementRemovedListener(ElementRemovedListener<ET> listener) {
        super.addElementRemovedListener(listener);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> removeElementAddedListener(ElementAddedListener listener) {
        super.removeElementAddedListener(listener);
        return this;
    }

    @Override
    public ElementCollectionTable<ET> addElementAddedListener(ElementAddedListener<ET> listener) {
        super.addElementAddedListener(listener);
        return this;
    }

    public ElementCollectionTable<ET> withEditorInstantiator(Instantiator instantiator) {
        setEditorInstantiator(instantiator);
        return this;
    }
}

19 View Complete Implementation : StandupListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void showReports() {
    removeAllComponents();
    if (CollectionUtils.isNotEmpty(projectIds)) {
        MHorizontalLayout headerLayout = constructHeader();
        ELabel listLnl = ELabel.h3("Projects (" + projectIds.size() + ")");
        MHorizontalLayout favoriteListHeaderPanel = new MHorizontalLayout(listLnl).expand(listLnl).withMargin(new MarginInfo(false, false, false, true)).withStyleName(WebThemes.PANEL_HEADER).withFullWidth().alignAll(Alignment.MIDDLE_LEFT);
        projectListComp = new ProjectListComp();
        MVerticalLayout projectListPanel = new MVerticalLayout(favoriteListHeaderPanel, projectListComp).withMargin(false).withSpacing(false).withWidth("300px");
        standupPerProjectView = new StandupPerProjectView();
        standupPerProjectView.setMargin(new MarginInfo(false, false, false, true));
        MHorizontalLayout bodyLayout = new MHorizontalLayout(projectListPanel, standupPerProjectView).expand(standupPerProjectView);
        with(headerLayout, bodyLayout).expand(bodyLayout);
        int totalCount = projectListComp.display(projectIds, onDate);
        if (totalCount > 0) {
            StandupReportStatistic firstProject = projectListComp.gereplacedemAt(0);
            if (firstProject != null) {
                viewStandupReportsForProject(firstProject);
            }
            Component firstRow = projectListComp.getRowAt(0);
            if (firstRow != null) {
                projectListComp.setSelectedRow(firstRow);
            }
        }
    }
}

19 View Complete Implementation : ElementPropertySetterTest.java
Copyright Apache License 2.0
Author : viritin
@Override
public Component getTestComponent() {
    final MVerticalLayout mVerticalLayout = new MVerticalLayout();
    TextField rawTextField = new TextField();
    rawTextField.addValueChangeListener(vcl);
    HtmlElementPropertySetter s1 = new HtmlElementPropertySetter(rawTextField);
    s1.setProperty("type", "number");
    s1.setProperty("min", "10");
    s1.setProperty("max", "100");
    // prevent all but numbers with a simple js
    s1.setJavaScriptEventHandler("keypress", "function(e) {var c = viritin.getChar(e); return c==null || /^[\\d\\n\\t\\r]+$/.test(c);}");
    mVerticalLayout.add(rawTextField);
    HtmlElementPropertySetter s2 = new HtmlElementPropertySetter(mVerticalLayout);
    // sets with xpath, same could be also done via s1 as
    // using doreplacedent global selector (// vs .//)
    s2.setProperty("//input", "step", "10");
    s2.setProperty("//input", "required", "true");
    TextField rawTextField2 = new TextField();
    TextField rawTextField3 = new TextField();
    rawTextField2.addValueChangeListener(vcl);
    rawTextField3.addValueChangeListener(vcl);
    final MVerticalLayout dates = new MVerticalLayout(rawTextField2, rawTextField3).withCaption("dates");
    HtmlElementPropertySetter s3 = new HtmlElementPropertySetter(dates);
    // set all inputs inside dates layout to be of type date
    s3.setProperty(".//input", "type", "date");
    mVerticalLayout.add(dates);
    return mVerticalLayout;
}

19 View Complete Implementation : LogoEditWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 4.1
 */
clreplaced LogoEditWindow extends MWindow {

    private static final long serialVersionUID = -5294741083557671011L;

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

    private MVerticalLayout content;

    private BufferedImage originalImage;

    private Embedded previewImage;

    private byte[] scaleImageData;

    LogoEditWindow(byte[] imageData) {
        super(UserUIContext.getMessage(FileI18nEnum.ACTION_CHANGE_LOGO));
        this.withModal(true).withResizable(false).withWidth("800px").withHeight("800px");
        content = new MVerticalLayout();
        this.setContent(content);
        editPhoto(imageData);
    }

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

    private void displayPreviewImage() {
        if (scaleImageData != null && scaleImageData.length > 0) {
            ByteArrayImageResource previewResource = new ByteArrayImageResource(scaleImageData, "image/png");
            previewImage.setSource(previewResource);
        }
    }
}

19 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();
    }
}

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

19 View Complete Implementation : MessageListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void createAddMessageLayout() {
    isAddingMessage = true;
    MVerticalLayout newMessageLayout = new MVerticalLayout().withWidth("800px");
    GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    TextField replacedleField = new MTextField().withFullWidth().withRequiredIndicatorVisible(true);
    gridFormLayoutHelper.addComponent(replacedleField, UserUIContext.getMessage(MessageI18nEnum.FORM_replacedLE), 0, 0);
    RichTextArea descField = new RichTextArea();
    descField.setWidth("100%");
    descField.setHeight("200px");
    gridFormLayoutHelper.addComponent(descField, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 1);
    newMessageLayout.with(gridFormLayoutHelper.getLayout());
    AttachmentPanel attachmentPanel = new AttachmentPanel();
    CheckBox chkIsStick = new CheckBox(UserUIContext.getMessage(MessageI18nEnum.FORM_IS_STICK));
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> {
        bodyLayout.removeComponent(newMessageLayout);
        isAddingMessage = false;
    }).withStyleName(WebThemes.BUTTON_OPTION);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_POST), clickEvent -> {
        Message message = new Message();
        message.setProjectid(CurrentProjectVariables.getProjectId());
        if (!replacedleField.getValue().trim().equals("")) {
            message.setreplacedle(replacedleField.getValue());
            message.setMessage(descField.getValue());
            message.setCreateduser(UserUIContext.getUsername());
            message.setSaccountid(AppUI.getAccountId());
            message.setIsstick(chkIsStick.getValue());
            MessageService messageService = AppContextUtil.getSpringBean(MessageService.clreplaced);
            messageService.saveWithSession(message, UserUIContext.getUsername());
            bodyLayout.removeComponent(newMessageLayout);
            isAddingMessage = false;
            searchPanel.notifySearchHandler(searchCriteria);
            String attachmentPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), message.getProjectid(), ProjectTypeConstants.MESSAGE, "" + message.getId());
            attachmentPanel.saveContentsToRepo(attachmentPath);
        } else {
            replacedleField.addStyleName("errorField");
            NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(MessageI18nEnum.FORM_replacedLE)));
        }
    }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);
    MHorizontalLayout controlLayout = new MHorizontalLayout(chkIsStick, cancelBtn, saveBtn).alignAll(Alignment.MIDDLE_CENTER);
    newMessageLayout.with(attachmentPanel, controlLayout).withAlign(controlLayout, Alignment.MIDDLE_RIGHT);
    bodyLayout.addComponent(newMessageLayout, 0);
}

19 View Complete Implementation : BeanList.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void loadItems(List<T> items) {
    contentLayout.removeAllComponents();
    try {
        if (CollectionUtils.isEmpty(items) && isDisplayEmptyListText) {
            Label noItemLbl = new Label(UserUIContext.getMessage(GenericI18Enum.EXT_NO_ITEM));
            MVerticalLayout widgetFooter = new MVerticalLayout().withFullWidth();
            widgetFooter.addStyleName("widget-footer");
            widgetFooter.with(noItemLbl).withAlign(noItemLbl, Alignment.MIDDLE_CENTER);
            contentLayout.addComponent(widgetFooter);
        } else {
            int i = 0;
            for (T item : items) {
                Component row = rowDisplayHandler.generateRow(this, item, i);
                if (row != null) {
                    row.setWidth("100%");
                    contentLayout.addComponent(row);
                }
                i++;
            }
        }
    } catch (Exception e) {
        LOG.error("Error while generate column display", e);
    }
}

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

    private static final long serialVersionUID = 1L;

    private final VersionSearchPanel versionSearchPanel;

    private SelectionOptionButton selectOptionButton;

    private DefaultPagedBeanTable<VersionService, VersionSearchCriteria, SimpleVersion> tableItem;

    private MVerticalLayout versionListLayout;

    private DefaultMreplacedItemActionHandlerContainer tableActionControls;

    private Label selectedItemsNumberLabel = new Label();

    public VersionListViewImpl() {
        this.setMargin(new MarginInfo(false, true, false, true));
        this.versionSearchPanel = new VersionSearchPanel();
        this.versionListLayout = new MVerticalLayout().withSpacing(false).withMargin(false);
        this.with(versionSearchPanel, versionListLayout);
        this.generateDisplayTable();
    }

    private void generateDisplayTable() {
        tableItem = new DefaultPagedBeanTable<>(AppContextUtil.getSpringBean(VersionService.clreplaced), SimpleVersion.clreplaced, new TableViewField(null, "selected", WebUIConstants.TABLE_CONTROL_WIDTH), Arrays.asList(new TableViewField(GenericI18Enum.FORM_NAME, "name", WebUIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_STATUS, "status", WebUIConstants.TABLE_M_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_DESCRIPTION, "description", WebUIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_DUE_DATE, "duedate", WebUIConstants.TABLE_DATE_TIME_WIDTH), new TableViewField(GenericI18Enum.FORM_PROGRESS, "id", WebUIConstants.TABLE_M_LABEL_WIDTH)));
        tableItem.addGeneratedColumn("selected", (source, itemId, columnId) -> {
            SimpleVersion version = tableItem.getBeanByIndex(itemId);
            CheckBoxDecor cb = new CheckBoxDecor("", version.isSelected());
            cb.addValueChangeListener(valueChangeEvent -> tableItem.fireSelecreplacedemEvent(version));
            version.setExtraData(cb);
            return cb;
        });
        tableItem.addGeneratedColumn("name", (source, itemId, columnId) -> {
            final Version version = tableItem.getBeanByIndex(itemId);
            final LabelLink b = new LabelLink(version.getName(), ProjectLinkGenerator.generateVersionPreviewLink(version.getProjectid(), version.getId()));
            if (version.getStatus() != null && version.getStatus().equals(StatusI18nEnum.Closed.name())) {
                b.addStyleName(WebThemes.LINK_COMPLETED);
            } else if (version.getDuedate() != null && (version.getDuedate().isBefore(LocalDate.now()))) {
                b.addStyleName(WebThemes.LINK_OVERDUE);
            }
            b.setDescription(ProjectTooltipGenerator.generateToolTipVersion(UserUIContext.getUserLocale(), AppUI.getDateFormat(), version, AppUI.getSiteUrl(), UserUIContext.getUserTimeZone()), ContentMode.HTML);
            return b;
        });
        tableItem.addGeneratedColumn("duedate", (source, itemId, columnId) -> {
            final Version bugVersion = tableItem.getBeanByIndex(itemId);
            return new ELabel().prettyDate(bugVersion.getDuedate());
        });
        tableItem.addGeneratedColumn("id", (source, itemId, columnId) -> {
            SimpleVersion version = tableItem.getBeanByIndex(itemId);
            return new ProgressBarIndicator(version.getNumBugs() + version.getNumTasks(), version.getNumBugs() + version.getNumTasks() - (version.getNumOpenBugs() + version.getNumOpenTasks()), false);
        });
        tableItem.addGeneratedColumn("status", (source, itemId, columnId) -> {
            SimpleVersion version = tableItem.getBeanByIndex(itemId);
            return ELabel.i18n(version.getStatus(), StatusI18nEnum.clreplaced);
        });
        tableItem.addGeneratedColumn("description", (source, itemId, columnId) -> {
            SimpleVersion version = tableItem.getBeanByIndex(itemId);
            return ELabel.richText(version.getDescription());
        });
        tableItem.setWidth("100%");
        versionListLayout.addComponent(constructTableActionControls());
        versionListLayout.addComponent(tableItem);
    }

    @Override
    public HreplacedearchHandlers<VersionSearchCriteria> getSearchHandlers() {
        return versionSearchPanel;
    }

    private ComponentContainer constructTableActionControls() {
        final MCssLayout layoutWrapper = new MCssLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);
        selectOptionButton = new SelectionOptionButton(tableItem);
        tableActionControls = new DefaultMreplacedItemActionHandlerContainer();
        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.VERSIONS)) {
            tableActionControls.addDeleteActionItem();
        }
        tableActionControls.addMailActionItem();
        tableActionControls.addDownloadPdfActionItem();
        tableActionControls.addDownloadExcelActionItem();
        tableActionControls.addDownloadCsvActionItem();
        layoutWrapper.add(selectOptionButton, tableActionControls, selectedItemsNumberLabel);
        return layoutWrapper;
    }

    @Override
    public void enableActionControls(final int numOfSelectedItems) {
        this.tableActionControls.setVisible(true);
        this.selectedItemsNumberLabel.setValue(UserUIContext.getMessage(GenericI18Enum.TABLE_SELECTED_ITEM_replacedLE, numOfSelectedItems));
    }

    @Override
    public void disableActionControls() {
        this.tableActionControls.setVisible(false);
        this.selectOptionButton.setSelectedCheckbox(false);
        this.selectedItemsNumberLabel.setValue("");
    }

    @Override
    public void showNoItemView() {
        removeAllComponents();
        this.addComponent(new VersionListNoItemView());
    }

    @Override
    public HreplacedelectionOptionHandlers getOptionSelectionHandlers() {
        return this.selectOptionButton;
    }

    @Override
    public HasMreplacedItemActionHandler getPopupActionHandlers() {
        return this.tableActionControls;
    }

    @Override
    public HreplacedelectableItemHandlers<SimpleVersion> getSelectableItemHandlers() {
        return this.tableItem;
    }

    @Override
    public AbstractPagedBeanTable<VersionSearchCriteria, SimpleVersion> getPagedBeanGrid() {
        return this.tableItem;
    }
}

18 View Complete Implementation : MilestoneTicketGroupComponent.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.4.5
 */
clreplaced MilestoneTicketGroupComponent extends MVerticalLayout implements IGroupComponent, IBlockContainer {

    private Label headerLbl;

    private MVerticalLayout wrapBody;

    private SimpleMilestone milestone;

    MilestoneTicketGroupComponent(Integer milestoneId) {
        this.withMargin(new MarginInfo(true, false, true, false)).withSpacing(false);
        wrapBody = new MVerticalLayout().withFullWidth().withSpacing(false).withMargin(false).withStyleName(WebThemes.BORDER_LIST);
        headerLbl = ELabel.h3("").withFullWidth();
        MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.clreplaced);
        MVerticalLayout headerGroup;
        if (milestoneId == null) {
            headerGroup = new MVerticalLayout(headerLbl).withMargin(false).withSpacing(false);
        } else {
            milestone = milestoneService.findById(milestoneId, AppUI.getAccountId());
            if (milestone != null) {
                ELabel milestoneDateLbl = new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_FROM_TO, UserUIContext.formatDate(milestone.getStartdate()), UserUIContext.formatDate(milestone.getEnddate()))).withStyleName(WebThemes.META_INFO);
                headerGroup = new MVerticalLayout(headerLbl, milestoneDateLbl).withMargin(false).withSpacing(false);
            } else {
                headerGroup = new MVerticalLayout(headerLbl).withMargin(false).withSpacing(false);
            }
        }
        with(headerGroup, wrapBody);
        // make the layout accept drops
        DropTargetExtension<MVerticalLayout> dropTarget = new DropTargetExtension<>(wrapBody);
        // catch the drops
        dropTarget.addDropListener(event -> {
            Optional<AbstractComponent> dragSource = event.getDragSourceComponent();
            if (dragSource.isPresent() && dragSource.get() instanceof EditableTicketRowRenderer) {
                TicketRowRender ticketRowRenderer = (TicketRowRender) dragSource.get();
                MilestoneTicketGroupComponent originalMilestoneContainer = UIUtils.getRoot(ticketRowRenderer, MilestoneTicketGroupComponent.clreplaced);
                ProjectTicket ticket = ticketRowRenderer.getTicket();
                ticket.setMilestoneId(milestoneId);
                AppContextUtil.getSpringBean(ProjectTicketService.clreplaced).updateTicket(ticket, UserUIContext.getUsername());
                wrapBody.addComponent(ticketRowRenderer);
                updatereplacedle();
                if (originalMilestoneContainer != null) {
                    originalMilestoneContainer.updatereplacedle();
                }
            }
        });
    }

    @Override
    public void refresh() {
        if (wrapBody.getComponentCount() > 0) {
            updatereplacedle();
        } else {
            ComponentContainer parent = (ComponentContainer) getParent();
            if (parent != null) {
                parent.removeComponent(this);
            }
        }
    }

    void insertTicketComp(TicketRowRender ticketRowRenderer) {
        ticketRowRenderer.addStyleName("cursor-move");
        wrapBody.addComponent(ticketRowRenderer);
        updatereplacedle();
    }

    private void updatereplacedle() {
        String replacedleValue;
        if (milestone == null) {
            replacedleValue = String.format("%s (%d)", UserUIContext.getMessage(GenericI18Enum.OPT_UNDEFINED), wrapBody.getComponentCount());
        } else {
            replacedleValue = new DivLessFormatter().appendChild(new A(ProjectLinkGenerator.generateMilestonePreviewLink(milestone.getProjectid(), milestone.getId())).appendText(String.format("%s (%d)", milestone.getName(), wrapBody.getComponentCount()))).write();
        }
        headerLbl.setValue(ProjectreplacedetsManager.getreplacedet(ProjectTypeConstants.MILESTONE).getHtml() + " " + replacedleValue);
    }
}

18 View Complete Implementation : ReportContainerImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
public void showDashboard() {
    body.removeAllComponents();
    body.with(ELabel.h2(VaadinIcons.PIE_CHART.getHtml() + " " + UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS)));
    MCssLayout contentLayout = new MCssLayout().withStyleName(WebThemes.FLEX_DISPLAY);
    MVerticalLayout standupConsole = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
    standupConsole.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    standupConsole.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
    A standupReportLink = new A(ProjectLinkGenerator.generateStandupDashboardLink()).appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP));
    standupConsole.addComponent(ELabel.h3(standupReportLink.write()).withUndefinedWidth());
    standupConsole.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP_HELP)).withFullWidth());
    contentLayout.addComponent(standupConsole);
    MVerticalLayout userWorkloadReport = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
    userWorkloadReport.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    userWorkloadReport.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
    A userWorkloadReportLink = new A(ProjectLinkGenerator.generateUsersWorkloadReportLink()).appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_replacedIGNMENT));
    userWorkloadReport.addComponent(ELabel.h3(userWorkloadReportLink.write()).withUndefinedWidth());
    userWorkloadReport.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_replacedIGNMENT_HELP)).withFullWidth());
    contentLayout.addComponent(userWorkloadReport);
    body.with(contentLayout).expand(contentLayout).withAlign(contentLayout, Alignment.TOP_LEFT);
}

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

    private MVerticalLayout body;

    public ReportContainerImpl() {
        withMargin(true);
        ReportBreadcrumb breadcrumb = ViewManager.getCacheComponent(ReportBreadcrumb.clreplaced);
        body = new MVerticalLayout().withMargin(new MarginInfo(true, false, true, false));
        with(breadcrumb, ELabel.hr(), body).expand(body);
    }

    @Override
    public void showDashboard() {
        body.removeAllComponents();
        body.with(ELabel.h2(VaadinIcons.PIE_CHART.getHtml() + " " + UserUIContext.getMessage(ProjectCommonI18nEnum.VIEW_REPORTS)));
        MCssLayout contentLayout = new MCssLayout().withStyleName(WebThemes.FLEX_DISPLAY);
        MVerticalLayout standupConsole = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
        standupConsole.setDefaultComponentAlignment(Alignment.TOP_CENTER);
        standupConsole.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
        A standupReportLink = new A(ProjectLinkGenerator.generateStandupDashboardLink()).appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP));
        standupConsole.addComponent(ELabel.h3(standupReportLink.write()).withUndefinedWidth());
        standupConsole.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_STANDUP_HELP)).withFullWidth());
        contentLayout.addComponent(standupConsole);
        MVerticalLayout userWorkloadReport = new MVerticalLayout().withWidth("300px").withStyleName("member-block");
        userWorkloadReport.setDefaultComponentAlignment(Alignment.TOP_CENTER);
        userWorkloadReport.addComponent(ELabel.fontIcon(VaadinIcons.CALENDAR_CLOCK).withStyleName("icon-38px"));
        A userWorkloadReportLink = new A(ProjectLinkGenerator.generateUsersWorkloadReportLink()).appendText(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_replacedIGNMENT));
        userWorkloadReport.addComponent(ELabel.h3(userWorkloadReportLink.write()).withUndefinedWidth());
        userWorkloadReport.addComponent(new ELabel(UserUIContext.getMessage(ProjectReportI18nEnum.REPORT_TICKET_replacedIGNMENT_HELP)).withFullWidth());
        contentLayout.addComponent(userWorkloadReport);
        body.with(contentLayout).expand(contentLayout).withAlign(contentLayout, Alignment.TOP_LEFT);
    }

    @Override
    public void addView(PageView view) {
        body.removeAllComponents();
        body.with(view).expand(view);
    }
}

18 View Complete Implementation : AbstractResourceMovingWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void constructBody() {
    MVerticalLayout contentLayout = new MVerticalLayout();
    this.setContent(contentLayout);
    Tree<Resource> folderTree = new Tree<>();
    folderTree.setSizeFull();
    AbstractBackEndHierarchicalDataProvider<Resource, SerializablePredicate<Resource>> dataProvider = new AbstractBackEndHierarchicalDataProvider<Resource, SerializablePredicate<Resource>>() {

        @Override
        protected Stream<Resource> fetchChildrenFromBackEnd(HierarchicalQuery<Resource, SerializablePredicate<Resource>> query) {
            Optional<Resource> parentRes = query.getParentOptional();
            if (parentRes.isPresent()) {
                List<Resource> resources = resourceService.getResources(parentRes.get().getPath());
                return (resources != null) ? resources.stream().filter(resource -> !resource.getName().startsWith(".") && !(resource instanceof Content)) : Stream.empty();
            } else {
                return Stream.of(baseFolder);
            }
        }

        @Override
        public int getChildCount(HierarchicalQuery<Resource, SerializablePredicate<Resource>> query) {
            Stream<Resource> stream = fetchChildrenFromBackEnd(query);
            return (int) stream.count();
        }

        @Override
        public boolean hasChildren(Resource item) {
            if (item instanceof Folder) {
                List<Resource> resources = resourceService.getResources(item.getPath());
                return (resources != null) && !resources.isEmpty();
            }
            return false;
        }
    };
    folderTree.setDataProvider(dataProvider);
    folderTree.sereplacedemCaptionGenerator((ItemCaptionGenerator<Resource>) item -> {
        if (item == baseFolder) {
            return UserUIContext.getMessage(FileI18nEnum.OPT_MY_DOreplacedENTS);
        } else {
            return item.getName();
        }
    });
    folderTree.addItemClickListener(itemClickEvent -> selectedFolder = (Folder) itemClickEvent.gereplacedem());
    contentLayout.addComponent(folderTree);
    MButton moveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MOVE), clickEvent -> {
        if (!CollectionUtils.isEmpty(movedResources)) {
            boolean checkingFail = false;
            for (Resource res : movedResources) {
                try {
                    resourceService.moveResource(res, selectedFolder, UserUIContext.getUsername(), AppUI.getAccountId());
                } catch (Exception e) {
                    checkingFail = true;
                    LOG.error("Error", e);
                }
            }
            close();
            displayAfterMoveSuccess(selectedFolder, checkingFail);
        }
    }).withIcon(VaadinIcons.ARROWS).withStyleName(WebThemes.BUTTON_ACTION);
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MHorizontalLayout controlGroupBtnLayout = new MHorizontalLayout(cancelBtn, moveBtn);
    contentLayout.with(controlGroupBtnLayout).withAlign(controlGroupBtnLayout, Alignment.MIDDLE_RIGHT);
}

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

    private static final long serialVersionUID = 8433776359091397422L;

    private MVerticalLayout bodyLayout;

    private DefaultBeanPagedList<MessageService, MessageSearchCriteria, SimpleMessage> messageList;

    private MessageSearchPanel searchPanel;

    private MessageSearchCriteria searchCriteria;

    private boolean isAddingMessage = false;

    public MessageListViewImpl() {
        this.withSpacing(true).withMargin(true).withFullWidth();
        searchPanel = new MessageSearchPanel();
        messageList = new DefaultBeanPagedList<>(AppContextUtil.getSpringBean(MessageService.clreplaced), new MessageRowDisplayHandler());
        bodyLayout = new MVerticalLayout(messageList).withSpacing(false).withMargin(false);
    }

    @Override
    public void setCriteria(final MessageSearchCriteria criteria) {
        this.removeAllComponents();
        this.searchCriteria = criteria;
        messageList.setSearchCriteria(searchCriteria);
        with(searchPanel, bodyLayout).expand(bodyLayout);
    }

    private clreplaced MessageRowDisplayHandler implements IBeanList.RowDisplayHandler<SimpleMessage> {

        @Override
        public Component generateRow(IBeanList<SimpleMessage> host, final SimpleMessage message, int rowIndex) {
            final MHorizontalLayout messageLayout = new MHorizontalLayout().withMargin(new MarginInfo(true, false, true, false)).withFullWidth();
            if (Boolean.TRUE.equals(message.getIsstick())) {
                messageLayout.addStyleName("important-message");
            }
            ProjectMemberBlock userBlock = new ProjectMemberBlock(message.getCreateduser(), message.getPostedUserAvatarId(), message.getFullPostedUserName());
            messageLayout.addComponent(userBlock);
            MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName(WebThemes.MESSAGE_CONTAINER);
            A messageLink = new A(ProjectLinkGenerator.generateMessagePreviewLink(message.getProjectid(), message.getId()), new Text(message.getreplacedle()));
            MHorizontalLayout messageHeader = new MHorizontalLayout().withMargin(false);
            messageHeader.setDefaultComponentAlignment(Alignment.TOP_LEFT);
            CssLayout leftHeader = new CssLayout();
            leftHeader.addComponent(ELabel.h3(messageLink.write()));
            ELabel timePostLbl = new ELabel().prettyDateTime(message.getCreatedtime()).withStyleName(WebThemes.META_INFO);
            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()) {
                    MessageService messageService = AppContextUtil.getSpringBean(MessageService.clreplaced);
                    messageService.removeWithSession(message, UserUIContext.getUsername(), AppUI.getAccountId());
                    messageList.setSearchCriteria(searchCriteria);
                }
            })).withIcon(VaadinIcons.TRASH).withStyleName(WebThemes.BUTTON_ICON_ONLY).withVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MESSAGES));
            MHorizontalLayout rightHeader = new MHorizontalLayout(timePostLbl, deleteBtn).alignAll(Alignment.MIDDLE_RIGHT);
            messageHeader.with(leftHeader, rightHeader).expand(leftHeader);
            rowLayout.addComponent(messageHeader);
            SafeHtmlLabel messageContent = new SafeHtmlLabel(message.getMessage());
            rowLayout.addComponent(messageContent);
            MHorizontalLayout notification = new MHorizontalLayout().withStyleName("notification").withUndefinedSize();
            if (message.getCommentsCount() > 0) {
                MHorizontalLayout commentNotification = new MHorizontalLayout();
                Label commentCountLbl = ELabel.html(String.format("%s %s", Integer.toString(message.getCommentsCount()), VaadinIcons.COMMENTS.getHtml()));
                commentCountLbl.setSizeUndefined();
                commentNotification.addComponent(commentCountLbl);
                notification.addComponent(commentNotification);
            }
            ResourceService attachmentService = AppContextUtil.getSpringBean(ResourceService.clreplaced);
            List<Content> attachments = attachmentService.getContents(AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), message.getProjectid(), ProjectTypeConstants.MESSAGE, "" + message.getId()));
            if (CollectionUtils.isNotEmpty(attachments)) {
                HorizontalLayout attachmentNotification = new HorizontalLayout();
                Label attachmentCountLbl = new Label(Integer.toString(attachments.size()));
                attachmentCountLbl.setSizeUndefined();
                attachmentNotification.addComponent(attachmentCountLbl);
                Button attachmentIcon = new Button(VaadinIcons.PAPERCLIP);
                attachmentIcon.addStyleName(WebThemes.BUTTON_ICON_ONLY);
                attachmentNotification.addComponent(attachmentIcon);
                notification.addComponent(attachmentNotification);
            }
            if (notification.getComponentCount() > 0) {
                MVerticalLayout messageFooter = new MVerticalLayout(notification).withMargin(false).withSpacing(false).withFullWidth().withAlign(notification, Alignment.MIDDLE_RIGHT);
                rowLayout.addComponent(messageFooter);
            }
            messageLayout.with(rowLayout).expand(rowLayout);
            return messageLayout;
        }
    }

    private clreplaced MessageSearchPanel extends DefaultGenericSearchPanel<MessageSearchCriteria> {

        private TextField nameField;

        @Override
        protected HeaderWithIcon buildSearchreplacedle() {
            return ComponentUtils.headerH2(ProjectTypeConstants.MESSAGE, UserUIContext.getMessage(MessageI18nEnum.LIST));
        }

        @Override
        protected Component buildExtraControls() {
            return new MButton(UserUIContext.getMessage(MessageI18nEnum.NEW), clickEvent -> {
                if (!isAddingMessage)
                    createAddMessageLayout();
            }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MESSAGES));
        }

        @Override
        protected SearchLayout<MessageSearchCriteria> createBasicSearchLayout() {
            return new BasicSearchLayout<MessageSearchCriteria>(MessageSearchPanel.this) {

                @Override
                public ComponentContainer constructBody() {
                    nameField = new MTextField().withPlaceholder(UserUIContext.getMessage(GenericI18Enum.ACTION_QUERY_BY_TEXT)).withWidth(WebUIConstants.DEFAULT_CONTROL_WIDTH);
                    MButton searchBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SEARCH), clickEvent -> callSearchAction()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.SEARCH).withClickShortcut(KeyCode.ENTER);
                    return new MHorizontalLayout(nameField, searchBtn).withMargin(true).withAlign(nameField, Alignment.MIDDLE_LEFT);
                }

                @Override
                protected MessageSearchCriteria fillUpSearchCriteria() {
                    MessageSearchCriteria criteria = new MessageSearchCriteria();
                    criteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
                    criteria.setMessage(StringSearchField.and(nameField.getValue()));
                    return criteria;
                }
            };
        }
    }

    private void createAddMessageLayout() {
        isAddingMessage = true;
        MVerticalLayout newMessageLayout = new MVerticalLayout().withWidth("800px");
        GridFormLayoutHelper gridFormLayoutHelper = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
        TextField replacedleField = new MTextField().withFullWidth().withRequiredIndicatorVisible(true);
        gridFormLayoutHelper.addComponent(replacedleField, UserUIContext.getMessage(MessageI18nEnum.FORM_replacedLE), 0, 0);
        RichTextArea descField = new RichTextArea();
        descField.setWidth("100%");
        descField.setHeight("200px");
        gridFormLayoutHelper.addComponent(descField, UserUIContext.getMessage(GenericI18Enum.FORM_DESCRIPTION), 0, 1);
        newMessageLayout.with(gridFormLayoutHelper.getLayout());
        AttachmentPanel attachmentPanel = new AttachmentPanel();
        CheckBox chkIsStick = new CheckBox(UserUIContext.getMessage(MessageI18nEnum.FORM_IS_STICK));
        MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> {
            bodyLayout.removeComponent(newMessageLayout);
            isAddingMessage = false;
        }).withStyleName(WebThemes.BUTTON_OPTION);
        MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_POST), clickEvent -> {
            Message message = new Message();
            message.setProjectid(CurrentProjectVariables.getProjectId());
            if (!replacedleField.getValue().trim().equals("")) {
                message.setreplacedle(replacedleField.getValue());
                message.setMessage(descField.getValue());
                message.setCreateduser(UserUIContext.getUsername());
                message.setSaccountid(AppUI.getAccountId());
                message.setIsstick(chkIsStick.getValue());
                MessageService messageService = AppContextUtil.getSpringBean(MessageService.clreplaced);
                messageService.saveWithSession(message, UserUIContext.getUsername());
                bodyLayout.removeComponent(newMessageLayout);
                isAddingMessage = false;
                searchPanel.notifySearchHandler(searchCriteria);
                String attachmentPath = AttachmentUtils.getProjectEnreplacedyAttachmentPath(AppUI.getAccountId(), message.getProjectid(), ProjectTypeConstants.MESSAGE, "" + message.getId());
                attachmentPanel.saveContentsToRepo(attachmentPath);
            } else {
                replacedleField.addStyleName("errorField");
                NotificationUtil.showErrorNotification(UserUIContext.getMessage(ErrorI18nEnum.FIELD_MUST_NOT_NULL, UserUIContext.getMessage(MessageI18nEnum.FORM_replacedLE)));
            }
        }).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);
        MHorizontalLayout controlLayout = new MHorizontalLayout(chkIsStick, cancelBtn, saveBtn).alignAll(Alignment.MIDDLE_CENTER);
        newMessageLayout.with(attachmentPanel, controlLayout).withAlign(controlLayout, Alignment.MIDDLE_RIGHT);
        bodyLayout.addComponent(newMessageLayout, 0);
    }

    @Override
    public HreplacedearchHandlers<MessageSearchCriteria> getSearchHandlers() {
        return this.searchPanel;
    }
}

18 View Complete Implementation : MilestoneListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 1.0
 */
@ViewComponent
public clreplaced MilestoneListViewImpl extends AbstractLazyPageView implements MilestoneListView {

    private static final long serialVersionUID = 1L;

    private MVerticalLayout inProgressContainer;

    private Label inProgressHeader;

    private MVerticalLayout futureContainer;

    private Label futureHeader;

    private MVerticalLayout closeContainer;

    private Label closedHeader;

    private MilestoneSearchCriteria baseCriteria;

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

        @Override
        @Subscribe
        public void handle(MilestoneEvent.NewMilestoneAdded event) {
            displayMilestones();
        }
    };

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

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

    @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() {
        Component headerComp = buildHeader();
        Component bodyComp = buildBody();
        this.with(headerComp, bodyComp).expand(bodyComp);
        displayMilestones();
    }

    private Component buildHeader() {
        HeaderWithIcon headerText = ComponentUtils.headerH2(ProjectTypeConstants.MILESTONE, UserUIContext.getMessage(MilestoneI18nEnum.LIST));
        return new MHorizontalLayout(headerText, createHeaderRight()).withMargin(true).withAlign(headerText, Alignment.MIDDLE_LEFT).expand(headerText);
    }

    private HorizontalLayout createHeaderRight() {
        MHorizontalLayout layout = new MHorizontalLayout();
        MButton createBtn = new MButton(UserUIContext.getMessage(MilestoneI18nEnum.NEW), clickEvent -> {
            SimpleMilestone milestone = new SimpleMilestone();
            milestone.setSaccountid(AppUI.getAccountId());
            milestone.setProjectid(CurrentProjectVariables.getProjectId());
            UI.getCurrent().addWindow(new MilestoneAddWindow(milestone));
        }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
        layout.with(createBtn);
        MButton printBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new MilestoneCustomizeReportOutputWindow(new LazyValueInjector() {

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

    private Component buildBody() {
        CustomLayout bodyContent = CustomLayoutExt.createLayout("milestoneView");
        MHorizontalLayout closedHeaderLayout = new MHorizontalLayout();
        closedHeader = ELabel.html("").withUndefinedWidth();
        closedHeaderLayout.with(closedHeader).withAlign(closedHeader, Alignment.MIDDLE_CENTER);
        bodyContent.addComponent(closedHeaderLayout, "closed-header");
        closeContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
        bodyContent.addComponent(closeContainer, "closed-milestones");
        MHorizontalLayout inProgressHeaderLayout = new MHorizontalLayout();
        inProgressHeader = ELabel.html("").withUndefinedWidth();
        inProgressHeaderLayout.addComponent(inProgressHeader);
        inProgressHeaderLayout.setComponentAlignment(inProgressHeader, Alignment.MIDDLE_CENTER);
        bodyContent.addComponent(inProgressHeaderLayout, "in-progress-header");
        inProgressContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
        bodyContent.addComponent(this.inProgressContainer, "in-progress-milestones");
        MHorizontalLayout futureHeaderLayout = new MHorizontalLayout();
        futureHeader = ELabel.html("").withUndefinedWidth();
        futureHeaderLayout.addComponent(futureHeader);
        futureHeaderLayout.setComponentAlignment(futureHeader, Alignment.MIDDLE_CENTER);
        bodyContent.addComponent(futureHeaderLayout, "future-header");
        futureContainer = new MVerticalLayout().withStyleName("milestone-col").withFullWidth();
        bodyContent.addComponent(this.futureContainer, "future-milestones");
        return bodyContent;
    }

    private void displayMilestones() {
        closeContainer.removeAllComponents();
        inProgressContainer.removeAllComponents();
        futureContainer.removeAllComponents();
        baseCriteria = new MilestoneSearchCriteria();
        baseCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
        MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.clreplaced);
        List<SimpleMilestone> milestones = (List<SimpleMilestone>) milestoneService.findAbsoluteListByCriteria(baseCriteria, 0, Integer.MAX_VALUE);
        int totalClosedMilestones = 0, totalInProgressMilestones = 0, totalFutureMilestones = 0;
        for (SimpleMilestone milestone : milestones) {
            ComponentContainer componentContainer = new MilestoneBox(milestone);
            if (MilestoneStatus.InProgress.name().equals(milestone.getStatus())) {
                inProgressContainer.addComponent(componentContainer);
                totalInProgressMilestones++;
            } else if (MilestoneStatus.Future.name().equals(milestone.getStatus())) {
                futureContainer.addComponent(componentContainer);
                totalFutureMilestones++;
            } else if (MilestoneStatus.Closed.name().equals(milestone.getStatus())) {
                closeContainer.addComponent(componentContainer);
                totalClosedMilestones++;
            }
        }
        updateClosedMilestoneNumber(totalClosedMilestones);
        updateFutureMilestoneNumber(totalFutureMilestones);
        updateInProgressMilestoneNumber(totalInProgressMilestones);
    }

    private void updateClosedMilestoneNumber(int closeMilestones) {
        closedHeader.setValue(String.format("%s %s (%d)", ProjectreplacedetsManager.getMilestoneStatus(MilestoneStatus.Closed.name()).getHtml(), UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_CLOSED_PHASE_replacedLE), closeMilestones));
    }

    private void updateFutureMilestoneNumber(int futureMilestones) {
        futureHeader.setValue(String.format("%s %s (%d)", ProjectreplacedetsManager.getMilestoneStatus(MilestoneStatus.Future.name()).getHtml(), UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_FUTURE_PHASE_replacedLE), futureMilestones));
    }

    private void updateInProgressMilestoneNumber(int inProgressMilestones) {
        inProgressHeader.setValue(String.format("%s %s (%d)", ProjectreplacedetsManager.getMilestoneStatus(MilestoneStatus.InProgress.name()).getHtml(), UserUIContext.getMessage(MilestoneI18nEnum.WIDGET_INPROGRESS_PHASE_replacedLE), inProgressMilestones));
    }

    private clreplaced MilestoneBox extends CssLayout {

        MilestoneBox(final SimpleMilestone milestone) {
            this.addStyleName(WebThemes.MILESTONE_BOX);
            this.setWidth("100%");
            String valId = String.format("%s-%d", UUID.randomUUID().toString(), milestone.hashCode());
            this.setId(valId);
            JavaScript.getCurrent().execute("$('#" + valId + "').css({'background-color':'#" + milestone.getColor() + "'});");
            ToggleMilestoneSummaryField toggleMilestoneSummaryField = new ToggleMilestoneSummaryField(milestone, 50, false, true);
            MHorizontalLayout milestoneHeader = new MHorizontalLayout().withFullWidth().with(toggleMilestoneSummaryField).expand(toggleMilestoneSummaryField);
            this.addComponent(milestoneHeader);
            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);
            }
            this.addComponent(progressInfoLbl);
            CssLayout metaBlock = new CssLayout();
            MilestoneComponentFactory popupFieldFactory = AppContextUtil.getSpringBean(MilestoneComponentFactory.clreplaced);
            metaBlock.addComponent(popupFieldFactory.createMilestonereplacedigneePopupField(milestone, false));
            metaBlock.addComponent(popupFieldFactory.createStartDatePopupField(milestone));
            metaBlock.addComponent(popupFieldFactory.createEndDatePopupField(milestone));
            if (!SiteConfiguration.isCommunityEdition()) {
                metaBlock.addComponent(popupFieldFactory.createBillableHoursPopupField(milestone));
                metaBlock.addComponent(popupFieldFactory.createNonBillableHoursPopupField(milestone));
            }
            this.addComponent(metaBlock);
        }
    }
}

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

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

    private static final long serialVersionUID = 1L;

    private MHorizontalLayout headerLayout;

    private MVerticalLayout pagesLayout;

    private List<? extends PageResource> resources;

    private static Comparator<PageResource> dateSort = Comparator.comparing(PageResource::getCreatedTime);

    private static Comparator<PageResource> kindSort = (o1, o2) -> {
        if (o1.getClreplaced() == o2.getClreplaced()) {
            return 0;
        } else {
            if ((o1 instanceof Folder) && (o2 instanceof Page)) {
                return 1;
            } else {
                return -1;
            }
        }
    };

    private static Comparator<PageResource> nameSort = (o1, o2) -> {
        String name1 = (o1 instanceof Folder) ? ((Folder) o1).getName() : ((Page) o1).getSubject();
        String name2 = (o2 instanceof Folder) ? ((Folder) o2).getName() : ((Page) o2).getSubject();
        return name1.compareTo(name2);
    };

    private boolean dateSourceAscend = true;

    private boolean nameSortAscend = true;

    private boolean kindSortAscend = true;

    public PageListViewImpl() {
        withMargin(new MarginInfo(true));
        headerLayout = new MHorizontalLayout().withFullWidth().withMargin(false);
        this.addComponent(headerLayout);
        initHeader();
        pagesLayout = new MVerticalLayout().withMargin(false).withSpacing(false).withStyleName("pages-list-layout");
        this.addComponent(pagesLayout);
    }

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

    private void displayPages(List<? extends PageResource> resources) {
        this.resources = resources;
        pagesLayout.removeAllComponents();
        if (resources != null) {
            resources.stream().map(resource -> resource instanceof Page ? displayPageBlock((Page) resource) : displayFolderBlock((Folder) resource)).forEach(resourceBlock -> pagesLayout.addComponent(resourceBlock));
        }
    }

    @Override
    public void showNoItemView() {
        removeAllComponents();
        this.addComponent(new PageListNoItemView());
    }

    @Override
    public void displayDefaultPages(List<? extends PageResource> resources) {
        resources.sort(Ordering.from(dateSort));
        displayPages(resources);
    }

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

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

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

    private static final long serialVersionUID = 1L;

    private ProjectRoleSearchPanel searchPanel;

    private SelectionOptionButton selectOptionButton;

    private DefaultPagedBeanTable<ProjectRoleService, ProjectRoleSearchCriteria, SimpleProjectRole> tableItem;

    private MVerticalLayout listLayout;

    private DefaultMreplacedItemActionHandlerContainer tableActionControls;

    private Label selectedItemsNumberLabel = new Label();

    public ProjectRoleListViewImpl() {
        this.setMargin(new MarginInfo(false, true, true, true));
        searchPanel = new ProjectRoleSearchPanel();
        listLayout = new MVerticalLayout().withMargin(false).withSpacing(false);
        with(searchPanel, listLayout).expand(listLayout);
        this.generateDisplayTable();
    }

    private void generateDisplayTable() {
        tableItem = new DefaultPagedBeanTable<>(AppContextUtil.getSpringBean(ProjectRoleService.clreplaced), SimpleProjectRole.clreplaced, new TableViewField(null, "selected", WebUIConstants.TABLE_CONTROL_WIDTH), Arrays.asList(new TableViewField(GenericI18Enum.FORM_NAME, "rolename", WebUIConstants.TABLE_EX_LABEL_WIDTH), new TableViewField(GenericI18Enum.FORM_DESCRIPTION, "description", WebUIConstants.TABLE_EX_LABEL_WIDTH)));
        tableItem.addGeneratedColumn("selected", (source, itemId, columnId) -> {
            final SimpleProjectRole role = tableItem.getBeanByIndex(itemId);
            CheckBoxDecor cb = new CheckBoxDecor("", role.isSelected());
            cb.addValueChangeListener(valueChangeEvent -> tableItem.fireSelecreplacedemEvent(role));
            role.setExtraData(cb);
            return cb;
        });
        tableItem.addGeneratedColumn("rolename", (source, itemId, columnId) -> {
            ProjectRole role = tableItem.getBeanByIndex(itemId);
            return new LabelLink(role.getRolename(), ProjectLinkGenerator.generateRolePreviewLink(role.getProjectid(), role.getId()));
        });
        tableItem.setWidth("100%");
        listLayout.with(constructTableActionControls(), tableItem).expand(tableItem);
    }

    @Override
    public void showNoItemView() {
    }

    @Override
    public HreplacedearchHandlers<ProjectRoleSearchCriteria> getSearchHandlers() {
        return this.searchPanel;
    }

    private ComponentContainer constructTableActionControls() {
        MCssLayout layout = new MCssLayout().withStyleName(WebThemes.TABLE_ACTION_CONTROLS).withFullWidth();
        selectOptionButton = new SelectionOptionButton(tableItem);
        tableActionControls = new DefaultMreplacedItemActionHandlerContainer();
        if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.ROLES)) {
            tableActionControls.addDeleteActionItem();
        }
        tableActionControls.addDownloadPdfActionItem();
        tableActionControls.addDownloadExcelActionItem();
        tableActionControls.addDownloadCsvActionItem();
        layout.add(selectOptionButton, tableActionControls, this.selectedItemsNumberLabel);
        return layout;
    }

    @Override
    public void enableActionControls(int numOfSelectedItems) {
        tableActionControls.setVisible(true);
        selectedItemsNumberLabel.setValue(UserUIContext.getMessage(GenericI18Enum.TABLE_SELECTED_ITEM_replacedLE, numOfSelectedItems));
    }

    @Override
    public void disableActionControls() {
        tableActionControls.setVisible(false);
        selectOptionButton.setSelectedCheckbox(false);
        selectedItemsNumberLabel.setValue("");
    }

    @Override
    public HreplacedelectionOptionHandlers getOptionSelectionHandlers() {
        return this.selectOptionButton;
    }

    @Override
    public HasMreplacedItemActionHandler getPopupActionHandlers() {
        return this.tableActionControls;
    }

    @Override
    public HreplacedelectableItemHandlers<SimpleProjectRole> getSelectableItemHandlers() {
        return this.tableItem;
    }

    @Override
    public AbstractPagedBeanTable<ProjectRoleSearchCriteria, SimpleProjectRole> getPagedBeanGrid() {
        return this.tableItem;
    }
}

17 View Complete Implementation : ProjectListViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.2.12
 */
@ViewComponent
public clreplaced ProjectListViewImpl extends AbstractVerticalPageView implements ProjectListView {

    private ProjectSearchPanel projectSearchPanel;

    private SelectionOptionButton selectOptionButton;

    private DefaultPagedBeanTable<ProjectService, ProjectSearchCriteria, SimpleProject> tableItem;

    private MVerticalLayout bodyLayout;

    private DefaultMreplacedItemActionHandlerContainer tableActionControls;

    private Label selectedItemsNumberLabel = new Label();

    public ProjectListViewImpl() {
        withMargin(true);
    }

    @Override
    public void initContent() {
        removeAllComponents();
        projectSearchPanel = new ProjectSearchPanel();
        bodyLayout = new MVerticalLayout().withSpacing(false).withMargin(false);
        this.with(projectSearchPanel, bodyLayout).expand(bodyLayout);
        generateDisplayTable();
    }

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

    private ComponentContainer constructTableActionControls() {
        MHorizontalLayout layout = new MHorizontalLayout().withFullWidth().withStyleName(WebThemes.TABLE_ACTION_CONTROLS);
        selectOptionButton = new SelectionOptionButton(tableItem);
        selectOptionButton.setWidthUndefined();
        layout.addComponent(selectOptionButton);
        tableActionControls = new DefaultMreplacedItemActionHandlerContainer();
        tableActionControls.addDownloadPdfActionItem();
        tableActionControls.addDownloadExcelActionItem();
        tableActionControls.addDownloadCsvActionItem();
        tableActionControls.setVisible(false);
        tableActionControls.setWidthUndefined();
        layout.addComponent(tableActionControls);
        selectedItemsNumberLabel.setWidth("100%");
        layout.with(selectedItemsNumberLabel).withAlign(selectedItemsNumberLabel, Alignment.MIDDLE_CENTER).expand(selectedItemsNumberLabel);
        MButton customizeViewBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new ProjectListCustomizeWindow(tableItem))).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ADJUST);
        customizeViewBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.OPT_LAYOUT_OPTIONS));
        layout.with(customizeViewBtn).withAlign(customizeViewBtn, Alignment.MIDDLE_RIGHT);
        return layout;
    }

    @Override
    public void showNoItemView() {
    }

    @Override
    public void enableActionControls(int numOfSelectedItems) {
        tableActionControls.setVisible(true);
        selectedItemsNumberLabel.setValue(UserUIContext.getMessage(GenericI18Enum.TABLE_SELECTED_ITEM_replacedLE, numOfSelectedItems));
    }

    @Override
    public void disableActionControls() {
        tableActionControls.setVisible(false);
        selectOptionButton.setSelectedCheckbox(false);
        selectedItemsNumberLabel.setValue("");
    }

    @Override
    public HreplacedearchHandlers<ProjectSearchCriteria> getSearchHandlers() {
        return projectSearchPanel;
    }

    @Override
    public HreplacedelectionOptionHandlers getOptionSelectionHandlers() {
        return selectOptionButton;
    }

    @Override
    public HasMreplacedItemActionHandler getPopupActionHandlers() {
        return tableActionControls;
    }

    @Override
    public HreplacedelectableItemHandlers<SimpleProject> getSelectableItemHandlers() {
        return tableItem;
    }

    @Override
    public IPagedTable<ProjectSearchCriteria, SimpleProject> getPagedBeanGrid() {
        return tableItem;
    }
}

17 View Complete Implementation : UserWorkloadReportViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd
 * @since 5.3.0
 */
@ViewComponent
public clreplaced UserWorkloadReportViewImpl extends AbstractVerticalPageView implements UserWorkloadReportView {

    private ProjectTicketSearchCriteria baseCriteria;

    private TicketCrossProjectsSearchPanel searchPanel;

    private ResponsiveLayout wrapBody;

    private MVerticalLayout projectTicketsContentLayout;

    private TicketGroupOrderComponent ticketGroupOrderComponent;

    private TicketSavedFilterComboBox savedFilterComboBox;

    private ProjectRoleService projectRoleService;

    private ProjectTicketService projectTicketService;

    private SimpleProject selectedProject = null;

    private int currentPage = 0;

    private String groupByState;

    private String sortDirection;

    public UserWorkloadReportViewImpl() {
        projectRoleService = AppContextUtil.getSpringBean(ProjectRoleService.clreplaced);
        projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
        searchPanel = new TicketCrossProjectsSearchPanel();
        wrapBody = new ResponsiveLayout();
        withSpacing(true).with(searchPanel, wrapBody).expand(wrapBody);
        MHorizontalLayout extraCompsHeaderLayout = new MHorizontalLayout();
        extraCompsHeaderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        savedFilterComboBox = new TicketSavedFilterComboBox();
        savedFilterComboBox.addQuerySelectListener((SavedFilterComboBox.QuerySelectListener) querySelectEvent -> {
            List<SearchFieldInfo<ProjectTicketSearchCriteria>> fieldInfos = querySelectEvent.getSearchFieldInfos();
            ProjectTicketSearchCriteria criteria = SearchFieldInfo.buildSearchCriteria(ProjectTicketSearchCriteria.clreplaced, fieldInfos);
            EventBusFactory.getInstance().post(new TicketEvent.SearchRequest(UserWorkloadReportViewImpl.this, criteria));
            queryTickets(criteria);
        });
        extraCompsHeaderLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.SAVE_FILTER_VALUE)));
        extraCompsHeaderLayout.addComponent(savedFilterComboBox);
        extraCompsHeaderLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.ACTION_SORT)));
        StringValueComboBox sortCombo = new StringValueComboBox(false, UserUIContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING), UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING));
        sortCombo.setWidth("130px");
        sortCombo.addValueChangeListener(valueChangeEvent -> {
            String sortValue = sortCombo.getValue();
            if (UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
                sortDirection = SearchCriteria.ASC;
            } else {
                sortDirection = SearchCriteria.DESC;
            }
            displayProjectTickets(selectedProject);
        });
        sortDirection = SearchCriteria.DESC;
        extraCompsHeaderLayout.addComponent(sortCombo);
        extraCompsHeaderLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_GROUP)));
        StringValueComboBox groupCombo = new StringValueComboBox(false, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE), UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE), UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME), UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN), UserUIContext.getMessage(GenericI18Enum.OPT_USER), UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
        groupByState = UserUIContext.getMessage(MilestoneI18nEnum.SINGLE);
        groupCombo.setValue(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
        groupCombo.addValueChangeListener(valueChangeEvent -> {
            groupByState = groupCombo.getValue();
            displayProjectTickets(selectedProject);
        });
        groupCombo.setWidth("130px");
        extraCompsHeaderLayout.addComponent(groupCombo);
        MButton printBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new TicketCustomizeReportOutputWindow(new LazyValueInjector() {

            @Override
            protected Object doEval() {
                return baseCriteria;
            }
        }))).withIcon(VaadinIcons.PRINT).withStyleName(WebThemes.BUTTON_OPTION).withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
        extraCompsHeaderLayout.addComponent(printBtn);
        searchPanel.addHeaderRight(extraCompsHeaderLayout);
    }

    @Override
    public HreplacedearchHandlers<ProjectTicketSearchCriteria> getSearchHandlers() {
        return this.searchPanel;
    }

    @Override
    public void display() {
        wrapBody.removeAllComponents();
        ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria();
        ProjectService projectService = AppContextUtil.getSpringBean(ProjectService.clreplaced);
        List<SimpleProject> projects;
        if (UserUIContext.isAdmin()) {
            projects = projectService.getProjectsUserInvolved(null, AppUI.getAccountId());
        } else {
            projects = projectService.getProjectsUserInvolved(UserUIContext.getUsername(), AppUI.getAccountId());
        }
        ResponsiveRow row = wrapBody.addRow();
        ProjectListComp projectListComp = new ProjectListComp(projects);
        ResponsiveColumn leftCol = new ResponsiveColumn(12, 12, 3, 3);
        leftCol.setContent(projectListComp);
        row.addColumn(leftCol);
        ResponsiveColumn rightCol = new ResponsiveColumn(12, 12, 9, 9);
        projectTicketsContentLayout = new MVerticalLayout();
        rightCol.setContent(projectTicketsContentLayout);
        row.addColumn(rightCol);
        savedFilterComboBox.selectQueryInfo(TicketQueryInfo.OPEN_TICKETS);
    }

    @Override
    public void queryTickets(ProjectTicketSearchCriteria searchCriteria) {
        this.baseCriteria = searchCriteria;
        if (selectedProject != null) {
            displayProjectTickets(selectedProject);
        }
    }

    private clreplaced ProjectListComp extends MVerticalLayout {

        ProjectListComp(List<SimpleProject> projects) {
            withSpacing(false).withMargin(false).withStyleName(WebThemes.BORDER_TOP);
            projects.forEach(project -> addComponent(buildProjectComp(project)));
        }

        MHorizontalLayout buildProjectComp(SimpleProject project) {
            MButton projectLink = new MButton(project.getName()).withListener((Button.ClickListener) event -> displayProjectTickets(project)).withStyleName(WebThemes.BUTTON_LINK);
            return new MHorizontalLayout(projectLink).withMargin(new MarginInfo(false, true, false, true)).withFullWidth().withStyleName("list-row");
        }
    }

    private void displayProjectTickets(SimpleProject project) {
        selectedProject = project;
        if (selectedProject != null) {
            projectTicketsContentLayout.removeAllComponents();
            projectTicketsContentLayout.addComponent(buildProjectLink(project));
            if (UserUIContext.isAdmin()) {
                baseCriteria.setProjectIds(new SetSearchField<>(project.getId()));
                baseCriteria.setOrderFields(Arrays.asList(new OrderField("replacedignUser", SearchCriteria.ASC)));
            } else {
                PermissionMap permissionMap = projectRoleService.findProjectsPermission(UserUIContext.getUsername(), project.getId(), AppUI.getAccountId());
                List<String> ticketTypes = new ArrayList<>();
                if (permissionMap.canWrite(ProjectRolePermissionCollections.TASKS)) {
                    ticketTypes.add(ProjectTypeConstants.TASK);
                }
                if (permissionMap.canWrite(ProjectRolePermissionCollections.BUGS)) {
                    ticketTypes.add(ProjectTypeConstants.BUG);
                }
                if (permissionMap.canWrite(ProjectRolePermissionCollections.RISKS)) {
                    ticketTypes.add(ProjectTypeConstants.RISK);
                }
                baseCriteria.setProjectIds(new SetSearchField<>(project.getId()));
                if (!ticketTypes.isEmpty()) {
                    baseCriteria.setTypes(new SetSearchField<>(ticketTypes));
                }
            }
            if (UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("dueDate", sortDirection)));
                ticketGroupOrderComponent = new DueDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
            } else if (UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("startdate", sortDirection)));
                ticketGroupOrderComponent = new StartDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
            } else if (UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("lastupdatedtime", sortDirection)));
                ticketGroupOrderComponent = new SimpleListOrderComponent(ReadableTicketRowRenderer.clreplaced);
            } else if (UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("createdtime", sortDirection)));
                ticketGroupOrderComponent = new CreatedDateOrderComponent(ReadableTicketRowRenderer.clreplaced);
            } else if (UserUIContext.getMessage(GenericI18Enum.OPT_USER).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("replacedignUser", sortDirection)));
                ticketGroupOrderComponent = new UserOrderComponent(ReadableTicketRowRenderer.clreplaced);
            } else if (UserUIContext.getMessage(MilestoneI18nEnum.SINGLE).equals(groupByState)) {
                baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("milestoneId", sortDirection)));
                ticketGroupOrderComponent = new MilestoneOrderGroup(ReadableTicketRowRenderer.clreplaced);
            } else {
                throw new MyCollabException("Do not support group view by " + groupByState);
            }
            projectTicketsContentLayout.addComponent(ticketGroupOrderComponent);
            ProjectTicketService projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
            int totalTasks = projectTicketService.getTotalTicketsCount(baseCriteria);
            currentPage = 0;
            int pages = totalTasks / 100;
            if (currentPage < pages) {
                MButton moreBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MORE), clickEvent -> {
                    int newTotalTickets = projectTicketService.getTotalTicketsCount(baseCriteria);
                    int newNumPages = newTotalTickets / 100;
                    currentPage++;
                    List<ProjectTicket> otherTickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
                    ticketGroupOrderComponent.insertTickets(otherTickets);
                    if (currentPage >= newNumPages) {
                        wrapBody.removeComponent(wrapBody.getComponent(1));
                    }
                }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ANGLE_DOUBLE_DOWN);
                wrapBody.addComponent(moreBtn);
            }
            List<ProjectTicket> tickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
            ticketGroupOrderComponent.insertTickets(tickets);
        }
    }

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

    @Override
    public ProjectTicketSearchCriteria getCriteria() {
        return baseCriteria;
    }
}

17 View Complete Implementation : TicketDashboardViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
/**
 * @author MyCollab Ltd.
 * @since 1.0
 */
@ViewComponent
public clreplaced TicketDashboardViewImpl extends AbstractVerticalPageView implements TicketDashboardView {

    private static final long serialVersionUID = 1L;

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

    private int currentPage = 0;

    private String groupByState;

    private String sortDirection;

    private ProjectTicketSearchCriteria baseCriteria;

    private ProjectTicketSearchCriteria statisticSearchCriteria;

    private TicketSearchPanel ticketSearchPanel;

    private MVerticalLayout wrapBody;

    private TicketGroupOrderComponent ticketGroupOrderComponent;

    private ApplicationEventListener<TicketEvent.SearchRequest> searchHandler = new ApplicationEventListener<TicketEvent.SearchRequest>() {

        @Override
        @Subscribe
        public void handle(TicketEvent.SearchRequest event) {
            ProjectTicketSearchCriteria criteria = event.getSearchCriteria();
            queryTickets(criteria);
        }
    };

    private ApplicationEventListener<TicketEvent.NewTicketAdded> newTicketAddedHandler = new ApplicationEventListener<TicketEvent.NewTicketAdded>() {

        @Override
        @Subscribe
        public void handle(TicketEvent.NewTicketAdded event) {
            final ProjectTicketService projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
            ProjectTicket ticket = projectTicketService.findTicket(event.getTypeVal(), event.getTypeIdVal());
            if (ticket != null && ticketGroupOrderComponent != null) {
                ticketGroupOrderComponent.insertTickets(Collections.singletonList(ticket));
            }
            displayTicketsStatistic();
            int totalTickets = projectTicketService.getTotalTicketsCount(baseCriteria);
            ticketSearchPanel.setTotalCountNumber(totalTickets);
        }
    };

    private ApplicationEventListener<ShellEvent.AddQueryParam> addQueryHandler = QueryParamHandler.queryParamHandler();

    public TicketDashboardViewImpl() {
        this.withMargin(new MarginInfo(false, true, true, true));
        ticketSearchPanel = new TicketSearchPanel();
        MHorizontalLayout extraCompsHeaderLayout = new MHorizontalLayout();
        extraCompsHeaderLayout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);
        extraCompsHeaderLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.ACTION_SORT)));
        StringValueComboBox sortCombo = new StringValueComboBox(false, UserUIContext.getMessage(GenericI18Enum.OPT_SORT_DESCENDING), UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING));
        sortCombo.setWidth("130px");
        sortCombo.addValueChangeListener(valueChangeEvent -> {
            String sortValue = sortCombo.getValue();
            if (UserUIContext.getMessage(GenericI18Enum.OPT_SORT_ASCENDING).equals(sortValue)) {
                sortDirection = SearchCriteria.ASC;
            } else {
                sortDirection = SearchCriteria.DESC;
            }
            queryAndDisplayTickets();
        });
        sortDirection = SearchCriteria.DESC;
        extraCompsHeaderLayout.addComponent(sortCombo);
        extraCompsHeaderLayout.addComponent(new ELabel(UserUIContext.getMessage(GenericI18Enum.OPT_GROUP)));
        StringValueComboBox groupCombo = new StringValueComboBox(false, UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE), UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE), UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME), UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN), UserUIContext.getMessage(GenericI18Enum.OPT_USER), UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
        groupByState = UserUIContext.getMessage(MilestoneI18nEnum.SINGLE);
        groupCombo.setValue(UserUIContext.getMessage(MilestoneI18nEnum.SINGLE));
        groupCombo.addValueChangeListener(valueChangeEvent -> {
            groupByState = groupCombo.getValue();
            queryAndDisplayTickets();
        });
        groupCombo.setWidth("130px");
        extraCompsHeaderLayout.addComponent(groupCombo);
        MButton printBtn = new MButton("", clickEvent -> UI.getCurrent().addWindow(new TicketCustomizeReportOutputWindow(new LazyValueInjector() {

            @Override
            protected Object doEval() {
                return baseCriteria;
            }
        }))).withIcon(VaadinIcons.PRINT).withStyleName(WebThemes.BUTTON_OPTION).withDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_EXPORT));
        extraCompsHeaderLayout.addComponent(printBtn);
        MButton newTicketBtn = new MButton(UserUIContext.getMessage(TicketI18nEnum.NEW), clickEvent -> {
            UI.getCurrent().addWindow(AppContextUtil.getSpringBean(TicketComponentFactory.clreplaced).createNewTicketWindow(null, CurrentProjectVariables.getProjectId(), null, false, null));
        }).withIcon(VaadinIcons.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(CurrentProjectVariables.canWriteTicket());
        extraCompsHeaderLayout.addComponent(newTicketBtn);
        ticketSearchPanel.addHeaderRight(extraCompsHeaderLayout);
        wrapBody = new MVerticalLayout().withMargin(new MarginInfo(false, false, true, false));
        this.with(ticketSearchPanel, wrapBody).expand(wrapBody);
    }

    @Override
    public void attach() {
        EventBusFactory.getInstance().register(searchHandler);
        EventBusFactory.getInstance().register(newTicketAddedHandler);
        EventBusFactory.getInstance().register(addQueryHandler);
        super.attach();
    }

    @Override
    public void detach() {
        EventBusFactory.getInstance().unregister(searchHandler);
        EventBusFactory.getInstance().unregister(newTicketAddedHandler);
        EventBusFactory.getInstance().unregister(addQueryHandler);
        super.detach();
    }

    public void displayView(String query) {
        baseCriteria = new ProjectTicketSearchCriteria();
        baseCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
        baseCriteria.setTypes(CurrentProjectVariables.getRestrictedTicketTypes());
        statisticSearchCriteria = BeanUtility.deepClone(baseCriteria);
        statisticSearchCriteria.setOpen(new SearchField());
        statisticSearchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.TASK, ProjectTypeConstants.RISK));
        if (StringUtils.isNotBlank(query)) {
            try {
                String jsonQuery = UrlEncodeDecoder.decode(query);
                List<SearchFieldInfo<ProjectTicketSearchCriteria>> searchFieldInfos = Queryreplacedyzer.toSearchFieldInfos(jsonQuery, ProjectTypeConstants.TICKET);
                ticketSearchPanel.displaySearchFieldInfos(searchFieldInfos);
                ProjectTicketSearchCriteria searchCriteria = SearchFieldInfo.buildSearchCriteria(baseCriteria, searchFieldInfos);
                searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
                queryTickets(searchCriteria);
            } catch (Exception e) {
                LOG.error("Error", e);
                ticketSearchPanel.selectQueryInfo(TicketQueryInfo.OPEN_TICKETS);
            }
        } else {
            ticketSearchPanel.selectQueryInfo(TicketQueryInfo.OPEN_TICKETS);
        }
    }

    @Override
    public void showNoItemView() {
    }

    @Override
    public ProjectTicketSearchCriteria getCriteria() {
        return baseCriteria;
    }

    private void displayTicketsStatistic() {
        ProjectView rightBar = UIUtils.getRoot(this, ProjectView.clreplaced);
        UnresolvedTicketsByreplacedigneeWidget unresolvedTicketsByreplacedigneeWidget = new UnresolvedTicketsByreplacedigneeWidget();
        unresolvedTicketsByreplacedigneeWidget.setSearchCriteria(statisticSearchCriteria);
        UIUtils.makeStackPanel(unresolvedTicketsByreplacedigneeWidget);
        UnresolvedTicketByPriorityWidget unresolvedTicketByPriorityWidget = new UnresolvedTicketByPriorityWidget();
        unresolvedTicketByPriorityWidget.setSearchCriteria(statisticSearchCriteria);
        UIUtils.makeStackPanel(unresolvedTicketByPriorityWidget);
        rightBar.addComponentToRightBar(new MVerticalLayout(unresolvedTicketsByreplacedigneeWidget, unresolvedTicketByPriorityWidget).withMargin(false));
    }

    @Override
    public void queryTickets(ProjectTicketSearchCriteria searchCriteria) {
        baseCriteria = searchCriteria;
        if (baseCriteria.getTypes() == null) {
            baseCriteria.setTypes(CurrentProjectVariables.getRestrictedTicketTypes());
        }
        queryAndDisplayTickets();
        displayTicketsStatistic();
    }

    private void queryAndDisplayTickets() {
        wrapBody.removeAllComponents();
        if (UserUIContext.getMessage(GenericI18Enum.FORM_DUE_DATE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("dueDate", sortDirection)));
            ticketGroupOrderComponent = new DueDateOrderComponent();
        } else if (UserUIContext.getMessage(GenericI18Enum.FORM_START_DATE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("startdate", sortDirection)));
            ticketGroupOrderComponent = new StartDateOrderComponent();
        } else if (UserUIContext.getMessage(GenericI18Enum.OPT_PLAIN).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("lastupdatedtime", sortDirection)));
            ticketGroupOrderComponent = new SimpleListOrderComponent();
        } else if (UserUIContext.getMessage(GenericI18Enum.FORM_CREATED_TIME).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("createdtime", sortDirection)));
            ticketGroupOrderComponent = new CreatedDateOrderComponent();
        } else if (UserUIContext.getMessage(GenericI18Enum.OPT_USER).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("replacedignUser", sortDirection)));
            ticketGroupOrderComponent = new UserOrderComponent();
        } else if (UserUIContext.getMessage(MilestoneI18nEnum.SINGLE).equals(groupByState)) {
            baseCriteria.setOrderFields(Collections.singletonList(new SearchCriteria.OrderField("milestoneId", sortDirection)));
            ticketGroupOrderComponent = new MilestoneOrderGroup();
        } else {
            throw new MyCollabException("Do not support group view by " + groupByState);
        }
        wrapBody.addComponent(ticketGroupOrderComponent);
        ProjectTicketService projectTicketService = AppContextUtil.getSpringBean(ProjectTicketService.clreplaced);
        int totalTasks = projectTicketService.getTotalTicketsCount(baseCriteria);
        ticketSearchPanel.setTotalCountNumber(totalTasks);
        currentPage = 0;
        int pages = totalTasks / 100;
        if (currentPage < pages) {
            MButton moreBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_MORE), clickEvent -> {
                int newTotalTickets = projectTicketService.getTotalTicketsCount(baseCriteria);
                int newNumPages = newTotalTickets / 100;
                currentPage++;
                List<ProjectTicket> otherTickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
                ticketGroupOrderComponent.insertTickets(otherTickets);
                if (currentPage >= newNumPages) {
                    wrapBody.removeComponent(wrapBody.getComponent(1));
                }
            }).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.ANGLE_DOUBLE_DOWN);
            wrapBody.addComponent(moreBtn);
        }
        List<ProjectTicket> tickets = (List<ProjectTicket>) projectTicketService.findTicketsByCriteria(new BasicSearchRequest<>(baseCriteria, currentPage + 1, 100));
        ticketGroupOrderComponent.insertTickets(tickets);
    }

    @Override
    public HreplacedearchHandlers<ProjectTicketSearchCriteria> getSearchHandlers() {
        return ticketSearchPanel;
    }
}

16 View Complete Implementation : VersionReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
@Override
protected void initRelatedComponents() {
    activityComponent = new ProjectActivityComponent(ProjectTypeConstants.VERSION, CurrentProjectVariables.getProjectId());
    ProjectView projectView = UIUtils.getRoot(this, ProjectView.clreplaced);
    MVerticalLayout detailLayout = new MVerticalLayout().withMargin(new MarginInfo(false, true, true, true));
    dateInfoComp = new DateInfoComp();
    if (SiteConfiguration.isCommunityEdition()) {
        detailLayout.with(dateInfoComp);
    } else {
        versionTimeLogComp = new VersionTimeLogComp();
        detailLayout.with(dateInfoComp, versionTimeLogComp);
    }
    Panel detailPanel = new Panel(UserUIContext.getMessage(GenericI18Enum.OPT_DETAILS), detailLayout);
    UIUtils.makeStackPanel(detailPanel);
    projectView.addComponentToRightBar(detailPanel);
}

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

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

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

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

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

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

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

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

5 View Complete Implementation : PasswordChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void initUI() {
    final MVerticalLayout mainLayout = new MVerticalLayout().withFullWidth();
    Label lbInstruct1 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PreplacedWORD_INSTRUCT_LABEL_1)).withFullWidth();
    mainLayout.addComponent(lbInstruct1);
    mainLayout.setComponentAlignment(lbInstruct1, Alignment.MIDDLE_LEFT);
    final Label lbInstruct2 = new ELabel(UserUIContext.getMessage(UserI18nEnum.MSG_PreplacedWORD_INSTRUCT_LABEL_2)).withFullWidth();
    mainLayout.addComponent(lbInstruct2);
    mainLayout.setComponentAlignment(lbInstruct2, Alignment.MIDDLE_LEFT);
    GridFormLayoutHelper preplacedInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    txtNewPreplacedword = new PreplacedwordField();
    preplacedInfo.addComponent(txtNewPreplacedword, UserUIContext.getMessage(ShellI18nEnum.OPT_NEW_PreplacedWORD), 0, 0);
    txtConfirmPreplacedword = new PreplacedwordField();
    preplacedInfo.addComponent(txtConfirmPreplacedword, UserUIContext.getMessage(ShellI18nEnum.OPT_CONFIRMED_PreplacedWORD), 0, 1);
    mainLayout.addComponent(preplacedInfo.getLayout());
    mainLayout.setComponentAlignment(preplacedInfo.getLayout(), Alignment.MIDDLE_CENTER);
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changePreplacedword()).withIcon(VaadinIcons.CLIPBOARD).withStyleName(WebThemes.BUTTON_ACTION).withClickShortcut(KeyCode.ENTER);
    MHorizontalLayout hlayoutControls = new MHorizontalLayout(cancelBtn, saveBtn).withMargin(false);
    mainLayout.with(hlayoutControls).withAlign(hlayoutControls, Alignment.MIDDLE_RIGHT);
    this.setContent(mainLayout);
}

4 View Complete Implementation : AdvancedInfoChangeWindow.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void initUI() {
    MVerticalLayout mainLayout = new MVerticalLayout().withMargin(true).withFullWidth();
    GridFormLayoutHelper preplacedInfo = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    preplacedInfo.addComponent(txtWebsite, UserUIContext.getMessage(UserI18nEnum.FORM_WEBSITE), 0, 0);
    preplacedInfo.addComponent(txtCompany, UserUIContext.getMessage(UserI18nEnum.FORM_COMPANY), 0, 1);
    preplacedInfo.addComponent(cboCountry, UserUIContext.getMessage(UserI18nEnum.FORM_COUNTRY), 0, 2);
    txtWebsite.setValue(MoreObjects.firstNonNull(user.getWebsite(), ""));
    txtCompany.setValue(MoreObjects.firstNonNull(user.getCompany(), ""));
    cboCountry.setValue(MoreObjects.firstNonNull(user.getCountry(), ""));
    mainLayout.with(preplacedInfo.getLayout()).withAlign(preplacedInfo.getLayout(), Alignment.TOP_LEFT);
    MButton cancelBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CANCEL), clickEvent -> close()).withStyleName(WebThemes.BUTTON_OPTION);
    MButton saveBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_SAVE), clickEvent -> changeInfo()).withStyleName(WebThemes.BUTTON_ACTION).withIcon(VaadinIcons.CLIPBOARD).withClickShortcut(KeyCode.ENTER);
    MHorizontalLayout buttonControls = new MHorizontalLayout(cancelBtn, saveBtn);
    mainLayout.with(buttonControls).withAlign(buttonControls, Alignment.MIDDLE_RIGHT);
    this.setModal(true);
    this.setContent(mainLayout);
}

4 View Complete Implementation : ProfileReadViewImpl.java
Copyright GNU Affero General Public License v3.0
Author : MyCollab
private void displayUserAvatar() {
    avatarAndPreplaced.removeAllComponents();
    Image cropField = UserAvatarControlFactory.createUserAvatarEmbeddedComponent(UserUIContext.getUserAvatarId(), 100);
    cropField.addStyleName(WebThemes.CIRCLE_BOX);
    CssLayout avatarWrapper = new CssLayout();
    avatarWrapper.addComponent(cropField);
    MVerticalLayout userAvatar = new MVerticalLayout().withMargin(false).with(avatarWrapper);
    userAvatar.setSizeUndefined();
    UploadImageField avatarUploadField = new UploadImageField(this);
    avatarUploadField.setButtonCaption(UserUIContext.getMessage(UserI18nEnum.BUTTON_CHANGE_AVATAR));
    userAvatar.addComponent(avatarUploadField);
    avatarAndPreplaced.with(userAvatar);
    User user = formItem.getBean();
    MVerticalLayout basicLayout = new MVerticalLayout().withMargin(false);
    ELabel usernameLbl = ELabel.h2(UserUIContext.getUser().getDisplayName()).withUndefinedWidth();
    MButton btnChangeBasicInfo = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> UI.getCurrent().addWindow(new BasicInfoChangeWindow(formItem.getBean()))).withStyleName(WebThemes.BUTTON_LINK);
    MHorizontalLayout userWrapper = new MHorizontalLayout(usernameLbl, btnChangeBasicInfo);
    basicLayout.addComponent(userWrapper);
    basicLayout.setComponentAlignment(userWrapper, Alignment.MIDDLE_LEFT);
    GridFormLayoutHelper userFormLayout = GridFormLayoutHelper.defaultFormLayoutHelper(LayoutType.ONE_COLUMN);
    userFormLayout.getLayout().addStyleName(WebThemes.GRIDFORM_BORDERLESS);
    userFormLayout.addComponent(new Label(UserUIContext.formatDate(user.getBirthday())), UserUIContext.getMessage(UserI18nEnum.FORM_BIRTHDAY), 0, 0);
    userFormLayout.addComponent(ELabel.html(new A("mailto:" + user.getEmail()).appendText(user.getEmail()).setTarget("_blank").write()), UserUIContext.getMessage(GenericI18Enum.FORM_EMAIL), 0, 1);
    userFormLayout.addComponent(new Label(TimezoneVal.getDisplayName(UserUIContext.getUserLocale(), user.getTimezone())), UserUIContext.getMessage(UserI18nEnum.FORM_TIMEZONE), 0, 2);
    userFormLayout.addComponent(new Label(LocalizationHelper.getLocaleInstance(user.getLanguage()).getDisplayLanguage(UserUIContext.getUserLocale())), UserUIContext.getMessage(UserI18nEnum.FORM_LANGUAGE), UserUIContext.getMessage(ShellI18nEnum.OPT_SUPPORTED_LANGUAGES_INTRO), 0, 3);
    MButton btnChangePreplacedword = new MButton(UserUIContext.getMessage(GenericI18Enum.ACTION_CHANGE), clickEvent -> UI.getCurrent().addWindow(new PreplacedwordChangeWindow(formItem.getBean()))).withStyleName(WebThemes.BUTTON_LINK);
    userFormLayout.addComponent(new CssLayout(new MHorizontalLayout(new ELabel("***********"), btnChangePreplacedword).withAlign(btnChangePreplacedword, Alignment.TOP_RIGHT)), UserUIContext.getMessage(ShellI18nEnum.FORM_PreplacedWORD), 0, 4);
    basicLayout.addComponent(userFormLayout.getLayout());
    avatarAndPreplaced.with(basicLayout).expand(basicLayout);
}