Example usage for com.vaadin.ui NativeButton setIcon

List of usage examples for com.vaadin.ui NativeButton setIcon

Introduction

In this page you can find the example usage for com.vaadin.ui NativeButton setIcon.

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

From source file:org.lunifera.runtime.web.vaadin.components.fields.BeanReferenceField.java

License:Open Source License

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override//from  w  w w .j  a  v  a2 s  . c o  m
protected Component initContent() {

    HorizontalLayout root = new HorizontalLayout();
    root.addStyleName("l-beansearchfield");
    comboBox = new CustomComboBox();
    comboBox.setImmediate(true);
    comboBox.setNullSelectionAllowed(false);
    comboBox.setInvalidAllowed(false);

    BeanServiceLazyLoadingContainer container = new BeanServiceLazyLoadingContainer(searchService, type,
            sharedState);
    // add the passed container filter
    if (filter != null) {
        container.addContainerFilter(filter);
    }
    comboBox.setContainerDataSource(container);
    comboBox.setFilteringMode(FilteringMode.CONTAINS);

    if (itemCaptionPropertyId != null) {
        comboBox.setItemCaptionPropertyId(itemCaptionPropertyId);
    }

    if (itemIconPropertyId != null) {
        comboBox.setItemIconPropertyId(itemIconPropertyId);
    }

    NativeButton searchButton = new NativeButton();
    searchButton.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(ClickEvent event) {
            openSearchDialog();
        }
    });
    searchButton.setWidth("26px");
    searchButton.setIcon(new ThemeResource("icons/SearchButton.png"));

    root.addComponent(comboBox);
    root.addComponent(searchButton);

    // Create the property
    comboBox.setPropertyDataSource(property);

    // Create the bindings
    // valueBinding =
    // dbc.bindValue(VaadinObservables.observeValue(comboBox),
    // PojoObservables.observeValue(property, "value"));

    return root;
}