Package com.google.gwt.safehtml.shared

Examples of com.google.gwt.safehtml.shared.SafeHtml


  /**
   * Tests SafeHtml constructor.
   */
  public void testSafeHtml() {
    TestTemplates templates = GWT.create(TestTemplates.class);
    SafeHtml table = templates.tableTemplate("Hello");

    HTMLPanel hp = new HTMLPanel(table);
    InlineLabel label = new InlineLabel("World");
    hp.addAndReplaceElement(label, "labelHere");

View Full Code Here


    assertEquals("mySimpleTemplate", templates.mySimpleTemplate().asString());
  }

  public void testArgs() {
    MyTemplates templates = FakeSafeHtmlTemplatesMaker.create(MyTemplates.class);
    SafeHtml message = SafeHtmlUtils.fromString("message");
    assertEquals("messageWithLink[message, url, link, style]",
        templates.messageWithLink(message, "url", "link", "style").asString());
  }
View Full Code Here

            Row row = (Row)context.getKey();
            final String labelId = id + row.getRowNum() +"_"+index+"_l";

            boolean hasTitle = title!=null && !title.equals("");
            SafeHtml render = hasTitle ? TEMPLATE.render(labelId, title) : new SafeHtmlBuilder().toSafeHtml();
            safeHtmlBuilder.append(render);

        }
View Full Code Here

            Row row = (Row)context.getKey();
            final String labelId = id + row.getRowNum() +"_"+index+"_l";

            boolean hasValue = value!=null && !value.equals("");
            SafeHtml render = hasValue ? VALUE_TEMPLATE.render(labelId, value) : new SafeHtmlBuilder().toSafeHtml();
            safeHtmlBuilder.append(render);

        }
View Full Code Here

  @Override
  public void render(Context context, ToDoItem value, SafeHtmlBuilder sb) {
    // render the cell in edit or view mode
    if (isEditing(value)) {
      SafeHtml rendered = templates.edit(value.getTitle());
      sb.append(rendered);
    } else {
      SafeHtml rendered =
          templates.view(value.isCompleted() ? templates.inputChecked() : templates.inputClear(),
              SafeHtmlUtils.fromString(value.getTitle()), value.isCompleted() ? "listItem view completed"
                  : "listItem view",
              // NOTE: The addition of a timestamp here is a bit of a HACK! The problem
              // is that the CellList uses a HasDataPresenter for rendering. This class
View Full Code Here

        this.title = title;
    }

    @Override
    public void render(Context context, T value, SafeHtmlBuilder sb) {
        SafeHtml html = new SafeHtmlBuilder()
                .appendHtmlConstant("<a href='javascript:void(0)' tabindex=\"-1\" class='textlink-cell'>")
                .appendHtmlConstant(title)
                .appendHtmlConstant("</a>")
                .toSafeHtml();
View Full Code Here

        this.title = title;
    }

    @Override
    public void render(Context context, T value, SafeHtmlBuilder sb) {
        SafeHtml html = new SafeHtmlBuilder().appendHtmlConstant("<button class='celltable-button' type=\"button\" tabindex=\"-1\">")
                .appendHtmlConstant(title)
                .appendHtmlConstant("</button>")
                .toSafeHtml();

        sb.append(html);
View Full Code Here

    private SafeHtml                 shtml;

    public RuleEnabledStateCell() {
        //Do the expensive operations in the constructor
        AbstractImagePrototype aip = AbstractImagePrototype.create( images.warning() );
        SafeHtml icon = SafeHtmlUtils.fromTrustedString( aip.getHTML() );
        shtml = SafeHtmlUtils.fromTrustedString( "<div title='" + constants.AssetTableIsDisabledTip() + "'>" + icon.asString() + "</div>" );
    }
View Full Code Here

     * @return the header as a string
     */
    public static SafeHtml getHeader(ImageResource image,
                                     final String text) {
        return HEADER_TEMPLATE.message(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(image).getHTML()),
                new SafeHtml() {
                    public String asString() {
                        return text;
                    }
                });
    }
View Full Code Here

        sb.appendHtmlConstant("<div>");

        // current user
        String userHtml = "<i style='color:#cecece' class='icon-user'></i>&nbsp;"+bootstrap.getPrincipal();

        SafeHtml principal = new SafeHtmlBuilder().appendHtmlConstant("<div class='header-textlink'>"+userHtml+"</div>").toSafeHtml();
        final HTML userButton = new HTML(principal);
        userButton.getElement().setAttribute("style", "cursor:pointer");
        tools.add(userButton);

        final DefaultPopup menuPopup = new DefaultPopup(DefaultPopup.Arrow.TOP);
View Full Code Here

TOP

Related Classes of com.google.gwt.safehtml.shared.SafeHtml

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.