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


Java SafeHtmlUtils.htmlEscape方法代码示例

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


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

示例1: SuggestionMenuItem

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private SuggestionMenuItem(final Suggestion suggestion) {
	super(suggestion.getDisplayString() == null
			? suggestion.getChip().getLabel() + " <span class='item-command'>" + suggestion.getChip().getTranslatedCommand() + "</span>"
			: SafeHtmlUtils.htmlEscape(suggestion.getDisplayString()) + (suggestion.getHint() == null ? "" : " " + suggestion.getHint()),
		true,
		new Command() {
			@Override
			public void execute() {
				hideSuggestions();
				setStatus(ARIA.suggestionSelected(suggestion.toAriaString(FilterBox.this)));
				applySuggestion(suggestion);
				iLastValue = getValue();
				setAriaLabel(toAriaString());
				fireSelectionEvent(suggestion);
				ValueChangeEvent.fire(FilterBox.this, getValue());
			}
		});
	setStyleName("item");
	getElement().setAttribute("whiteSpace", "nowrap");
	iSuggestion = suggestion;
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:22,代码来源:FilterBox.java

示例2: urlElement

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private static String urlElement(MDUrl url) {
    // Sanitizing URL
    String href = UriUtils.sanitizeUri(url.getUrl());

    // "DeSanitize" custom url scheme
    if (url.getUrl().startsWith("send:")) {
        href = UriUtils.encodeAllowEscapes(url.getUrl());
    } else {
        // HotFixing url without prefix
        if (!href.equals("#") && !href.contains("://")) {
            href = "http://" + href;
        }
    }

    return "<a " +
            "target=\"_blank\" " +
            "onClick=\"window.messenger.handleLinkClick(event)\" " +
            "href=\"" + href + "\">" +
            SafeHtmlUtils.htmlEscape(url.getUrlTitle()) +
            "</a>";
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:22,代码来源:HtmlMarkdownUtils.java

示例3: onChannelMessage

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
@Override
public void onChannelMessage(Object p_message)
{
  if( p_message instanceof ChatMessage )
  {
    ChatMessage p_msg = (ChatMessage)p_message;
    if( !p_msg.isEmpty() )
    {
      String text = SafeHtmlUtils.htmlEscape( p_msg.getText() );
      text = SmileyCollection.INSTANCE.replace( text );
      text = text.replace( "\n", "<br/>" );
      HTML label = new HTML( "<b>[" + p_msg.getFromPseudo() + "]</b> " + text );
      m_msgList.add( label );
      scrollPanel.ensureVisible( label );
    }
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:18,代码来源:MAppChat.java

示例4: toAriaString

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public String toAriaString(FilterBox box) {
	if (getChipToAdd() != null) {
		if (getChipToRemove() != null)
			return ARIA.chipReplace(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
		else {
			if (box.hasChip(getChipToAdd()))
				return ARIA.chipDelete(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
			else
				return ARIA.chipAdd(getChipToAdd().getTranslatedCommand(), getChipToAdd().getLabel());
		}
	} else if (getChipToRemove() != null) {
		return ARIA.chipDelete(getChipToRemove().getTranslatedCommand(), getChipToRemove().getLabel());
	}
	return SafeHtmlUtils.htmlEscape(getDisplayString()) + (getHint() == null ? "" : " " + getHint());
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:16,代码来源:FilterBox.java

示例5: getSuggestions

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public void getSuggestions(String searchText) {
    String url = JSON_URL_SUGGESTION;
    String searchString = SafeHtmlUtils.htmlEscape(searchText.trim().replace("'", ""));

    // Append the name of the callback function to the JSON URL.
    url += searchString;
    url = URL.encode(url);
    JsonpRequestBuilder jsonp = new JsonpRequestBuilder();
    // Set timeout for 30 seconds (30000 milliseconds)
    jsonp.setTimeout(30000);
    jsonp.requestObject(url, new AsyncCallback<Words>() {

        @Override
        public void onFailure(Throwable caught) {
            // Just fail silently here.
        }

        @Override
        public void onSuccess(Words words) {
            if (words.getWords() != null) {

                List<SearchObject> searchHints = new ArrayList<SearchObject>();

                for (int i = 0; i < words.getWords().length(); i++){
                    SearchObject search = new SearchObject();
                    search.setKeyword(words.getWords().get(i));
                    searchHints.add(search);
                }

                updateSuggestions(searchHints);
            }
        }
    });
}
 
开发者ID:WSDOT,项目名称:social-analytics,代码行数:35,代码来源:SearchView.java

示例6: formatLine

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private String formatLine(String str) {
    if (str.trim().isEmpty()) {
        return "";
    } else {
        String safeString;
        // Timestamp is colored when the default pattern is in use
        if (str.matches("\\[.*\\].*")) {
            safeString = SafeHtmlUtils.htmlEscape(str).replaceFirst("]", "]</span>");
            return "<nobr><span style='color:gray;'>" + safeString + "</nobr><br>";
        } else {
            safeString = SafeHtmlUtils.htmlEscape(str);
            return "<nobr>" + safeString + "</nobr><br>";
        }
    }
}
 
开发者ID:ow2-proactive,项目名称:scheduling-portal,代码行数:16,代码来源:JobOutput.java

示例7: setCaption

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public void setCaption(final String caption, final boolean captionAsHtml) {
    String captionContent = caption != null ? caption : "";
    if (!captionAsHtml) {
        captionContent = SafeHtmlUtils.htmlEscape(captionContent);
    }
    this.captionNode.setInnerHTML(captionContent);
}
 
开发者ID:melistik,项目名称:vaadin-sliderpanel,代码行数:8,代码来源:VSliderPanel.java

示例8: formatUserMessage

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/**
 * format a string written by a user to a string that can be displayed.
 * ie: html escape, \n and smiley convert
 * @param p_message
 * @return
 */
public static String formatUserMessage(String p_message)
{
  String text = SafeHtmlUtils.htmlEscape( p_message );
  text = HTTP_URL_MATCHER.replace( text, "<a target='_blank' href='$&'>$&</a>" );
  text = SmileyCollection.INSTANCE.replace( text );
  text = text.replace( "\n", "<br/>" );
  return text;
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:15,代码来源:ClientUtil.java

示例9: doSearch

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
void doSearch(final String pattern) {
    final String pEsc = SafeHtmlUtils.htmlEscape(pattern);
    heading.setText(UsersManagementWidgetsConstants.INSTANCE.searchResultsFor() + " " + pEsc);
    clearSearchButton.setEnabled(true);
    if (callback != null) {
        callback.onSearch(pattern);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:9,代码来源:EntitiesExplorerViewImpl.java

示例10: append

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private void append(JQElement element, String text) {
    String escaped = SafeHtmlUtils.htmlEscape(text);
    if (text != null && text.length() > 0) {
        element.empty().append(prettifier.prettify(escaped));
    }
    element.addClass("prettyprint");
}
 
开发者ID:kyoken74,项目名称:gwt-angular,代码行数:8,代码来源:GwtPrettify.java

示例11: renderCode

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public static String renderCode(MDCode code) {
    return "<pre><code>" + SafeHtmlUtils.htmlEscape(code.getCode()) + "</pre></code>";
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:4,代码来源:HtmlMarkdownUtils.java

示例12: setTitleText

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public void setTitleText(String text) {
	titleHtml = SafeHtmlUtils.htmlEscape(text);
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:4,代码来源:GuideTip.java

示例13: setBodyText

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public void setBodyText(String text) {
	bodyHtml = SafeHtmlUtils.htmlEscape(text);
}
 
开发者ID:ctripcorp,项目名称:dataworks-zeus,代码行数:4,代码来源:GuideTip.java

示例14: print

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
@Override
public void print(final String text, boolean carriageReturn, String color) {

  if (consoleLines.getElement().getChildCount() > 500) {
    consoleLines.getElement().getFirstChild().removeFromParent();
  }

  if (this.carriageReturn) {
    Node lastChild = consoleLines.getElement().getLastChild();
    if (lastChild != null) {
      lastChild.removeFromParent();
    }
  }

  this.carriageReturn = carriageReturn;

  final SafeHtml colorOutput =
      new SafeHtml() {
        @Override
        public String asString() {

          if (Strings.isNullOrEmpty(text)) {
            return " ";
          }

          String encoded = SafeHtmlUtils.htmlEscape(text);
          if (delegate != null) {
            if (delegate.getCustomizer() != null) {
              if (delegate.getCustomizer().canCustomize(encoded)) {
                encoded = delegate.getCustomizer().customize(encoded);
              }
            }
          }

          for (final Pair<RegExp, String> pair : output2Color) {
            final MatchResult matcher = pair.first.exec(encoded);

            if (matcher != null) {
              return encoded.replaceAll(
                  matcher.getGroup(1),
                  "<span style=\"color: "
                      + pair.second
                      + "\">"
                      + matcher.getGroup(1)
                      + "</span>");
            }
          }

          return encoded;
        }
      };

  PreElement pre = DOM.createElement("pre").cast();
  pre.setInnerSafeHtml(colorOutput);
  if (color != null) {
    pre.getStyle().setColor(color);
  }
  consoleLines.getElement().appendChild(pre);

  followOutput();
}
 
开发者ID:eclipse,项目名称:che,代码行数:62,代码来源:OutputConsoleViewImpl.java

示例15: addTab

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public void addTab(final PagedTable<T> grid,
                   final String key,
                   final Command filterCommand,
                   final boolean selectTab) {

    dataGridFilterHashMap.put(key,
                              new DataGridFilter(key,
                                                 filterCommand));

    final String gridHeader = multiGridPreferencesStore.getGridSettingParam(key,
                                                                            NewTabFilterPopup.FILTER_TAB_NAME_PARAM);
    final String gridTitle = multiGridPreferencesStore.getGridSettingParam(key,
                                                                           NewTabFilterPopup.FILTER_TAB_DESC_PARAM);
    final String safeHtmlGridHeader = (gridHeader != null ? SafeHtmlUtils.htmlEscape(gridHeader) : "");
    final String safeHtmlGridTitle = (gridTitle != null ? SafeHtmlUtils.htmlEscape(gridTitle) : "");

    grid.addTableTitle(safeHtmlGridTitle);

    Button close = null;
    if (!"base".equals(key)) {
        close = GWT.create(Button.class);
        close.setType(ButtonType.LINK);
        close.setIcon(IconType.TIMES);
        close.setSize(ButtonSize.EXTRA_SMALL);
        close.setTitle(CommonConstants.INSTANCE.Close() + " " + gridHeader);
        close.getElement().getStyle().setVerticalAlign(Style.VerticalAlign.TEXT_TOP);
        close.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                getYesNoCancelPopup(safeHtmlGridHeader,
                                    key).show();
            }
        });
    }

    addContentTab(gridHeader,
                  close,
                  grid,
                  key);

    if(selectTab) {
        selectTab(dataGridFilterHashMap.size() - 1);
    }
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:45,代码来源:FilterPagedTable.java


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