当前位置: 首页>>代码示例>>Java>>正文


Java WidgetUtil.escapeHTML方法代码示例

本文整理汇总了Java中com.vaadin.client.WidgetUtil.escapeHTML方法的典型用法代码示例。如果您正苦于以下问题:Java WidgetUtil.escapeHTML方法的具体用法?Java WidgetUtil.escapeHTML怎么用?Java WidgetUtil.escapeHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.vaadin.client.WidgetUtil的用法示例。


在下文中一共展示了WidgetUtil.escapeHTML方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateCaptions

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
 * @param bigMode
 *            If false, event is so small that caption must be in time-row
 */
private void updateCaptions(boolean bigMode) {
    String innerHtml;
    String htmlOrText;

    String timeAsText = Strings.format(
            calendarItem.getDateCaptionFormat(),
            calendarItem.getFormattedStartTime(),
            calendarItem.getFormattedEndTime());

    if (dateCell.weekgrid.getCalendar().isItemCaptionAsHtml()) {
        htmlOrText = calendarItem.getCaption();
    } else {
        htmlOrText = WidgetUtil.escapeHTML(calendarItem.getCaption());
    }

    if (bigMode) {
        innerHtml = "<span>" + timeAsText + "</span><br />" + htmlOrText;
    } else {
        innerHtml = "<span>" + timeAsText + "<span></span></span> " + htmlOrText;
    }

    caption.setInnerHTML(innerHtml);
    eventContent.setInnerHTML("");
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:29,代码来源:DateCellDayItem.java

示例2: renderCaption

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
 * Renders the caption in the DIV element
 */
private void renderCaption() {
    StringBuilder html = new StringBuilder();
    String textOrHtml;
    if (calendar.isItemCaptionAsHtml()) {
        textOrHtml = caption;
    } else {
        textOrHtml = WidgetUtil.escapeHTML(caption);
    }

    if (caption != null && time != null) {
        html.append("<span class=\"" + STYLENAME + "-time\">");
        html.append(calendar.getTimeFormat().format(time));
        html.append("</span> ");
        html.append(textOrHtml);
    } else if (caption != null) {
        html.append(textOrHtml);
    } else if (time != null) {
        html.append("<span class=\"" + STYLENAME + "-time\">");
        html.append(calendar.getTimeFormat().format(time));
        html.append("</span>");
    }
    super.setHTML(html.toString());
}
 
开发者ID:blackbluegl,项目名称:calendar-component,代码行数:27,代码来源:MonthItemLabel.java

示例3: getDisplayString

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
 * Gets the visible row in the popup as a HTML string. The string
 * contains an image tag with the rows icon (if an icon has been
 * specified) and the caption of the item
 */

@Override
public String getDisplayString() {
	final StringBuilder sb = new StringBuilder();
	ApplicationConnection client = VComboBoxMultiselect.this.connector.getConnection();
	final Icon icon = client.getIcon(client.translateVaadinUri(this.untranslatedIconUri));
	if (icon != null) {
		sb.append(icon.getElement()
			.getString());
	}
	String content;
	if ("".equals(this.caption)) {
		// Ensure that empty options use the same height as other
		// options and are not collapsed (#7506)
		content = "&nbsp;";
	} else {
		content = WidgetUtil.escapeHTML(this.caption);
	}
	sb.append("<span>" + content + "</span>");
	return sb.toString();
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:27,代码来源:VComboBoxMultiselect.java

示例4: updateSuggestionPopupMinWidth

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
/**
 * Update minimum width for combo box textarea based on input prompt and
 * suggestions.
 * <p>
 * For internal use only. May be removed or replaced in the future.
 */
public void updateSuggestionPopupMinWidth() {
	debug("VComboBoxMultiselect: updateSuggestionPopupMinWidth()");

	// used only to calculate minimum width
	String captions = WidgetUtil.escapeHTML(this.inputPrompt);

	for (ComboBoxMultiselectSuggestion suggestion : this.currentSuggestions) {
		// Collect captions so we can calculate minimum width for
		// textarea
		if (captions.length() > 0) {
			captions += "|";
		}
		captions += WidgetUtil.escapeHTML(suggestion.getReplacementString());
	}

	// Calculate minimum textarea width
	this.suggestionPopupMinWidth = minWidth(captions);
}
 
开发者ID:bonprix,项目名称:vaadin-combobox-multiselect,代码行数:25,代码来源:VComboBoxMultiselect.java

示例5: setCaption

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
public void setCaption(String c, boolean asHtml) {
    String html;
    if (asHtml) {
        html = c == null ? "" : c;
    } else {
        html = WidgetUtil.escapeHTML(c);
    }

    headerText.setInnerHTML(html);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:11,代码来源:CubaFileUploadProgressWindow.java

示例6: buildItemHTML

import com.vaadin.client.WidgetUtil; //导入方法依赖的package包/类
@Override
public String buildItemHTML(UIDL item) {
    // Construct html from the text and the optional icon
    // Haulmont API : Added support for shortcuts
    StringBuilder itemHTML = new StringBuilder();
    if (item.hasAttribute("separator")) {
        itemHTML.append("<span>---</span><span>---</span>");
    } else {
        itemHTML.append("<span class=\"")
                .append(getStylePrimaryName())
                .append("-menuitem-caption\">");

        Icon icon = client.getIcon(item.getStringAttribute("icon"));
        if (icon != null) {
            itemHTML.append(icon.getElement().getString());
        }

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

        // Add submenu indicator
        if (item.getChildCount() > 0) {
            String bgStyle = "";
            itemHTML.append("<span class=\"")
                    .append(getStylePrimaryName())
                    .append("-submenu-indicator\"")
                    .append(bgStyle)
                    .append("><span class=\"")
                    .append(getStylePrimaryName())
                    .append("-submenu-indicator-icon\"")
                    .append("><span class=\"text\">&#x25BA;</span></span></span>");
        } else {
            itemHTML.append("<span class=\"");
            String shortcut = "";
            if (item.hasAttribute("shortcut")) {
                shortcut = item.getStringAttribute("shortcut");
            } else {
                itemHTML.append(getStylePrimaryName())
                        .append("-menuitem-empty-shortcut ");
            }

            itemHTML.append(getStylePrimaryName())
                    .append("-menuitem-shortcut\">")
                    .append(shortcut)
                    .append("</span");
        }
    }
    return itemHTML.toString();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:54,代码来源:CubaMenuBarWidget.java


注:本文中的com.vaadin.client.WidgetUtil.escapeHTML方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。