Package elemental.css

Examples of elemental.css.CSSStyleDeclaration$Display


    positionController.updateElementPosition(x, y);
  }

  private void updateArrow(int x, int y) {
    Element arrow = getView().getArrow();
    CSSStyleDeclaration style = arrow.getStyle();

    HorizontalAlign alignment = positionController.getPositioner().getHorizontalAlignment();
    style.setLeft("auto");
    style.setRight("auto");
    if (alignment == HorizontalAlign.LEFT) {
      style.setLeft(-(x * 2), CSSStyleDeclaration.Unit.PX);
    } else {
      style.setRight((x * 2), CSSStyleDeclaration.Unit.PX);
    }
    style.setTop(-(y * 2), CSSStyleDeclaration.Unit.PX);
  }
View Full Code Here


  }
 
  private static Element createPopupDummyElement(int lineHeight) {
    Element element = Elements.createDivElement();

    CSSStyleDeclaration style = element.getStyle();
    style.setDisplay(CSSStyleDeclaration.Display.INLINE_BLOCK);
    style.setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
    style.setWidth(0, CSSStyleDeclaration.Unit.PX);
    style.setHeight(lineHeight, CSSStyleDeclaration.Unit.PX);
    style.setZIndex(1);

    // We do this so that custom CSS class (provided by textCssClassName in the #showPopup)
    // with cursor:pointer should work correctly.
    style.setProperty("pointer-events", "none");

    return element;
  }
View Full Code Here

      /**
       * Show by fading+sliding in from the left.
       */
      void show(int startDelay, int duration) {
        CSSStyleDeclaration style = breadcrumb.getStyle();
        // TODO: extract constants
        style.setProperty("-webkit-transition-duration", duration + "ms");
        style.setProperty("-webkit-transition-delay", startDelay + "ms");
        breadcrumb.removeClassName(css.start());
      }
View Full Code Here

      /**
       * 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

   *        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

      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

    }

    // 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

    /*
     * 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

  /**
   * 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

    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

TOP

Related Classes of elemental.css.CSSStyleDeclaration$Display

Copyright © 2018 www.massapicom. 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.