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:annis.gui.querybuilder.NodeWindow.java

License:Apache License

public NodeWindow(int id, TigerQueryBuilderCanvas parent) {
    this.parent = parent;
    this.id = id;
    this.annoNames = new TreeSet<>();

    for (String a : parent.getAvailableAnnotationNames()) {
        annoNames.add(a.replaceFirst("^[^:]*:", ""));
    }//from  w  ww .ja v  a  2s.  c  om
    constraints = new ArrayList<>();

    setSizeFull();

    // HACK: use our own border since the one from chameleon does not really work
    addStyleName(ValoTheme.PANEL_WELL);
    //addStyleName("border-layout");

    prepareEdgeDock = false;

    vLayout = new VerticalLayout();
    setContent(vLayout);
    vLayout.setWidth("100%");
    vLayout.setHeight("-1px");
    vLayout.setMargin(false);
    vLayout.setSpacing(true);

    toolbar = new HorizontalLayout();
    toolbar.addStyleName("toolbar");
    toolbar.setWidth("100%");
    toolbar.setHeight("-1px");
    toolbar.setMargin(false);
    toolbar.setSpacing(false);
    vLayout.addComponent(toolbar);

    btMove = new Button();
    btMove.setWidth("100%");
    btMove.setIcon(FontAwesome.ARROWS);
    btMove.setDescription("<strong>Move node</strong><br />Click, hold and move mouse to move the node.");
    btMove.addStyleName(ValoTheme.BUTTON_SMALL);
    btMove.addStyleName("drag-source-enabled");
    toolbar.addComponent(btMove);

    btEdge = new Button("Edge");
    btEdge.setIcon(FontAwesome.EXTERNAL_LINK);
    btEdge.addClickListener((Button.ClickListener) this);
    btEdge.addStyleName(ValoTheme.BUTTON_SMALL);
    //btEdge.addStyleName(ChameleonTheme.BUTTON_LINK);
    btEdge.setDescription("<strong>Add Edge</strong><br />" + "To create a new edge between "
            + "two nodes click this button first. " + "Then define a destination node by clicking its \"Dock\" "
            + "button.<br>You can cancel the action by clicking this button " + "(\"Cancel\") again.");
    btEdge.setImmediate(true);
    toolbar.addComponent(btEdge);

    btAdd = new Button("Add");
    btAdd.setIcon(FontAwesome.PLUS);
    btAdd.addStyleName(ValoTheme.BUTTON_SMALL);
    //btAdd.addStyleName(ChameleonTheme.BUTTON_LINK);
    btAdd.addClickListener((Button.ClickListener) this);
    btAdd.setDescription("<strong>Add Node Condition</strong><br />"
            + "Every condition will constraint the node described by this window. "
            + "Most conditions limit the node by defining which annotations and which "
            + "values of the annotation a node needs to have.");
    toolbar.addComponent(btAdd);

    btClear = new Button("Clear");
    btClear.setIcon(FontAwesome.TRASH_O);
    btClear.addStyleName(ValoTheme.BUTTON_SMALL);
    //btClear.addStyleName(ChameleonTheme.BUTTON_LINK);
    btClear.addClickListener((Button.ClickListener) this);
    btClear.setDescription("<strong>Clear All Node Conditions</strong>");
    toolbar.addComponent(btClear);

    btClose = new Button();
    btClose.setIcon(FontAwesome.TIMES_CIRCLE);
    btClose.setDescription("<strong>Close</strong><br />Close this node description window");
    btClose.addStyleName(ValoTheme.BUTTON_SMALL);
    btClose.addClickListener((Button.ClickListener) this);
    toolbar.addComponent(btClose);

    toolbar.setComponentAlignment(btMove, Alignment.TOP_LEFT);
    toolbar.setExpandRatio(btMove, 1.0f);

    toolbar.setComponentAlignment(btEdge, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btAdd, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btClear, Alignment.TOP_CENTER);
    toolbar.setComponentAlignment(btClose, Alignment.TOP_RIGHT);

}

From source file:com.esofthead.mycollab.common.ui.components.CommentRowDisplayHandler.java

License:Open Source License

