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.kaaproject.avro.ui.gwt.client.widget.dialog.AvroUiDialog.java

License:Apache License

public void setTitle(String title) {
    setHTML(SafeHtmlUtils.fromTrustedString("<h2 title=\"" + title + "\">" + title + "</h2>"));
}

From source file:org.kie.uberfire.client.common.AbstractConcurrentChangePopup.java

License:Apache License

protected AbstractConcurrentChangePopup(final String content, final Command onIgnore, final Command onAction,
        final String buttonText) {
    setTitle(CommonConstants.INSTANCE.Error());

    add(uiBinder.createAndBindUi(this));
    add(new ModalFooterReOpenIgnoreButtons(this, onAction, onIgnore, buttonText));

    message.setHTML(SafeHtmlUtils.fromTrustedString(content));
}

From source file:org.kie.uberfire.client.common.AbstractConcurrentChangePopup.java

License:Apache License

protected AbstractConcurrentChangePopup(final String content, final Command onForceSave, final Command onIgnore,
        final Command onReOpen) {
    setTitle(CommonConstants.INSTANCE.Error());

    add(uiBinder.createAndBindUi(this));
    add(new ModalFooterForceSaveReOpenCancelButtons(this, onForceSave, onReOpen, onIgnore));

    message.setHTML(SafeHtmlUtils.fromTrustedString(content));
}

From source file:org.kie.uberfire.client.common.popups.errors.ErrorPopup.java

License:Apache License

public void setMessage(final String message) {
    this.message.setHTML(SafeHtmlUtils.fromTrustedString(message));
}

From source file:org.kie.uberfire.client.common.popups.YesNoCancelPopup.java

License:Apache License

protected YesNoCancelPopup(final String title, final String content, final Command yesCommand,
        final String yesButtonText, final ButtonType yesButtonType, final IconType yesButtonIconType,
        final Command noCommand, final String noButtonText, final ButtonType noButtonType,
        final IconType noButtonIconType, final Command cancelCommand, final String cancelButtonText,
        final ButtonType cancelButtonType, final IconType cancelButtonIconType) {

    setTitle(title);//from ww w . j  a v  a2s.  c om
    setHideOthers(false);

    add(uiBinder.createAndBindUi(this));
    add(new ModalFooterYesNoCancelButtons(this, yesCommand, yesButtonText, yesButtonType, yesButtonIconType,
            noCommand, noButtonText, noButtonType, noButtonIconType, cancelCommand, cancelButtonText,
            cancelButtonType, cancelButtonIconType));

    message.setHTML(SafeHtmlUtils.fromTrustedString(content != null ? content : ""));
}

From source file:org.kie.workbench.common.forms.dynamic.client.rendering.renderers.selectors.radioGroup.RadioGroupFieldRendererBase.java

License:Apache License

protected SafeHtml getOptionLabel(String text) {
    if (text == null || text.isEmpty()) {
        return SafeHtmlUtils.fromTrustedString("&nbsp;");
    }/* w  w  w  .  j a va  2s.  co  m*/
    return SafeHtmlUtils.fromString(text);
}

From source file:org.kie.workbench.common.screens.datamodeller.client.widgets.refactoring.ShowUsagesPopup.java

License:Apache License

private void initTable() {
    usedByTable.columnPickerButton.setVisible(true);

    usedByFilesProvider.addDataDisplay(usedByTable);
    Column<UsedByRow, String> nameColumn = new TextColumn<UsedByRow>() {
        @Override/*from w w  w . j av  a2  s.  com*/
        public String getValue(UsedByRow row) {
            return row.getPath() != null ? row.getPath().getFileName() : null;
        }

        @Override
        public void render(Cell.Context context, UsedByRow object, SafeHtmlBuilder sb) {
            final String currentValue = getValue(object);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("<div title=\""));
                sb.append(SafeHtmlUtils.fromString(currentValue));
                sb.append(SafeHtmlUtils.fromTrustedString("\">"));
            }
            super.render(context, object, sb);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("</div>"));
            }
        }
    };
    usedByTable.addColumn(nameColumn, Constants.INSTANCE.usages_popup_file_name_column());
    usedByTable.setColumnWidth(nameColumn, 40, Style.Unit.PCT);

    Column<UsedByRow, String> pathColumn = new TextColumn<UsedByRow>() {
        @Override
        public String getValue(UsedByRow row) {
            String pathStr = null;
            if (row.getPath() != null && row.getPath().getFileName() != null) {
                pathStr = row.getPath().toURI().substring(0, row.getPath().toURI().lastIndexOf('/'));
            }
            return pathStr;
        }

        @Override
        public void render(Cell.Context context, UsedByRow object, SafeHtmlBuilder sb) {
            final String currentValue = getValue(object);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("<div title=\""));
                sb.append(SafeHtmlUtils.fromString(currentValue));
                sb.append(SafeHtmlUtils.fromTrustedString("\">"));
            }
            super.render(context, object, sb);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("</div>"));
            }
        }
    };
    usedByTable.addColumn(pathColumn, Constants.INSTANCE.usages_popup_file_path_column());
    usedByTable.setColumnWidth(pathColumn, 60, Style.Unit.PCT);
}

From source file:org.kie.workbench.common.screens.datamodeller.client.widgets.ShowUsagesPopup.java

License:Apache License

