Example usage for com.vaadin.server FontAwesome TRASH

List of usage examples for com.vaadin.server FontAwesome TRASH

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome TRASH.

Prototype

FontAwesome TRASH

To view the source code for com.vaadin.server FontAwesome TRASH.

Click Source Link

Usage

From source file:com.esofthead.mycollab.mobile.module.project.ui.ProjectCommentInputView.java

License:Open Source License

private Component createAttachmentRow(String fileName) {
    final MHorizontalLayout uploadSucceedLayout = new MHorizontalLayout().withFullWidth();
    Label uploadResult = new Label(fileName);
    uploadSucceedLayout.with(uploadResult).expand(uploadResult);

    Button removeAttachment = new Button("", new Button.ClickListener() {
        @Override//from  w w w .  ja v a2  s. co m
        public void buttonClick(ClickEvent event) {
            statusWrapper.removeComponent(uploadSucceedLayout);
        }
    });
    removeAttachment.setIcon(FontAwesome.TRASH);
    removeAttachment.setHtmlContentAllowed(true);
    removeAttachment.setStyleName("link");
    uploadSucceedLayout.addComponent(removeAttachment);
    return uploadSucceedLayout;
}

From source file:com.mycollab.mobile.module.project.view.settings.ProjectMemberReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoEdit(this, beanItem)))
                    .withIcon(FontAwesome.EDIT).withStyleName(UIConstants.CIRCLE_BOX)
                    .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.USERS));

    MButton deleteBtn = new MButton("",
            clickEvent -> ConfirmDialog.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), dialog -> {
                        if (dialog.isConfirmed()) {
                            ProjectMemberService projectMemberService = AppContextUtil
                                    .getSpringBean(ProjectMemberService.class);
                            projectMemberService.removeWithSession(beanItem, UserUIContext.getUsername(),
                                    MyCollabUI.getAccountId());
                            EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoList(this, null));
                        }//from ww  w .j a  v  a  2s.  c om
                    })).withIcon(FontAwesome.TRASH).withStyleName(UIConstants.CIRCLE_BOX).withVisible(
                            CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.USERS));

    return new MHorizontalLayout(editBtn, deleteBtn);
}

From source file:com.mycollab.module.project.view.milestone.ToggleMilestoneSummaryField.java

License:Open Source License

