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


Java SafeHtmlUtils.fromTrustedString方法代码示例

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


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

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

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

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

示例4: toSafeHtml

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
SafeHtml toSafeHtml(boolean withFormatting) {

      // NOTE :: Embedded operations are LOST using this method .... 
      
      StringBuilder sb = new StringBuilder();
      
      for (StyledParagraphItem i : _items) {
         final String text = i.getText();
         final String style = i.getStyle();
         
         if (withFormatting && style != null) {
            sb.append("<span style=\"");
            sb.append(SafeHtmlUtils.htmlEscape(style));
            sb.append("\">");
            if (text != null && " ".equals(text)) {
               sb.append("&nbsp;");
            } else {
               sb.append(SafeHtmlUtils.htmlEscape(text));
            }
            sb.append("</span>");
         } else {
            sb.append(SafeHtmlUtils.htmlEscape(text));
         }
      }
      
      final SafeHtml safeHtml = SafeHtmlUtils.fromTrustedString(sb.toString());
      return safeHtml;
   }
 
开发者ID:ainslec,项目名称:gwt-promptly,代码行数:29,代码来源:StyledBlock.java

示例5: createDivStart

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml createDivStart(String title,
                               String defaultValue,
                               String cssClasses) {
    if (title == null || "".equals(title)) {
        title = defaultValue;
    }

    final String css = cssClasses == null ? "" : "class=\"" + cssClasses + "\"";
    return SafeHtmlUtils.fromTrustedString("<div title=\"" + SafeHtmlUtils.htmlEscape(title.trim()) + "\" " + css + " >");
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:11,代码来源:MessageTableWidget.java

示例6: getExpandImageHtml

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private SafeHtml getExpandImageHtml()
{
	StringBuilder sb = new StringBuilder();
	sb.append( "<img src='" );
	if( !hasChilds() )
		sb.append( "" );
	else if( getExpanded() )
		sb.append( this.treeTable.treeMinus.getSafeUri().asString() );
	else
		sb.append( this.treeTable.treePlus.getSafeUri().asString() );
	sb.append( "'></img>" );

	return SafeHtmlUtils.fromTrustedString( sb.toString() );
}
 
开发者ID:ltearno,项目名称:hexa.tools,代码行数:15,代码来源:Row.java

示例7: makeImage

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private static SafeHtml makeImage(ImageResource resource) {
    AbstractImagePrototype proto = AbstractImagePrototype.create(resource);
    String html = proto
        .getHTML()
        .replace("style='", "style='position:absolute;right:0px;top:0px;");
    return SafeHtmlUtils.fromTrustedString(html);
}
 
开发者ID:inepex,项目名称:ineform,代码行数:8,代码来源:SortableHeader.java

示例8: createColumnList

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
private ColumnModel<VehicleJSO> createColumnList(VehicleJSOProperties props, 
		RowExpander<VehicleJSO> rowExpander) {
	
	rowExpander.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
	rowExpander.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	ColumnConfig<VehicleJSO, String> nameColumn = new ColumnConfig<VehicleJSO, String>(
			props.name(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UISgfMessages.INSTANCE.nameColumn() + "</b>"));
	
	nameColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	
	ColumnConfig<VehicleJSO, String> plateColumn = new ColumnConfig<VehicleJSO, String>(
			props.plate(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UISgfMessages.INSTANCE.plateColumn() + "</b>"));
	
	plateColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);		
	
	ColumnConfig<VehicleJSO, String> statusColumn = new ColumnConfig<VehicleJSO, String>(
			props.status(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UISgfMessages.INSTANCE.statusColumn() + "</b>"));
	statusColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
	
	
	ColumnConfig<VehicleJSO, String> lastRevisionDateColumn = new ColumnConfig<VehicleJSO, String>(
			props.lastRevisionDate(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UISgfMessages.INSTANCE.lastReviewColumn() + "</b>"));
	lastRevisionDateColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);	
	
	ColumnConfig<VehicleJSO, String> kmRevisionColumn = new ColumnConfig<VehicleJSO, String>(
			props.kmsLeftForRevision(), 200, SafeHtmlUtils.fromTrustedString("<b>"
					+ UISgfMessages.INSTANCE.kmForReviewColumn() + "</b>"));
	kmRevisionColumn.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);	
			
	List<ColumnConfig<VehicleJSO, ?>> columns = new ArrayList<ColumnConfig<VehicleJSO, ?>>();
	columns.add(rowExpander);
	columns.add(nameColumn);
	columns.add(plateColumn);
	columns.add(statusColumn);	
	columns.add(lastRevisionDateColumn);
	columns.add(kmRevisionColumn);
	
	return new ColumnModel<VehicleJSO>(columns);
}
 
开发者ID:geowe,项目名称:sig-seguimiento-vehiculos,代码行数:46,代码来源:VehicleDialog.java

示例9: menuItemWithShortcut

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
MenuItem menuItemWithShortcut(String text, String shortcut, MyCommand cmd) {
final String edithtml="<div style=\"display:inline-block;width:80px;\">";
String sn=edithtml + text + "</div>" + shortcut;
return new MenuItem(SafeHtmlUtils.fromTrustedString(sn), cmd);
   }
 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:6,代码来源:CirSim.java

示例10: CheckboxAlignedMenuItem

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public CheckboxAlignedMenuItem(String s, Command cmd) {
	super(SafeHtmlUtils.fromTrustedString(CheckboxMenuItem.checkBoxHtml+"&nbsp;</div>"+s), cmd);
}
 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:4,代码来源:CheckboxAlignedMenuItem.java

示例11: createDivEnd

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
public SafeHtml createDivEnd() {
    return SafeHtmlUtils.fromTrustedString("</div>");
}
 
开发者ID:kiegroup,项目名称:appformer,代码行数:4,代码来源:MessageTableWidget.java

示例12: sanitizeHtml

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/**
 * HTML-sanitizes a string.
 *
 * <p>
 * The input string is processed as described above. The result of sanitizing
 * the string is guaranteed to be safe to use (with respect to XSS
 * vulnerabilities) in HTML contexts, and is returned as an instance of the
 * {@link SafeHtml} type.
 *
 * @param html the input String
 * @return a sanitized SafeHtml instance
 */
public static SafeHtml sanitizeHtml(String html) {
  if (html == null) {
    throw new NullPointerException("html is null");
  }
  return SafeHtmlUtils.fromTrustedString(simpleSanitize(html));
}
 
开发者ID:NOAA-PMEL,项目名称:LAS,代码行数:19,代码来源:HtmlSanitizerUtil.java

示例13: imageItemHTML

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
/**
 * Generates HTML for a tree item with an attached icon.
 *
 * @param imageProto the image prototype to use
 * @param title      the title of the item
 * @return the resultant HTML
 */
private SafeHtml imageItemHTML(ImageResource imageProto,
                               String title) {
  return SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(imageProto)
                                                               .getHTML() + " " + title);
}
 
开发者ID:mvp4g,项目名称:mvp4g-examples,代码行数:13,代码来源:Mailboxes.java

示例14: LSHTML

import com.google.gwt.safehtml.shared.SafeHtmlUtils; //导入方法依赖的package包/类
static SafeHtml LSHTML(String s) { return SafeHtmlUtils.fromTrustedString(LS(s)); } 
开发者ID:sharpie7,项目名称:circuitjs1,代码行数:2,代码来源:CirSim.java


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