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

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

Introduction

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

Prototype

public static SafeHtml fromTrustedString(String s) 

Source Link

Document

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

Usage

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

License:Open Source License

protected SafeHtml localisedHtml(String key) {
    return SafeHtmlUtils.fromTrustedString(localise(key));
}

From source file:org.ol3cesium.demo.client.components.ShowcaseTopPanel.java

License:Apache License

@Inject
public ShowcaseTopPanel(Image logo, ShowcaseSearchPanel searchPanel) {
    super.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    super.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    super.setStyleName("top");

    super.setSpacing(1);

    logo.setSize("32px", "32px");
    super.add(logo);
    Anchor anchor = new Anchor();
    String text = "<div class=\"brand\"><a href=\"http://openlayers.org\">Ol3-Cesium</a>, <a href=\"https://github.com/richkadel/cesium-gwt\">Cesium-GWT</a> and <a href=\"http://openlayers.org/ol3-cesium/\">OpenLayers 3</a> Examples</div>";
    anchor.setHTML(SafeHtmlUtils.fromTrustedString(text));
    super.add(anchor);
    super.add(searchPanel);

    super.setCellWidth(logo, "10px");
}

From source file:org.opennms.dashboard.client.AlarmView.java

License:Open Source License

/** {@inheritDoc} */
@Override//from   w  w w  .  java2s . c om
protected void setRow(FlexTable table, int row, int elementIndex) {
    Alarm alarm = m_alarms[elementIndex];
    if (alarm.getIsDashboardRole()) {
        table.setText(row, 0, alarm.getNodeLabel());
    } else {
        table.setHTML(row, 0,
                "<a href=\"element/node.jsp?node=" + alarm.getNodeId() + "\">" + alarm.getNodeLabel() + "</a>");
    }

    HTML label = new HTML();
    label.setTitle(stripHtmlTags(alarm.getDescrption()));
    label.setHTML(SafeHtmlUtils.fromTrustedString(alarm.getLogMsg()));
    table.setWidget(row, 1, label);
    table.setText(row, 2, "" + alarm.getCount());
    table.setText(row, 3, alarm.getFirstEventTime().toString());
    table.setText(row, 4, alarm.getLastEventTime().toString());
    table.getRowFormatter().setStyleName(row, "severity-" + alarm.getSeverity().toLowerCase());
}

From source file:org.opennms.dashboard.client.portlet.AlarmView.java

License:Open Source License

/** {@inheritDoc} */
protected void setRow(FlexTable table, int row, int elementIndex) {
    Alarm alarm = m_alarms[elementIndex];
    if (alarm.getIsDashboardRole()) {
        table.setText(row, 0, alarm.getNodeLabel());
    } else {//from w ww  . j a  va  2 s.  c o m
        table.setHTML(row, 0,
                "<a href=\"element/node.jsp?node=" + alarm.getNodeId() + "\">" + alarm.getNodeLabel() + "</a>");
    }

    HTML label = new HTML();
    label.setTitle(stripHtmlTags(alarm.getDescrption()));
    label.setHTML(SafeHtmlUtils.fromTrustedString(alarm.getLogMsg()));
    table.setWidget(row, 1, label);
    table.setText(row, 2, "" + alarm.getCount());
    table.setText(row, 3, alarm.getFirstEventTime().toString());
    table.setText(row, 4, alarm.getLastEventTime().toString());
    table.getRowFormatter().setStyleName(row, alarm.getSeverity());
}

From source file:org.roda.wui.client.browse.BrowseAIP.java