@Override
public Component generateRow(final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout().withSpacing(true).withMargin(false)
            .withWidth("100%").withStyleName("message");

    MVerticalLayout userBlock = new MVerticalLayout().withSpacing(true).withMargin(false).withWidth("80px");
    userBlock.setDefaultComponentAlignment(Alignment.TOP_CENTER);
    ClickListener gotoUser = new ClickListener() {
        private static final long serialVersionUID = 1L;

        @Override/*from www.  j av a 2 s .c  o  m*/
        public void buttonClick(ClickEvent event) {
            EventBusFactory.getInstance().post(new ProjectMemberEvent.GotoRead(this, comment.getCreateduser()));
        }
    };
    Button userAvatarBtn = UserAvatarControlFactory.createUserAvatarButtonLink(comment.getOwnerAvatarId(),
            comment.getOwnerFullName());
    userAvatarBtn.addClickListener(gotoUser);
    userBlock.addComponent(userAvatarBtn);

    Button userName = new Button(comment.getOwnerFullName());
    userName.setStyleName("user-name");
    userName.addStyleName("link");
    userName.addStyleName(UIConstants.WORD_WRAP);
    userName.addClickListener(gotoUser);
    userBlock.addComponent(userName);
    layout.addComponent(userBlock);

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName("message-container");
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout().withSpacing(true)
            .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%")
            .withStyleName("message-header");
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    Label timePostLbl = new Label(
            AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT, comment.getOwnerFullName(),
                    DateTimeUtils.getPrettyDateValue(comment.getCreatedtime(), AppContext.getUserLocale())),
            ContentMode.HTML);
    timePostLbl.setDescription(AppContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName("time-post");
    messageHeader.addComponent(timePostLbl);
    messageHeader.setExpandRatio(timePostLbl, 1.0f);

    // Message delete button
    Button msgDeleteBtn = new Button();
    msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
    msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
    messageHeader.addComponent(msgDeleteBtn);

    if (hasDeletePermission(comment)) {
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(ClickEvent event) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                SiteConfiguration.getSiteName()),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                        AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = ApplicationContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment.getId(), AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    CommentRowDisplayHandler.this.owner.removeRow(layout);
                                }
                            }
                        });
            }
        });
    } else {
        msgDeleteBtn.setVisible(false);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new UrlDetectableLabel(comment.getComment());
    messageContent.setStyleName("message-body");
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withMargin(true)
                .withWidth("100%").withStyleName("message-footer");
        AttachmentDisplayComponent attachmentDisplay = new AttachmentDisplayComponent(attachments);
        attachmentDisplay.setWidth("100%");
        messageFooter.addComponent(attachmentDisplay);
        messageFooter.setComponentAlignment(attachmentDisplay, Alignment.MIDDLE_RIGHT);
        rowLayout.addComponent(messageFooter);
    }

    layout.addComponent(rowLayout);
    layout.setExpandRatio(rowLayout, 1.0f);
    return layout;
}

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

License:Open Source License

