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

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

Introduction

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

Prototype

public SafeHtmlBuilder() 

Source Link

Document

Constructs an empty SafeHtmlBuilder.

Usage

From source file:org.dashbuilder.client.widgets.dataset.editor.DataSetDefProviderTypeEditor.java

License:Apache License

protected Collection<ImageListEditor<DataSetProviderType>.Entry> getDefaultEntries() {
    final DataSetProviderType[] providerTypes = CORE_TYPES;
    final Collection<ImageListEditor<DataSetProviderType>.Entry> entries = new ArrayList<>(
            providerTypes.length);//from   w  w w  .java  2 s. c o m
    for (final DataSetProviderType type : providerTypes) {
        final String title = getTypeSelectorTitle(type);
        final String text = getTypeSelectorText(type);
        final SafeUri uri = getTypeSelectorImageUri(type);
        final ImageListEditor<DataSetProviderType>.Entry entry = provider.newEntry(type, uri,
                new SafeHtmlBuilder().appendEscaped(title).toSafeHtml(),
                new SafeHtmlBuilder().appendEscaped(text).toSafeHtml());
        entries.add(entry);
    }

    if (!dataSetEditorPlugin.isUnsatisfied()) {

        for (DataSetEditorPlugin pluginEditor : dataSetEditorPlugin) {
            final String title = pluginEditor.getTypeSelectorTitle();
            final String text = pluginEditor.getTypeSelectorText();
            final SafeUri uri = pluginEditor.getTypeSelectorImageUri();
            final ImageListEditor<DataSetProviderType>.Entry entry = provider.newEntry(
                    pluginEditor.getProviderType(), uri,
                    new SafeHtmlBuilder().appendEscaped(title).toSafeHtml(),
                    new SafeHtmlBuilder().appendEscaped(text).toSafeHtml());
            entries.add(entry);
        }
    }

    return entries;
}

From source file:org.dashbuilder.client.widgets.dataset.editor.DataSetEditor.java

License:Apache License

protected void showError(final ClientRuntimeError error) {
    loadingBox.hide();// w ww . j a v  a2  s .  c om
    final String message = error.getCause() != null ? error.getCause() : error.getMessage();
    view.showErrorNotification(new SafeHtmlBuilder().appendEscaped(message).toSafeHtml());
    errorEvent.fire(new ErrorEvent(this, error));

    if (afterPreviewCommand != null) {
        this.afterPreviewCommand.execute();
    }
}

From source file:org.dashbuilder.common.client.editor.list.DropDownEditor.java

License:Apache License

/*************************************************************
 ** GWT EDITOR CONTRACT METHODS **//from   ww w  .  ja  va 2 s.c  o m
 *************************************************************/

@Override
public void showErrors(final List<EditorError> errors) {
    StringBuilder sb = new StringBuilder();
    for (EditorError error : errors) {
        if (error.getEditor().equals(this)) {
            sb.append("\n").append(error.getMessage());
        }
    }

    boolean hasErrors = sb.length() > 0;
    if (!hasErrors) {
        view.clearError();
        return;
    }

    // Show the errors.
    view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());
}

From source file:org.datacleaner.monitor.dashboard.widgets.DrillToProfilingResultSelectHandler.java

License:Open Source License

public void onSelect() {

    final String metricLabel = _item.getSeries().getLabel();

    final Integer index = _item.getDataIndex();
    GWT.log("Item index: " + index);

    final Date date = _timelineData.getRows().get(index).getDate();
    final String formattedDate = DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_SHORT).format(date);
    final String resultFilePath = _timelineData.getRows().get(index).getResultFilePath();

    final String analyzerDescriptorName = getAnalyzerDescriptorName();
    final String bookmark = createResultUrlBookmark(analyzerDescriptorName);

    final String url = Urls.createRelativeUrl("repository" + resultFilePath) + bookmark;
    GWT.log("Drill to result URL: " + url);

    final Button showResultButton = DCButtons.primaryButton("glyphicon-stats", "Show results");
    showResultButton.addClickHandler(new ClickHandler() {
        @Override//from   ww  w. j  av a 2s.  c  om
        public void onClick(ClickEvent event) {
            Frame frame = new Frame(url);
            frame.setPixelSize(800, 500);
            _popup.setWidget(frame);
            _popup.removeButton(showResultButton);
            _popup.center();
        }
    });

    final Button showResultFullPageButton = DCButtons.defaultButton("glyphicon-stats",
            "Show results (new window)");
    showResultFullPageButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            Window.open(url, "_blank", null);
        }
    });

    final SafeHtml labelHtml = new SafeHtmlBuilder()
            .appendHtmlConstant("Do you wish to inspect the profiling result for ").appendEscaped(metricLabel)
            .appendEscapedLines("\ncollected at ").appendEscaped(formattedDate).appendHtmlConstant("?")
            .toSafeHtml();

    _popup.setWidget(new HTML(labelHtml));
    _popup.removeButtons();
    _popup.addButton(showResultButton);
    _popup.addButton(showResultFullPageButton);
    _popup.addButton(new CancelPopupButton(_popup));
    _popup.center();
    _popup.show();
}

