Java Code Examples for com.google.gwt.dom.client.StyleInjector#flush()

The following examples show how to use com.google.gwt.dom.client.StyleInjector#flush() . 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: Tooltip.java    From jetpad-projectional-open-source with Apache License 2.0 6 votes vote down vote up
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();
    }
  };
}
 
Example 2
Source File: TimelineWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
/**
 * Injects custom stylesheet just for this widget. It helps to update styles
 * for a big group of elements in the DOM, like resolution blocks.
 * <p>
 * Warning, this feature is not working with Internet Explorer reliably
 * enough. Read more at {@link StyleInjector#injectStylesheetAtEnd(String)}.
 * This method has no effect when {@link #ie} is set to true.
 */
private void injectStyle() {
    if (ie || styleElement != null) {
        return;
    }

    styleElement = StyleInjector.injectStylesheetAtEnd(
            "." + STYLE_FIRST + " { } ." + STYLE_CENTER + " { } ." + STYLE_LAST + " { } ." + STYLE_COL + " { } ");

    StyleInjector.flush();
}
 
Example 3
Source File: TimelineWidget.java    From gantt with Apache License 2.0 5 votes vote down vote up
private void injectLeftStyle() {
    if (ie || styleElementForLeft != null) {
        return;
    }

    styleElementForLeft = StyleInjector.injectStylesheetAtEnd("." + STYLE_COL + " { } ");

    StyleInjector.flush();
}
 
Example 4
Source File: CellContainerToDomMapper.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
private static void ensureIndentInjected() {
  if (ourIndentInjected) return;

  StyleInjector.flush();

  double width = TextMetricsCalculator.calculate(TextCell.DEFAULT_FONT, "xx").dimension().x;
  StyleInjector.inject("." + CSS.indented() + "{ padding-left: " + width + "px }", true);
  ourIndentInjected = true;
}