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.mechanicshop.components.MaintenanceLayout.java

private void buildLayout() {
    HorizontalLayout layoutTitle = new HorizontalLayout();
    layoutTitle.setSizeUndefined();/*w ww.  j  av  a 2 s .co  m*/
    layoutTitle.setWidth("100%");
    layoutTitle.setSpacing(false);
    layoutTitle.setMargin(false);
    titleLabel.addStyleName(ValoTheme.LABEL_H2);
    titleLabel.addStyleName(ValoTheme.LABEL_COLORED);
    titleLabel.addStyleName(ValoTheme.LABEL_NO_MARGIN);
    titleLabel.addStyleName(ValoTheme.LABEL_BOLD);
    titleLabel.setSizeUndefined();

    layoutTitle.addComponent(titleLabel);
    layoutTitle.setComponentAlignment(titleLabel, Alignment.MIDDLE_CENTER);

    VerticalLayout layoutTable = new VerticalLayout();

    layoutTable.setSizeFull();

    layoutTable.setSpacing(true);
    HorizontalLayout layoutButtons = new HorizontalLayout();
    layoutButtons.setMargin(false);
    layoutButtons.setSpacing(true);
    layoutButtons.setSizeUndefined();
    Button passwordBtn = new Button("Edit Password");
    passwordBtn.addClickListener(passwordListener);
    passwordBtn.setImmediate(true);
    passwordBtn.setIcon(FontAwesome.EDIT);
    passwordBtn.setStyleName(ValoTheme.BUTTON_TINY);
    Button media1Btn = new Button("Media 1 Default Text");
    media1Btn.setStyleName(ValoTheme.BUTTON_TINY);
    media1Btn.setImmediate(true);
    media1Btn.setIcon(FontAwesome.EDIT);
    media1Btn.addClickListener(media1Listener);
    Button media2Btn = new Button("Media 2 Default Text");
    media2Btn.setStyleName(ValoTheme.BUTTON_TINY);
    media2Btn.setImmediate(true);
    media2Btn.setIcon(FontAwesome.EDIT);
    media2Btn.addClickListener(media2Listener);
    layoutButtons.addComponents(passwordBtn, media1Btn, media2Btn);

    layoutButtons.setComponentAlignment(passwordBtn, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(media1Btn, Alignment.MIDDLE_LEFT);
    layoutButtons.setComponentAlignment(media2Btn, Alignment.MIDDLE_LEFT);

    addComponent(layoutTitle);
    addComponent(layoutTable);
    layoutTable.addComponent(layoutButtons);
    layoutTable.addComponent(table);
    layoutTable.setComponentAlignment(table, Alignment.TOP_CENTER);
    layoutTable.setExpandRatio(table, 3);
    setComponentAlignment(layoutTitle, Alignment.TOP_CENTER);
    setComponentAlignment(layoutTable, Alignment.TOP_CENTER);
    setExpandRatio(layoutTable, 3);
    setSpacing(true);
    setMargin(true);

}

From source file:com.mycollab.mobile.module.project.view.bug.BugReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleBug> formControlsGenerator = new ProjectPreviewFormControlsGenerator<>(
            previewForm);/*from ww w. java2s.  c  o m*/
    bugWorkFlowControl = new MVerticalLayout().withMargin(false).withFullWidth();
    formControlsGenerator.insertToControlBlock(bugWorkFlowControl);
    VerticalLayout formControls = formControlsGenerator.createButtonControls(
            ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED,
            ProjectRolePermissionCollections.BUGS);
    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance().post(new BugEvent.GotoEdit(this, beanItem)))
                    .withIcon(FontAwesome.EDIT).withStyleName(UIConstants.CIRCLE_BOX)
                    .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS));
    return new MHorizontalLayout(editBtn, new NavigationBarQuickMenu(formControls));
}

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

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleMilestone> formControlsGenerator = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//from   ww  w .  j  a va 2 s  . c  o  m
    final VerticalLayout formControls = formControlsGenerator.createButtonControls(
            ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED,
            ProjectRolePermissionCollections.MILESTONES);
    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance().post(new MilestoneEvent.GotoEdit(this, beanItem)))
                    .withIcon(FontAwesome.EDIT).withStyleName(UIConstants.CIRCLE_BOX)
                    .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.MILESTONES));
    return new MHorizontalLayout(editBtn, new NavigationBarQuickMenu(formControls));
}

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));
                        }/*  w ww. ja  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.mobile.module.project.view.task.TaskReadViewImpl.java

License:Open Source License

@Override
protected ComponentContainer createButtonControls() {
    ProjectPreviewFormControlsGenerator<SimpleTask> taskPreviewForm = new ProjectPreviewFormControlsGenerator<>(
            previewForm);//  w ww  . j  av a 2  s. c o m
    final VerticalLayout formControls = taskPreviewForm.createButtonControls(
            ProjectPreviewFormControlsGenerator.CLONE_BTN_PRESENTED
                    | ProjectPreviewFormControlsGenerator.DELETE_BTN_PRESENTED,
            ProjectRolePermissionCollections.TASKS);

    quickActionStatusBtn = new Button("", clickEvent -> {
        if (beanItem.getStatus() != null && beanItem.getStatus().equals(StatusI18nEnum.Closed.name())) {
            beanItem.setStatus(StatusI18nEnum.Open.name());
            beanItem.setPercentagecomplete(0d);
            TaskReadViewImpl.this.removeStyleName(MobileUIConstants.STATUS_DISABLED);
            quickActionStatusBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.BUTTON_CLOSE));
        } else {
            beanItem.setStatus(StatusI18nEnum.Closed.name());
            beanItem.setPercentagecomplete(100d);
            TaskReadViewImpl.this.addStyleName(MobileUIConstants.STATUS_DISABLED);
            quickActionStatusBtn.setCaption(UserUIContext.getMessage(GenericI18Enum.BUTTON_REOPEN));
        }

        ProjectTaskService service = AppContextUtil.getSpringBean(ProjectTaskService.class);
        service.updateWithSession(beanItem, UserUIContext.getUsername());
    });
    quickActionStatusBtn.setWidth("100%");

    taskPreviewForm.insertToControlBlock(quickActionStatusBtn);

    if (!CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS)) {
        quickActionStatusBtn.setEnabled(false);
    }

    MButton editBtn = new MButton("",
            clickEvent -> EventBusFactory.getInstance().post(new TaskEvent.GotoEdit(this, beanItem)))
                    .withIcon(FontAwesome.EDIT).withStyleName(UIConstants.CIRCLE_BOX)
                    .withVisible(CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS));
    return new MHorizontalLayout(editBtn, new NavigationBarQuickMenu(formControls));
}

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 w w w .j  av  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.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);
        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();
                        }/*from  w  w  w . j  a va  2s .co  m*/
                    });
        }).withIcon(FontAwesome.TRASH_O);
        filterBtnLayout.addDangerOption(deleteBtn);
    }

    return filterBtnLayout;
}

