Example usage for com.vaadin.server FontAwesome EDIT

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

Introduction

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

Prototype

FontAwesome EDIT

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

Click Source Link

Usage

From source file:com.anphat.customer.controller.CustomerContactController.java

private void addEditButtonForTableCareCust() {
    panelTblHistory.getMainTable().addGeneratedColumn("btnEdit", new CustomTable.ColumnGenerator() {
        @Override/*from  w ww  .  j a  va 2  s  .c o m*/
        public Object generateCell(CustomTable source, Object itemId, Object columnId) {
            final CustomerCareHistoryDTO editDTO = (CustomerCareHistoryDTO) itemId;
            Button btnEdit = new Button();
            btnEdit.addStyleName("v-button-link");
            btnEdit.setIcon(FontAwesome.EDIT);
            //                btnEdit.setCaption("Sa");
            btnEdit.addClickListener(new Button.ClickListener() {
                @Override
                public void buttonClick(Button.ClickEvent event) {
                    CustomerContactDialog contactDialog = new CustomerContactDialog(
                            BundleUtils.getString("customerCareHistoryForm"), lstCustomerServiceStatus,
                            lstCustContact);
                    contactDialog.fillData2Dialog(editDTO);
                    contactDialog.setIsEdit(Boolean.TRUE);
                    UI.getCurrent().addWindow(contactDialog);
                    addListenerBtnSaveContactWhenEditCare(contactDialog, editDTO);
                    event.getButton().setEnabled(true);
                }
            });
            return btnEdit;
        }
    });
}

From source file:com.dungnv.streetfood.ui.ArticleItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }/*ww  w  .  j av  a2  s.c  om*/
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getTitle());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbIntroduce = new Label(item.getShortContent());
    lbIntroduce.setStyleName("lb-description");
    vlInfo.addComponent(lbIntroduce);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.CategoryItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }//  ww w . ja  v a 2s .  c  o m
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    if ("1".equals(item.getCategoryStatus())) {
        lbTitle.addStyleName("lb-status-active");
    } else {
        lbTitle.addStyleName("lb-status-inActive");
    }
    vlInfo.addComponent(lbTitle);

    lbDesc = new Label(item.getDescription());
    lbDesc.setStyleName("lb-description");
    vlInfo.addComponent(lbDesc);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getCategoryStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.DishItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }//  w  w w  .  j a v  a2  s .c  o m
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbDesc = new Label(item.getShortDescription());
    lbDesc.setStyleName("lb-description");
    vlInfo.addComponent(lbDesc);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getDishStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.RestaurantItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }//from   w  ww.j a  v a 2s  .c om
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbIntroduce = new Label(item.getAddress());
    lbIntroduce.setStyleName("lb-description");
    vlInfo.addComponent(lbIntroduce);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnLock = new Button();
    if ("1".equals(item.getRestaurantStatus())) {
        btnLock.setIcon(FontAwesome.LOCK);
    } else {
        btnLock.setIcon(FontAwesome.UNLOCK);
    }

    btnLock.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLock.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLock.setWidth("25px");
    btnLock.setHeight("25px");
    htToolBar.addComponent(btnLock);
    htToolBar.setComponentAlignment(btnLock, Alignment.BOTTOM_RIGHT);

    btnLink = new Button();
    btnLink.setIcon(FontAwesome.LINK);
    btnLink.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnLink.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnLink.setWidth("25px");
    btnLink.setHeight("25px");
    htToolBar.addComponent(btnLink);
    htToolBar.setComponentAlignment(btnLink, Alignment.BOTTOM_RIGHT);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

From source file:com.dungnv.streetfood.ui.SlideShowItemUI.java

private void init() {
    this.addStyleName("item-interator");
    this.setSpacing(true);
    this.setWidth("100%");

    CssLayout horizontal = new CssLayout();
    horizontal.setStyleName("padding-5");
    horizontal.setWidth("100%");
    Responsive.makeResponsive(horizontal);
    this.addComponent(horizontal);

    Image imag = new Image();
    if (!StringUtils.isNullOrEmpty(item.getImageUrl())) {
        imag.setSource(new ExternalResource(item.getImageUrl()));
    }/*from   w w w .  j av a2  s.  co  m*/
    horizontal.addComponent(imag);

    VerticalLayout vlInfo = new VerticalLayout();
    vlInfo.setStyleName("padding-5");
    vlInfo.setWidth("70%");

    horizontal.addComponent(vlInfo);

    lbTitle = new Label(item.getName());
    lbTitle.addStyleName("lb-title");
    vlInfo.addComponent(lbTitle);

    lbIntroduce = new Label(item.getDescription());
    lbIntroduce.setStyleName("lb-description");
    vlInfo.addComponent(lbIntroduce);

    HorizontalLayout htInfo = new HorizontalLayout();
    vlInfo.addComponent(htInfo);

    lbInfo = new Label();
    lbInfo.setCaptionAsHtml(true);
    htInfo.addComponent(lbInfo);

    HorizontalLayout htToolBar = new HorizontalLayout();
    htToolBar.setStyleName("lb-toolbar");
    horizontal.addComponent(htToolBar);

    btnEdit = new Button();
    btnEdit.setIcon(FontAwesome.EDIT);
    btnEdit.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnEdit.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnEdit.setWidth("25px");
    btnEdit.setHeight("25px");
    htToolBar.addComponent(btnEdit);
    htToolBar.setComponentAlignment(btnEdit, Alignment.BOTTOM_RIGHT);

    btnDelete = new Button();
    btnDelete.setIcon(FontAwesome.TIMES);
    btnDelete.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    btnDelete.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    btnDelete.setWidth("25px");
    btnDelete.setHeight("25px");
    htToolBar.addComponent(btnDelete);
    htToolBar.setComponentAlignment(btnDelete, Alignment.BOTTOM_RIGHT);
}

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);//ww w. j av a 2  s  . c  om
    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.project.view.bug.components.BugRowComponent.java