private void getDescriptiveMetadataHTML(final String aipId, final String descId,
        final DescriptiveMetadataViewBundle bundle, final AsyncCallback<SafeHtml> callback) {
    SafeUri uri = RestUtils.createDescriptiveMetadataHTMLUri(aipId, descId);
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, uri.asString());
    requestBuilder.setHeader("Authorization", "Custom");
    try {/* w  ww .  j a v a  2s  . c o  m*/
        requestBuilder.sendRequest(null, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                String escapedDescId = SafeHtmlUtils.htmlEscape(descId);

                if (200 == response.getStatusCode()) {
                    String html = response.getText();

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataLinks'>"));

                    if (bundle.hasHistory()) {
                        // History link
                        String historyLink = HistoryUtils.createHistoryHashLink(
                                DescriptiveMetadataHistory.RESOLVER, aipId, escapedDescId);
                        String historyLinkHtml = "<a href='" + historyLink
                                + "' class='toolbarLink'><i class='fa fa-history'></i></a>";
                        b.append(SafeHtmlUtils.fromSafeConstant(historyLinkHtml));
                    }

                    // Edit link
                    String editLink = HistoryUtils.createHistoryHashLink(EditDescriptiveMetadata.RESOLVER,
                            aipId, escapedDescId);
                    String editLinkHtml = "<a href='" + editLink
                            + "' class='toolbarLink'><i class='fa fa-edit'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(editLinkHtml));

                    // Download link
                    SafeUri downloadUri = RestUtils.createDescriptiveMetadataDownloadUri(aipId, escapedDescId);
                    String downloadLinkHtml = "<a href='" + downloadUri.asString()
                            + "' class='toolbarLink'><i class='fa fa-download'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(downloadLinkHtml));

                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataHTML'>"));
                    b.append(SafeHtmlUtils.fromTrustedString(html));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));
                    SafeHtml safeHtml = b.toSafeHtml();

                    callback.onSuccess(safeHtml);
                } else {
                    String text = response.getText();
                    String message;
                    try {
                        RestErrorOverlayType error = (RestErrorOverlayType) JsonUtils.safeEval(text);
                        message = error.getMessage();
                    } catch (IllegalArgumentException e) {
                        message = text;
                    }

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataLinks'>"));

                    if (bundle.hasHistory()) {
                        // History link
                        String historyLink = HistoryUtils.createHistoryHashLink(
                                DescriptiveMetadataHistory.RESOLVER, aipId, escapedDescId);
                        String historyLinkHtml = "<a href='" + historyLink
                                + "' class='toolbarLink'><i class='fa fa-history'></i></a>";
                        b.append(SafeHtmlUtils.fromSafeConstant(historyLinkHtml));
                    }

                    // Edit link
                    String editLink = HistoryUtils.createHistoryHashLink(EditDescriptiveMetadata.RESOLVER,
                            aipId, escapedDescId);
                    String editLinkHtml = "<a href='" + editLink
                            + "' class='toolbarLink'><i class='fa fa-edit'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(editLinkHtml));

                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    // error message
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='error'>"));
                    b.append(messages.descriptiveMetadataTransformToHTMLError());
                    b.append(SafeHtmlUtils.fromSafeConstant("<pre><code>"));
                    b.append(SafeHtmlUtils.fromString(message));
                    b.append(SafeHtmlUtils.fromSafeConstant("</core></pre>"));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    callback.onSuccess(b.toSafeHtml());
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                callback.onFailure(exception);
            }
        });
    } catch (RequestException e) {
        callback.onFailure(e);
    }
}

From source file:org.roda.wui.client.browse.BrowseRepresentation.java

private void getDescriptiveMetadataHTML(final String descId, final DescriptiveMetadataViewBundle bundle,
        final AsyncCallback<SafeHtml> callback) {
    SafeUri uri = RestUtils.createRepresentationDescriptiveMetadataHTMLUri(aipId, repId, descId);
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, uri.asString());
    requestBuilder.setHeader("Authorization", "Custom");
    try {//from  ww w .  j a  v  a2s.  c om
        requestBuilder.sendRequest(null, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    String html = response.getText();

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataLinks'>"));

                    if (bundle.hasHistory()) {
                        // History link
                        String historyLink = HistoryUtils.createHistoryHashLink(
                                DescriptiveMetadataHistory.RESOLVER, aipId, repId, descId);
                        String historyLinkHtml = "<a href='" + historyLink
                                + "' class='toolbarLink'><i class='fa fa-history'></i></a>";
                        b.append(SafeHtmlUtils.fromSafeConstant(historyLinkHtml));
                    }
                    // Edit link
                    String editLink = HistoryUtils.createHistoryHashLink(EditDescriptiveMetadata.RESOLVER,
                            aipId, repId, descId);
                    String editLinkHtml = "<a href='" + editLink
                            + "' class='toolbarLink'><i class='fa fa-edit'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(editLinkHtml));

                    // Download link
                    SafeUri downloadUri = RestUtils.createRepresentationDescriptiveMetadataDownloadUri(aipId,
                            repId, descId);
                    String downloadLinkHtml = "<a href='" + downloadUri.asString()
                            + "' class='toolbarLink'><i class='fa fa-download'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(downloadLinkHtml));

                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataHTML'>"));
                    b.append(SafeHtmlUtils.fromTrustedString(html));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));
                    SafeHtml safeHtml = b.toSafeHtml();

                    callback.onSuccess(safeHtml);
                } else {
                    String text = response.getText();
                    String message;
                    try {
                        RestErrorOverlayType error = (RestErrorOverlayType) JsonUtils.safeEval(text);
                        message = error.getMessage();
                    } catch (IllegalArgumentException e) {
                        message = text;
                    }

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='descriptiveMetadataLinks'>"));

                    if (bundle.hasHistory()) {
                        // History link
                        String historyLink = HistoryUtils.createHistoryHashLink(
                                DescriptiveMetadataHistory.RESOLVER, aipId, repId, descId);
                        String historyLinkHtml = "<a href='" + historyLink
                                + "' class='toolbarLink'><i class='fa fa-history'></i></a>";
                        b.append(SafeHtmlUtils.fromSafeConstant(historyLinkHtml));
                    }

                    // Edit link
                    String editLink = HistoryUtils.createHistoryHashLink(EditDescriptiveMetadata.RESOLVER,
                            aipId, repId, descId);
                    String editLinkHtml = "<a href='" + editLink
                            + "' class='toolbarLink'><i class='fa fa-edit'></i></a>";
                    b.append(SafeHtmlUtils.fromSafeConstant(editLinkHtml));

                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    // error message
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='error'>"));
                    b.append(messages.descriptiveMetadataTransformToHTMLError());
                    b.append(SafeHtmlUtils.fromSafeConstant("<pre><code>"));
                    b.append(SafeHtmlUtils.fromString(message));
                    b.append(SafeHtmlUtils.fromSafeConstant("</core></pre>"));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    callback.onSuccess(b.toSafeHtml());
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                callback.onFailure(exception);
            }
        });
    } catch (RequestException e) {
        callback.onFailure(e);
    }
}

