Example usage for com.vaadin.ui.themes ValoTheme BUTTON_ICON_ONLY

List of usage examples for com.vaadin.ui.themes ValoTheme BUTTON_ICON_ONLY

Introduction

In this page you can find the example usage for com.vaadin.ui.themes ValoTheme BUTTON_ICON_ONLY.

Prototype

String BUTTON_ICON_ONLY

To view the source code for com.vaadin.ui.themes ValoTheme BUTTON_ICON_ONLY.

Click Source Link

Document

Only show the icon in the button, and size the button to a square shape.

Usage

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

License:Open Source License

public ToggleBugSummaryWithDependentField(final BugWithBLOBs hostBug, final BugWithBLOBs relatedBug) {
    toggleBugSummaryField = new ToggleBugSummaryField(relatedBug);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        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 -> {
                    RelatedBugExample ex = new RelatedBugExample();
                    ex.createCriteria().andBugidEqualTo(hostBug.getId())
                            .andRelatedidEqualTo(relatedBug.getId());
                    RelatedBugMapper bugMapper = AppContextUtil.getSpringBean(RelatedBugMapper.class);
                    bugMapper.deleteByExample(ex);
                    UIUtils.removeChildAssociate(toggleBugSummaryField, RemoveInlineComponentMarker.class);
                });/*  ww  w  .  j  a  v  a  2s  .  c  o  m*/
    });
    unlinkBtn.setIcon(FontAwesome.UNLINK);
    unlinkBtn.setDescription("Remove relationship");
    unlinkBtn.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    unlinkBtn.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    toggleBugSummaryField.addControl(unlinkBtn);
}

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 a  v 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.bug.ToggleBugSummaryWithDependentField.java

License:Open Source License

public ToggleBugSummaryWithDependentField(final BugWithBLOBs hostBug, final BugWithBLOBs relatedBug) {
    toggleBugSummaryField = new ToggleBugSummaryField(relatedBug);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        ConfirmDialogExt.show(UI.getCurrent(),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_TITLE, MyCollabUI.getSiteName()),
                UserUIContext.getMessage(GenericI18Enum.DIALOG_DELETE_SINGLE_ITEM_MESSAGE),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_YES),
                UserUIContext.getMessage(GenericI18Enum.BUTTON_NO), confirmDialog -> {
                    RelatedBugExample ex = new RelatedBugExample();
                    ex.createCriteria().andBugidEqualTo(hostBug.getId())
                            .andRelatedidEqualTo(relatedBug.getId());
                    RelatedBugMapper bugMapper = AppContextUtil.getSpringBean(RelatedBugMapper.class);
                    bugMapper.deleteByExample(ex);
                    UIUtils.removeChildAssociate(toggleBugSummaryField, RemoveInlineComponentMarker.class);
                });//from www  . ja  v a  2  s . c o m
    }).withIcon(FontAwesome.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP, ValoTheme.BUTTON_ICON_ONLY)
            .withDescription(UserUIContext.getMessage(BugI18nEnum.OPT_REMOVE_RELATIONSHIP));
    toggleBugSummaryField.addControl(unlinkBtn);
}

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()//w w w .j  av  a2s  . 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);
    }
}

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

License:Open Source License

public ToggleTicketSummaryField(final ProjectTicket ticket) {
    this.ticket = ticket;
    this.setWidth("100%");
    titleLinkLbl = ELabel.html(buildTicketLink())
            .withStyleName(ValoTheme.LABEL_NO_MARGIN, UIConstants.LABEL_WORD_WRAP).withWidthUndefined();
    if (ticket.isClosed()) {
        titleLinkLbl.addStyleName(WebUIConstants.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebUIConstants.LINK_OVERDUE);
    }//from  www.  java  2s. c o  m
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withStyleName("toggle").withSpacing(false);
        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                removeComponent(titleLinkLbl);
                removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(ticket.getName());
                editField.setWidth("100%");
                editField.focus();
                addComponent(editField);
                removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_ONLY,
                ValoTheme.BUTTON_ICON_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        this.addComponent(buttonControls);
    }
}

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

