Example usage for com.vaadin.ui Image setIcon

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

Introduction

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

Prototype

@Override
public void setIcon(Resource icon) 

Source Link

Document

Sets the component's icon.

Usage

From source file:com.esofthead.mycollab.vaadin.ui.AddViewLayout.java

License:Open Source License

public AddViewLayout(String viewTitle, Resource viewIcon) {
    super("addView");

    this.viewIcon = viewIcon;

    this.header = new MHorizontalLayout().withWidth("100%");
    this.header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    this.titleLbl = new Label("", ContentMode.HTML);
    this.titleLbl.setStyleName("headerName");

    if (!(viewIcon instanceof FontAwesome)) {
        Image icon = new Image(null);
        icon.setIcon(viewIcon);
        icon.addStyleName(UIConstants.BUTTON_ICON_ONLY);
        this.header.with(icon);
    }/*from   w w  w.  j av  a2  s  . co  m*/
    this.header.with(titleLbl).expand(titleLbl);
    setHeader(viewTitle);
    this.addComponent(this.header, "addViewHeader");
}

From source file:com.esofthead.mycollab.vaadin.web.ui.AddViewLayout.java

License:Open Source License

public AddViewLayout(String viewTitle, Resource viewIcon) {
    super("addView");

    this.viewIcon = viewIcon;

    header = new MHorizontalLayout().withFullWidth().withMargin(new MarginInfo(true, false, true, false));
    header.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT);

    titleLbl = ELabel.h2("");

    if (!(viewIcon instanceof FontAwesome)) {
        Image icon = new Image(null);
        icon.setIcon(viewIcon);
        icon.addStyleName(UIConstants.BUTTON_ICON_ONLY);
        header.with(icon);// ww w .j  ava2 s  . c  o m
    }
    header.with(titleLbl).expand(titleLbl);
    setHeader(viewTitle);
    addComponent(header, "addViewHeader");
}