protected ShowUsagesPopup(final String title, final String message, final List<Path> usedByFiles,
        final Command yesCommand, final String yesButtonText, final ButtonType yesButtonType,
        final IconType yesButtonIconType, final Command cancelCommand, final String cancelButtonText,
        final ButtonType cancelButtonType, final IconType cancelButtonIconType) {

    setTitle(title);/*from  w  w  w. j  a v  a2 s.co m*/
    setMaxHeigth((Window.getClientHeight() * 0.75) + "px");
    setBackdrop(BackdropType.STATIC);
    setKeyboard(true);
    setAnimation(true);
    setDynamicSafe(true);
    setHideOthers(false);
    this.usedByFiles = usedByFiles;
    this.yesCommand = yesCommand;
    this.cancelCommand = cancelCommand;

    add(uiBinder.createAndBindUi(this));

    if (yesCommand == null) {
        yesButton.setVisible(false);
    }
    if (cancelCommand == null) {
        cancelButton.setVisible(false);
    }

    if (yesButtonType != null) {
        yesButton.setType(yesButtonType);
    }
    if (yesButtonText != null) {
        yesButton.setText(yesButtonText);
    }
    if (yesButtonIconType != null) {
        yesButton.setIcon(yesButtonIconType);
    }

    if (cancelButtonType != null) {
        cancelButton.setType(cancelButtonType);
    }
    if (cancelButtonText != null) {
        cancelButton.setText(cancelButtonText);
    }
    if (cancelButtonIconType != null) {
        cancelButton.setIcon(cancelButtonIconType);
    }

    //setWidth(  );
    this.message.setHTML(SafeHtmlUtils.fromTrustedString(message));
    initTable();
    addShownHandler(new ShownHandler() {
        @Override
        public void onShown(ShownEvent shownEvent) {
            loadTable();
        }
    });
}

From source file:org.kie.workbench.common.services.refactoring.client.usages.ShowAssetUsagesDisplayerViewViewImpl.java

License:Apache License

private void initTable() {
    usedByTable.columnPickerButton.setVisible(true);

    usedByFilesProvider.addDataDisplay(usedByTable);

    Column<Path, String> nameColumn = new TextColumn<Path>() {
        @Override//from   w  w w. j  a  v a2s . co  m
        public String getValue(Path row) {
            return row != null ? row.getFileName() : null;
        }

        @Override
        public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) {
            final String currentValue = getValue(object);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("<div title=\""));
                sb.append(SafeHtmlUtils.fromString(currentValue));
                sb.append(SafeHtmlUtils.fromTrustedString("\">"));
            }
            super.render(context, object, sb);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("</div>"));
            }
        }
    };

    usedByTable.addColumn(nameColumn,
            translationService.getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplName));

    Column<Path, String> assetType = new TextColumn<Path>() {
        @Override
        public String getValue(Path row) {
            return row != null ? presenter.getAssetType(row) : null;
        }

        @Override
        public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) {
            final String currentValue = getValue(object);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("<div title=\""));
                sb.append(SafeHtmlUtils.fromString(currentValue));
                sb.append(SafeHtmlUtils.fromTrustedString("\">"));
            }
            super.render(context, object, sb);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("</div>"));
            }
        }
    };

    usedByTable.addColumn(assetType, translationService
            .getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplAssetType));

    Column<Path, String> pathColumn = new TextColumn<Path>() {
        @Override
        public String getValue(Path row) {
            String pathStr = null;
            if (row != null && row.getFileName() != null) {
                pathStr = row.toURI().substring(0, row.toURI().lastIndexOf('/'));
            }
            return pathStr;
        }

        @Override
        public void render(Cell.Context context, Path object, SafeHtmlBuilder sb) {
            final String currentValue = getValue(object);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("<div title=\""));
                sb.append(SafeHtmlUtils.fromString(currentValue));
                sb.append(SafeHtmlUtils.fromTrustedString("\">"));
            }
            super.render(context, object, sb);
            if (currentValue != null) {
                sb.append(SafeHtmlUtils.fromTrustedString("</div>"));
            }
        }
    };

    usedByTable.addColumn(pathColumn,
            translationService.getTranslation(RefactoringConstants.ShowAssetUsagesDisplayerViewViewImplPath));
}

From source file:org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.widget.NotificationWidgetViewImpl.java

License:Apache License

private void initDelete() {
    AbstractCell<NotificationRow> buttonCell = new AbstractCell<NotificationRow>(
            ClickEvent.getType().getName()) {
        @Override/*from  w w  w .j  ava  2  s .co  m*/
        public void render(Context context, NotificationRow value, SafeHtmlBuilder sb) {
            Button button = new Button();
            button.setSize(ButtonSize.SMALL);
            button.add(new Icon(IconType.TRASH));
            sb.append(SafeHtmlUtils.fromTrustedString(button.toString()));
        }

        @Override
        public void onBrowserEvent(Context context, Element parent, NotificationRow value, NativeEvent event,
                ValueUpdater<NotificationRow> valueUpdater) {
            if (!readOnly) {
                delete(value);
            }
        }
    };

    Column<NotificationRow, NotificationRow> deleteColumn = new Column<NotificationRow, NotificationRow>(
            buttonCell) {
        @Override
        public NotificationRow getValue(NotificationRow object) {
            return object;
        }
    };
    deleteColumn.setSortable(false);
    table.addColumn(deleteColumn, presenter.getDeleteLabel());
    table.setColumnWidth(deleteColumn, 60, Style.Unit.PX);
}