From source file:org.roda.wui.client.browse.DescriptiveMetadataHistory.java

private void getDescriptiveMetadata(final String aipId, final String representationId, final String descId,
        final String versionKey, final boolean inHTML, final AsyncCallback<SafeHtml> callback) {

    SafeUri uri;//from  w w w. ja v a2  s  .  co m
    if (inHTML) {
        if (representationId != null) {
            uri = RestUtils.createRepresentationDescriptiveMetadataHTMLUri(aipId, representationId, descId,
                    versionKey);
        } else {
            uri = RestUtils.createDescriptiveMetadataHTMLUri(aipId, descId, versionKey);
        }
    } else {
        if (representationId != null) {
            uri = RestUtils.createRepresentationDescriptiveMetadataDownloadUri(aipId, representationId, descId,
                    versionKey);
        } else {
            uri = RestUtils.createDescriptiveMetadataDownloadUri(aipId, descId, versionKey);
        }
    }
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, uri.asString());
    requestBuilder.setHeader("Authorization", "Custom");
    try {
        requestBuilder.sendRequest(null, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    String text = response.getText();

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    if (inHTML) {
                        b.append(SafeHtmlUtils.fromTrustedString(text));
                    } else {
                        b.append(SafeHtmlUtils.fromString(text));
                    }
                    SafeHtml safeHtml = b.toSafeHtml();

                    callback.onSuccess(safeHtml);
                } else {
                    String text = response.getText();
                    String message;
                    try {
                        RestErrorOverlayType error = (RestErrorOverlayType) JsonUtils.safeEval(text);
                        message = error.getMessage();
                    } catch (IllegalArgumentException e) {
                        message = text;
                    }

                    SafeHtmlBuilder b = new SafeHtmlBuilder();

                    // error message
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='error'>"));
                    b.append(messages.descriptiveMetadataTransformToHTMLError());
                    b.append(SafeHtmlUtils.fromSafeConstant("<pre><code>"));
                    b.append(SafeHtmlUtils.fromString(message));
                    b.append(SafeHtmlUtils.fromSafeConstant("</core></pre>"));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    callback.onSuccess(b.toSafeHtml());
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                callback.onFailure(exception);
            }
        });
    } catch (

    RequestException e)

    {
        callback.onFailure(e);
    }

}

From source file:org.roda.wui.client.browse.ShowPreservationEvent.java