From source file:org.daxplore.presenter.client.ui.PerspectiveQuestionsPanel.java

License:Open Source License

private PerspectiveQuestionsPanel(QuestionMetadata questions, Perspectives perspectives, UITexts uiTexts,
        PrefixProperties prefixProperties) {
    Label header = new Label(uiTexts.pickSelectionGroupHeader());
    header.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    header.addStyleName("daxplore-PerspectiveQuestionList-header");
    this.add(header);

    perspectiveList = new Tree();
    for (String questionID : perspectives.getQuestionIDs()) {
        SafeHtmlBuilder html = new SafeHtmlBuilder();
        html.appendEscaped(questions.getShortText(questionID));
        if (questions.hasSecondary(questionID)) {
            html.appendHtmlConstant("&nbsp;<span class=\"super\">");
            html.appendEscaped(prefixProperties.getSecondaryFlagText());
            html.appendHtmlConstant("</span>");
        }/*from www .j a v  a  2 s.c o  m*/
        QuestionTreeItem item = new QuestionTreeItem(html.toSafeHtml(), questionID);
        perspectiveList.addItem(item);
    }
    this.add(perspectiveList);
    setWidth("100%");
    setPerspective(perspectives.getQuestionIDs().get(0), false);
}

From source file:org.daxplore.presenter.client.ui.QuestionPanel.java

License:Open Source License

@Inject
protected QuestionPanel(QuestionMetadata questions, Groups groups, EventBus eventBus, UITexts uiTexts,
        UIResources uiResources, PrefixProperties prefixProperties) {
    this.eventBus = eventBus;

    treeRoot = new Tree(uiResources, false);

    Label header = new Label(uiTexts.pickAQuestionHeader());
    header.addStyleName("daxplore-QuestionPanel-header");
    vp.add(header);//  www  . j  a v  a  2s  . c  om
    vp.setCellHeight(header, "30px");

    // Set up questiontree

    treeRoot.addSelectionHandler(new QuestionSelectionHandler());
    treeRoot.addOpenHandler(new GroupOpenHandler());

    for (int i = 0; i < groups.getGroupCount(); i++) {
        String txt = groups.getGroupName(i);
        SafeHtmlBuilder html = new SafeHtmlBuilder();
        html.appendHtmlConstant("<span class=\"daxplore-QuestionPanel-branch\">&nbsp;");
        html.appendEscaped(txt);
        html.appendHtmlConstant("&nbsp;</span>");
        GroupItem gr = new GroupItem(html.toSafeHtml());
        List<String> qlist = groups.getQuestionIDs(i);
        for (String q : qlist) {
            html = new SafeHtmlBuilder();
            html.appendHtmlConstant("&nbsp;");
            html.appendEscaped(questions.getShortText(q));
            if (questions.hasSecondary(q)) {
                html.appendHtmlConstant("&nbsp;<span class=\"super\">");
                html.appendEscaped(prefixProperties.getSecondaryFlagText());
                html.appendHtmlConstant("</span>");
            }
            html.appendHtmlConstant("&nbsp;");
            QuestionTreeItem qi = new QuestionTreeItem(html.toSafeHtml(), q);
            qi.setTitle(questions.getFullText(q));
            gr.addItem(qi);
        }
        treeRoot.addItem(gr);
    }

    vp.add(treeRoot);
    vp.setCellVerticalAlignment(treeRoot, HasVerticalAlignment.ALIGN_TOP);
    vp.setWidth("100%");
    initWidget(vp);

    QueryUpdateEvent.register(eventBus, this);
}

From source file:org.drools.guvnor.client.asseteditor.drools.serviceconfig.KBaseConfigPanel.java

License:Apache License

private SafeHtml treeItemFormat(final String text, final ImageResource image) {
    return new SafeHtmlBuilder().append(fromTrustedString(create(image).getHTML())).appendEscaped(" ")
            .appendEscaped(text).toSafeHtml();
}

From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java

License:Apache License

private SafeHtml getSafeHtml(final InsertRowAuditLogEntry event) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.append(TEMPLATE// w  w w.  ja  v  a 2 s. co  m
            .commentHeader(Constants.INSTANCE.DecisionTableAuditLogInsertRowAt0(event.getRowIndex() + 1)));
    return sb.toSafeHtml();
}

From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java

License:Apache License

private SafeHtml getSafeHtml(final DeleteRowAuditLogEntry event) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    sb.append(TEMPLATE// w  w w.  j av a2 s  .c om
            .commentHeader(Constants.INSTANCE.DecisionTableAuditLogDeleteRowAt0(event.getRowIndex() + 1)));
    return sb.toSafeHtml();
}

From source file:org.drools.guvnor.client.decisiontable.widget.auditlog.AuditLogEntryCellHelper.java

License:Apache License

private SafeHtml getSafeHtml(final InsertColumnAuditLogEntry event) {
    SafeHtmlBuilder sb = new SafeHtmlBuilder();
    buildColumnDetailsInsert(event.getDetails(), sb);
    return sb.toSafeHtml();
}