Package elemental.html

Examples of elemental.html.Element


      @Override
      public void handleEvent(Event evt) {
        MouseEvent event = (MouseEvent) evt;
        // we could really just use the event target but this is for future
        // expandability I guess.
        Element element = CssUtils.getAncestorOrSelfWithClassName(
            (Element) event.getTarget(), res.baseCss().tab());
        if (element != null) {
          @SuppressWarnings("unchecked")
          TabElement<T> tabElement = (TabElement<T>) element;
          selectTab(tabElement);
View Full Code Here


      sliderLeft = Elements.createDivElement(css.sliderLeft());
      sliderSplitter = Elements.createDivElement(css.sliderSplitter());
      sliderRight = Elements.createDivElement(css.sliderRight());
      paddingForBorderRadius = CssUtils.parsePixels(css.paddingForBorderRadius());

      Element rootElement = Elements.createDivElement(css.sliderRoot());
      rootElement.appendChild(sliderLeft);
      rootElement.appendChild(sliderSplitter);
      rootElement.appendChild(sliderRight);
      setElement(rootElement);

      rootElement.addEventListener(Event.CLICK, toggleSliderListener, false);

      new SplitterController().start();
    }
View Full Code Here

  private void attachEventHandlers() {
    getView().addEventListener(Event.CLICK, new EventListener() {
      @Override
      public void handleEvent(Event evt) {
        Element listItemElem = CssUtils.getAncestorOrSelfWithClassName(
            (Element) evt.getTarget(), css.listItem());

        if (listItemElem == null) {
          Log.warn(SimpleList.class,
              "Unable to find an ancestor that was a list item for a click on: ", evt.getTarget());
View Full Code Here

      animating = true;
    }

    private int prepareForAnimation(boolean active) {
      Element visibleButton = active ? sliderLeft : sliderRight;
      int value = visibleButton.getOffsetWidth();
      String rightStart = (active ? 0 : value - paddingForBorderRadius)
          + CSSStyleDeclaration.Unit.PX;

      sliderLeft.getStyle().setWidth(value + CSSStyleDeclaration.Unit.PX);
      sliderRight.getStyle().setWidth(value + CSSStyleDeclaration.Unit.PX);
View Full Code Here

    View(Resources resources) {
      this.css = resources.popupCss();

      contentHolder = Elements.createDivElement(css.contentHolder());

      Element rootElement = Elements.createDivElement(css.root());
      rootElement.appendChild(contentHolder);
      setElement(rootElement);
    }
View Full Code Here

    /**
     * Creates a new ListItem overlay object by creating a div element,
     * assigning it the listItem css class, and associating it to its data.
     */
    public static <M> ListItem<M> create(ListItemRenderer<M> factory, Css css, M data) {
      Element element = factory.createElement();
      element.addClassName(css.listItem());
     
      ListItem<M> item = ListItem.cast(element);
      item.setData(data);
      return item;
    }
View Full Code Here

    int maxLineLength = buffer.getMaxLineLength();
    int newMaxLineLength = maxLineLength;

    for (int i = 0, n = dirtyLines.size(); i < n; i++) {
      Line line = dirtyLines.get(i);
      Element lineElement = getLineElement(line);
      if (lineElement == null) {
        /*
         * The line may have been in the viewport when marked as dirty, but it
         * is not anymore
         */
 
View Full Code Here

      public void dispatch(LineLifecycleListener listener) {
        listener.onRenderedLineGarbageCollected(line);
      }
    });

    Element element = line.getTag(LINE_TAG_LINE_ELEMENT);
    if (element != null && buffer.hasLineElement(element)) {
      element.removeFromParent();
      line.putTag(LINE_TAG_LINE_ELEMENT, null);
    }

    handleLineLeftViewport(line);
  }
View Full Code Here

  }

  private Element createOrUpdateLineElement(final Line line, final int lineNumber,
      int createOffset) {
    int top = buffer.calculateLineTop(lineNumber);
    Element element = getLineElement(line);
    boolean isCreatingElement = element == null;
    if (isCreatingElement) {
      element = Elements.createDivElement();
      element.getStyle().setPosition(CSSStyleDeclaration.Position.ABSOLUTE);
      lineRendererController.renderLine(line, lineNumber, element, true);
      line.putTag(LINE_TAG_LINE_ELEMENT, element);
    }
    new DebugAttributeSetter().add("lineNum", Integer.toString(lineNumber)).on(element);

    if (!buffer.hasLineElement(element)) {
      element.getStyle().setTop(top + createOffset, CSSStyleDeclaration.Unit.PX);
      buffer.addLineElement(element);
      if (createOffset != 0) {
        /*
         * TODO: When enabling editor animations, reinvestigate
         * need for below
         */
        // Force a browser layout so CSS3 animations transition properly.
        //element.getClientWidth();
        element.getStyle().setTop(top, CSSStyleDeclaration.Unit.PX);
      }
      handleLineEnteredViewport(line, lineNumber, element);
    } else {
      element.getStyle().setTop(top, CSSStyleDeclaration.Unit.PX);
    }

    if (isCreatingElement) {
      lineLifecycleListenerManager.dispatch(new Dispatcher<Renderer.LineLifecycleListener>() {
        @Override
View Full Code Here

    addClassesToElement(elem, classNames);
    return elem;
  }

  public static Element createElement(String tagName, String... classNames) {
    Element elem = getDocument().createElement(tagName);
    addClassesToElement(elem, classNames);
    return elem;
  }
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.