License:Open Source License

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

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

        MButton instantEditBtn = new MButton("", clickEvent -> {
            if (isRead) {
                ToggleTaskSummaryField.this.removeComponent(titleLinkLbl);
                ToggleTaskSummaryField.this.removeComponent(buttonControls);
                final TextField editField = new TextField();
                editField.setValue(task.getTaskname());
                editField.setWidth("100%");
                editField.focus();// ww  w .j a  v  a2s  .c  om
                ToggleTaskSummaryField.this.addComponent(editField);
                ToggleTaskSummaryField.this.removeStyleName("editable-field");
                editField.addValueChangeListener(valueChangeEvent -> updateFieldValue(editField));
                editField.addBlurListener(blurEvent -> updateFieldValue(editField));
                isRead = !isRead;
            }
        }).withIcon(FontAwesome.EDIT).withStyleName(ValoTheme.BUTTON_ICON_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.task.components.ToggleTaskSummaryWithChildRelationshipField.java

License:Open Source License

public ToggleTaskSummaryWithChildRelationshipField(final SimpleTask parentTask, final SimpleTask childTask) {
    toggleTaskSummaryField = new ToggleTaskSummaryField(parentTask);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        childTask.setParenttaskid(null);
        ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
        taskService.updateWithSession(childTask, AppContext.getUsername());
        UIUtils.removeChildAssociate(ToggleTaskSummaryWithChildRelationshipField.this,
                RemoveInlineComponentMarker.class);
    }).withIcon(FontAwesome.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_ICON_ALIGN_TOP);
    unlinkBtn.setDescription("Remove parent-child relationship");
    toggleTaskSummaryField.addControl(unlinkBtn);
}

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

License:Open Source License

public ToggleTaskSummaryWithParentRelationshipField(final SimpleTask task) {
    toggleTaskSummaryField = new ToggleTaskSummaryField(task);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        task.setParenttaskid(null);/*  w w w  . j a  v a2  s  .  c  om*/
        ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
        taskService.updateWithSession(task, AppContext.getUsername());
        UIUtils.removeChildAssociate(ToggleTaskSummaryWithParentRelationshipField.this,
                RemoveInlineComponentMarker.class);
    }).withIcon(FontAwesome.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP, ValoTheme.BUTTON_ICON_ONLY);
    unlinkBtn.setDescription("Remove parent-child relationship");
    toggleTaskSummaryField.addControl(unlinkBtn);
}

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

License:Open Source License

public ToggleTaskSummaryWithChildRelationshipField(final SimpleTask parentTask, final SimpleTask childTask) {
    toggleTaskSummaryField = new ToggleTaskSummaryField(parentTask, false);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        childTask.setParenttaskid(null);
        ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
        taskService.updateWithSession(childTask, UserUIContext.getUsername());
        UIUtils.removeChildAssociate(ToggleTaskSummaryWithChildRelationshipField.this,
                RemoveInlineComponentMarker.class);
    }).withIcon(FontAwesome.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ONLY, ValoTheme.BUTTON_ICON_ALIGN_TOP)
            .withDescription(UserUIContext.getMessage(TaskI18nEnum.OPT_REMOVE_PARENT_CHILD_RELATIONSHIP));

    toggleTaskSummaryField.addControl(unlinkBtn);
}

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

License:Open Source License

public ToggleTaskSummaryWithParentRelationshipField(final SimpleTask task) {
    toggleTaskSummaryField = new ToggleTaskSummaryField(task, false);
    MButton unlinkBtn = new MButton("", clickEvent -> {
        task.setParenttaskid(null);/*w  w  w  .j a  v a 2  s  . c o  m*/
        ProjectTaskService taskService = AppContextUtil.getSpringBean(ProjectTaskService.class);
        taskService.updateWithSession(task, UserUIContext.getUsername());
        UIUtils.removeChildAssociate(ToggleTaskSummaryWithParentRelationshipField.this,
                RemoveInlineComponentMarker.class);
    }).withIcon(FontAwesome.UNLINK).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP, ValoTheme.BUTTON_ICON_ONLY)
            .withDescription(UserUIContext.getMessage(TaskI18nEnum.OPT_REMOVE_PARENT_CHILD_RELATIONSHIP));
    toggleTaskSummaryField.addControl(unlinkBtn);
}