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


Java SafeHtmlUtils类代码示例

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


SafeHtmlUtils类属于com.google.gwt.safehtml.shared包,在下文中一共展示了SafeHtmlUtils类的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: createColumnList

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
private ColumnModel<LayerDef> createColumnList(LayerDefProperties props, 
		RowExpander<LayerDef> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<LayerDef, String> nameColumn = new ColumnConfig<LayerDef, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UIMessages.INSTANCE.layerManagerToolText() + "</b>"));
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, String> typeColumn = new ColumnConfig<LayerDef, String>(
			props.type(), 75, UICatalogMessages.INSTANCE.type());
	typeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	typeColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<LayerDef, ImageResource> iconColumn = new ColumnConfig<LayerDef, ImageResource>(
			props.icon(), 32, "");
	iconColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	iconColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	iconColumn.setCell(new ImageResourceCell() {
		@Override
		public void render(Context context, ImageResource value, SafeHtmlBuilder sb) {
			super.render(context, value, sb);
		}
	});
			
	List<ColumnConfig<LayerDef, ?>> columns = new ArrayList<ColumnConfig<LayerDef, ?>>();
	columns.add(rowExpander);
	columns.add(iconColumn);		
	columns.add(nameColumn);
	columns.add(typeColumn);		
	
	return new ColumnModel<LayerDef>(columns);
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:36,代码来源:LayerCatalogDialog.java

示例3: renderText

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
public static String renderText(MDText[] texts) {
    StringBuilder builder = new StringBuilder();

    for (MDText text : texts) {
        if (text instanceof MDRawText) {
            final MDRawText rawText = (MDRawText) text;
            builder.append(SafeHtmlUtils.htmlEscape(rawText.getRawText()).replace("\n", "<br/>"));
        } else if (text instanceof MDSpan) {
            final MDSpan span = (MDSpan) text;
            builder.append(spanElement(span.getSpanType(), renderText(span.getChild())));
        } else if (text instanceof MDUrl) {
            final MDUrl url = (MDUrl) text;
            builder.append(urlElement(url));
        }
    }

    return builder.toString();
}
 
开发者ID:wex5,项目名称:dangchat-sdk,代码行数:19,代码来源:HtmlMarkdownUtils.java

示例4: 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

示例5: ShowcaseTopPanel

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
@Inject
public ShowcaseTopPanel(Image logo, ShowcaseSearchPanel searchPanel) {
    super.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    super.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    super.setStyleName("top");
    
    super.setSpacing(1);

    logo.setSize("32px", "32px");
    super.add(logo);
    Anchor anchor = new Anchor();
    String text = "<div class=\"brand\"><a href=\"http://cesiumjs.org\">Cesium</a> on GWT Examples</div>";
    anchor.setHTML(SafeHtmlUtils.fromTrustedString(text));
    super.add(anchor);
    super.add(searchPanel);

    super.setCellWidth(logo, "10px");
}
 
开发者ID:iSergio,项目名称:gwt-cs,代码行数:19,代码来源:ShowcaseTopPanel.java

示例6: getImageHtml

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
private SafeHtml getImageHtml(ImageResource res, VerticalAlignmentConstant valign) {
	AbstractImagePrototype proto = AbstractImagePrototype.create(res);
	SafeHtml image = SafeHtmlUtils.fromTrustedString(proto.getHTML());

	// Create the wrapper based on the vertical alignment.
	SafeStylesBuilder cssStyles =
			new SafeStylesBuilder().appendTrustedString(direction + ":0px;");
	if (HasVerticalAlignment.ALIGN_TOP == valign) {
		return templates.imageWrapperTop(cssStyles.toSafeStyles(), image);
	} else if (HasVerticalAlignment.ALIGN_BOTTOM == valign) {
		return templates.imageWrapperBottom(cssStyles.toSafeStyles(), image);
	} else {
		int halfHeight = (int) Math.round(res.getHeight() / 2.0);
		cssStyles.appendTrustedString("margin-top:-" + halfHeight + "px;");
		return templates.imageWrapperMiddle(cssStyles.toSafeStyles(), image);
	}
}
 
开发者ID:Novartis,项目名称:ontobrowser,代码行数:18,代码来源:ActionIconCellDecorator.java