ToggleMilestoneSummaryField(final SimpleMilestone milestone, int maxLength, boolean toggleStatusSupport,
        boolean isDeleteSupport) {
    this.milestone = milestone;
    this.maxLength = maxLength;
    this.setWidth("100%");
    this.addStyleName("editable-field");
    if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        toggleStatusSelect = new CssCheckBox();
        toggleStatusSelect.setSimpleMode(true);
        toggleStatusSelect.setValue(milestone.isCompleted());
        this.addComponent(toggleStatusSelect);
        this.addComponent(ELabel.EMPTY_SPACE());
        displayTooltip();//from   w w  w .ja va  2 s  . c  o  m

        toggleStatusSelect.addValueChangeListener(valueChangeEvent -> {
            if (milestone.isCompleted()) {
                milestone.setStatus(MilestoneStatus.InProgress.name());
                titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED);
            } else {
                milestone.setStatus(MilestoneStatus.Closed.name());
                titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
            }
            displayTooltip();
            MilestoneService milestoneService = AppContextUtil.getSpringBean(MilestoneService.class);
            milestoneService.updateSelectiveWithSession(milestone, UserUIContext.getUsername());
            ProjectTicketSearchCriteria searchCriteria = new ProjectTicketSearchCriteria();
            searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
            searchCriteria.setTypes(new SetSearchField<>(ProjectTypeConstants.BUG, ProjectTypeConstants.RISK,
                    ProjectTypeConstants.TASK));
            searchCriteria.setMilestoneId(NumberSearchField.equal(milestone.getId()));
            searchCriteria.setIsOpenned(new SearchField());
            ProjectTicketService genericTaskService = AppContextUtil.getSpringBean(ProjectTicketService.class);
            int openAssignmentsCount = genericTaskService.getTotalCount(searchCriteria);
            if (openAssignmentsCount > 0) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, MyCollabUI.getSiteName()),
                        UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                genericTaskService.closeSubAssignmentOfMilestone(milestone.getId());
                            }
                        });
            }
        });
    }

    titleLinkLbl = ELabel.h3(buildMilestoneLink()).withStyleName(UIConstants.LABEL_WORD_WRAP)
            .withWidthUndefined();
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withStyleName("toggle");
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES)) {
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleMilestoneSummaryField.this.removeComponent(titleLinkLbl);
                ToggleMilestoneSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(milestone.getName());
                editField.setWidth("100%");
                editField.focus();
                ToggleMilestoneSummaryField.this.addComponent(editField);
                ToggleMilestoneSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withDescription(UserUIContext.getMessage(MilestoneI18nEnum.OPT_EDIT_PHASE_NAME))
                .withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(instantEditBtn);
    }
    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.MILESTONES)) {
        MButton removeBtn = new MButton("", clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            AppContextUtil.getSpringBean(MilestoneService.class).removeWithSession(milestone,
                                    UserUIContext.getUsername(), MyCollabUI.getAccountId());
                            BlockRowRender rowRenderer = UIUtils.getRoot(ToggleMilestoneSummaryField.this,
                                    BlockRowRender.class);
                            if (rowRenderer != null) {
                                rowRenderer.selfRemoved();
                            }
                            EventBusFactory.getInstance()
                                    .post(new MilestoneEvent.MilestoneDeleted(this, milestone.getId()));
                        }
                    });
        }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(removeBtn);
    }
    if (buttonControls.getComponentCount() > 0) {
        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.task.ToggleTaskSummaryField.java

License:Open Source License

public ToggleTaskSummaryField(final SimpleTask task, int maxLength, boolean toggleStatusSupport,
        boolean canRemove) {
    this.setWidth("100%");
    this.maxLength = maxLength;
    this.task = task;
    titleLinkLbl = ELabel.html(buildTaskLink()).withWidthUndefined().withStyleName(UIConstants.LABEL_WORD_WRAP);

    if (toggleStatusSupport && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        toggleStatusSelect = new CssCheckBox();
        toggleStatusSelect.setSimpleMode(true);
        toggleStatusSelect.setValue(task.isCompleted());
        displayTooltip();/*from   www .j  a v a 2s .  c o m*/
        toggleStatusSelect.addValueChangeListener(valueChangeEvent -> {
            if (task.isCompleted()) {
                task.setStatus(StatusI18nEnum.Open.name());
                task.setPercentagecomplete(0d);
                titleLinkLbl.removeStyleName(WebThemes.LINK_COMPLETED);
            } else {
                task.setStatus(StatusI18nEnum.Closed.name());
                task.setPercentagecomplete(100d);
                titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
            }
            displayTooltip();
            ProjectTaskService projectTaskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
            projectTaskService.updateWithSession(task, UserUIContext.getUsername());

            if (StatusI18nEnum.Closed.name().equals(task.getStatus())) {
                Integer countOfOpenSubTasks = projectTaskService.getCountOfOpenSubTasks(task.getId());
                if (countOfOpenSubTasks > 0) {
                    ConfirmDialogExt.show(UI.getCurrent(),
                            UserUIContext.getMessage(GenericI18Enum.OPT_QUESTION, MyCollabUI.getSiteName()),
                            UserUIContext.getMessage(ProjectCommonI18nEnum.OPT_CLOSE_SUB_ASSIGNMENTS),
                            UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                            UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                                if (confirmDialog.isConfirmed()) {
                                    projectTaskService.massUpdateTaskStatuses(task.getId(),
                                            StatusI18nEnum.Closed.name(), MyCollabUI.getAccountId());
                                }
                            });
                }
            }
        });
        this.addComponent(toggleStatusSelect);
        this.addComponent(ELabel.EMPTY_SPACE());
    }

    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
            .withStyleName("toggle");
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        this.addStyleName("editable-field");

        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleTaskSummaryField.this.removeComponent(titleLinkLbl);
                ToggleTaskSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(task.getName());
                editField.setWidth("100%");
                editField.focus();
                ToggleTaskSummaryField.this.addComponent(editField);
                ToggleTaskSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(TaskI18nEnum.OPT_EDIT_TASK_NAME));
        buttonControls.with(instantEditBtn);
    }

    if (canRemove && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) {
        MButton removeBtn = new MButton("", clickEvent -> {
            ConfirmDialogExt.show(UI.getCurrent(),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                    UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                    UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            AppContextUtil.getSpringBean(ProjectTaskService.class).removeWithSession(task,
                                    UserUIContext.getUsername(), MyCollabUI.getAccountId());
                            BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTaskSummaryField.this,
                                    BlockRowRender.class);
                            if (rowRenderer != null) {
                                rowRenderer.selfRemoved();
                            }
                            EventBusFactory.getInstance().post(new TaskEvent.TaskDeleted(this, task.getId()));
                        }
                    });
        }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(removeBtn);
    }
    if (buttonControls.getComponentCount() > 0) {
        this.addComponent(buttonControls);
    }
}

