Java Code Examples for com.google.gwt.dom.client.Element#removeAllChildren()

The following examples show how to use com.google.gwt.dom.client.Element#removeAllChildren() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CubaTreeTableWidget.java    From cuba with Apache License 2.0 6 votes vote down vote up
@Override
protected void initCellWithText(String text, char align, String style, boolean textIsHTML,
                                boolean sorted, String description, TableCellElement td) {
    super.initCellWithText(text, align, style, textIsHTML, sorted, description, td);

    Element tdElement = td.cast();
    Tools.textSelectionEnable(tdElement, _delegate.textSelectionEnabled);

    if ((_delegate.clickableColumns != null && _delegate.clickableColumns.contains(currentColumnKey))
            || (_delegate.clickableTableColumns != null && _delegate.clickableTableColumns.contains(currentColumnKey))) {
        tdElement.addClassName(CUBA_TABLE_CLICKABLE_CELL_CONTENT);
        Element wrapperElement = tdElement.getFirstChildElement();
        final Element clickableSpan = DOM.createSpan().cast();
        clickableSpan.setClassName(CUBA_TABLE_CLICKABLE_CELL_STYLE);

        clickableSpan.setInnerText(wrapperElement.getInnerText());

        wrapperElement.removeAllChildren();
        DOM.appendChild(wrapperElement, clickableSpan);
    }

    if (_delegate.multiLineCells) {
        Style wrapperStyle = tdElement.getFirstChildElement().getStyle();
        wrapperStyle.setWhiteSpace(Style.WhiteSpace.PRE_LINE);
    }
}
 
Example 2
Source File: BreadcrumbLink.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void redraw() {
	StyleUtils.toggleStyle(this, LinkStyle.ACTIVE, this.active);
	Element elem = getElement();
	elem.removeAllChildren();
	if (!active) {
		elem = Document.get().createAnchorElement();
		getElement().appendChild(elem);
		if (this.link != null) {
			AnchorElement.as(elem).setHref(this.link);
		}
	}

	if (this.label != null) {
		elem.setInnerHTML(this.label);
	}
	if (this.iconType != null) {
		Icon icon = new Icon();
		icon.setType(this.iconType);
		elem.insertFirst(icon.getElement());
	}
}
 
Example 3
Source File: NaluPluginGWT.java    From nalu with Apache License 2.0 5 votes vote down vote up
@Override
public void remove(String selector) {
  Element selectorElement = DOM.getElementById(selector);
  if (selectorElement != null) {
    selectorElement.removeAllChildren();
  }
}
 
Example 4
Source File: DomUtil.java    From mapper with Apache License 2.0 5 votes vote down vote up
public static WritableProperty<WithElement> withElementOneChild(final Element el) {
  return new WritableProperty<WithElement>() {
    @Override
    public void set(WithElement value) {
      el.removeAllChildren();
      if (value != null && value.getElement() != null) {
        el.appendChild(value.getElement());
      }
    }
  };
}
 
Example 5
Source File: DomUtil.java    From mapper with Apache License 2.0 5 votes vote down vote up
public static WritableProperty<Element> elementOneChild(final Element el) {
  return new WritableProperty<Element>() {
    @Override
    public void set(Element value) {
      el.removeAllChildren();
      if (value != null) {
        el.appendChild(value);
      }
    }
  };
}