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:org.activityinfo.core.shared.validation.ValidationUtils.java

License:Open Source License

public static void showMessages(List<String> messages, DivElement divContainer) {
    final SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
    for (String message : messages) {
        safeHtmlBuilder.append(SafeHtmlUtils.fromString(message)).appendHtmlConstant("<br/>");
    }/*w w  w.  java2  s  . com*/
    divContainer.setInnerHTML(safeHtmlBuilder.toSafeHtml().asString());
}

From source file:org.activityinfo.ui.client.component.formdesigner.container.FieldWidgetContainer.java

License:Open Source License

public void syncWithModel() {
    final SafeHtmlBuilder label = new SafeHtmlBuilder();

    if (!Strings.isNullOrEmpty(formField.getCode())) { // append code
        label.appendHtmlConstant("<span class='small'>"
                + SafeHtmlUtils.fromString(formField.getCode()).asString() + "</span>&nbsp;");
    }//from   w  w  w . j  a  v a2s. c om

    label.append(SafeHtmlUtils.fromString(Strings.nullToEmpty(formField.getLabel())));
    if (formField.isRequired()) {
        label.append(LABEL_TEMPLATE.mandatoryMarker());
    }
    formFieldWidget.setReadOnly(formField.isReadOnly());

    String labelHtml = label.toSafeHtml().asString();
    if (!formField.isVisible()) {
        labelHtml = "<del>" + labelHtml + "</del>";
    }
    widgetContainer.getLabel().setHTML(labelHtml);
    formFieldWidget.setType(formField.getType());
}

From source file:org.activityinfo.ui.client.component.importDialog.validation.cells.ValidationResultCell.java

License:Open Source License

@Override
public void render(Context context, ValidatedRow data, SafeHtmlBuilder sb) {
    final SafeHtml safeHtml = Templates.INSTANCE.html(style(data.getResult(columnIndex).getState()),
            accessor.getValue(data.getSourceRow()));
    sb.append(safeHtml);
    //        return state + " - " + accessor.getValue(row.getSourceRow());
}

From source file:org.activityinfo.ui.client.component.table.action.ChooseColumnsHeaderAction.java

License:Open Source License

@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
    sb.append(TEMPLATE.enabled(uniqueId, Icons.INSTANCE.wrench(), I18N.CONSTANTS.chooseColumns()));
}

From source file:org.activityinfo.ui.client.component.table.action.DeleteHeaderAction.java

License:Open Source License

@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
    final boolean hasSelection = !table.getSelectionModel().getSelectedSet().isEmpty();
    if (hasSelection) {
        sb.append(TEMPLATE.enabled(uniqueId, Icons.INSTANCE.remove(), I18N.CONSTANTS.remove()));
    } else {//from www.  j  a v a 2s  .  c o m
        sb.append(TEMPLATE.disabled(uniqueId, Icons.INSTANCE.remove(), I18N.CONSTANTS.remove()));
    }
}

From source file:org.activityinfo.ui.client.component.table.action.EditHeaderAction.java

License:Open Source License

@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
    final boolean hasSelection = !table.getSelectionModel().getSelectedSet().isEmpty();
    if (hasSelection) {
        sb.append(TEMPLATE.enabled(uniqueId, Icons.INSTANCE.edit(), I18N.CONSTANTS.edit()));
    } else {//from w w  w.  j  a  va 2s  .c om
        sb.append(TEMPLATE.disabled(uniqueId, Icons.INSTANCE.edit(), I18N.CONSTANTS.edit()));
    }
}

From source file:org.activityinfo.ui.client.component.table.action.ImportHeaderAction.java

License:Open Source License

@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
    //        final boolean isOneSelected = table.getSelectionModel().getSelectedSet().size() == 1;
    //        if (isOneSelected) {
    sb.append(TEMPLATE.enabled(uniqueId, Icons.INSTANCE.importIcon(), I18N.CONSTANTS.importText()));
    //        } else {
    //            sb.append(TEMPLATE.disabled(uniqueId, Icons.INSTANCE.importIcon(), I18N.CONSTANTS.importText()));
    //        }//from   w w  w.jav  a  2  s.c  om
}

From source file:org.activityinfo.ui.client.component.table.action.NewHeaderAction.java

License:Open Source License

@Override
public void render(Cell.Context context, String value, SafeHtmlBuilder sb) {
    sb.append(TEMPLATE.rightAlignedButton(uniqueId, Icons.INSTANCE.add(), I18N.CONSTANTS.newText()));
}

From source file:org.activityinfo.ui.client.component.table.filter.FilterCell.java

License:Open Source License

@Override
public void render(Context context, C value, SafeHtmlBuilder sb) {
    final boolean hasCriteria = cellAction.getColumn().getCriteria() != null;
    final String icon = hasCriteria ? Icons.INSTANCE.filter() : Icons.INSTANCE.caretDown();
    sb.append(TEMPLATE.html(cellAction.getColumn().getHeader(), icon));
}

From source file:org.activityinfo.ui.client.component.table.InstanceTableHeaderBuilder.java

License:Open Source License

private void buildActionRow(int row, int columnCount) {
    AbstractCellTable.Style style = getTable().getResources().style();

    TableRowBuilder tr = startRow();/*from   w  ww.ja  v  a2 s. c  om*/
    setTrWidth(tr, row);

    TableCellBuilder th = tr.startTH().colSpan(columnCount).className(style.header());
    setTdWidth(th, row, 0);

    final SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.append(SafeHtmlUtils.fromString(table.getRootFormClass().getLabel()));
    sb.append(SafeHtmlUtils.fromTrustedString("&nbsp;"));
    for (TableHeaderAction buttonAction : table.getHeaderActions()) {
        final ButtonActionCell cell = new ButtonActionCell(buttonAction);
        cell.render(new Cell.Context(row, 0, table), "", sb);
        sb.append(SafeHtmlUtils.fromTrustedString("&nbsp;"));
    }
    th.html(sb.toSafeHtml());

    th.endTH();
    tr.endTR();
}