@Override
public Component generateRow(final SimpleComment comment, int rowIndex) {
    final MHorizontalLayout layout = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, false, true, false)).withWidth("100%").withStyleName("message");

    UserBlock memberBlock = new UserBlock(comment.getCreateduser(), comment.getOwnerAvatarId(),
            comment.getOwnerFullName());
    layout.addComponent(memberBlock);/*from w  w w . j  a v  a2s  .co m*/

    CssLayout rowLayout = new CssLayout();
    rowLayout.setStyleName("message-container");
    rowLayout.setWidth("100%");

    MHorizontalLayout messageHeader = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, true, false, true)).withWidth("100%")
            .withStyleName("message-header");
    messageHeader.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT,
            comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())),
            ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime()));

    timePostLbl.setSizeUndefined();
    timePostLbl.setStyleName("time-post");
    messageHeader.with(timePostLbl).expand(timePostLbl);

    // Message delete button
    Button msgDeleteBtn = new Button();
    msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
    msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
    messageHeader.addComponent(msgDeleteBtn);

    if (hasDeletePermission(comment)) {
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(Button.ClickEvent event) {
                ConfirmDialogExt.show(UI.getCurrent(),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE,
                                SiteConfiguration.getSiteName()),
                        AppContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                        AppContext.getMessage(GenericI18Enum.BUTTON_YES),
                        AppContext.getMessage(GenericI18Enum.BUTTON_NO), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = ApplicationContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment.getId(), AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    CommentRowDisplayHandler.this.owner.removeRow(layout);
                                }
                            }
                        });
            }
        });
    } else {
        msgDeleteBtn.setVisible(false);
    }

    rowLayout.addComponent(messageHeader);

    Label messageContent = new SafeHtmlLabel(comment.getComment());
    messageContent.setStyleName("message-body");
    rowLayout.addComponent(messageContent);

    List<Content> attachments = comment.getAttachments();
    if (!CollectionUtils.isEmpty(attachments)) {
        MVerticalLayout messageFooter = new MVerticalLayout().withSpacing(false).withWidth("100%")
                .withStyleName("message-footer");
        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.esofthead.mycollab.module.crm.ui.components.CrmActivityComponent.java

License:Open Source License

private Component buildCommentBlock(final SimpleComment comment) {
    final MHorizontalLayout layout = new MHorizontalLayout()
            .withMargin(new MarginInfo(true, false, true, false)).withFullWidth().withStyleName("message");

    ProjectMemberBlock memberBlock = new ProjectMemberBlock(comment.getCreateduser(),
            comment.getOwnerAvatarId(), comment.getOwnerFullName());
    layout.addComponent(memberBlock);/*from   ww  w .  j  a  v a 2  s  .c o  m*/

    MVerticalLayout rowLayout = new MVerticalLayout().withFullWidth().withStyleName("message-container");

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

    ELabel timePostLbl = new ELabel(AppContext.getMessage(GenericI18Enum.EXT_ADDED_COMMENT,
            comment.getOwnerFullName(), AppContext.formatPrettyTime(comment.getCreatedtime())),
            ContentMode.HTML).withDescription(AppContext.formatDateTime(comment.getCreatedtime()));
    timePostLbl.setStyleName(UIConstants.META_INFO);

    if (hasDeletePermission(comment)) {
        Button msgDeleteBtn = new Button();
        msgDeleteBtn.setIcon(FontAwesome.TRASH_O);
        msgDeleteBtn.setStyleName(UIConstants.BUTTON_ICON_ONLY);
        msgDeleteBtn.setVisible(true);
        msgDeleteBtn.addClickListener(new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(Button.ClickEvent event) {
                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), new ConfirmDialog.Listener() {
                            private static final long serialVersionUID = 1L;

                            @Override
                            public void onClose(ConfirmDialog dialog) {
                                if (dialog.isConfirmed()) {
                                    CommentService commentService = AppContextUtil
                                            .getSpringBean(CommentService.class);
                                    commentService.removeWithSession(comment, AppContext.getUsername(),
                                            AppContext.getAccountId());
                                    activityBox.removeComponent(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().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.esofthead.mycollab.module.crm.ui.components.CrmPreviewFormControlsGenerator.java

License:Open Source License

public HorizontalLayout createButtonControls(int buttonEnableFlags, final String permissionItem) {

    layout.setStyleName("control-buttons");
    layout.setSpacing(true);//  w  w w . j av  a  2  s.  c o  m
    layout.setSizeUndefined();

    boolean canRead = true;
    boolean canWrite = true;
    boolean canAccess = true;
    if (permissionItem != null) {
        canRead = AppContext.canRead(permissionItem);
        canWrite = AppContext.canWrite(permissionItem);
        canAccess = AppContext.canAccess(permissionItem);
    }

    MVerticalLayout popupButtonsControl = new MVerticalLayout()
            .withMargin(new MarginInfo(false, true, false, true));

    if ((buttonEnableFlags & ADD_BTN_PRESENTED) == ADD_BTN_PRESENTED) {
        Button addBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_ADD),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireAddForm(item);
                    }
                });
        addBtn.setIcon(FontAwesome.PLUS);
        addBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        addBtn.setEnabled(canWrite);
        layout.addComponent(addBtn);
    }

    if ((buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {
        Button editBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireEditForm(item);
                    }
                });
        editBtn.setIcon(FontAwesome.EDIT);
        editBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        editBtn.setEnabled(canWrite);
        layout.addComponent(editBtn);
    }

    if ((buttonEnableFlags & DELETE_BTN_PRESENTED) == DELETE_BTN_PRESENTED) {
        Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        final T item = previewForm.getBean();
                        previewForm.fireDeleteForm(item);
                    }
                });
        deleteBtn.setIcon(FontAwesome.TRASH_O);
        deleteBtn.setStyleName(UIConstants.THEME_RED_LINK);
        layout.addComponent(deleteBtn);
        deleteBtn.setEnabled(canAccess);
    }

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED) {
        Button cloneBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_CLONE),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        final T item = previewForm.getBean();
                        previewForm.fireCloneForm(item);
                    }
                });
        cloneBtn.setIcon(FontAwesome.ROAD);
        cloneBtn.setStyleName("link");
        popupButtonsControl.addComponent(cloneBtn);
    }

    if ((buttonEnableFlags & HISTORY_BTN_PRESENTED) == HISTORY_BTN_PRESENTED) {
        Button historyBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_HISTORY),
                new Button.ClickListener() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    public void buttonClick(final ClickEvent event) {
                        optionBtn.setPopupVisible(false);
                        previewForm.showHistory();
                    }
                });
        historyBtn.setIcon(FontAwesome.HISTORY);
        historyBtn.setStyleName("link");
        popupButtonsControl.addComponent(historyBtn);
    }

    optionBtn.setContent(popupButtonsControl);

    if ((buttonEnableFlags & CLONE_BTN_PRESENTED) == CLONE_BTN_PRESENTED
            | (buttonEnableFlags & EDIT_BTN_PRESENTED) == EDIT_BTN_PRESENTED) {

        layout.addComponent(optionBtn);
    }

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

    if ((buttonEnableFlags & PREVIOUS_BTN_PRESENTED) == PREVIOUS_BTN_PRESENTED) {
        Button previousItem = new Button(null, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoPrevious(item);
            }
        });
        previousItem.setStyleName(UIConstants.THEME_GREEN_LINK);
        previousItem.setIcon(FontAwesome.CHEVRON_LEFT);
        previousItem.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_PREVIOUS_ITEM));
        navigationBtns.addButton(previousItem);
        previousItem.setEnabled(canRead);
    }

    if ((buttonEnableFlags & NEXT_BTN_PRESENTED) == NEXT_BTN_PRESENTED) {
        Button nextItemBtn = new Button(null, new Button.ClickListener() {
            private static final long serialVersionUID = 1L;

            @Override
            public void buttonClick(final ClickEvent event) {
                final T item = previewForm.getBean();
                previewForm.fireGotoNextItem(item);
            }
        });
        nextItemBtn.setStyleName(UIConstants.THEME_GREEN_LINK);
        nextItemBtn.setIcon(FontAwesome.CHEVRON_RIGHT);
        nextItemBtn.setDescription(AppContext.getMessage(GenericI18Enum.TOOLTIP_SHOW_NEXT_ITEM));
        navigationBtns.addButton(nextItemBtn);
        nextItemBtn.setEnabled(canRead);
    }

    layout.addComponent(navigationBtns);

    return layout;
}

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

