List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromString
public static SafeHtml fromString(String s)
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 a v a 2 s .c om*/ 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.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 a 2 s . com 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.client.widgets.marshaller.MarshallingResponsePopupView.java
License:Apache License
private void initTable() { messagesTable.setColumnPickerButtonVisible(true); messagesTableProvider.addDataDisplay(messagesTable); final Column<MarshallingResponsePopup.Row, String> levelColumn = new TextColumn<MarshallingResponsePopup.Row>() { @Override/* w w w . ja v a 2s . c om*/ public String getValue(MarshallingResponsePopup.Row row) { return row.getLevel(); } }; messagesTable.addColumn(levelColumn, translationService.getValue(StunnerWidgetsConstants.MarshallingResponsePopup_LevelTableColumnName)); messagesTable.setColumnWidth(levelColumn, 80, Style.Unit.PX); final Column<MarshallingResponsePopup.Row, String> messageColumn = new TextColumn<MarshallingResponsePopup.Row>() { @Override public String getValue(MarshallingResponsePopup.Row row) { return row.getMessage(); } @Override public void render(Cell.Context context, MarshallingResponsePopup.Row row, SafeHtmlBuilder sb) { final String currentValue = getValue(row); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("<div title=\"")) .append(SafeHtmlUtils.fromString(currentValue)) .append(SafeHtmlUtils.fromTrustedString("\">")); } super.render(context, row, sb); if (currentValue != null) { sb.append(SafeHtmlUtils.fromTrustedString("</div>")); } } }; messagesTable.addColumn(messageColumn, translationService .getValue(StunnerWidgetsConstants.MarshallingResponsePopup_MessageTableColumnName)); setOnShownCommand(modal.getElement(), () -> messagesTable.redraw()); }
From source file:org.livespark.formmodeler.renderer.client.rendering.renderers.RadioGroupFieldRenderer.java
License:Apache License
protected SafeHtml getOptionLabel(SelectorOption option) { if (option.getText() == null || option.getText().isEmpty()) { return SafeHtmlUtils.fromTrustedString(" "); }/*from ww w. jav a2 s . com*/ return SafeHtmlUtils.fromString(option.getText()); }
From source file:org.obiba.opal.web.gwt.app.client.magma.derive.view.DeriveCategoricalVariableStepView.java
License:Open Source License
private void initializeValueMapGrid() { valuesMapGrid = new ValueMapGrid() { @Override/*from w w w . ja v a 2 s . c o m*/ protected void initializeValueColumn() { ValueMapCell cell = new ValueMapCell() { @Override protected String getText(ValueMapEntry entry) { return entry.getValue(); } @Override public void render(Cell.Context context, ValueMapEntry entry, SafeHtmlBuilder sb) { if (entry != null) { String cssClasses = getCssClasses(entry.getType()); SafeHtml safeHtml = SafeHtmlUtils.fromString(getText(entry)); if (entry.getType() == ValueMapEntryType.DISTINCT_VALUE) { sb.append(DeriveCategoricalVariableStepView.template.spanWithTile( cssClasses + " warning", translations.valueIsNotACategory(), safeHtml)); } else { sb.append(template.span(cssClasses, safeHtml)); } } } }; // Value Column<ValueMapEntry, ValueMapEntry> valueColumn = new Column<ValueMapEntry, ValueMapEntry>(cell) { @Override public ValueMapEntry getValue(ValueMapEntry entry) { return entry; } }; valueColumn.setCellStyleNames("original-value"); table.addColumn(valueColumn, translations.originalValueLabel()); } }; valuesMapGrid.setWidth("100%"); valuesMapGrid.setPageSize(100); }
From source file:org.obiba.opal.web.gwt.app.client.magma.derive.view.ValueMapCell.java
License:Open Source License
@Override public void render(Cell.Context context, ValueMapEntry entry, SafeHtmlBuilder sb) { if (entry != null) { sb.append(template.span(getCssClasses(entry.getType()), SafeHtmlUtils.fromString(getText(entry)))); }// w ww. j a va 2 s. c o m }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.AttributeColumn.java
License:Open Source License
private void appendLabel(AttributeDto attr, StringBuilder labels) { if (attr.hasValue() && attr.getValue().trim().length() > 0) { labels.append("<div class=\"attribute-value\">"); if (AttributeDtos.SCRIPT_ATTRIBUTE.equals(attr.getName())) { labels.append("<pre>"); }/*from w w w.j ava 2 s . com*/ if (attr.hasLocale() && attr.getLocale().trim().length() > 0) { labels.append("<span class=\"label\">").append(attr.getLocale()).append("</span> "); } String value = attr.getValue(); String safeValue = SafeHtmlUtils.fromString(value).asString().replaceAll("\\n", "<br />"); try { if (UriUtils.extractScheme(value) != null && UriUtils.isSafeUri(value)) { labels.append("<a href=").append(value).append(" target=\"_blank\">").append(safeValue) .append("</a>"); } else { labels.append(safeValue); } } catch (Exception e) { labels.append(safeValue); } if (AttributeDtos.SCRIPT_ATTRIBUTE.equals(attr.getName())) { labels.append("</pre>"); } labels.append("</div>"); } }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.IconActionCell.java
License:Open Source License
public IconActionCell(IconType iconType, String text, Delegate<C> delegate) { this(iconType, SafeHtmlUtils.fromString(text), delegate); }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.LocaleTextColumn.java
License:Open Source License
private void appendLabel(LocaleTextDto attr, StringBuilder labels) { labels.append("<div class=\"attribute-value\">"); if (attr.hasLocale() && attr.getLocale().trim().length() > 0) { labels.append("<span class=\"label\">").append(attr.getLocale()).append("</span> "); }// w w w .j a va2 s .com String value = attr.getText(); String safeValue = SafeHtmlUtils.fromString(value).asString().replaceAll("\\n", "<br />"); try { if (UriUtils.extractScheme(value) != null && UriUtils.isSafeUri(value)) { labels.append("<a href=").append(value).append(" target=\"_blank\">").append(safeValue) .append("</a>"); } else { labels.append(safeValue); } } catch (Exception e) { labels.append(safeValue); } labels.append("</div>"); }
From source file:org.opendatakit.aggregate.client.AggregateUI.java
License:Apache License
/*********************************** ****** HELP STUFF ******//from w ww. j av a2 s .c om ***********************************/ private void changeHelpPanel(SubTabs subMenu) { // change root item rootItem.setText(subMenu + " Help"); rootItem.removeItems(); SubTabInterface subTabObj = getSubTab(subMenu); if (subTabObj != null) { HelpSliderConsts[] helpVals = subTabObj.getHelpSliderContent(); if (helpVals != null) { for (int i = 0; i < helpVals.length; i++) { TreeItem helpItem = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getTitle())); TreeItem content = new TreeItem(SafeHtmlUtils.fromString(helpVals[i].getContent())); helpItem.setState(false); helpItem.addItem(content); rootItem.addItem(helpItem); } } } rootItem.setState(true); resize(); }