Example usage for com.vaadin.server FontAwesome TRASH_O

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

Introduction

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

Prototype

FontAwesome TRASH_O

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

Click Source Link

Usage

From source file:com.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, String permissionItem) {
    boolean canRead = false;
    boolean canWrite = false;
    boolean canAccess = false;
    if (permissionItem != null) {
        canRead = UserUIContext.canRead(permissionItem);
        canWrite = UserUIContext.canWrite(permissionItem);
        canAccess = UserUIContext.canAccess(permissionItem);
    }/*from  ww w.  j a  v  a  2  s  .co  m*/

    MHorizontalLayout editBtns = new MHorizontalLayout();
    layout.addComponent(editBtns);

    OptionPopupContent popupButtonsControl = new OptionPopupContent();

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        MButton addBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_ADD), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireAddForm(item);
        }).withIcon(FontAwesome.PLUS).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
        editBtns.addComponent(addBtn);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        MButton editBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireEditForm(item);
        }).withIcon(FontAwesome.EDIT).withStyleName(WebThemes.BUTTON_ACTION).withVisible(canWrite);
        editBtns.addComponent(editBtn);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireDeleteForm(item);
        }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_DANGER).withVisible(canAccess);
        editBtns.addComponent(deleteBtn);
    }

    if ((buttonEnableFlags & PRINT_BTN_PRESENTED) == PRINT_BTN_PRESENTED) {
        final PrintButton printBtn = new PrintButton();
        printBtn.withListener(clickEvent -> {
            T item = previewForm.getBean();
            previewForm.firePrintForm(printBtn, item);
        }).withStyleName(WebThemes.BUTTON_OPTION).withVisible(canRead);
        editBtns.addComponent(printBtn);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        MButton cloneBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLONE), clickEvent -> {
            optionBtn.setPopupVisible(false);
            T item = previewForm.getBean();
            previewForm.fireCloneForm(item);
        }).withIcon(FontAwesome.ROAD).withVisible(canWrite);
        popupButtonsControl.addOption(cloneBtn);
    }

    optionBtn.setContent(popupButtonsControl);

    ButtonGroup navigationBtns = new ButtonGroup();
    navigationBtns.setStyleName("navigation-btns");

    if ((buttonEnableFlags & NAVIGATOR_BTN_PRESENTED) == NAVIGATOR_BTN_PRESENTED) {
        MButton previousItem = new MButton("", clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireGotoPrevious(item);
        }).withIcon(FontAwesome.CHEVRON_LEFT).withStyleName(WebThemes.BUTTON_OPTION)
                .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM))
                .withVisible(canRead);
        navigationBtns.addButton(previousItem);

        MButton nextItemBtn = new MButton("", clickEvent -> {
            T item = previewForm.getBean();
            previewForm.fireGotoNextItem(item);
        }).withIcon(FontAwesome.CHEVRON_RIGHT).withStyleName(WebThemes.BUTTON_OPTION)
                .withDescription(UserUIContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM))
                .withVisible(canRead);
        navigationBtns.addButton(nextItemBtn);
    }

    layout.addComponent(navigationBtns);
    if (popupButtonsControl.getComponentCount() > 0) {
        optionBtn.setContent(popupButtonsControl);
        layout.addComponent(optionBtn);
    }
    return layout;
}

From source file:com.mycollab.module.crm.ui.components.RelatedEditItemField.java

License:Open Source License