License:Open Source License

public RelatedEditItemField(String[] types, Object bean) {
    this.bean = bean;

    relatedItemComboBox = new RelatedItemComboBox(types);
    itemField = new TextField();
    itemField.setEnabled(true);//w  w  w . j a  v a 2 s  . c om

    browseBtn = new Button(null, FontAwesome.ELLIPSIS_H);
    browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    browseBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            String type = (String) relatedItemComboBox.getValue();
            if ("Account".equals(type)) {
                AccountSelectionWindow accountWindow = new AccountSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(accountWindow);
                accountWindow.show();
            } else if ("Campaign".equals(type)) {
                CampaignSelectionWindow campaignWindow = new CampaignSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(campaignWindow);
                campaignWindow.show();
            } else if ("Contact".equals(type)) {
                ContactSelectionWindow contactWindow = new ContactSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(contactWindow);
                contactWindow.show();
            } else if ("Lead".equals(type)) {
                LeadSelectionWindow leadWindow = new LeadSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(leadWindow);
                leadWindow.show();
            } else if ("Opportunity".equals(type)) {
                OpportunitySelectionWindow opportunityWindow = new OpportunitySelectionWindow(
                        RelatedEditItemField.this);
                UI.getCurrent().addWindow(opportunityWindow);
                opportunityWindow.show();
            } else if ("Case".equals(type)) {
                CaseSelectionWindow caseWindow = new CaseSelectionWindow(RelatedEditItemField.this);
                UI.getCurrent().addWindow(caseWindow);
                caseWindow.show();
            } else {
                relatedItemComboBox.focus();
            }
        }
    });

    clearBtn = new Button(null, FontAwesome.TRASH_O);
    clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    clearBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            try {
                PropertyUtils.setProperty(RelatedEditItemField.this.bean, "typeid", null);
            } catch (Exception e) {
                LOG.error("Error while saving type", e);
            }
        }
    });
}

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

License:Open Source License

