當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。