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.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void showDownloadsLoading() {
    safeDownloadHtml = SafeHtmlUtils
            .fromSafeConstant(DisplayUtils.getIconHtml(sageImageBundle.loading16()) + " Loading...");
    fillDownloadContentContainer();/*  ww w. jav  a  2s .  com*/
}

From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void setNoDownloads() {
    safeDownloadHtml = SafeHtmlUtils.fromSafeConstant(DisplayConstants.TEXT_NO_DOWNLOADS);
    fillDownloadContentContainer();
}

From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void setUnauthorizedDownloads() {
    safeDownloadHtml = SafeHtmlUtils.fromSafeConstant(DisplayConstants.TEXT_UNAUTH_DOWNLOADS);
    fillDownloadContentContainer();
}

From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void setNeedToLogIn() {
    safeDownloadHtml = SafeHtmlUtils.fromSafeConstant(DisplayConstants.ERROR_LOGIN_REQUIRED);
}

From source file:org.xdi.oxd.license.admin.client.Admin.java

public static SafeHtml asFullHtml(String str) {
    return SafeHtmlUtils.fromSafeConstant(insertPeriodically(str, "<br/>", 40));
}

From source file:stroom.cell.expander.client.ExpanderCell.java

License:Apache License

@Override
public void render(final Context context, final Expander value, final SafeHtmlBuilder sb) {
    if (value != null) {
        final int depth = value.getDepth();
        final int padding = depth * 10;
        final SafeStyles style = SafeStylesUtils.fromTrustedString("padding-left:" + padding + "px;");
        String className = "";
        SafeHtml icon = null;/*from w  w  w.j  ava2 s  . c om*/

        if (value.isLeaf()) {
            icon = getImageHtml(resources.leaf());
        } else if (value.isExpanded()) {
            icon = getImageHtml(resources.open());
            className = resources.style().active();
        } else {
            icon = getImageHtml(resources.closed());
            className = resources.style().active();
        }

        sb.append(template.outerDiv(className, style, icon));

    } else {
        sb.append(SafeHtmlUtils.fromSafeConstant("<br/>"));
    }
}

From source file:stroom.cell.valuespinner.client.ValueSpinnerCell.java

License:Apache License

@Override
public void render(final Context context, final Number value, final SafeHtmlBuilder sb) {
    // If the value isn't editable then just output the value.
    if (value != null) {
        if (!(value instanceof Editable) || !((Editable) value).isEditable()) {
            sb.append(SafeHtmlUtils.fromString(String.valueOf(value)));

        } else {/* w w  w .j  av  a2  s.  c o  m*/
            // Get the view data.
            final Object key = context.getKey();

            // Get the current view data if there is some.
            ViewData viewData = getViewData(key);

            // If the value held by the view data object is the same as the
            // passed value then we no longer need the view data object to
            // hold temporary state.
            if (viewData != null && viewData.getCurrentValue() != null) {
                try {
                    final Number currentValue = Long.valueOf(viewData.getCurrentValue());
                    if (currentValue != null && currentValue.equals(value)) {
                        clearViewData(key);
                        viewData = null;
                    }
                } catch (final NumberFormatException e) {
                    // Ignore.
                }
            }

            if (viewData != null) {
                sb.append(template.input(viewData.getCurrentValue(), arrowUpHtml, arrowDownHtml));
            } else {
                sb.append(template.input(String.valueOf(value), arrowUpHtml, arrowDownHtml));
            }
        }
    } else {
        sb.append(SafeHtmlUtils.fromSafeConstant("<br/>"));
    }
}

From source file:stroom.data.grid.client.DataGridViewImpl.java

License:Apache License

@Override
public void addColumn(final Column<R, ?> column, final String name, final int width) {
    dataGrid.addColumn(column, SafeHtmlUtils.fromSafeConstant(name));
    setColumnWidth(column, width, Unit.PX);
    colSettings.add(new ColSettings(false, false));
}

From source file:stroom.data.grid.client.DataGridViewImpl.java

License:Apache License

@Override
public void addResizableColumn(final Column<R, ?> column, final String name, final int width) {
    dataGrid.addColumn(column, SafeHtmlUtils.fromSafeConstant(name));
    setColumnWidth(column, width, Unit.PX);
    colSettings.add(new ColSettings(true, true));
}

From source file:tv.dyndns.kishibe.qmaclone.client.game.panel.QuestionPanel.java

License:Open Source License

protected QuestionPanel(PacketProblem problem, SessionData sessionData) {
    this.problem = Preconditions.checkNotNull(problem);
    this.sessionData = Preconditions.checkNotNull(sessionData);
    setHorizontalAlignment(ALIGN_CENTER);

    HorizontalPanel panelProblemInfo = new HorizontalPanel();
    panelProblemInfo.addStyleName("gwt-HorizontalPanel-problemInformation");
    panelProblemInfo.add(new Label(problem.genre.toString()));
    panelProblemInfo.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    panelProblemInfo.add(new Label(problem.type.toString()));
    panelProblemInfo.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    panelProblemInfo.add(labelRatio);//from w  w w  .java 2 s  .c om

    if (!Strings.isNullOrEmpty(problem.creator)) {
        panelProblemInfo.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
        panelProblemInfo.add(labelCreator);
    }

    // ???????????(????????)
    WidgetProblemSentence problemStatement = createWidgetProblemSentence();
    answerView = createAnswerView();
    inputWidget = createWidgetInput();

    add(panelProblemInfo);
    add(problemStatement);
    add(panelTimeProgressBar);
    add(answerView);
    add(inputWidget);

    setWidth("600px");

    setCellHeight(inputWidget, "300px");
}