Examples of CSSStyleDeclaration


Examples of elemental.css.CSSStyleDeclaration

      /**
       * Hide by fading+sliding out to the left.
       */
      void hide(int startDelay) {
        CSSStyleDeclaration style = breadcrumb.getStyle();
        style.setProperty("-webkit-transition-delay", startDelay + "ms");
        getElement().addClassName(css.hide());
      }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

   *        completes. It will be passed a {@code null} event if the animation
   *        was pre-empted by some other animation on the same element.
   */
  public static void animatePropertySet(final Element elem, String property, String value,
      double duration, final EventListener animationCallback) {
    final CSSStyleDeclaration style = elem.getStyle();
    enableTransitions(style, duration);

    if (BrowserUtils.isFirefox()) {
      // For FF4.
      new TransitionEndHandler(animationCallback).handleEndFor(elem, "transitionend");
    } else {
      // For webkit based browsers.
      // TODO: Keep an eye on whether or not webkit supports the
      // vendor prefix free version. If they ever do we should remove this.
      new TransitionEndHandler(animationCallback).handleEndFor(elem, Event.WEBKITTRANSITIONEND);
    }

    style.setProperty(property, value);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

      positionElementToAnchorTopLeft(anchor, element);
    }
  }

  private void positionElementToAnchorTopLeft(ReadOnlyAnchor anchor, Element element) {
    CSSStyleDeclaration style = element.getStyle();

    style.setTop(buffer.convertLineNumberToY(anchor.getLineNumber()), CSSStyleDeclaration.Unit.PX);

    int column = anchor.getColumn();
    if (column != AnchorManager.IGNORE_COLUMN) {
      style.setLeft(buffer.convertColumnToX(anchor.getLine(), column), CSSStyleDeclaration.Unit.PX);
    }
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    }

    // Cancel pending transition event listeners.
    showEndHandler.unhandleEndFor(element);

    final CSSStyleDeclaration style = element.getStyle();

    if (options.collapse) {
      // Set height because the CSS transition requires one
      int height = getCurrentHeight(element);
      style.setHeight(height + CSSStyleDeclaration.Unit.PX);
    }

    // Give the browser a chance to accept the height set above
    setState(element, State.HIDING);
    schedule(element, new ScheduledCommand() {
      @Override
      public void execute() {
        // The user changed the state before this command executed.
        if (!clearLastCommand(element, this) || !isAnyState(element, State.HIDING)) {
          return;
        }

        if (options.collapse) {
          /*
           * Hide overflow if changing height, or the overflow will be visible
           * even as the element collapses.
           */
          AnimationUtils.backupOverflow(style);
        }
        AnimationUtils.enableTransitions(style);

        if (options.collapse) {
          // Animate all properties that could affect height if collapsing.
          style.setHeight("0");
          style.setMarginTop("0");
          style.setMarginBottom("0");
          style.setPaddingTop("0");
          style.setPaddingBottom("0");
          CssUtils.setBoxShadow(element, "0 0");
        }

        if (options.fade) {
          style.setOpacity(0);
        }
      }
    });

    // For webkit based browsers.
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    /*
     * Make this "visible" again so we can measure its eventual height (required
     * for CSS transitions). We will set its initial state in this event loop,
     * so the element will not be fully visible.
     */
    final CSSStyleDeclaration style = element.getStyle();
    element.getStyle().removeProperty("display");
    final int measuredHeight = getCurrentHeight(element);

    /*
     * Set the initial state, but not if the element is in the process of
     * hiding.
     */
    if (!isAnyState(element, State.HIDING)) {
      if (options.collapse) {
        // Start the animation at a height of zero.
        style.setHeight("0");

        // We want to animate from total height of 0
        style.setMarginTop("0");
        style.setMarginBottom("0");
        style.setPaddingTop("0");
        style.setPaddingBottom("0");
        CssUtils.setBoxShadow(element, "0 0");

        /*
         * Hide overflow if expanding the element, or the entire element will be
         * instantly visible. Do not do this by default, because it could hide
         * absolutely positioned elements outside of the root element, such as
         * the arrow on a tooltip.
         */
        AnimationUtils.backupOverflow(style);
      }

      if (options.fade) {
        style.setOpacity(0);
      }
    }

    // Give the browser a chance to accept the properties set above
    setState(element, State.SHOWING);
    schedule(element, new ScheduledCommand() {
      @Override
      public void execute() {
        // The user changed the state before this command executed.
        if (!clearLastCommand(element, this) || !isAnyState(element, State.SHOWING)) {
          return;
        }

        // Enable animations before setting the end state.
        AnimationUtils.enableTransitions(style);

        // Set the end state.
        if (options.collapse) {
          if (options.fixedHeight) {
            // The element's styles have a fixed height set, so we just want to
            // clear our override
            style.setHeight("");
          } else {
            // Give it an explicit height to animate to, because the element's
            // height is auto otherwise
            style.setHeight(measuredHeight + CSSStyleDeclaration.Unit.PX);
          }

          style.removeProperty("margin-top");
          style.removeProperty("margin-bottom");
          style.removeProperty("padding-top");
          style.removeProperty("padding-bottom");
          CssUtils.removeBoxShadow(element);
        }

        if (options.fade) {
          style.setOpacity(1);
        }
      }
    });

    // For webkit based browsers.
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  /**
   * Returns the height as would be set on the CSS "height" property.
   */
  private int getCurrentHeight(final Element element) {
    // TODO: test to see if horizontal scroll plays nicely
    CSSStyleDeclaration style = CssUtils.getComputedStyle(element);
    return element.getClientHeight() - CssUtils.parsePixels(style.getPaddingTop())
        - CssUtils.parsePixels(style.getPaddingBottom());
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

    setLastCommandImpl(element, null);
    hideEndHandler.unhandleEndFor(element);
    showEndHandler.unhandleEndFor(element);

    // Disable animations.
    CSSStyleDeclaration style = element.getStyle();
    AnimationUtils.removeTransitions(style);
    if (options.collapse) {
      AnimationUtils.restoreOverflow(style);
    }

    // Remove the height and properties we set.
    if (options.collapse) {
      style.removeProperty("height");
      style.removeProperty("margin-top");
      style.removeProperty("margin-bottom");
      style.removeProperty("padding-top");
      style.removeProperty("padding-bottom");
    }
    if (options.fade) {
      style.removeProperty("opacity");
    }
    CssUtils.removeBoxShadow(element);
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

  private Element createContainer() {
    Element container = Elements.createDivElement();

    final int containerSize = 500;
    CSSStyleDeclaration containerStyle = container.getStyle();
    containerStyle.setWidth(containerSize, CSSStyleDeclaration.Unit.PX);
    containerStyle.setHeight(containerSize, CSSStyleDeclaration.Unit.PX);
    containerStyle.setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
    containerStyle.setLeft(-containerSize, CSSStyleDeclaration.Unit.PX);
    containerStyle.setTop(-containerSize, CSSStyleDeclaration.Unit.PX);

    Elements.getBody().appendChild(container);

    return container;
  }
View Full Code Here

Examples of elemental.css.CSSStyleDeclaration

   * that if you specify the horizontal and vertical position, the image will
   * not be the only content of the element.
   */
  public static void applyImageResource(Element elem, ImageResource image, String hPos,
      String vPos) {
    CSSStyleDeclaration style = elem.getStyle();
    style.setBackgroundImage("url(" + image.getSafeUri().asString() + ")");
    style.setProperty("background-repeat", "no-repeat");
    style.setProperty("background-position", hPos + " " + vPos);
    style.setOverflow("hidden");
  }
View Full Code Here

Examples of org.w3c.dom.css.CSSStyleDeclaration

    protected static GraphicsNode createSVGImageNode(BridgeContext ctx,
                                                     Element e,
                                                     SVGDocument imgDocument) {

        CompositeGraphicsNode result = new CompositeGraphicsNode();
        CSSStyleDeclaration decl = CSSUtilities.getComputedStyle(e);
        UnitProcessor.Context uctx = UnitProcessor.createContext(ctx, e);

        Rectangle2D r
            = CSSUtilities.convertEnableBackground(e, uctx);
        if (r != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.