List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils EMPTY_SAFE_HTML
SafeHtml EMPTY_SAFE_HTML
To view the source code for com.google.gwt.safehtml.shared SafeHtmlUtils EMPTY_SAFE_HTML.
Click Source Link
From source file:org.jboss.as.console.client.administration.accesscontrol.ui.Templates.java
License:Open Source License
static SafeHtml scopedRolePreview(final Role role) { return PREVIEWS.scopedRole(role.getName(), baseAndScope(role), SafeHtmlUtils.EMPTY_SAFE_HTML); }
From source file:org.jboss.hal.ballroom.ProgressElement.java
License:Apache License
@SuppressWarnings("HardCodedStringLiteral") public ProgressElement(Size size, Label label, boolean reverse) { this.reverse = reverse; value = 0;/*from w w w . ja v a 2s. c o m*/ max = 100; determinate = true; root = div().css(progress).add(progressBarElement = div().css(progressBar).attr(ROLE, "progress-bar") //NON-NLS .aria("valuenow", "0").aria("valuemin", "0").aria("valuemax", "100") .add(valueElement = span().innerHtml(SafeHtmlUtils.EMPTY_SAFE_HTML).get()).get()).get(); if (size != Size.NORMAL) { valueElement.classList.add(srOnly); root.classList.add(size.css); } if (label == Label.LEFT) { root.classList.add(progressLabelLeft); } Elements.setVisible(root, false); }
From source file:org.jboss.hal.core.expression.ExpressionDialog.java
License:Apache License
public ExpressionDialog(ExpressionResolver expressionResolver, Environment environment, Resources resources) { this.expressionResolver = expressionResolver; this.standalone = environment.isStandalone(); this.resources = resources; alert = new Alert(Icons.ERROR, SafeHtmlUtils.EMPTY_SAFE_HTML); noAlert();/* w w w.j ava 2s. c om*/ Metadata metadata = Metadata.staticDescription(RESOURCES.expression()); ModelNodeForm.Builder<ModelNode> builder = new ModelNodeForm.Builder<>(Ids.RESOLVE_EXPRESSION_FORM, metadata).addOnly() .customFormItem(EXPRESSION, attributeDescription -> new ExpressionItem(resources)) .onSave((f, changedValues) -> resolve(f.getModel())); resolvedValue = new StaticItem(VALUE, resources.constants().resolvedValue()); builder.unboundFormItem(resolvedValue); form = builder.build(); FormItem<String> expressionItem = form.getFormItem(EXPRESSION); HTMLInputElement inputElement = (HTMLInputElement) expressionItem.element(EDITING) .querySelector("." + formControl); if (inputElement != null) { bind(inputElement, keydown, event -> { if (Key.fromEvent(event) == Key.Enter) { // this would normally happen in the on change handler of the text box item, // which is too late String value = inputElement.value; expressionItem.setValue(value); expressionItem.setModified(true); expressionItem.setUndefined(Strings.isNullOrEmpty(value)); form.save(); } }); } dialog = new Dialog.Builder(resources.constants().resolveExpression()).add(alert.element()) .add(form.element()).primary(resources.constants().resolve(), () -> { if (!form.save()) { // calls the save handler from above upon successful validation clearValue(); } return false; // keep the dialog open }).secondary(resources.constants().close(), () -> true).size(Dialog.Size.MEDIUM).build(); dialog.registerAttachable(form); }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.AttributeColumn.java
License:Open Source License
public AttributeColumn(String attributeName) { super(new TextCell(new SafeHtmlRenderer<String>() { @Override//from ww w . ja va 2 s .co m public SafeHtml render(String object) { return object == null ? SafeHtmlUtils.EMPTY_SAFE_HTML : SafeHtmlUtils.fromTrustedString(object); } @Override public void render(String object, SafeHtmlBuilder appendable) { appendable.append(SafeHtmlUtils.fromTrustedString(object)); } })); this.attributeName = attributeName; }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.LabelValueColumn.java
License:Open Source License
public LabelValueColumn() { super(new TextCell(new SafeHtmlRenderer<String>() { @Override/*from www . j a v a2s .co m*/ public SafeHtml render(String object) { return object == null ? SafeHtmlUtils.EMPTY_SAFE_HTML : SafeHtmlUtils.fromTrustedString(object); } @Override public void render(String object, SafeHtmlBuilder appendable) { appendable.append(SafeHtmlUtils.fromTrustedString(object)); } })); }
From source file:org.obiba.opal.web.gwt.app.client.ui.celltable.LocaleTextColumn.java
License:Open Source License
public LocaleTextColumn() { super(new TextCell(new SafeHtmlRenderer<String>() { @Override//www .ja va2 s . co m public SafeHtml render(String object) { return object == null ? SafeHtmlUtils.EMPTY_SAFE_HTML : SafeHtmlUtils.fromTrustedString(object); } @Override public void render(String object, SafeHtmlBuilder appendable) { appendable.append(SafeHtmlUtils.fromTrustedString(object)); } })); }
From source file:org.roda.wui.client.ingest.transfer.TransferUpload.java
private void updateUploadForm() { String uploadUrl = getUploadUrl(); if (uploadUrl != null) { SafeHtml html = SafeHtmlUtils.fromSafeConstant( "<form id='upload' method='post' action='" + uploadUrl + "' enctype='multipart/form-data'>" + "<div id='drop'><h4>" + messages.ingestTransferUploadDropHere() + "</h4><a>" + messages.ingestTransferUploadBrowseFiles() + "</a>" + "<input title='" + RodaConstants.API_PARAM_UPLOAD + "' type='file' name='" + RodaConstants.API_PARAM_UPLOAD + "' multiple='true' />" + " </div>" + "<input title='hiddenSubmit' type='submit' hidden/> </form>"); uploadForm.setHTML(html);// w w w. j ava2 s . co m uploadList.setHTML(SafeHtmlUtils.fromSafeConstant("<ul id='upload-list'></ul>")); uploadForm.addDomHandler(new DragOverHandler() { @Override public void onDragOver(DragOverEvent event) { uploadForm.addStyleName(DRAGOVER); } }, DragOverEvent.getType()); uploadForm.addDomHandler(new DragLeaveHandler() { @Override public void onDragLeave(DragLeaveEvent event) { uploadForm.removeStyleName(DRAGOVER); } }, DragLeaveEvent.getType()); uploadForm.addDomHandler(new DropHandler() { @Override public void onDrop(DropEvent event) { uploadForm.removeStyleName(DRAGOVER); } }, DropEvent.getType()); JavascriptUtils.runMiniUploadForm(); } else { uploadForm.setHTML(SafeHtmlUtils.EMPTY_SAFE_HTML); } }
From source file:stroom.cell.info.client.FACell.java
License:Apache License
@Override public void render(final Context context, final GlyphIcon value, final SafeHtmlBuilder sb) { if (value == null) { sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML); } else {//from w w w .j ava 2 s . c o m sb.append(template.icon(resources.style().icon(), resources.style().face(), SafeStylesUtils.forTrustedColor(value.getColourSet().getEnabled()), value.getGlyph())); } }
From source file:stroom.cell.info.client.SvgCell.java
License:Apache License
@Override public void render(final Context context, final SvgPreset value, final SafeHtmlBuilder sb) { if (value == null) { sb.append(SafeHtmlUtils.EMPTY_SAFE_HTML); } else {//from w ww . ja v a 2 s.c o m final SafeStylesBuilder builder = new SafeStylesBuilder(); builder.append(SafeStylesUtils.forWidth(value.getWidth(), Unit.PX)); builder.append(SafeStylesUtils.forHeight(value.getHeight(), Unit.PX)); String className = resources.style().icon(); if (!value.isEnabled()) { className += " " + resources.style().disabled(); } sb.append(template.icon(className, builder.toSafeStyles(), UriUtils.fromString(value.getUrl()))); } }
From source file:stroom.dashboard.client.table.FieldCell.java
License:Apache License
public static FieldCell create(final FieldsManager fieldsManager) { final List<HasCell<Field, ?>> cells = new ArrayList<HasCell<Field, ?>>(); final Column<Field, String> name = new Column<Field, String>(new FieldEditTextCell(fieldsManager)) { @Override/*from w ww.j ava 2 s. c om*/ public String getValue(final Field field) { return field.getName(); } }; name.setFieldUpdater(new FieldUpdater<Field, String>() { @Override public void update(final int index, final Field object, final String value) { object.setName(value); } }); cells.add(name); final Column<Field, ImageResource> group = new Column<Field, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(final Field field) { if (field.getGroup() == null) { return null; } else { return fieldsManager.getResources().group(); } } }; cells.add(group); final Column<Field, SafeHtml> groupNo = new Column<Field, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(final Field field) { if (field.getGroup() == null) { return SafeHtmlUtils.EMPTY_SAFE_HTML; } else { return SafeHtmlUtils .fromTrustedString("<div class=\"" + fieldsManager.getResources().style().sortOrder() + "\">" + (field.getGroup() + 1) + "</div>"); } } }; cells.add(groupNo); final Column<Field, ImageResource> sort = new Column<Field, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(final Field field) { if (field.getSort() == null) { return null; } else if (Sort.SortDirection.ASCENDING == field.getSort().getDirection()) { return fieldsManager.getResources().sortaz(); } else { return fieldsManager.getResources().sortza(); } } }; cells.add(sort); final Column<Field, SafeHtml> sortOrder = new Column<Field, SafeHtml>(new SafeHtmlCell()) { @Override public SafeHtml getValue(final Field field) { if (field.getSort() == null) { return SafeHtmlUtils.EMPTY_SAFE_HTML; } else { return SafeHtmlUtils .fromTrustedString("<div class=\"" + fieldsManager.getResources().style().sortOrder() + "\">" + (field.getSort().getOrder() + 1) + "</div>"); } } }; cells.add(sortOrder); final Column<Field, ImageResource> filter = new Column<Field, ImageResource>(new ImageResourceCell()) { @Override public ImageResource getValue(final Field field) { final Filter filter = field.getFilter(); if (filter != null) { if ((filter.getIncludes() != null && filter.getIncludes().trim().length() > 0) || (filter.getExcludes() != null && filter.getExcludes().trim().length() > 0)) { return fieldsManager.getResources().filter(); } } return null; } }; cells.add(filter); return new FieldCell(cells); }