Java Code Examples for com.google.gwt.safehtml.shared.SafeHtmlUtils#htmlEscapeAllowEntities()

The following examples show how to use com.google.gwt.safehtml.shared.SafeHtmlUtils#htmlEscapeAllowEntities() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockComponent.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Constructs a tree item for the component which will be displayed in the
 * source structure explorer.
 *
 * @return  tree item for this component
 */
protected TreeItem buildTree() {
  // Instantiate new tree item for this component
  // Note: We create a ClippedImagePrototype because we need something that can be
  // used to get HTML for the iconImage. AbstractImagePrototype requires
  // an ImageResource, which we don't necessarily have.
  TreeItem itemNode = new TreeItem(
      new HTML("<span>" + iconImage.getElement().getString() + SafeHtmlUtils.htmlEscapeAllowEntities(getName()) + "</span>")) {
    @Override
    protected Focusable getFocusable() {
      return nullFocusable;
    }
  };
  itemNode.setUserObject(sourceStructureExplorerItem);
  return itemNode;
}
 
Example 2
Source File: PageMetadataEditor.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void setPreview() {
        String prefixValue = getPrefix();
        String suffixValue = getSuffix();
        Iterator<String> sequence = getSequence();
        StringBuilder sequenceItem = new StringBuilder();
        for (int i = 0; i < 3; i++) {
            if (prefixValue != null) {
                sequenceItem.append(prefixValue);
            }
            if (sequence != null) {
                sequenceItem.append(sequence.next());
            } else {
//                sequenceItem.append("<err>");
            }
            if (suffixValue != null) {
                sequenceItem.append(suffixValue);
            }
            if (sequenceItem.length() > 0) {
                sequenceItem.append(",&nbsp;");
            } else {
                break;
            }
        }
        if (sequenceItem.length() > 0) {
            sequenceItem.append("...");
        }
        String example = SafeHtmlUtils.htmlEscapeAllowEntities(sequenceItem.toString());
        numberExample.setValue(example);
        numberExample.setPrompt(example);
    }