Example usage for com.vaadin.client ApplicationConnection getIcon

List of usage examples for com.vaadin.client ApplicationConnection getIcon

Introduction

In this page you can find the example usage for com.vaadin.client ApplicationConnection getIcon.

Prototype

public Icon getIcon(String uri) 

Source Link

Document

Gets an Icon instance corresponding to a URI.

Usage

From source file:com.haulmont.cuba.web.toolkit.ui.client.groupbox.CubaGroupBoxWidget.java

License:Apache License

@Override
public void setIconUri(String iconUri, ApplicationConnection client) {
    if (icon != null) {
        captionNode.removeChild(icon.getElement());
    }/*w w w.  j a v  a  2s.  c o m*/
    icon = client.getIcon(iconUri);
    if (icon != null) {
        DOM.insertChild(captionNode, icon.getElement(), 1);
    }
}

From source file:com.haulmont.cuba.web.widgets.client.addons.contextmenu.ContextMenuConnector.java

License:Apache License

private static String buildItemHTML(MenuItemState state, boolean htmlContentAllowed,
        ApplicationConnection connection) {
    // Construct html from the text and the optional icon
    StringBuffer itemHTML = new StringBuffer();
    if (state.separator) {
        itemHTML.append("<span>---</span>");
    } else {//w  w  w  .  ja  v  a2s  .co m
        // Add submenu indicator
        if (state.childItems != null && state.childItems.size() > 0) {
            itemHTML.append("<span class=\"v-menubar-submenu-indicator\">&#x25BA;</span>");
        }

        itemHTML.append("<span class=\"v-menubar-menuitem-caption\">");

        if (state.icon != null) {
            Icon icon = connection.getIcon(state.icon.getURL());
            if (icon != null) {
                itemHTML.append(icon.getElement().getString());
            }
        }

        String itemText = state.text;
        if (!htmlContentAllowed) {
            itemText = WidgetUtil.escapeHTML(itemText);
        }
        itemHTML.append(itemText);
        itemHTML.append("</span>");
    }
    return itemHTML.toString();
}