public RelatedEditItemField(Object bean) {
    this.bean = bean;

    relatedItemComboBox = new RelatedItemComboBox();
    itemField = new TextField();
    itemField.setEnabled(true);//from ww w. ja  v a2s  .c o  m

    browseBtn = new MButton("", clickEvent -> {
        String type = (String) relatedItemComboBox.getValue();
        if (CrmTypeConstants.ACCOUNT.equals(type)) {
            AccountSelectionWindow accountWindow = new AccountSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(accountWindow);
            accountWindow.show();
        } else if (CrmTypeConstants.CAMPAIGN.equals(type)) {
            CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(campaignWindow);
            campaignWindow.show();
        } else if (CrmTypeConstants.CONTACT.equals(type)) {
            ContactSelectionWindow contactWindow = new ContactSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(contactWindow);
            contactWindow.show();
        } else if (CrmTypeConstants.LEAD.equals(type)) {
            LeadSelectionWindow leadWindow = new LeadSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(leadWindow);
            leadWindow.show();
        } else if (CrmTypeConstants.OPPORTUNITY.equals(type)) {
            OpportunitySelectionWindow opportunityWindow = new OpportunitySelectionWindow(
                    RelatedEditItemField.this);
            UI.getCurrent().addWindow(opportunityWindow);
            opportunityWindow.show();
        } else if (CrmTypeConstants.CASE.equals(type)) {
            CaseSelectionWindow caseWindow = new CaseSelectionWindow(RelatedEditItemField.this);
            UI.getCurrent().addWindow(caseWindow);
            caseWindow.show();
        } else {
            relatedItemComboBox.focus();
        }
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    clearBtn = new MButton("", clickEvent -> {
        try {
            PropertyUtils.setProperty(bean, "typeid", null);
            PropertyUtils.setProperty(bean, "type", null);
            relatedItemComboBox.setValue(null);
            itemField.setValue("");
        } catch (Exception e) {
            LOG.error("Error while saving type", e);
        }
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
}

From source file:com.mycollab.module.crm.view.account.AccountSelectionField.java

License:Open Source License

@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    accountName.setNullRepresentation("");
    accountName.setEnabled(true);// ww w.  j  a v a  2 s  . co  m
    accountName.setWidth("100%");

    MButton browseBtn = new MButton("", clickEvent -> {
        AccountSelectionWindow accountWindow = new AccountSelectionWindow(AccountSelectionField.this);
        UI.getCurrent().addWindow(accountWindow);
        accountWindow.show();
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    MButton clearBtn = new MButton("", clickEvent -> clearValue()).withIcon(FontAwesome.TRASH_O)
            .withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    layout.with(accountName, browseBtn, clearBtn).expand(accountName);
    return layout;
}

From source file:com.mycollab.module.crm.view.activity.CallTableDisplay.java

License:Open Source License

public CallTableDisplay(TableViewField requireColumn, List<TableViewField> displayColumns) {
    super(AppContextUtil.getSpringBean(CallService.class), SimpleCall.class, requireColumn, displayColumns);

    this.addGeneratedColumn("subject", (source, itemId, columnId) -> {
        final SimpleCall call = getBeanByIndex(itemId);

        LabelLink b = new LabelLink(call.getSubject(), CrmLinkBuilder.generateCallPreviewLinkFul(call.getId()));
        if (CallStatus.Held.name().equals(call.getStatus())) {
            b.addStyleName(WebThemes.LINK_COMPLETED);
        }//ww w .  ja v  a 2 s.  com
        return b;
    });

    this.addGeneratedColumn("isClosed", (source, itemId, columnId) -> {
        final SimpleCall call = getBeanByIndex(itemId);
        MButton b = new MButton("",
                clickEvent -> fireTableEvent(new TableClickEvent(CallTableDisplay.this, call, "isClosed")))
                        .withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK);
        b.setDescription(UserUIContext.getMessage(CallI18nEnum.OPT_CLOSE_THIS_CALL));
        return b;
    });

    this.addGeneratedColumn("startdate", (source, itemId, columnId) -> {
        final SimpleCall call = getBeanByIndex(itemId);
        return new Label(UserUIContext.formatDateTime(call.getStartdate()));
    });

    this.addGeneratedColumn("status", (source, itemId, columnId) -> {
        final SimpleCall call = getBeanByIndex(itemId);
        return ELabel.i18n(call.getStatus(), CallStatus.class);
    });
}

From source file:com.mycollab.module.crm.view.campaign.CampaignSelectionField.java

License:Open Source License

@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout().withFullWidth();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    MButton browseBtn = new MButton("", clickEvent -> {
        CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(CampaignSelectionField.this);
        UI.getCurrent().addWindow(campaignWindow);
        campaignWindow.show();// w  w  w  .  ja  v  a 2s  . c  om
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    MButton clearBtn = new MButton("", clickEvent -> {
        campaignName.setValue("");
        internalValue = null;
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    layout.with(campaignName, browseBtn, clearBtn).expand(campaignName);
    return layout;
}

From source file:com.mycollab.module.crm.view.contact.ContactSelectionField.java

License:Open Source License

public ContactSelectionField() {
    contactName = new TextField();
    contactName.setNullRepresentation("");
    contactName.setWidth("100%");
    browseBtn = new MButton("", clickEvent -> {
        ContactSelectionWindow contactWindow = new ContactSelectionWindow(ContactSelectionField.this);
        UI.getCurrent().addWindow(contactWindow);
        contactWindow.show();/*  www  .j  a  va  2 s  .  c  o m*/
    }).withIcon(FontAwesome.ELLIPSIS_H).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);

    clearBtn = new MButton("", clickEvent -> {
        contactName.setValue("");
        contact = null;
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_OPTION, WebThemes.BUTTON_SMALL_PADDING);
}

From source file:com.mycollab.module.project.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@Override
public Component generateRow(IBeanList<SimpleComment> host, final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withMargin(new MarginInfo(true, true, true, false))
            .withFullWidth();/*www  .j  av a 2 s . co  m*/

    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(),
            comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);

    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth()
            .withStyleName(WebThemes.MESSAGE_CONTAINER);

    MHorizontalLayout messageHeader = new MHorizontalLayout().withMargin(false).withFullWidth();
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel timePostLbl = ELabel
            .html(UserUIContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(),
                    UserUIContext.formatPrettyTime(comment.getCreatedtime())))
            .withDescription(UserUIContext.formatDateTime(comment.getCreatedtime()));
    timePostLbl.setStyleName(UIConstants.META_INFO);

    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_ICON_ONLY)
                .withListener(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()) {
                                    CommentService commentService = AppContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment, UserUIContext.getUsername(),
                                            MyCollabUI.getAccountId());
                                    ((BeanList) host).removeRow(layout);
                                }
                            });
                });
        messageHeader.with(timePostLbl, msgDeleteBtn).expand(timePostLbl);
    } else {
        messageHeader.with(timePostLbl).expand(timePostLbl);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new SafeHtmlLabel(comment.getComment());
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withFullWidth();
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.with(attachmentDisplay).withAlign(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.with(rowLayout).expand(rowLayout);
    return layout;
}

From source file:com.mycollab.module.project.ui.components.ProjectActivityComponent.java

License:Open Source License

private Component buildCommentBlock(final SimpleComment comment) {
    final 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);//from  ww  w  .ja v a2s.co m

    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()));
    timePostLbl.setStyleName(UIConstants.META_INFO);

    if (hasDeletePermission(comment)) {
        MButton msgDeleteBtn = new MButton(FontAwesome.TRASH_O).withListener(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()) {
                            CommentService commentService = AppContextUtil.getSpringBean(CommentService.class);
                            commentService.removeWithSession(comment, UserUIContext.getUsername(),
                                    MyCollabUI.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;
}

From source file:com.mycollab.module.project.view.bug.components.BugRowComponent.java

License:Open Source License

private OptionPopupContent createPopupContent() {
    OptionPopupContent filterBtnLayout = new OptionPopupContent();

    if (CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS)) {
        MButton editButton = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT), clickEvent -> {
            bugSettingPopupBtn.setPopupVisible(false);
            EventBusFactory.getInstance().post(new BugEvent.GotoEdit(BugRowComponent.this, bug));
        }).withIcon(FontAwesome.EDIT);//from  www. j  ava2 s .co m
        filterBtnLayout.addOption(editButton);

        MButton deleteBtn = new MButton(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE), clickEvent -> {
            bugSettingPopupBtn.setPopupVisible(false);
            ConfirmDialogExt.show(UI.getCurrent(),
                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, AppContext.getSiteName()),
                    AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                    AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                    AppContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                        if (confirmDialog.isConfirmed()) {
                            BugService bugService = AppContextUtil.getSpringBean(BugService.class);
                            bugService.removeWithSession(bug, AppContext.getUsername(),
                                    AppContext.getAccountId());
                            deleteBug();
                        }
                    });
        }).withIcon(FontAwesome.TRASH_O);
        filterBtnLayout.addDangerOption(deleteBtn);
    }

    return filterBtnLayout;
}

