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

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

Introduction

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

Prototype

String BUTTON_ICON_ALIGN_TOP

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

Click Source Link

Document

Stack the icon on top of the button caption.

Usage

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);/*from  ww  w  .  ja  v a  2 s .  co 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);
}

From source file:com.mycollab.module.project.view.ticket.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(WebThemes.LINK_COMPLETED);
    } else if (ticket.isOverdue()) {
        titleLinkLbl.addStyleName(WebThemes.LINK_OVERDUE);
    }//from  w  w  w .  j a v  a  2s .c  om
    this.addComponent(titleLinkLbl);
    if (CurrentProjectVariables.canWriteTicket(ticket)) {
        this.addStyleName("editable-field");
        buttonControls = new MHorizontalLayout().withMargin(new MarginInfo(false, false, false, true))
                .withStyleName("toggle");
        buttonControls.setDefaultComponentAlignment(Alignment.TOP_LEFT);
        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_ALIGN_TOP);
        instantEditBtn.setDescription(UserUIContext.getMessage(GenericI18Enum.ACTION_CLICK_TO_EDIT));
        buttonControls.with(instantEditBtn);

        if ((ticket.isRisk() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.RISKS))
                || (ticket.isBug() && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.BUGS))
                || (ticket.isTask()
                        && CurrentProjectVariables.canAccess(ProjectRolePermissionCollections.TASKS))) {
            MButton removeBtn = 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 -> {
                            if (confirmDialog.isConfirmed()) {
                                AppContextUtil.getSpringBean(ProjectTicketService.class).removeTicket(ticket,
                                        UserUIContext.getUsername());
                                BlockRowRender rowRenderer = UIUtils.getRoot(ToggleTicketSummaryField.this,
                                        BlockRowRender.class);
                                if (rowRenderer != null) {
                                    rowRenderer.selfRemoved();
                                }
                                EventBusFactory.getInstance()
                                        .post(new TicketEvent.HasTicketPropertyChanged(this, "all"));
                            }
                        });
            }).withIcon(FontAwesome.TRASH).withStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
            buttonControls.with(removeBtn);
        }

        this.addComponent(buttonControls);
    }
}

From source file:org.jumpmind.metl.ui.views.design.EditFlowPalette.java

License:Open Source License

protected void addItemToFlowPanelSection(String labelName, String componentType, VerticalLayout componentLayout,
        ClassResource icon, String componentId) {

    FlowPaletteItem paletteItem = new FlowPaletteItem(labelName);
    if (componentId != null) {
        paletteItem.setShared(true);/*from  ww w.j a  v a2s .c om*/
        paletteItem.setComponentId(componentId);
    } else {
        paletteItem.setComponentType(componentType);
        paletteItem.setShared(false);
    }
    paletteItem.setIcon(icon);
    paletteItem.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    paletteItem.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    paletteItem.addStyleName("leftAligned");
    paletteItem.setWidth(100, Unit.PERCENTAGE);
    DragAndDropWrapper wrapper = new DragAndDropWrapper(paletteItem);
    wrapper.setSizeUndefined();
    wrapper.setDragStartMode(DragStartMode.WRAPPER);
    componentLayout.addComponent(wrapper);
    componentLayout.setComponentAlignment(wrapper, Alignment.TOP_CENTER);

}

From source file:org.jumpmind.metl.ui.views.design.EditFlowPanel.java

License:Open Source License

protected Button createToolButton(String name, Resource icon) {
    Button button = new Button(name, icon);
    button.addStyleName(ValoTheme.BUTTON_SMALL);
    button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    return button;
}

From source file:org.lucidj.iconlist.renderer.IconListRenderer.java

License:Apache License

private AbstractComponent create_icon(Map<String, Object> component) {
    String icon_title = (String) component.get("iconTitle");

    if (icon_title == null) {
        icon_title = "No title";
    }//ww w  . j  a v  a  2s  .  c  om

    Resource icon_resource = iconHelper.getIcon((String) component.get("iconUrl"), 32);

    Button button_icon = new Button(icon_title);
    button_icon.setIcon(icon_resource);
    button_icon.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button_icon.addStyleName(ValoTheme.BUTTON_SMALL);
    button_icon.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    button_icon.addStyleName("x-icon-button");
    button_icon.addStyleName("icon-size-32");
    button_icon.addClickListener(this);
    button_icon.setWidthUndefined();
    button_caption_wrap(button_icon);

    // Put the component in a D&D wrapper and allow dragging it
    final DragAndDropWrapper icon_dd_wrap = new DragAndDropWrapper(button_icon);
    icon_dd_wrap.setDragStartMode(DragAndDropWrapper.DragStartMode.COMPONENT);

    // Set the wrapper to wrap tightly around the component
    icon_dd_wrap.setSizeUndefined();
    icon_dd_wrap.setData(component);

    // Set ID for drag-drop AND on the Label for double-click
    if (component.containsKey("entryId")) {
        String entryId = (String) component.get("entryId");
        icon_dd_wrap.setId(entryId);
        button_icon.setId(entryId);
    }

    // Component data is the map itself
    button_icon.setData(component);

    // Remember this association
    component_to_vaadin.put(component, icon_dd_wrap);
    return (icon_dd_wrap);
}

From source file:org.opencms.ui.apps.CmsDefaultAppButtonProvider.java

License:Open Source License

/**
 * Creates an icon button.<p>//from   w ww.java  2  s. c o m
 *
 * @param name the name
 * @param description the description
 * @param icon the icon
 * @param buttonStyle the button style
 *
 * @return the created button
 */
public static Button createIconButton(String name, String description, Resource icon, String buttonStyle) {

    Button button = new Button(name);
    button.setIcon(icon, name);
    button.setDescription(description);
    button.addStyleName(OpenCmsTheme.APP_BUTTON);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    button.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    button.addStyleName(buttonStyle);
    return button;
}

From source file:org.opencms.ui.apps.scheduler.CmsJobMainView.java

License:Open Source License

/**
 * Creates a new instance.<p>//  w  w w . j  a  va 2s  . c  om
 *
 * @param context the app context.
 */
public CmsJobMainView(I_CmsAppUIContext context) {

    m_appContext = context;
    CmsVaadinUtils.readAndLocalizeDesign(this, CmsVaadinUtils.getWpMessagesForCurrentLocale(), null);
    m_jobTable.setJobEditHandler(this);
    m_buttonAddJob.addStyleName(ValoTheme.BUTTON_ICON_ALIGN_TOP);
    m_buttonAddJob.addStyleName(ValoTheme.BUTTON_BORDERLESS);
    m_buttonAddJob.setIcon(new ExternalResource(OpenCmsTheme.getImageLink("scheduler/scheduler_big_add.png")));
    m_buttonAddJob.addClickListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {

            CmsScheduledJobInfo jobInfo = new CmsScheduledJobInfo();
            jobInfo.setContextInfo(new CmsContextInfo());
            editJob(jobInfo,
                    CmsVaadinUtils.getMessageText(org.opencms.ui.Messages.GUI_SCHEDULER_TITLE_CREATE_0));

        }
    });

}