Package com.google.gwt.safehtml.shared

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


    }

    @Override
    public void onLoginEvent(final LoginEvent loginEvent) {
        navigationBar.load();
        final SafeHtmlBuilder sb = new SafeHtmlBuilder();
        sb.appendEscaped(" | ");
        sb.appendEscaped(application.getI18n().user_status());
        sb.append(' ');
        sb.appendEscaped(application.getCurrentUsername());
        currentUserInfo.setInnerSafeHtml(sb.toSafeHtml());
    }
View Full Code Here


    }

    @Override
    public void showErrors(final List<EditorError> errors) {
        if(errors != null && !errors.isEmpty()) {
            final SafeHtmlBuilder b = new SafeHtmlBuilder();
            for (final EditorError error : errors) {
                if(error.getPath() != null && !"".equals(error.getPath())) {
                    final Object userData = error.getUserData();
                    b.appendEscaped(error.getPath()).appendEscaped(": ");
                }
                b.appendEscaped(error.getMessage()).appendEscaped("\n");
            }
            Window.alert(b.toSafeHtml().asString());
        }
    }
View Full Code Here

  }
 
  @Override
  public void showErrorsMessages(List<String> errors) {
    errorsPanel.clear();
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    for (String error : errors) {
      sb.appendEscaped(error);
      sb.appendHtmlConstant("<br />");
    }
    errorsPanel.add(new Alert(sb.toSafeHtml().asString(), AlertType.ERROR));
  }
View Full Code Here

    public String getSubText() {
        return subText;
    }

    private void render() {
        final SafeHtmlBuilder builder = new SafeHtmlBuilder();

        builder.appendHtmlConstant("<h1>");
        builder.appendEscaped(heading == null ? "" : heading);

        if (subText != null && !subText.isEmpty()) {
            builder.appendEscaped(" ");
            builder.appendHtmlConstant("<small>");
            builder.appendEscaped(subText);
            builder.appendHtmlConstant("</small>");
        }

        builder.appendHtmlConstant("</h1>");

        getElement().setInnerSafeHtml(builder.toSafeHtml());
    }
View Full Code Here

    /** Display the string value with tooltip, using a custom span. */
    @Override
    public SafeHtml getValue(T item) {
        String value = getStringValue(item);
        String tooltip = getTooltip(item);
        String contents = new SafeHtmlBuilder().appendEscaped(value).toSafeHtml().asString();
        if (tooltip != null) {
            String title = new SafeHtmlBuilder().appendEscaped(tooltip).toSafeHtml().asString();
            return new SafeHtmlBuilder().appendHtmlConstant("<span title='" + title + "'>" + contents + "</span>").toSafeHtml();
        } else {
            return new SafeHtmlBuilder().appendHtmlConstant("<span>" + contents + "</span>").toSafeHtml();
        }
    }
View Full Code Here

   * Test rendering the cell with a valid value and no view data.
   */
  public void testRender() {
    Cell<T> cell = createCell();
    T value = createCellValue();
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(0, 0, null);
    cell.render(context, value, sb);
    assertEquals(getExpectedInnerHtml(), sb.toSafeHtml().asString());
  }
View Full Code Here

   * Test rendering the cell with a negative index is handled.
   */
  public void testRenderNegativeIndex() {
    Cell<T> cell = createCell();
    T value = createCellValue();
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(-1, -1, null);
    cell.render(context, value, sb);
    assertEquals(getExpectedInnerHtml(), sb.toSafeHtml().asString());
  }
View Full Code Here

  /**
   * Test rendering the cell with a null value and no view data.
   */
  public void testRenderNull() {
    Cell<T> cell = createCell();
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(0, 0, null);
    cell.render(context, null, sb);
    assertEquals(getExpectedInnerHtmlNull(), sb.toSafeHtml().asString());
  }
View Full Code Here

   */
  public void testRenderViewData() {
    AbstractEditableCell<T, V> cell = createCell();
    T value = createCellValue();
    cell.setViewData(DEFAULT_KEY, createCellViewData());
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(0, 0, DEFAULT_KEY);
    cell.render(context, value, sb);
    String expectedInnerHtmlViewData = getExpectedInnerHtmlViewData();
    String asString = sb.toSafeHtml().asString();
    assertEquals(expectedInnerHtmlViewData, asString);
  }
View Full Code Here

  public void testRenderViewDataDisabledChecked() {
    CheckboxCell cell = createCell();
    cell.setEnabled(false);
    Boolean value = Boolean.TRUE;
    cell.setViewData(DEFAULT_KEY, createCellViewData());
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    Context context = new Context(0, 0, DEFAULT_KEY);
    cell.render(context, value, sb);
    String expectedInnerHtmlViewData = getExpectedInnerHtmlViewDisabled();
    String asString = sb.toSafeHtml().asString();
    assertEquals(expectedInnerHtmlViewData, asString);
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.safehtml.shared.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.