Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

Introduction

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

Prototype

public static SafeHtml fromSafeConstant(String s) 

Source Link

Document

Returns a SafeHtml constructed from a safe string, i.e., without escaping the string.

Usage

From source file:org.kie.guvnor.commons.ui.client.tables.SelectionColumn.java

License:Apache License

public static <T> SelectionColumn<T> createAndAddSelectionColumn(CellTable<T> cellTable) {
    SelectionColumn<T> selectionColumn = new SelectionColumn<T>(cellTable);
    cellTable.addColumn(selectionColumn, SafeHtmlUtils.fromSafeConstant("<br>"));
    return selectionColumn;
}

From source file:org.kie.uberfire.client.tables.SelectionColumn.java

License:Apache License

public static <T> SelectionColumn<T> createAndAddSelectionColumn(DataGrid<T> dataGrid) {
    SelectionColumn<T> selectionColumn = new SelectionColumn<T>(dataGrid);
    dataGrid.addColumn(selectionColumn, SafeHtmlUtils.fromSafeConstant("<br>"));
    return selectionColumn;
}

From source file:org.obiba.opal.web.gwt.app.client.magma.importvariables.view.TableComparisonsTable.java

License:Open Source License

private void initCheckColumn() {
    Column<TableComparison, Boolean> checkColumn = new Column<TableComparison, Boolean>(
            new CheckboxCell(true, true) {
                @Override//from  w  w  w .  j  a  v a 2  s. co m
                public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
                    // check if forbidden or has conflict
                    TableComparison tc = (TableComparison) context.getKey();
                    if (tc.isSelectable()) {
                        super.render(context, value, sb);
                    } else {
                        sb.append(SafeHtmlUtils.fromSafeConstant(
                                "<input type=\"checkbox\" disabled=\"true\" tabindex=\"-1\"/>"));
                    }
                }
            }) {

        @Override
        public Boolean getValue(TableComparison object) {
            // Get the value from the selection model.
            return getSelectionModel().isSelected(object);
        }

    };
    checkColumn.setFieldUpdater(new FieldUpdater<ComparedDatasourcesReportStepView.TableComparison, Boolean>() {

        @Override
        public void update(int index, TableComparison object, Boolean value) {
            getSelectionModel().setSelected(object, value);
        }
    });

    addColumn(checkColumn, createTableListCheckColumnHeader());
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.CheckboxColumn.java

License:Open Source License

public Header<Boolean> getCheckColumnHeader() {
    Header<Boolean> checkHeader = new Header<Boolean>(new CheckboxCell(true, true) {
        @Override/*from   w  ww  .  j av  a 2  s. com*/
        public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
            if (display.getDataProvider().getList().isEmpty()) {
                sb.append(SafeHtmlUtils
                        .fromSafeConstant("<input type=\"checkbox\" tabindex=\"-1\" disabled=\"disabled\"/>"));
            } else {
                super.render(context, value, sb);
            }

        }
    }) {

        @Override
        public Boolean getValue() {
            updateStatusAlert();
            if (display.getDataProvider().getList().isEmpty()) {
                return false;
            }

            // Value of the header checkbox for the current page
            for (T tc : display.getTable().getVisibleItems()) {
                if (!selectionModel.isSelected(tc)) {
                    return false;
                }
            }

            return true;
        }
    };
    checkHeader.setUpdater(new ValueUpdater<Boolean>() {

        @Override
        public void update(Boolean value) {

            if (display.getDataProvider().getList().isEmpty())
                return;

            for (T tc : display.getTable().getVisibleItems()) {
                selectionModel.setSelected(tc, value);
            }

            doAction();

            display.getTable().redraw();
        }

    });

    return checkHeader;
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.GroupStatusIconActionCell.java

License:Open Source License

