Package elemental.html

Examples of elemental.html.Element


    lineNumberElement.getStyle().setTop(
        buffer.calculateLineTop(lineNumber), CSSStyleDeclaration.Unit.PX);
  }

  private Element createElement(int lineNumber) {
    Element element = Elements.createDivElement(css.lineNumber());
    // Line 0 will be rendered as Line 1
    element.setTextContent(String.valueOf(lineNumber + 1));
    element.getStyle().setTop(buffer.calculateLineTop(lineNumber), CSSStyleDeclaration.Unit.PX);
    if (lineNumber == activeLineNumber) {
      element.addClassName(css.activeLineNumber());
      renderedActiveLineNumber = activeLineNumber;
    }
    return element;
  }
View Full Code Here


    return element;
  }

  private void garbageCollectLines(int beginLineNumber, int endLineNumber) {
    for (int i = beginLineNumber; i <= endLineNumber; i++) {
      Element lineElement = lineNumberToElementCache.get(i);
      if (lineElement != null) {
        leftGutter.removeUnmanagedElement(lineElement);
        lineNumberToElementCache.erase(i);
      } else {
        throw new IndexOutOfBoundsException(
View Full Code Here

       * We verify that the target is actually being animated by the
       * AnimationController by checking its current state. It will only have a
       * state if the AnimationController added the state attribute to the
       * target.
       */
      Element target = (Element) evt.getTarget();
      if (isAnyState(target, State.SHOWING)) {
        showWithoutAnimating(target); // Puts element in SHOWN state
      }
    }
View Full Code Here

       * We verify that the target is actually being animated by the
       * AnimationController by checking its current state. It will only have a
       * state if the AnimationController added the state attribute to the
       * target.
       */
      Element target = (Element) evt.getTarget();
      if (isAnyState(target, State.HIDING)) {
        hideWithoutAnimating(target); // Puts element in HIDDEN state
      }
    }
View Full Code Here

  /**
   * Calculates (or recalculates) the sizes of the scrollbars.
   */
  public void calculateSize() {
    Element container = createContainer();

    // No scrollbars
    container.getStyle().setOverflow(CSSStyleDeclaration.Overflow.HIDDEN);
    int noScrollbarClientHeight = container.getClientHeight();
    int noScrollbarClientWidth = container.getClientWidth();

    // Force scrollbars
    container.getStyle().setOverflow(CSSStyleDeclaration.Overflow.SCROLL);
    heightOfHorizontalScrollbar = noScrollbarClientHeight - container.getClientHeight();
    widthOfVerticalScrollbar = noScrollbarClientWidth - container.getClientWidth();

    container.removeFromParent();
  }
View Full Code Here

    container.removeFromParent();
  }

  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);
View Full Code Here

  @Deprecated
  public static Offset calculateElementOffset(
      Element childElement, Element ancestorElement, boolean includeScroll) {

    Offset offset = new Offset();
    Element element = childElement;
    for (; element.getOffsetParent() != null && element != ancestorElement; element =
        element.getOffsetParent()) {
      offset.top += element.getOffsetTop();
      offset.left += element.getOffsetLeft();

      if (!includeScroll) {
        offset.top -= element.getOffsetParent().getScrollTop();
        offset.left -= element.getOffsetParent().getScrollLeft();
      }
    }

    return offset;
  }
View Full Code Here

      return event.getOffsetY();
    }
  }

  public static Element getNthChild(Element element, int index) {
    Element child = element.getFirstChildElement();
    while (child != null && index > 0) {
      --index;
      child = child.getNextSiblingElement();
    }
    return child;
  }
View Full Code Here

    }
    return child;
  }

  public static Element getNthChildWithClassName(Element element, int index, String className) {
    Element child = element.getFirstChildElement();
    while (child != null) {
      if (child.hasClassName(className)) {
        --index;
        if (index < 0) {
          break;
        }
      }
      child = child.getNextSiblingElement();
    }
    return child;
  }
View Full Code Here

        event.preventDefault();
      }
    };

    // Attach the listeners.
    final Element documentElement = Elements.getDocument().getDocumentElement();
    documentElement.addEventListener(Event.KEYDOWN, downListener, true);

    final CaptureReleaser downRemover = new CaptureReleaser() {
      @Override
      public void release() {
        documentElement.removeEventListener(Event.KEYDOWN, downListener, true);
      }
    };

    return new CaptureReleaser() {
      @Override
View Full Code Here

TOP

Related Classes of elemental.html.Element

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.