Java 类com.google.gwt.dom.client.StyleElement 实例源码

项目:hawkbit    文件:ViewClientCriterion.java   
/**
 * Styles a multi-row selection with the number of elements.
 *
 * @param drag
 *            the current drag event holding the context.
 */
void setMultiRowDragDecoration(VDragEvent drag) {
    Widget widget = drag.getTransferable().getDragSource().getWidget();

    if (widget instanceof VScrollTable) {
        VScrollTable table = (VScrollTable) widget;
        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);
                HeadElement head = HeadElement.as(Document.get().getElementsByTagName(HeadElement.TAG).getItem(0));
                head.appendChild(dragCountElement);
            }
            SafeHtml formattedCssStyle = getDraggableTemplate().multiSelectionStyle(determineActiveTheme(drag),
                    String.valueOf(rowCount));
            StyleElement dragCountStyleElement = StyleElement.as(dragCountElement);
            dragCountStyleElement.setInnerSafeHtml(formattedCssStyle);
        } else if (dragCountElement != null) {
            dragCountElement.removeFromParent();
        }
    }
}
项目:jetpad-projectional-open-source    文件:Tooltip.java   
private static Registration injectCornerStyle(String id, Cell cell) {
  Color borderColor = cell.get(Cell.BORDER_COLOR);
  String border = borderColor == null ? "none" : "1px solid " + borderColor.toCssColor();
  Color backgroundColor = cell.get(Cell.BACKGROUND);
  String background = backgroundColor == null ? Color.WHITE.toCssColor() : backgroundColor.toCssColor();
  final StyleElement styleElement = StyleInjector.injectStylesheet("." + id
      + "::before { border-top: " + border + "; border-left: " + border + "; " +
      "background: linear-gradient(135deg, " + background + " 0%, " + background
      + " 70%, rgba(0,0,0,0) 71%, rgba(0,0,0,0) 100%) }");
  StyleInjector.flush();
  return new Registration() {
    @Override
    protected void doRemove() {
      styleElement.removeFromParent();
    }
  };
}
项目:hawkbit    文件:ViewClientCriterionTest.java   
@Test
@Description("Check multi row drag decoration with a valid multi selection")
public void processMultiRowDragDecorationMultiSelection() {
    final ViewClientCriterion cut = new ViewClientCriterion();

    // prepare table
    final VScrollTable table = Mockito.spy(new VScrollTable());
    table.selectedRowKeys.add("one");
    table.selectedRowKeys.add("two");
    table.focusedRow = Mockito.mock(VScrollTable.VScrollTableBody.VScrollTableRow.class);
    when(table.focusedRow.getKey()).thenReturn("one");

    // prepare drag-event with table widget:
    final VDragEvent dragEvent = CriterionTestHelper.createMockedVDragEvent("thisId", table, "myTheme");
    dragEvent.getTransferable().getDragSource().getConnection().getUIConnector();

    // prepare document
    final Document document = Document.get();
    final StyleElement ele = Mockito.spy(StyleElement.class);
    when(ele.getTagName()).thenReturn(StyleElement.TAG);
    when(document.getElementById(ViewClientCriterion.SP_DRAG_COUNT)).thenReturn(ele);

    try {
        // act
        cut.setMultiRowDragDecoration(dragEvent);

        // assure that multi-row decoration for the table was processed
        verify(document).getElementById(ViewClientCriterion.SP_DRAG_COUNT);

        // assure that no multi selection was detected
        verify(ele).setInnerSafeHtml(any(SafeHtml.class));
    } finally {
        reset(Document.get());
    }
}
项目:gerrit    文件:Themer.java   
void init(Element css, Element header, Element footer) {
  cssElement = StyleElement.as(css);
  headerElement = header;
  footerElement = footer;

  cssText = getCssText(this.cssElement);
  headerHtml = header.getInnerHTML();
  footerHtml = footer.getInnerHTML();
}
项目:qafe-platform    文件:MainController.java   
private void handleStyling(String css) {
    if ((css == null) || (css.length() == 0)) {
        return;
    }
    if (isIE()) {
        addStyleSheet(css);
    } else {
        // Append custom css style as last thing in the Head element
        Element head = Document.get().getElementsByTagName("head").getItem(0);
        StyleElement styleElement = Document.get().createStyleElement();
        styleElement.setType("text/css");
        styleElement.setInnerText(css);
        head.appendChild(styleElement);
    }
}
项目:gerrit    文件:Themer.java   
@Override
protected String getCssText(StyleElement el) {
  return el.getCssText();
}
项目:gerrit    文件:Themer.java   
@Override
protected void setCssText(StyleElement el, String css) {
  el.setCssText(css);
}
项目:gerrit    文件:Themer.java   
protected String getCssText(StyleElement el) {
  return el.getInnerHTML();
}
项目:gerrit    文件:Themer.java   
protected void setCssText(StyleElement el, String css) {
  el.setInnerHTML(css);
}
项目:xapi    文件:HtmlSnippetTest.java   
@Override
public StyleElement injectStyle(
    Class<? extends HasStyleResources> bundle, Class<?>[] styles
) {
  throw new UnsupportedOperationException();
}
项目:xapi    文件:HtmlSnippetTest.java   
@Override
public Out1<StyleElement> registerStyle(
    Class<? extends HasStyleResources> bundle, String css, Class<?>[] styles
) {
  throw new UnsupportedOperationException();
}