Example usage for com.vaadin.ui Button setWidthUndefined

List of usage examples for com.vaadin.ui Button setWidthUndefined

Introduction

In this page you can find the example usage for com.vaadin.ui Button setWidthUndefined.

Prototype

@Override
    public void setWidthUndefined() 

Source Link

Usage

From source file:com.save.employee.maintenance.MRUI.java

public MRUI(int employeeId) {
    this.employeeId = employeeId;

    setWidth("90%");
    setHeight("100%");
    setMargin(new MarginInfo(true, false, false, false));

    MRDataGridProperties dataGrid = new MRDataGridProperties(getEmployeeId());

    Button mrForm = new Button("Maintenance/Reimbursement Form");
    mrForm.setWidthUndefined();
    mrForm.setIcon(FontAwesome.OPENID);/*from   ww  w .  j  a  v  a  2s.c  om*/
    mrForm.addStyleName(ValoTheme.BUTTON_SMALL);
    mrForm.addStyleName(ValoTheme.BUTTON_LINK);
    mrForm.addClickListener((Button.ClickEvent event) -> {
        Window sub = new MRFormWindow(getEmployeeId());
        if (sub.getParent() == null) {
            UI.getCurrent().addWindow(sub);
        }

        sub.addCloseListener((Window.CloseEvent e) -> {
            dataGrid.getContainerDataSource().removeAllItems();
            dataGrid.setContainerDataSource(new MRDataContainer(getEmployeeId()));
        });
    });

    addComponent(mrForm);
    setComponentAlignment(mrForm, Alignment.MIDDLE_RIGHT);

    addComponent(dataGrid);
    setExpandRatio(dataGrid, 2);
}

From source file:org.eclipse.hawkbit.ui.decorators.SPUIButtonStyleLargeIconNoBorder.java

License:Open Source License

/**
 * {@inheritDoc}// ww w .ja v a2 s. com
 */
@Override
public Button decorate(Button button, String style, boolean setStyle, Resource icon) {
    button.addStyleName(ValoTheme.BUTTON_LARGE);
    button.addStyleName(ValoTheme.BUTTON_BORDERLESS_COLORED);
    button.addStyleName(ValoTheme.BUTTON_ICON_ONLY);
    if (setStyle && style != null) {
        button.addStyleName(style);
    }
    button.setWidthUndefined();
    // Set icon
    if (null != icon) {
        button.setIcon(icon);
    }
    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";
    }// w  ww .j  a v  a2s  .  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);
}