List of usage examples for com.vaadin.client ApplicationConnection getIcon
public Icon getIcon(String uri)
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\">►</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(); }