本文整理了Java中com.google.gwt.dom.client.Element.setInnerSafeHtml()
方法的一些代码示例,展示了Element.setInnerSafeHtml()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.setInnerSafeHtml()
方法的具体详情如下:
包路径:com.google.gwt.dom.client.Element
类名称:Element
方法名:setInnerSafeHtml
[英]All of the markup and content within a given element.
[中]给定元素中的所有标记和内容。
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void doHtmlImpl(SafeHtml html) {
getCurrentElement().setInnerSafeHtml(html);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to convert the specified HTML into DOM elements and
* return the parent of the DOM elements.
*
* @param html the HTML to convert
* @param tmpElem a temporary element
* @return the parent element
*/
static Element convertToElements(Widget widget, Element tmpElem, SafeHtml html) {
// Attach an event listener so we can catch synchronous load events from
// cached images.
DOM.setEventListener(tmpElem, widget);
tmpElem.setInnerSafeHtml(html);
// Detach the event listener.
DOM.setEventListener(tmpElem, null);
return tmpElem;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public void setValue(Context context, Element parent, C value) {
SafeHtmlBuilder sb = new SafeHtmlBuilder();
render(context, value, sb);
parent.setInnerSafeHtml(sb.toSafeHtml());
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected Element doFinishImpl() {
Element tmp = Document.get().createDivElement();
tmp.setInnerSafeHtml(asSafeHtml());
return tmp.getFirstChildElement();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
tmpElem.setInnerSafeHtml(template.tbody(rowHtml));
} else if ("thead".equals(sectionTag)) {
tmpElem.setInnerSafeHtml(template.thead(rowHtml));
} else if ("tfoot".equals(sectionTag)) {
tmpElem.setInnerSafeHtml(template.tfoot(rowHtml));
} else {
throw new IllegalArgumentException("Invalid table section tag: " + sectionTag);
代码示例来源:origin: com.google.gwt/gwt-servlet
private void createFrame() {
// Attach a hidden IFrame to the form. This is the target iframe to which
// the form will be submitted. We have to create the iframe using innerHTML,
// because setting an iframe's 'name' property dynamically doesn't work on
// most browsers.
Element dummy = Document.get().createDivElement();
dummy.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(frameName));
synthesizedFrame = dummy.getFirstChildElement();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Creates an HTML IFRAME element with a name.
*
* @param name the name of the frame, which must contain at least one
* non-whitespace character and must not contain reserved HTML markup
* characters such as '<code><</code>', '<code>></code>',
* or '<code>&</code>'
* @return the newly-created element
* @throws IllegalArgumentException if the supplied name is not allowed
*/
private static IFrameElement createIFrame(String name) {
if (name == null || !isValidName(name.trim())) {
throw new IllegalArgumentException(
"expecting one or more non-whitespace chars with no '<', '>', or '&'");
}
// Use innerHTML to implicitly create the <iframe>. This is necessary
// because most browsers will not respect a dynamically-set iframe name.
Element div = DOM.createDiv();
div.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(name));
return div.getFirstChild().cast();
}
代码示例来源:origin: com.google.gwt/gwt-servlet
public Element createStructure(SafeUri url, int left, int top, int width, int height) {
Element tmp = Document.get().createSpanElement();
tmp.setInnerSafeHtml(getSafeHtml(url, left, top, width, height));
Element elem = tmp.getFirstChildElement();
elem.setPropertyJSO("onload", createOnLoadHandlerFunction());
return elem;
}
代码示例来源:origin: com.google.gwt/gwt-servlet
/**
* Convenience method to replace all children of a Widget.
*
* @param widget the widget who's contents will be replaced
* @param childContainer the container that holds the contents
* @param html the html to set
*/
static void replaceAllChildren(Widget widget, Element childContainer, SafeHtml html) {
// If the widget is not attached, attach an event listener so we can catch
// synchronous load events from cached images.
if (!widget.isAttached()) {
DOM.setEventListener(widget.getElement(), widget);
}
// Render the HTML.
childContainer.setInnerSafeHtml(CellBasedWidgetImpl.get().processHtml(html));
// Detach the event listener.
if (!widget.isAttached()) {
DOM.setEventListener(widget.getElement(), null);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
public void onBrowserEvent(Context context, Element parent, String value,
NativeEvent event, ValueUpdater<String> valueUpdater) {
// The loading indicator can fire its own load or error event, so we check
// that the event actually occurred on the main image.
String type = event.getType();
if (BrowserEvents.LOAD.equals(type) && eventOccurredOnImage(event, parent)) {
// Remove the loading indicator.
parent.getFirstChildElement().getStyle().setDisplay(Display.NONE);
// Show the image.
Element imgWrapper = parent.getChild(1).cast();
imgWrapper.getStyle().setProperty("height", "auto");
imgWrapper.getStyle().setProperty("width", "auto");
imgWrapper.getStyle().setProperty("overflow", "auto");
} else if (BrowserEvents.ERROR.equals(type) && eventOccurredOnImage(event, parent)) {
// Replace the loading indicator with an error message.
parent.getFirstChildElement().setInnerSafeHtml(errorRenderer.render(value));
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
Element td = DOM.createTD();
td.setPropertyString("vAlign", "middle");
td.setInnerSafeHtml(subMenuIcon.getSafeHtml());
setStyleName(td, "subMenuIcon");
DOM.appendChild(tr, td);
代码示例来源:origin: com.google.gwt/gwt-servlet
element.setInnerSafeHtml(getInnerHtml());
代码示例来源:origin: com.google.gwt/gwt-servlet
@Override
protected void setKeyboardSelected(int index, boolean selected, boolean stealFocus) {
super.setKeyboardSelected(index, selected, stealFocus);
if (!isRowWithinBounds(index)) {
return;
}
// Update the style.
Element elem = getRowElement(index);
T value = getPresenter().getVisibleItem(index);
boolean isOpen = selected && isOpen(index);
setStyleName(elem, style.cellBrowserOpenItem(), isOpen);
// Update the image.
SafeHtml image = null;
if (isOpen) {
image = openImageHtml;
} else if (getTreeViewModel().isLeaf(value)) {
image = LEAF_IMAGE;
} else {
image = closedImageHtml;
}
tmpElem.setInnerSafeHtml(image);
elem.replaceChild(tmpElem.getFirstChildElement(), elem.getFirstChildElement());
// Update the open state.
updateChildState(this, true);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void buildDOM(AbstractImagePrototype thumbImage) {
final Element leftDiv = getElement(LEFT);
final Element rightDiv = getElement(RIGHT);
final Element splitDiv = getSplitElement();
DOM.appendChild(getElement(), container);
DOM.appendChild(container, leftDiv);
DOM.appendChild(container, splitDiv);
DOM.appendChild(container, rightDiv);
/*
* Sadly, this is the only way I've found to get vertical centering in this
* case. The usually CSS hacks (display: table-cell, vertical-align: middle)
* don't work in an absolute positioned DIV.
*/
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant("<table class='hsplitter' height='100%' cellpadding='0' "
+ "cellspacing='0'><tr><td align='center' valign='middle'>");
sb.append(thumbImage.getSafeHtml());
splitDiv.setInnerSafeHtml(sb.toSafeHtml());
addScrolling(leftDiv);
addScrolling(rightDiv);
}
代码示例来源:origin: com.vaadin.external.gwt/gwt-user
@Override
protected void doHtmlImpl(SafeHtml html) {
getCurrentElement().setInnerSafeHtml(html);
}
代码示例来源:origin: com.google.gwt/gwt-servlet
private void buildDOM(AbstractImagePrototype thumb) {
final Element topDiv = getElement(TOP);
final Element bottomDiv = getElement(BOTTOM);
final Element splitDiv = getSplitElement();
DOM.appendChild(getElement(), container);
DOM.appendChild(container, topDiv);
DOM.appendChild(container, splitDiv);
DOM.appendChild(container, bottomDiv);
/*
* The style name is placed on the table rather than splitElem to allow the
* splitter to be styled without interfering with layout.
*/
SafeHtmlBuilder sb = new SafeHtmlBuilder();
sb.appendHtmlConstant("<div class='vsplitter' style='text-align:center;'>");
sb.append(thumb.getSafeHtml());
sb.appendHtmlConstant("</div>");
splitDiv.setInnerSafeHtml(sb.toSafeHtml());
addScrolling(topDiv);
addScrolling(bottomDiv);
}
}
代码示例来源:origin: com.google.gwt/gwt-servlet
tmp.setInnerSafeHtml(html);
Element imageElem = tmp.getFirstChildElement();
代码示例来源:origin: net.wetheinter/gwt-user
public Element createStructure(SafeUri url, int left, int top, int width, int height) {
Element tmp = Document.get().createSpanElement();
tmp.setInnerSafeHtml(getSafeHtml(url, left, top, width, height));
return tmp.getFirstChildElement();
}
代码示例来源:origin: gwtbootstrap3/gwtbootstrap3
private void createFrame() {
// Attach a hidden IFrame to the form. This is the target iframe to
// which the form will be submitted. We have to create the iframe using
// innerHTML, because setting an iframe's 'name' property dynamically
// doesn't work on most browsers.
Element dummy = Document.get().createDivElement();
dummy.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(frameName));
synthesizedFrame = dummy.getFirstChildElement();
}
代码示例来源:origin: org.gwtbootstrap3/gwtbootstrap3
private void createFrame() {
// Attach a hidden IFrame to the form. This is the target iframe to
// which the form will be submitted. We have to create the iframe using
// innerHTML, because setting an iframe's 'name' property dynamically
// doesn't work on most browsers.
Element dummy = Document.get().createDivElement();
dummy.setInnerSafeHtml(IFrameTemplate.INSTANCE.get(frameName));
synthesizedFrame = dummy.getFirstChildElement();
}
内容来源于网络,如有侵权,请联系作者删除!