private void getEventDetailsHTML(final AsyncCallback<SafeHtml> callback) {
    IndexedPreservationEvent event = bundle.getEvent();
    SafeUri uri = RestUtils.createPreservationEventDetailsHTMLUri(eventId, event.getAipID(),
            event.getRepresentationUUID(), event.getFileUUID());
    RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, uri.asString());
    requestBuilder.setHeader("Authorization", "Custom");
    try {/*from  w w w .  java2s  .c o m*/
        requestBuilder.sendRequest(null, new RequestCallback() {

            @Override
            public void onResponseReceived(Request request, Response response) {
                if (200 == response.getStatusCode()) {
                    String html = response.getText();

                    SafeHtmlBuilder b = new SafeHtmlBuilder();
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='eventHTML'>"));
                    b.append(SafeHtmlUtils.fromTrustedString(html));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));
                    SafeHtml safeHtml = b.toSafeHtml();

                    callback.onSuccess(safeHtml);
                } else {
                    String text = response.getText();
                    String message;
                    try {
                        RestErrorOverlayType error = (RestErrorOverlayType) JsonUtils.safeEval(text);
                        message = error.getMessage();
                    } catch (IllegalArgumentException e) {
                        message = text;
                    }

                    SafeHtmlBuilder b = new SafeHtmlBuilder();

                    // error message
                    b.append(SafeHtmlUtils.fromSafeConstant("<div class='error'>"));
                    b.append(messages.preservationEventDetailsTransformToHTMLError());
                    b.append(SafeHtmlUtils.fromSafeConstant("<pre><code>"));
                    b.append(SafeHtmlUtils.fromString(message));
                    b.append(SafeHtmlUtils.fromSafeConstant("</core></pre>"));
                    b.append(SafeHtmlUtils.fromSafeConstant("</div>"));

                    callback.onSuccess(b.toSafeHtml());
                }
            }

            @Override
            public void onError(Request request, Throwable exception) {
                callback.onFailure(exception);
            }
        });
    } catch (RequestException e) {
        callback.onFailure(e);
    }
}

From source file:org.roda.wui.client.ingest.process.ShowJobReport.java