From source file:com.mycollab.module.project.view.page.PageListViewImpl.java

License:Open Source License

private Layout displayFolderBlock(final Folder resource) {
    MVerticalLayout container = new MVerticalLayout().withFullWidth().withStyleName("page-item-block");

    A folderHtml = new A(ProjectLinkBuilder.generatePageFolderFullLink(CurrentProjectVariables.getProjectId(),
            resource.getPath())).appendText(FontAwesome.FOLDER_OPEN.getHtml() + " " + resource.getName());
    ELabel folderLink = ELabel.h3(folderHtml.write());
    container.addComponent(folderLink);//  w w  w.  j a v a  2s .c  o m
    if (StringUtils.isNotBlank(resource.getDescription())) {
        container.addComponent(new Label(StringUtils.trimHtmlTags(resource.getDescription())));
    }

    Label lastUpdateInfo = new ELabel(UserUIContext.getMessage(PageI18nEnum.LABEL_LAST_UPDATE,
            ProjectLinkBuilder.generateProjectMemberHtmlLink(CurrentProjectVariables.getProjectId(),
                    resource.getCreatedUser(), true),
            UserUIContext.formatPrettyTime(resource.getCreatedTime().getTime())), ContentMode.HTML)
                    .withDescription(UserUIContext.formatDateTime(resource.getCreatedTime().getTime()));
    lastUpdateInfo.addStyleName(UIConstants.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(FontAwesome.EDIT);
    editBtn.setVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.PAGES));

    MButton deleteBtn = new MButton(UserUIContext.getMessage(GenericI18Enum.BUTTON_DELETE), 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()) {
                        PageService pageService = AppContextUtil.getSpringBean(PageService.class);
                        pageService.removeResource(resource.getPath());
                        resources.remove(resource);
                        displayPages(resources);
                    }
                });
    }).withIcon(FontAwesome.TRASH_O).withStyleName(WebThemes.BUTTON_LINK, WebThemes.BUTTON_SMALL_PADDING);
    deleteBtn.setVisible(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.PAGES));

    container.addComponent(new MHorizontalLayout(editBtn, deleteBtn));
    return container;
}