Package org.waveprotocol.wave.client.common.safehtml

Examples of org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder


      replacementRangeHelper.trackRange(replaceRange);
    }
    Menu menuWrapper = new Menu() {
      @Override
      public MenuItem addItem(SafeHtml title, Command callback) {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();
        builder.append(START_SUGGEST_LINK);
        builder.append(title);
        builder.append(END_SUGGEST_LINK);

        return menu.addItem(builder.toSafeHtml(), callback);
      }

      @Override
      public MenuItem addItem(String title, Command callback) {
        return addItem(EscapeUtils.fromString(title), callback);
View Full Code Here


   * @param options options to include in the menu
   * @param selected which options, if any, are to be selected.
   */
  private void setMenuState(Set<MenuOption> options, Set<MenuOption> selected) {
    UiBuilder builder = BlipMetaViewBuilder.menuBuilder(options, selected, css);
    SafeHtmlBuilder  out = new SafeHtmlBuilder();
    builder.outputHtml(out);
    getMenu().setInnerHTML(out.toSafeHtml().asString());
  }
View Full Code Here

   * @param options options to include in the menu
   * @param selected which options, if any, are to be selected.
   */
  private void setMenuState(Set<MenuOption> options, Set<MenuOption> selected) {
    UiBuilder builder = BlipMetaViewBuilder.menuBuilder(options, selected, css);
    SafeHtmlBuilder  out = new SafeHtmlBuilder();
    builder.outputHtml(out);
    getMenu().setInnerHTML(out.toSafeHtml().asString());
  }
View Full Code Here

    self.removeClassName(css.selected());
  }

  @Override
  public void setAvatars(Iterable<Profile> profiles) {
    SafeHtmlBuilder html = new SafeHtmlBuilder();
    for (Profile profile : profiles) {
      renderAvatar(html, profile);
    }
    avatars.setInnerHTML(html.toSafeHtml().asString());
  }
View Full Code Here

      time.addClassName(css.unread());
    }
  }

  private SafeHtml renderUnreadMessages(int unread, int total) {
    SafeHtmlBuilder html = new SafeHtmlBuilder();
    html.appendHtmlConstant("<span class='" + css.unreadCount() + "'>");
    html.appendHtmlConstant(String.valueOf(unread));
    html.appendHtmlConstant("</span>");
    html.appendHtmlConstant(" of ");
    html.appendHtmlConstant(String.valueOf(total));
    return html.toSafeHtml();
  }
View Full Code Here

    html.appendHtmlConstant(String.valueOf(total));
    return html.toSafeHtml();
  }

  private SafeHtml renderReadMessages(int total) {
    SafeHtmlBuilder html = new SafeHtmlBuilder();
    html.appendHtmlConstant(String.valueOf(total));
    html.appendHtmlConstant(" msgs");
    return html.toSafeHtml();
  }
View Full Code Here

    void add(String name) {
      events.put(name, duration.elapsedMillis());
    }

    void dump(Element timeBox) {
      final SafeHtmlBuilder timeHtml = new SafeHtmlBuilder();
      timeHtml.appendHtmlConstant("<table cellpadding='0' cellspacing='0'>");
      events.each(new ProcV<Integer>() {
        @Override
        public void apply(String key, Integer value) {
          timeHtml.appendHtmlConstant("<tr><td>");
          timeHtml.appendEscaped(key);
          timeHtml.appendHtmlConstant(":</td><td>");
          timeHtml.appendEscaped("" + value);
          timeHtml.appendHtmlConstant("</td></tr>");
        }
      });
      timeHtml.appendHtmlConstant("</table>");
      timeBox.setInnerHTML(timeHtml.toSafeHtml().asString());

    }
View Full Code Here

    }
  }

  @Override
  public SafeHtml getResult() {
    SafeHtmlBuilder builder = new SafeHtmlBuilder();
    for (ResultProducingRenderHelper<? extends UiBuilder> h : helpers) {
      h.getResult().outputHtml(builder);
    }
    return builder.toSafeHtml();
  }
View Full Code Here

      replacementRangeHelper.trackRange(replaceRange);
    }
    Menu menuWrapper = new Menu() {
      @Override
      public MenuItem addItem(SafeHtml title, Command callback) {
        SafeHtmlBuilder builder = new SafeHtmlBuilder();
        builder.append(START_SUGGEST_LINK);
        builder.append(title);
        builder.append(END_SUGGEST_LINK);

        return menu.addItem(builder.toSafeHtml(), callback);
      }

      @Override
      public MenuItem addItem(String title, Command callback) {
        return addItem(EscapeUtils.fromString(title), callback);
View Full Code Here

  /** Turns a UiBuilder rendering into a DOM element. */
  private Element parseHtml(UiBuilder ui) {
    if (ui == null) {
      return null;
    }
    SafeHtmlBuilder html = new SafeHtmlBuilder();
    ui.outputHtml(html);
    Element div = com.google.gwt.dom.client.Document.get().createDivElement();
    div.setInnerHTML(html.toSafeHtml().asString());
    Element ret = div.getFirstChildElement();
    // Detach, in order that this element looks free-floating (required by some
    // preconditions).
    ret.removeFromParent();
    return ret;
View Full Code Here

TOP

Related Classes of org.waveprotocol.wave.client.common.safehtml.SafeHtmlBuilder

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.