public ShowJobReport(IndexedReport jobReport) {
    this.jobReport = jobReport;

    initWidget(uiBinder.createAndBindUi(this));

    job.setText(jobReport.getJobName());
    job.setHref(HistoryUtils.createHistoryHashLink(ShowJob.RESOLVER, jobReport.getJobId()));
    outcomeObjectState.setVisible(false);

    boolean hasSource = !jobReport.getSourceObjectOriginalIds().isEmpty()
            || !jobReport.getSourceObjectId().isEmpty();

    if (hasSource) {
        String idText = !jobReport.getSourceObjectOriginalIds().isEmpty()
                ? " (" + StringUtils.prettyPrint(jobReport.getSourceObjectOriginalIds()) + ")"
                : "";

        if (StringUtils.isNotBlank(jobReport.getSourceObjectOriginalName())) {
            sourceObject.setText(jobReport.getSourceObjectOriginalName() + idText);
        } else if (StringUtils.isNotBlank(jobReport.getSourceObjectLabel())) {
            sourceObject.setText(jobReport.getSourceObjectLabel() + idText);
        } else if (StringUtils.isNotBlank(jobReport.getSourceObjectId())) {
            sourceObject.setText(jobReport.getSourceObjectId() + idText);
        } else {/*from   ww w.jav  a  2 s.c o  m*/
            hasSource = false;
        }

        // sourceObject.setTitle(jobReport.getSourceObjectOriginalName());
        sourceObject.setHref(HistoryUtils.createHistoryHashLink(HistoryUtils
                .getHistoryUuidResolver(jobReport.getSourceObjectClass(), jobReport.getSourceObjectId())));
        sourceObjectLabel.setText(messages.jobReportSource(jobReport.getSourceObjectClass()));
    }

    sourceObjectLabel.setVisible(hasSource);
    sourceObject.setVisible(hasSource);

    boolean hasOutcome = StringUtils.isNotBlank(jobReport.getOutcomeObjectId())
            && !jobReport.getOutcomeObjectId().equals(jobReport.getSourceObjectId());

    if (hasOutcome) {
        if (jobReport.getOutcomeObjectLabel() != null) {
            outcomeObject.setText(jobReport.getOutcomeObjectLabel());
        } else if (jobReport.getOutcomeObjectId() != null) {
            outcomeObject.setText(jobReport.getOutcomeObjectId());
        } else {
            hasOutcome = false;
        }

        // outcomeObject.setTitle(jobReport.getSourceObjectOriginalName());
        outcomeObject.setHref(HistoryUtils.createHistoryHashLink(HistoryUtils
                .getHistoryUuidResolver(jobReport.getOutcomeObjectClass(), jobReport.getOutcomeObjectId())));
        outcomeObjectLabel.setText(messages.jobReportOutcome(jobReport.getOutcomeObjectClass()));
        outcomeObjectState.setHTML(HtmlSnippetUtils.getAIPStateHTML(jobReport.getOutcomeObjectState()));
    }

    outcomeObject.setVisible(hasOutcome);
    outcomeObjectState.setVisible(hasOutcome);
    outcomeObjectLabel.setVisible(hasOutcome);

    DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat(RodaConstants.DEFAULT_DATETIME_FORMAT);
    dateCreated.setText(dateTimeFormat.format(jobReport.getDateCreated()));
    dateUpdated.setText(dateTimeFormat.format(jobReport.getDateUpdated()));
    duration.setText(
            Humanize.durationInDHMS(jobReport.getDateCreated(), jobReport.getDateUpdated(), DHMSFormat.LONG));
    status.setHTML(HtmlSnippetUtils.getPluginStateHTML(jobReport.getPluginState()));
    progress.setText(messages.showJobReportProgress(jobReport.getCompletionPercentage(),
            jobReport.getStepsCompleted(), jobReport.getTotalSteps()));

    ListSelectionUtils.bindLayout(jobReport, searchPrevious, searchNext, keyboardFocus, true, false, false);

    for (Report reportItem : jobReport.getReports()) {
        FlowPanel panel = new FlowPanel();
        panel.setStyleName("panel");
        panel.addStyleName("panel-counter");
        reportItems.add(panel);

        FlowPanel panelHeading = new FlowPanel();
        panelHeading.setStyleName("panel-heading");
        Label panelTitle = new Label(reportItem.getTitle());
        panelTitle.setStyleName("panel-title");
        panelHeading.add(panelTitle);
        panel.add(panelHeading);

        FlowPanel panelBody = new FlowPanel();
        panelBody.addStyleName("panel-body");
        panel.add(panelBody);

        Label attributeLabel = new Label(messages.reportAgent());
        attributeLabel.setStyleName("label");
        panelBody.add(attributeLabel);

        String text;
        if (StringUtils.isNotBlank(reportItem.getPluginVersion())) {
            text = messages.pluginLabelWithVersion(reportItem.getPlugin(), reportItem.getPluginVersion());
        } else {
            text = messages.pluginLabel(reportItem.getPlugin());
        }

        Label attributeValue = new Label(text);
        attributeValue.setStyleName("value");
        panelBody.add(attributeValue);

        attributeLabel = new Label(messages.reportStartDatetime());
        attributeLabel.setStyleName("label");
        panelBody.add(attributeLabel);
        attributeValue = new Label(dateTimeFormat.format(reportItem.getDateCreated()));
        attributeValue.setStyleName("value");
        panelBody.add(attributeValue);

        attributeLabel = new Label(messages.reportEndDatetime());
        attributeLabel.setStyleName("label");
        panelBody.add(attributeLabel);
        attributeValue = new Label(dateTimeFormat.format(reportItem.getDateUpdated()));
        attributeValue.setStyleName("value");
        panelBody.add(attributeValue);

        attributeLabel = new Label(messages.reportOutcome());
        attributeLabel.setStyleName("label");
        panelBody.add(attributeLabel);
        HTML outcomeHTML = new HTML(HtmlSnippetUtils.getPluginStateHTML(reportItem.getPluginState()));
        panelBody.add(outcomeHTML);

        if (reportItem.getPluginDetails() != null && !"".equals(reportItem.getPluginDetails())) {
            attributeLabel = new Label(messages.reportOutcomeDetails());
            attributeLabel.setStyleName("label");
            panelBody.add(attributeLabel);
            if (reportItem.isHtmlPluginDetails()) {
                attributeValue = new HTML(SafeHtmlUtils.fromTrustedString(reportItem.getPluginDetails()));
            } else {
                attributeValue = new Label(reportItem.getPluginDetails());
            }
            attributeValue.addStyleName("code-pre");
            panelBody.add(attributeValue);
        }
    }

    Element firstElement = this.getElement().getFirstChildElement();
    if ("input".equalsIgnoreCase(firstElement.getTagName())) {
        firstElement.removeFromParent();
    }
}

From source file:org.rstudio.core.client.cellview.TriStateCheckboxCell.java

License:Open Source License

@Override
public void render(Context context, Boolean value, SafeHtmlBuilder sb) {
    ImageResource img;/*from ww w  .ja va  2  s  .  c om*/
    if (value == null)
        img = RES.checkboxIndeterminate();
    else if (value)
        img = RES.checkboxOn();
    else
        img = RES.checkboxOff();

    sb.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(img).getHTML()));
}