@Override
public void render(Context context, GroupDto value, SafeHtmlBuilder sb) {

    if (isEnabled(value)) {
        Icon i = new Icon(iconType);
        sb.append(SafeHtmlUtils.fromSafeConstant("<a class=\"icon\">")).appendHtmlConstant(i.toString())
                .append(message).append(SafeHtmlUtils.fromSafeConstant("</a>"));

    } else {// w  ww  .  j  av  a2  s . c o  m
        Icon i = new Icon(IconType.REMOVE);
        sb.append(SafeHtmlUtils.fromSafeConstant("<a class=\"icon disabled\">"))
                .appendHtmlConstant(i.toString()).append(message)
                .append(SafeHtmlUtils.fromSafeConstant("</a>"));
    }
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.IconActionCell.java

License:Open Source License

@Override
public void render(Context context, C value, SafeHtmlBuilder sb) {

    if (isEnabled()) {
        if (iconType != null) {
            Icon i = new Icon(iconType);
            sb.append(SafeHtmlUtils.fromSafeConstant("<a class=\"iconb\">")).appendHtmlConstant(i.toString())
                    .append(message).append(SafeHtmlUtils.fromSafeConstant("</a>"));
        } else {//from  w w w .jav  a2  s.c o m
            sb.append(SafeHtmlUtils.fromSafeConstant("<a class=\"iconb\">")).append(message)
                    .append(SafeHtmlUtils.fromSafeConstant("</a>"));
        }
    } else {
        if (iconType != null) {
            Icon i = new Icon(iconType);
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"icon disabled\">"))
                    .appendHtmlConstant(i.toString()).append(message)
                    .append(SafeHtmlUtils.fromSafeConstant("</span>"));
        } else {
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"iconb disabled\">")).append(message)
                    .append(SafeHtmlUtils.fromSafeConstant("</span>"));
        }
    }
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.IconCell.java

License:Open Source License

@Override
public void render(Context context, C value, SafeHtmlBuilder sb) {
    IconType iconType = getIconType(value);
    if (isEnabled()) {
        if (iconType != null) {
            Icon i = new Icon(iconType);
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"icon\">")).appendHtmlConstant(i.toString())
                    .append(SafeHtmlUtils.fromSafeConstant("</span>"));
        } else {/*from  w w  w  .j  a v a2s .  c  o m*/
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"icon\">"))
                    .append(SafeHtmlUtils.fromSafeConstant("</span>"));
        }
    } else {
        if (iconType != null) {
            Icon i = new Icon(iconType);
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"icon disabled\">"))
                    .appendHtmlConstant(i.toString()).append(SafeHtmlUtils.fromSafeConstant("</span>"));
        } else {
            sb.append(SafeHtmlUtils.fromSafeConstant("<span class=\"iconb disabled\">"))
                    .append(SafeHtmlUtils.fromSafeConstant("</span>"));
        }
    }
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.LinkCell.java

License:Open Source License

@Override
public void render(Context context, C value, SafeHtmlBuilder sb) {
    String link = getLink(value);
    if (isEnabled() && !Strings.isNullOrEmpty(link)) {
        sb.append(SafeHtmlUtils.fromSafeConstant("<a href=\"" + link + "\">"))
                .appendHtmlConstant(getText(value)).append(SafeHtmlUtils.fromSafeConstant("</a>"));
    } else {//from  w  ww  .  j a  v a  2  s .c  o m
        sb.append(SafeHtmlUtils.fromSafeConstant(getText(value)));
    }
}

From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.UserStatusIconActionCell.java

License:Open Source License

@Override
public void render(Context context, SubjectCredentialsDto value, SafeHtmlBuilder sb) {
    String cssClass = "icon";
    if (!value.getEnabled())
        cssClass += " disabled";
    sb.append(SafeHtmlUtils.fromSafeConstant("<a class=\"" + cssClass + "\">")) //
            .appendHtmlConstant(new Icon(value.getEnabled() ? iconType : IconType.REMOVE).toString()) //
            .append(message) //
            .append(SafeHtmlUtils.fromSafeConstant("</a>"));
}

From source file:org.opencms.ade.sitemap.client.alias.CmsCellTableUtil.java

License:Open Source License

/**
 * Formats the HTML for the error column of a cell table given an error message.<p>
 *
 * @param error the error message (null for no error)
 *
 * @return the SafeHtml representing the contents of the error cell
 */// w w  w .j av a2  s  . co  m
public static SafeHtml formatErrorHtml(String error) {

    String text;
    String cssClass;
    String title = "";

    if (error == null) {
        text = CmsAliasMessages.messageStatusOk();
        cssClass = STATUS_OK;
    } else {
        text = CmsAliasMessages.messageStatusError();
        title = SafeHtmlUtils.htmlEscape(error);
        cssClass = STATUS_ERROR;
    }
    String html = "<div class='" + cssClass + "' title='" + title + "'>" + text + "</div>";
    return SafeHtmlUtils.fromSafeConstant(html);
}