Example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder append

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder append

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlBuilder append.

Prototype

public SafeHtmlBuilder append(SafeHtml html) 

Source Link

Document

Appends the contents of another SafeHtml object, without applying HTML-escaping to it.

Usage

From source file:gwt.material.design.client.base.helper.CodeHelper.java

License:Apache License

public static SafeHtml parseCode(String code) {
    SafeHtmlBuilder builder = new SafeHtmlBuilder();
    String[] splitted = code.replaceAll("\\\\s", " ").split("\\\\n\\s?");
    String[] arr$ = splitted;/*  w w  w . j av a 2 s  .  com*/
    int len$ = splitted.length;

    for (int i$ = 0; i$ < len$; ++i$) {
        String s = arr$[i$];
        builder.append(SafeHtmlUtils.fromTrustedString(SafeHtmlUtils.htmlEscapeAllowEntities(s)));
        builder.appendHtmlConstant("<br>");
    }

    return builder.toSafeHtml();
}

From source file:gwt.material.design.client.custom.MaterialCheckBoxCell.java

License:Apache License

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, Boolean value, SafeHtmlBuilder sb) {
    Object key = context.getKey();
    Boolean viewData = getViewData(key);
    if (viewData != null && viewData.equals(value)) {
        clearViewData(key);//from  w  w  w  .ja va2s. com
        viewData = null;
    }

    if (value != null && ((viewData != null) ? viewData : value)) {
        sb.append(INPUT_CHECKED);
    } else {
        sb.append(INPUT_UNCHECKED);
    }
}

From source file:io.pelle.mango.client.gwt.modules.dictionary.container.ImageActionCell.java

License:Open Source License

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, Void value, SafeHtmlBuilder sb) {
    if (image == null) {
        image = new Image(imageResource);
        image.getElement().setTabIndex(-1);
        image.getElement().getStyle().setOpacity(GwtStyles.DISABLED_OPACITY);
    }//from  w ww.ja v a2 s .c  o  m

    sb.append(SafeHtmlUtils.fromTrustedString(image.getElement().getString()));
}

From source file:io.pelle.mango.client.gwt.modules.dictionary.controls.EditTextCellWithValidation.java

License:Open Source License

@Override
public void render(Context context, T value, SafeHtmlBuilder sb) {
    ViewData<T> viewData = getOrInitViewData(context);

    SafeStylesBuilder styles = new SafeStylesBuilder();

    if (getBaseControl(context).getValidationMessages().hasErrors()) {
        styles.appendTrustedString(GwtStyles.CELL_ERROR_STYLE);
    }/*from  w w w.  j  av a  2  s. c  o  m*/

    if (viewData.isEditing()) {
        sb.append(template.input(getBaseControl(context).format(), styles.toSafeStyles()));
    } else {
        styles.appendTrustedString(GwtStyles.CELL_ERROR_DISPLAY_PADDING);
        sb.append(template.display(renderer.render(getBaseControl(context).format()).asString(),
                styles.toSafeStyles()));
    }
}

From source file:io.pelle.mango.client.gwt.modules.dictionary.controls.ReferenceDropDownCellControl.java

License:Open Source License

@Override
public void render(Context context, T value, SafeHtmlBuilder sb) {
    ViewData<T> viewData = getOrInitViewData(context);

    if (hasListBox()) {
        clearListBox();/*from www . j av a 2 s .co m*/
    }

    if (viewData.isEditing()) {
        sb.append(template.inputStart());
        sb.append(template.selected(format(context)));
        sb.append(template.inputEnd());
    } else {
        sb.append(renderer.render(format(context)));
    }
}

From source file:io.pelle.mango.client.gwt.modules.dictionary.controls.table.ReferenceCell.java

License:Open Source License

@Override
public void render(com.google.gwt.cell.client.Cell.Context context, IBaseVO value, SafeHtmlBuilder sb) {
    if (value != null) {
        sb.append(SafeHtmlUtils.fromString(DictionaryUtil.getLabel(referenceControlModel, value)));
    }// ww w  .j  ava 2 s .c om
}

From source file:io.pelle.mango.client.gwt.modules.dictionary.controls.table.SuggestCellControl.java

License:Open Source License

@Override
public void render(Context context, T value, SafeHtmlBuilder sb) {
    GWT.log("render");

    ViewData<T> viewData = getOrInitViewData(context);

    if (hasSuggestBox()) {
        clearSuggestBox();//from  w w  w.  ja  v  a  2s  .  com
    }

    if (viewData.isEditing()) {
        sb.append(template.input(getBaseControl(context).format()));
    } else {
        sb.append(renderer.render(getBaseControl(context).format()));
    }
}

From source file:io.pelle.mango.client.gwt.modules.hierarchical.HierarchicalSafeHtmlRenderer.java

License:Open Source License

@Override
public void render(DictionaryHierarchicalNodeVO object, SafeHtmlBuilder builder) {
    builder.append(SafeHtmlUtils.fromString(object.getLabel()));
}

From source file:mat.client.shared.MatButtonCell.java

License:Apache License

@Override
public void render(Context context, SafeHtml data, SafeHtmlBuilder sb) {

    sb.appendHtmlConstant("<button type=\"button\" title=\" " + ButtonTitle + "\" tabindex=\"0\" class=\" "
            + cssClass + "\">");
    if (data != null) {
        sb.append(data);
    }//w  w  w .  j a v a  2s. c o  m
    sb.appendHtmlConstant("</button>");
}

From source file:medizin.client.a_nonroo.app.client.SortableHeader.java

License:Apache License

public void render(SafeHtmlBuilder sb) {
    if (sorted) {
        sb.append(template.sorted(IMAGE_WIDTH, reverseSort ? DOWN_ARROW : UP_ARROW, text));
    } else {/*  w w w . j  a  v  a  2s  . c  o m*/
        sb.append(template.unsorted(IMAGE_WIDTH, text));
    }
}