示例7: getHTML

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
public SafeHtml getHTML() {
    SafeHtml result = null;
    if (libraryLoaded && initialized) {
        try {
            String contentHtml = getContentHtml(elementId); // TinyMCE takes care of the sanitization.
            if (contentHtml == null || contentHtml.trim().isEmpty()) {
                return SafeHtmlUtils.fromSafeConstant("");
            }
            // Remove the root block <p></p> that gets added automatically by TinyMCE
            if (contentHtml.startsWith("<p>") && contentHtml.endsWith("</p>")) {
                contentHtml = contentHtml.substring(3, contentHtml.length() - 4);
            }
            result = SafeHtmlUtils.fromTrustedString(contentHtml); 
        } catch (JavaScriptException e) {
            GWT.log("Unable to get the content from the TinyMCE editor.", e);
        }
    } else {
        String text = super.getText();
        if (text == null || text.trim().isEmpty()) {
            return SafeHtmlUtils.fromSafeConstant("");
        } else {
            return SafeHtmlUtils.fromString(text);
        }
    }
    return result;        
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:27,代码来源:HFRichTextEditor.java

示例8: getText

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
public String getText()
{
    String result = "";
    if (libraryLoaded && initialized) {
        try {
            String contentText = getContentText(elementId);
            if (contentText == null) {
                contentText = "";
            }
            result = SafeHtmlUtils.fromString(contentText).asString(); // requested as text, so we need to escape the string
        } catch (JavaScriptException e) {
            GWT.log("Unable to get the content from the TinyMCE editor.", e);
        }
    } else {
        result = super.getText();
        if (result == null || result.trim().isEmpty()) {
            result = "";
        } else {
            result = SafeHtmlUtils.fromString(result).asString();
        }
    }
    return result;
}
 
开发者ID:harvardpan,项目名称:hftinymce-gwt,代码行数:24,代码来源:HFRichTextEditor.java

示例9: loadParticipantItems

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
/**
 * Load participant items.
 */
private void loadParticipantItems()
{
	NumberNetService.Util.getInstance().getAllParticipants(new AsyncCallback<List<Participant>>()
	{

		@Override
		public void onFailure(Throwable caught)
		{
			new MessageDialogBox(caught.getMessage()).show();
		}

		@Override
		public void onSuccess(List<Participant> result)
		{
			trtmByPerson.removeItems();
			for (Participant p : result)
			{
				TreeItem person = new TreeItem(SafeHtmlUtils.fromString(p.getName()));
				person.setUserObject("person");
				trtmByPerson.addItem(person);
			}
		}
	});
}
 
开发者ID:synergynet,项目名称:synergynet3.1,代码行数:28,代码来源:ExpressionView.java

示例10: changeHelpPanel

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
/***********************************
 ****** HELP STUFF ******
 ***********************************/

private void changeHelpPanel(SubTabs subMenu) {
  // change root item
  rootItem.setText(subMenu + " Help");
  rootItem.removeItems();
  SubTabInterface subTabObj = getSubTab(subMenu);
  if (subTabObj != null) {
    HelpSliderConsts[] helpVals = subTabObj.getHelpSliderContent();
    if (helpVals != null) {
      for (int i = 0; i < helpVals.length; i++) {
        TreeItem helpItem = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getTitle()));
        TreeItem content = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getContent()));
        helpItem.setState(false);
        helpItem.addItem(content);
        rootItem.addItem(helpItem);
      }
    }
  }
  rootItem.setState(true);
  resize();
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:25,代码来源:AggregateUI.java

示例11: 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

示例12: addImageWithLine

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
/**
 * @param line
 */
public void addImageWithLine (String line) {
	if (line.length() > 0) {
		ConfigLine config = parseConfigLine(line);

		if (config.url != null && config.url.length() > 0) {
			Image image = new Image(config.url);

			if (config.name != null) {
				image.setTitle(config.name);
				image.setAltText(config.caption);
			}

			((HTMLPanel) this.getWidget()).add(image);

			if (config.caption != null) {
				((HTMLPanel) this.getWidget())
						.add(new HTMLPanel(SafeHtmlUtils.fromTrustedString(
								PostHelper.makeMarkup(config.caption))));
			}
		}
	}
}
 
开发者ID:billy1380,项目名称:blogwt,代码行数:26,代码来源:GalleryPart.java

示例13: render

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
@Override
public void render (com.google.gwt.cell.client.Cell.Context context,
		User user, SafeHtmlBuilder sb) {

	String summary;
	if (user.summary != null) {
		summary = PostHelper.makeMarkup(user.summary);
	} else {
		summary = "<p class=\"text-muted text-justify\">"
				+ SafeHtmlUtils.fromString(UserHelper.name(user)).asString()
				+ " has not entered a user summary.</p>";
	}

	RENDERER.render(sb, SafeHtmlUtils.fromString(UserHelper.name(user)),
			SafeHtmlUtils.fromString("@" + user.username),
			UriUtils.fromString(user.avatar + "?s=80&default=retro"),
			SafeHtmlUtils.fromTrustedString(summary));

}
 
开发者ID:billy1380,项目名称:blogwt,代码行数:20,代码来源:UserSummaryCell.java

示例14: AbstractConcurrentChangePopup

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
protected AbstractConcurrentChangePopup(final String content,
                                        final Command onIgnore,
                                        final Command onAction,
                                        final String buttonText) {
    setTitle(CommonConstants.INSTANCE.Error());

    add(new ModalBody() {{
        add(uiBinder.createAndBindUi(AbstractConcurrentChangePopup.this));
    }});
    add(new ModalFooterReOpenIgnoreButtons(this,
                                           onAction,
                                           onIgnore,
                                           buttonText));

    message.setHTML(SafeHtmlUtils.fromTrustedString(content));
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:17,代码来源:AbstractConcurrentChangePopup.java

示例15: render

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入依赖的package包/类
@Override
public void render(Context context, PlayerDTO value, SafeHtmlBuilder sb) {
    String playerClass = "";
    if (comms.contains(value.getId())) {
        playerClass = "participant captain";
    } else {
        playerClass = "participant " + baseClass;
    }
    sb.appendHtmlConstant("<span class=\"" + playerClass + "\" title=\"" + SafeHtmlUtils.fromString(value.getName()).asString()
            + "\">");
    value.buildInfo(sb);
    if (value.getSide() == Side.MERC) {
        sb.appendEscaped(" [MERC]");
    }
    sb.appendHtmlConstant("</span>");
}
 
开发者ID:rkfg,项目名称:ns2gather,代码行数:17,代码来源:VoteResultPanel.java


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