Example usage for com.google.gwt.dom.client StyleElement as

List of usage examples for com.google.gwt.dom.client StyleElement as

Introduction

In this page you can find the example usage for com.google.gwt.dom.client StyleElement as.

Prototype

public static StyleElement as(Element elem) 

Source Link

Document

Assert that the given Element is compatible with this class and automatically typecast it.

Usage

From source file:com.google.gerrit.client.Themer.java

License:Apache License

void init(Element css, Element header, Element footer) {
    cssElement = StyleElement.as(css);
    headerElement = header;//w w  w.  ja v  a2  s  . c o m
    footerElement = footer;

    cssText = getCssText(this.cssElement);
    headerHtml = header.getInnerHTML();
    footerHtml = footer.getInnerHTML();
}

From source file:org.eclipse.hawkbit.ui.dd.client.criteria.ViewClientCriterion.java

License:Open Source License

/**
 * Styles a multi-row selection with the number of elements.
 *
 * @param drag/*from w w w .j  a  va 2 s . co  m*/
 *            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();
        }
    }
}