@Override
protected DefaultMassItemActionHandlersContainer createActionControls() {
    DefaultMassItemActionHandlersContainer container = new DefaultMassItemActionHandlersContainer();

    if (AppContext.canAccess(RolePermissionCollections.CRM_ACCOUNT)) {
        container.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete",
                AppContext.getMessage(GenericI18Enum.BUTTON_DELETE));
    }/*from   w ww  .  j  a  v  a  2 s  .  c  om*/

    container.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail",
            AppContext.getMessage(GenericI18Enum.BUTTON_MAIL));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export",
            "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O,
            "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export",
            "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV));

    if (AppContext.canWrite(RolePermissionCollections.CRM_ACCOUNT)) {
        container.addActionItem(MassItemActionHandler.MASS_UPDATE_ACTION, FontAwesome.DATABASE, "update",
                AppContext.getMessage(GenericI18Enum.TOOLTIP_MASS_UPDATE));
    }

    return container;
}

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

License:Open Source License

@Override
protected Component initContent() {
    MHorizontalLayout layout = new MHorizontalLayout().withWidth("100%");
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    accountName.setNullRepresentation("");
    accountName.setEnabled(true);//  ww w  . j  a  va2s. c  o  m
    accountName.setWidth("100%");

    Button browseBtn = new Button(null, FontAwesome.ELLIPSIS_H);
    browseBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    browseBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING);

    browseBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            AccountSelectionWindow accountWindow = new AccountSelectionWindow(AccountSelectionField.this);
            UI.getCurrent().addWindow(accountWindow);
            accountWindow.show();
        }
    });

    Button clearBtn = new Button(null, FontAwesome.TRASH_O);
    clearBtn.addStyleName(UIConstants.THEME_GRAY_LINK);
    clearBtn.addStyleName(UIConstants.BUTTON_SMALL_PADDING);
    clearBtn.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent clickEvent) {
            clearValue();
        }
    });

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

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

License:Open Source License

@Override
protected DefaultMassItemActionHandlersContainer createActionControls() {
    DefaultMassItemActionHandlersContainer container = new DefaultMassItemActionHandlersContainer();
    if (AppContext.canAccess(RolePermissionCollections.CRM_CALL)
            || AppContext.canAccess(RolePermissionCollections.CRM_MEETING)
            || AppContext.canAccess(RolePermissionCollections.CRM_TASK)) {

        container.addActionItem(MassItemActionHandler.DELETE_ACTION, FontAwesome.TRASH_O, "delete",
                AppContext.getMessage(GenericI18Enum.BUTTON_DELETE));
    }/*from   ww  w. j  a v a 2 s .  c om*/

    container.addActionItem(MassItemActionHandler.MAIL_ACTION, FontAwesome.ENVELOPE_O, "mail",
            AppContext.getMessage(GenericI18Enum.BUTTON_MAIL));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_PDF_ACTION, FontAwesome.FILE_PDF_O, "export",
            "export.pdf", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_PDF));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_EXCEL_ACTION, FontAwesome.FILE_EXCEL_O,
            "export", "export.xlsx", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_EXCEL));

    container.addDownloadActionItem(MassItemActionHandler.EXPORT_CSV_ACTION, FontAwesome.FILE_TEXT_O, "export",
            "export.csv", AppContext.getMessage(GenericI18Enum.BUTTON_EXPORT_CSV));

    return container;
}

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

License:Open Source License

public CallTableDisplay(TableViewField requireColumn, List<TableViewField> displayColumns) {
    super(ApplicationContextUtil.getSpringBean(CallService.class), SimpleCall.class, requireColumn,
            displayColumns);//from   w w  w. j av a 2 s .  c o  m

    this.addGeneratedColumn("subject", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);

            LabelLink b = new LabelLink(call.getSubject(),
                    CrmLinkBuilder.generateCallPreviewLinkFul(call.getId()));

            if ("Held".equals(call.getStatus())) {
                b.addStyleName(UIConstants.LINK_COMPLETED);
            }
            return b;

        }
    });

    this.addGeneratedColumn("isClosed", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);
            Button b = new Button(null, new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override
                public void buttonClick(Button.ClickEvent event) {
                    fireTableEvent(new TableClickEvent(CallTableDisplay.this, call, "isClosed"));
                }
            });
            b.setIcon(FontAwesome.TRASH_O);
            b.setStyleName("link");
            b.setDescription("Close this call");
            return b;

        }
    });

    this.addGeneratedColumn("startdate", new Table.ColumnGenerator() {
        private static final long serialVersionUID = 1L;

        @Override
        public com.vaadin.ui.Component generateCell(Table source, final Object itemId, Object columnId) {
            final SimpleCall call = CallTableDisplay.this.getBeanByIndex(itemId);
            return new Label(AppContext.formatDateTime(call.getStartdate()));

        }
    });
}