com.google.gwt.dom.client.HeadElement Java Examples

The following examples show how to use com.google.gwt.dom.client.HeadElement. 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: ViewClientCriterion.java    From hawkbit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Styles a multi-row selection with the number of elements.
 *
 * @param drag
 *            the current drag event holding the context.
 */
void setMultiRowDragDecoration(final VDragEvent drag) {
    final Widget widget = drag.getTransferable().getDragSource().getWidget();

    if (widget instanceof VScrollTable) {
        final VScrollTable table = (VScrollTable) widget;
        final int rowCount = table.selectedRowKeys.size();

        Element dragCountElement = Document.get().getElementById(SP_DRAG_COUNT);
        if (rowCount > 1 && table.selectedRowKeys.contains(table.focusedRow.getKey())) {
            if (dragCountElement == null) {
                dragCountElement = Document.get().createStyleElement();
                dragCountElement.setId(SP_DRAG_COUNT);
                final HeadElement head = HeadElement
                        .as(Document.get().getElementsByTagName(HeadElement.TAG).getItem(0));
                head.appendChild(dragCountElement);
            }
            final SafeHtml formattedCssStyle = getDraggableTemplate()
                    .multiSelectionStyle(determineActiveTheme(drag), String.valueOf(rowCount));
            final StyleElement dragCountStyleElement = StyleElement.as(dragCountElement);
            dragCountStyleElement.setInnerSafeHtml(formattedCssStyle);
        } else if (dragCountElement != null) {
            dragCountElement.removeFromParent();
        }
    }
}
 
Example #2
Source File: CubaRichTextAreaWidget.java    From cuba with Apache License 2.0 5 votes vote down vote up
protected void setContentCharset() {
    rta.addInitializeHandler(event -> {
        IFrameElement iFrameElement = IFrameElement.as(rta.getElement());
        HeadElement headElement = iFrameElement.getContentDocument().getHead();

        MetaElement charsetMetaElement = Document.get().createMetaElement();
        charsetMetaElement.setHttpEquiv(HttpHeaders.CONTENT_TYPE);
        charsetMetaElement.setContent(HttpHeaders.CONTENT_TYPE_TEXT_HTML_UTF8);

        headElement.appendChild(charsetMetaElement);
    });
}
 
Example #3
Source File: DefaultThemeController.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Gets the head tag element.
 *
 * @return the head tag element
 */
protected HeadElement getHead() {
	if (this.head == null) {
		Element elt = Document.get().getElementsByTagName("head").getItem(0);
		assert elt != null : "The host HTML page does not have a <head> element" + " which is required by this injector";
		this.head = HeadElement.as(elt);
	}
	return this.head;
}