License:Open Source License

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

    Button editButton = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_EDIT),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

                @Override/*w w  w .  ja  v  a  2s  .  c  o  m*/
                public void buttonClick(Button.ClickEvent event) {
                    bugSettingPopupBtn.setPopupVisible(false);
                    EventBusFactory.getInstance().post(new BugEvent.GotoEdit(BugRowComponent.this, bug));
                }
            });
    editButton.setEnabled(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    editButton.setIcon(FontAwesome.EDIT);
    filterBtnLayout.addOption(editButton);
    Button deleteBtn = new Button(AppContext.getMessage(GenericI18Enum.BUTTON_DELETE),
            new Button.ClickListener() {
                private static final long serialVersionUID = 1L;

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

                                @Override
                                public void onClose(ConfirmDialog dialog) {
                                    if (dialog.isConfirmed()) {
                                        BugService bugService = AppContextUtil.getSpringBean(BugService.class);
                                        bugService.removeWithSession(bug, AppContext.getUsername(),
                                                AppContext.getAccountId());
                                        deleteBug();
                                    }
                                }
                            });
                }
            });
    deleteBtn.setIcon(FontAwesome.TRASH_O);
    deleteBtn.setEnabled(CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS));
    filterBtnLayout.addDangerOption(deleteBtn);
    return filterBtnLayout;
}

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

License:Open Source License

public ToggleBugSummaryField(final BugWithBLOBs bug, int trimCharacters) {
    this.bug = bug;
    this.maxLength = trimCharacters;
    titleLinkLbl = new Label(buildBugLink(), ContentMode.HTML);
    titleLinkLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
    titleLinkLbl.setWidthUndefined();/*from w ww  .  j a v a  2 s.c om*/
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        this.addStyleName("editable-field");
        Button instantEditBtn = new Button(null, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (isRead) {
                    ToggleBugSummaryField.this.removeComponent(titleLinkLbl);
                    ToggleBugSummaryField.this.removeComponent(buttonControls);
                    final TextField editField = new TextField();
                    editField.setValue(bug.getSummary());
                    editField.setWidth("100%");
                    editField.focus();
                    ToggleBugSummaryField.this.addComponent(editField);
                    ToggleBugSummaryField.this.removeStyleName("editable-field");
                    editField.addValueChangeListener(new Property.ValueChangeListener() {
                        @Override
                        public void valueChange(Property.ValueChangeEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    editField.addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    isRead = !isRead;
                }
            }
        });
        instantEditBtn.setDescription("Edit task name");
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setIcon(FontAwesome.EDIT);
        buttonControls.with(instantEditBtn);
        this.addComponent(buttonControls);
    }
}

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

License:Open Source License

ToggleGenericTaskSummaryField(final ProjectGenericTask genericTask) {
    this.genericTask = genericTask;
    this.setWidth("100%");
    titleLinkLbl = new ELabel(buildGenericTaskLink(), ContentMode.HTML).withWidthUndefined();
    titleLinkLbl.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLinkLbl.addStyleName(UIConstants.LABEL_WORD_WRAP);
    this.addComponent(titleLinkLbl);
    if ((genericTask.isTask() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS))
            || (genericTask.isBug() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS))
            || (genericTask.isRisk()/*from   ww  w  . ja  v a  2 s  .  c om*/
                    && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.RISKS))) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
        Button instantEditBtn = new Button(null, new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent clickEvent) {
                if (isRead) {
                    removeComponent(titleLinkLbl);
                    removeComponent(buttonControls);
                    final TextField editField = new TextField();
                    editField.setValue(genericTask.getName());
                    editField.setWidth("100%");
                    editField.focus();
                    addComponent(editField);
                    removeStyleName("editable-field");
                    editField.addValueChangeListener(new Property.ValueChangeListener() {
                        @Override
                        public void valueChange(Property.ValueChangeEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    editField.addBlurListener(new FieldEvents.BlurListener() {
                        @Override
                        public void blur(FieldEvents.BlurEvent event) {
                            updateFieldValue(editField);
                        }
                    });
                    isRead = !isRead;
                }
            }
        });
        instantEditBtn.setDescription("Edit task name");
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
        instantEditBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setIcon(FontAwesome.EDIT);
        buttonControls.with(instantEditBtn);

        this.addComponent(buttonControls);
    }
}