From source file:com.mycollab.module.project.view.ticket.ToggleTicketSummaryField.java

License:Open Source License

public ToggleTicketSummaryField(final ProjectTicket ticket) {
    this.ticket = ticket;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildTicketLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    if (ticket.isClosed()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_OVERDUE);
    }// w  ww .ja  v a2  s .c om
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
                .withStyleName("toggle");
        buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                removeComponent(titleLinkLbl);
                removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(ticket.getName());
                editField.setWidth("100%");
                editField.focus();
                addComponent(editField);
                removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        if ((ticket.isRisk() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.RISKS))
                || (ticket.isBug() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.BUGS))
                || (ticket.isTask()
                        && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS))) {
            MButton removeBtn = new MButton("", clickEvent -> {
                ConfirmDialogExt.show(UI.getCurrent(),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                        UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                        UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                            if (confirmDialog.isConfirmed()) {
                                AppContextUtil.getSpringBean(ProjectTicketService.class).removeTicket(ticket,
                                        UserUIContext.getUsername());
                                BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTicketSummaryField.this,
                                        BlockRowRender.class);
                                if (rowRenderer != null) {
                                    rowRenderer.selfRemoved();
                                }
                                EventBusFactory.getInstance()
                                        .post(new TicketEvent.HasTicketPropertyChanged(this, "all"));
                            }
                        });
            }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
            buttonControls.with(removeBtn);
        }

        this.addComponent(buttonControls);
    }
}

From source file:com.vphakala.Toolbar.java

public Toolbar(String windowName, Button read, Button create, Button update, Button delete) {
    setSpacing(true);// w  ww.ja  v a2 s . c  om

    create.setIcon(FontAwesome.USER_PLUS);
    create.setDescription("Create a new " + windowName + ".");

    read.setIcon(FontAwesome.USER);
    read.setDescription("Read the " + windowName + ". Insert NAME.");

    update.setIcon(FontAwesome.SAVE);
    update.setDescription("Store the " + windowName + " data.");

    delete.setIcon(FontAwesome.TRASH);
    delete.setDescription("Remove the " + windowName);

    addComponents(read, create, update, delete);
}

From source file:org.inakirj.imagerulette.screens.DiceGallerySetupView.java

License:Open Source License

/**
 * Adds the row.// ww  w .j a  va2s. co  m
 */
public void addRow(String urlEntry) {
    DiceItem itemCreated = new DiceItem();
    Button validateButton = new Button();
    validateButton.setIcon(FontAwesome.CHECK_CIRCLE_O);
    validateButton.addClickListener(e -> validateUrl(itemCreated));
    itemCreated.setValidateImg(validateButton);
    Image imgRow = null;
    String url = null;
    if (urlEntry != null) {
        StringTokenizer urlEntryTokenizer = new StringTokenizer(urlEntry, " ");
        url = urlEntryTokenizer.nextToken();
        ExternalResource resource = new ExternalResource(url);
        imgRow = new Image("", resource);
        itemCreated.setId(getNextId());
    } else {
        imgRow = new Image("", null);
    }
    imgRow.addStyleName("dice-image");
    imgRow.addStyleName("dice-align-center");
    itemCreated.setImg(imgRow);
    TextField textRow = new TextField();
    textRow.addStyleName("url-style");
    if (url != null) {
        textRow.setValue(url);
        validateButton.setIcon(FontAwesome.CHECK_CIRCLE);
    }
    itemCreated.setUrl(textRow);
    if (urlEntry != null) {
        itemCreated.getUrl().setEnabled(false);
    }
    itemCreated.setValid(imgRow != null);

    Button deleteButton = new Button();
    deleteButton.setIcon(FontAwesome.TRASH);
    itemCreated.setDeleteImg(deleteButton);
    deleteButton.addClickListener(e -> deleteUrl(itemCreated));

    newDataSource.addBean(itemCreated);
    hasReachLimitImages = newDataSource.size() == TOTAL_URL_LIMIT;
}