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