Package elemental.html

Examples of elemental.html.DivElement


    addClassesToElement(elem, classNames);
    return elem;
  }

  public static DivElement createDivElement(String... classNames) {
    DivElement elem = getDocument().createDivElement();
    addClassesToElement(elem, classNames);
    return elem;
  }
View Full Code Here


    treeNode.setRenderer(nodeRenderer);
    // Associate the rendered node with the underlying model data.
    dataAdapter.setRenderedTreeNode(data, treeNode);

    // Attach the Tree node body.
    DivElement treeNodeBody = Elements.createDivElement(css.treeNodeBody());
    treeNodeBody.setAttribute("draggable", "true");
    DivElement expandControl = Elements.createDivElement();
    SpanElement nodeContents = nodeRenderer.renderNodeContents(data);
    nodeContents.addClassName(css.treeNodeLabel());

    treeNodeBody.appendChild(expandControl);
    treeNodeBody.appendChild(nodeContents);
View Full Code Here

      setElement(Elements.createDivElement(css.root()));
    }

    private void addParticipant(String userId, String displayEmail, String name, String color) {
      DivElement rowElement = Elements.createDivElement(css.row());

      DivElement swatchElement = Elements.createDivElement(css.swatch());
      swatchElement.setAttribute("style", "background-color: " + color);
      rowElement.appendChild(swatchElement);

      SpanElement nameElement = Elements.createSpanElement(css.name());
      nameElement.setTextContent(name);
      nameElement.setTitle(displayEmail);
View Full Code Here

      getElement().appendChild(rowElement);
      rows.put(userId, rowElement);
    }

    private void removeParticipant(String userId) {
      DivElement row = rows.get(userId);
      if (row != null) {
        row.removeFromParent();
      }
    }
View Full Code Here

  public static SpanElement renderNodeContents(
      Css css, String name, boolean isFile, EventListener mouseDownListener, boolean renderIcon) {

    SpanElement root = Elements.createSpanElement(css.root());
    if (renderIcon) {
      DivElement icon = Elements.createDivElement(css.icon());
      icon.addClassName(isFile ? css.file() : css.folder());
      root.appendChild(icon);
    }

    final Element label;
    if (mouseDownListener != null) {
View Full Code Here

    Tooltip noFileSelectedTooltip = new Tooltip.Builder(
        context.getResources(), target, positioner).setShouldListenToHover(false)
        .setTooltipRenderer(new TooltipRenderer() {
          @Override
          public elemental.html.Element renderDom() {
            DivElement container = Elements.createDivElement();

            DivElement header = Elements.createDivElement();
            header.setTextContent("No File Selected");
            header.getStyle().setFontWeight(CSSStyleDeclaration.FontWeight.BOLDER);
            header.getStyle().setMarginBottom(5, CSSStyleDeclaration.Unit.PX);
            container.appendChild(header);

            DivElement text = Elements.createDivElement();
            text.setTextContent(
                "Choose a file from the tree to preview it, or select a custom run target.");
            container.appendChild(text);

            return container;
          }
        }).build();

    Tooltip yamlAddedTooltip = new Tooltip.Builder(
        context.getResources(), target, positioner).setShouldListenToHover(false)
        .setTooltipRenderer(new TooltipRenderer() {
          @Override
          public elemental.html.Element renderDom() {
            DivElement container = Elements.createDivElement();

            SpanElement text = Elements.createSpanElement();
            text.setTextContent(
                "The run target has been set to your newly created app.yaml file. ");
            container.appendChild(text);

            // TODO: We'd like to offer an option to undo the
            // automatic setting of the run target, but I don't have time
            // to write a coach tips class right now and tool tips can't be
            // clicked.
            return container;
          }
        }).build();

    Tooltip targetResetTooltip = new Tooltip.Builder(
        context.getResources(), target, positioner).setShouldListenToHover(false)
        .setTooltipRenderer(new TooltipRenderer() {
          @Override
          public elemental.html.Element renderDom() {
            DivElement container = Elements.createDivElement();

            SpanElement text = Elements.createSpanElement();
            text.setTextContent(
                "You deleted your run target, the run button has been reset to preview "
                + "the active file.");
            container.appendChild(text);

            // TODO: We'd like to offer undo, but I don't have time
            // to write a coach tips class right now and tool tips can't be
            // clicked.
            return container;
View Full Code Here

      AnchorElement button = Elements.createAnchorElement();
      button.setClassName(css.button());
      button.setTextContent(buttonText);
      root.appendChild(button);

      DivElement footer = DomUtils.appendDivWithTextContent(root, css.footerText(), footerText);
      return new Panel(root, button, footer);
    }
View Full Code Here

   */
  public void setStats(DiffStatsDto diffStats) {
    // Cleanup any old state.
    destroy();

    DivElement barsDiv = getView().barsDiv;
    barsDiv.setInnerHTML("");
    int total = getTotal(diffStats);
    int addedBars = calculateBars(diffStats.getAdded(), total);
    int deletedBars = calculateBars(diffStats.getDeleted(), total);
    int modifiedBars = calculateBars(diffStats.getChanged(), total);
    int unmodifiedBars = Math.max(0, BAR_COUNT - (addedBars + deletedBars + modifiedBars));
View Full Code Here

    /**
     * Create several bars of the given style and append them to the element.
     */
    private void createBars(Element element, int bars, String style) {
      for (int i = 0; i < bars; i++) {
        DivElement bar = Elements.createDivElement(css.bar());
        bar.addClassName(style);
        element.appendChild(bar);
      }
    }
View Full Code Here

      rootElement.appendChild(scrollbarElement);
      setElement(rootElement);
    }

    private Element createScrollbarElement(BaseResources.Css baseCss) {
      final DivElement scrollbarElement = Elements.createDivElement(css.scrollbar());
      scrollbarElement.addClassName(baseCss.documentScrollable());

      scrollbarElement.addEventListener(Event.SCROLL, new EventListener() {
        @Override
        public void handleEvent(Event evt) {
          setScrollTop(scrollbarElement.getScrollTop(), false);
        }
      }, false);

      // Prevent stealing focus from scrollable.
      scrollbarElement.addEventListener(Event.MOUSEDOWN, new EventListener() {
        @Override
        public void handleEvent(Event evt) {
          evt.preventDefault();
        }
      }, false);

      // Empty child will be set to the document height
      scrollbarElement.appendChild(Elements.createDivElement());

      return scrollbarElement;
    }
View Full Code Here

TOP

Related Classes of elemental.html.DivElement

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.