From source file:com.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  w w  .j av a  2s  .  co  m*/
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        this.addStyleName("editable-field");
        MButton instantEditBtn = new MButton("", 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(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ONLY,
                ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription("Edit task name");
        buttonControls.with(instantEditBtn);
        this.addComponent(buttonControls);
    }
}

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

License:Open Source License

public ToggleBugSummaryField(final BugWithBLOBs bug, int trimCharacters) {
    this.bug = bug;
    this.maxLength = trimCharacters;
    titleLinkLbl = ELabel.html(buildBugLink()).withStyleName(UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    this.addComponent(titleLinkLbl);
    buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
    if (CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS)) {
        this.addStyleName("editable-field");
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleBugSummaryField.this.removeComponent(titleLinkLbl);
                ToggleBugSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(bug.getName());
                editField.setWidth("100%");
                editField.focus();/*from w ww.  j  av a 2 s.  c o  m*/
                ToggleBugSummaryField.this.addComponent(editField);
                ToggleBugSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withDescription(UserUIContext.getMessage(BugI18nEnum.OPT_EDIT_BUG_NAME)).withIcon(FontAwesome.EDIT)
                .withStyleName(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_ICON_ALIGN_TOP);
        buttonControls.with(instantEditBtn);
        this.addComponent(buttonControls);
    }
}

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

License:Open Source License

ToggleGenericTaskSummaryField(final ProjectGenericTask genericTask) {
    this.genericTask = genericTask;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildGenericTaskLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    this.addComponent(titleLinkLbl);
    if ((genericTask.isTask() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.TASKS))
            || (genericTask.isBug() && CurrentProjectVariables.canWrite(ProjectRolePermissionCollections.BUGS))
            || (genericTask.isRisk()//from   w  w w.  j a v a  2s.  c o  m
                    && 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);
    }
}