List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant
public SafeHtmlBuilder appendHtmlConstant(String html)
From source file:org.jbpm.workbench.common.client.util.SLAComplianceCell.java
License:Apache License
@Override public void render(Context context, Integer value, SafeHtmlBuilder sb) { List<String> tooltipClasses = new ArrayList<>(); tooltipClasses.add(SLA_STYLE);/*w w w. j av a 2 s. c o m*/ String description = descriptions.get(0); switch (value) { case ProcessInstance.SLA_NA: description = descriptions.get(1); tooltipClasses.add(SLA_NA_PRESENT_STYLE); break; case ProcessInstance.SLA_PENDING: description = descriptions.get(2); tooltipClasses.add(SLA_PENDING_PRESENT_STYLE); break; case ProcessInstance.SLA_MET: description = descriptions.get(3); tooltipClasses.add(SLA_MET_PRESENT_STYLE); break; case ProcessInstance.SLA_ABORTED: description = descriptions.get(4); tooltipClasses.add(SLA_ABORTED_PRESENT_STYLE); break; case ProcessInstance.SLA_VIOLATED: description = descriptions.get(5); tooltipClasses.add(SLA_VIOLATED_PRESENT_STYLE); break; default: description = descriptions.get(0); tooltipClasses.add(SLA_NA_PRESENT_STYLE); break; } Element span = DomGlobal.document.createElement("span"); span.textContent = description; tooltipClasses.forEach(c -> span.classList.add(c)); Element content = DomGlobal.document.createElement("span"); content.appendChild(span); sb.appendHtmlConstant(content.innerHTML); }
From source file:org.jbpm.workbench.pr.client.editors.instance.list.ProcessInstanceSummaryErrorCountCell.java
License:Apache License
@Override public void render(Context context, ProcessInstanceSummary value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList tooltipClasses = tooltip.getClassList(); tooltip.setTextContent(Integer.toString(errCount)); if (errCount > 0) { tooltipClasses.add(ERROR_PRESENT_STYLE); } else {//w ww . ja va 2 s .com tooltipClasses.remove(ERROR_PRESENT_STYLE); } if (viewPresenter.getViewErrorsActionCondition().test(value)) { tooltip.setTitle(Constants.INSTANCE.ErrorCountNumberView(errCount)); tooltip.setAttribute(PROCESS_INSTANCE_ATTRIBUTE, Long.toString(value.getProcessInstanceId())); tooltipClasses.add(LINK_AVAILABLE_STYLE); initTooltipsAsync(); } else { tooltip.removeAttribute("title"); tooltip.removeAttribute(PROCESS_INSTANCE_ATTRIBUTE); tooltipClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(tooltip.getOuterHTML()); }
From source file:org.jbpm.workbench.pr.client.editors.instance.list.ProcessInstanceSummaryErrorPopoverCell.java
License:Apache License
@Override public void render(Context context, ProcessInstanceSummary value, SafeHtmlBuilder sb) { Integer errCount = (value != null && value.getErrorCount() != null ? value.getErrorCount() : 0); DOMTokenList popoverClasses = popover.getClassList(); popover.setTextContent(Integer.toString(errCount)); if (errCount > 0) { popoverClasses.add(ERROR_PRESENT_STYLE); } else {//from ww w. j av a 2s . c om popoverClasses.remove(ERROR_PRESENT_STYLE); } if (viewPresenter.getViewErrorsActionCondition().test(value)) { viewErrAnchor.setTitle(I18N.ErrorCountViewLink()); viewErrAnchor.setTextContent(I18N.ErrorCountViewLink()); viewErrAnchor.setAttribute(PROCESS_INSTANCE_ATTRIBUTE, Long.toString(value.getProcessInstanceId())); contentErrCount.setTextContent(I18N.ErrorCountNumber(errCount)); popoverClasses.add(LINK_AVAILABLE_STYLE); popover.setAttribute("data-toggle", "popover"); Scheduler.get().scheduleDeferred(() -> initPopovers(VIEW_ERROR_LINK_NAME, PROCESS_INSTANCE_ATTRIBUTE)); } else { popover.removeAttribute("data-toggle"); popoverClasses.remove(LINK_AVAILABLE_STYLE); } sb.appendHtmlConstant(popover.getOuterHTML()); }
From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.AbstractSelectionCell.java
License:Apache License
@SuppressWarnings("unchecked") @Override//from w ww. j av a 2s. co m public void render(Context context, T value, SafeHtmlBuilder sb) { K key = (K) context.getKey(); int selectedIndex = getSelectedIndex(key, value); sb.appendHtmlConstant("<select tabindex=\"-1\">"); int index = 0; for (T option : getValuesForKey(key)) { if (index++ == selectedIndex) { sb.append(template.selected(renderer.render(option))); } else { sb.append(template.deselected(renderer.render(option))); } } sb.appendHtmlConstant("</select>"); }
From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.LinkCell.java
License:Apache License
@Override protected void render(Context context, SafeHtml value, SafeHtmlBuilder sb) { if (value != null) { sb.appendHtmlConstant("<div class=\"" + style + "\">"); sb.append(value);/*from w w w . j a va2 s .c o m*/ sb.appendHtmlConstant("</div>"); } }
From source file:org.kaaproject.avro.ui.gwt.client.widget.grid.cell.ValueSelectionCell.java
License:Apache License
@Override public void render(Context context, T value, SafeHtmlBuilder sb) { int selectedIndex = getSelectedIndex(value); sb.appendHtmlConstant("<select tabindex=\"-1\">"); int index = 0; for (T option : options) { if (index++ == selectedIndex) { sb.append(template.selected(renderer.render(option))); } else {//from ww w . j a va 2 s.c o m sb.append(template.deselected(renderer.render(option))); } } sb.appendHtmlConstant("</select>"); }
From source file:org.kie.uberfire.client.common.Util.java
License:Apache License
/** * Convert String to a SafeHtml/* www. j av a2s .com*/ * @param html * @return */ public static SafeHtml toSafeHtml(final String html) { final SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.appendHtmlConstant(html); return builder.toSafeHtml(); }
From source file:org.kie.workbench.common.screens.datamodeller.client.widgets.editor.MultiImageCell.java
License:Apache License
@Override public void render(final Context context, final List<ImageWrapper> imageWrappers, final SafeHtmlBuilder sb) { for (ImageWrapper imageWrapper : imageWrappers) { String imageBuilder = "<img src='" + imageWrapper.getUri() + "' title='" + imageWrapper.getDescription() + "' width='" + IMAGE_WIDTH + "' height='" + IMAGE_HEIGHT + "' style=\"margin-right: 5px;\">"; sb.appendHtmlConstant(imageBuilder); }//from www . ja va2 s. c o m }
From source file:org.kie.workbench.common.services.verifier.reporting.client.reporting.HTMLTableBuilder.java
License:Apache License
public HTMLTableBuilder(final SafeHtmlBuilder htmlBuilder, final T parent) { this.htmlBuilder = htmlBuilder; this.parent = parent; htmlBuilder.appendHtmlConstant( "<table class='" + AnalyzerResources.INSTANCE.analysisCss().exampleTable() + "'>"); }
From source file:org.kie.workbench.common.widgets.client.popups.validation.ValidationMessageLevelCell.java
License:Apache License
@Override public void render(final Context context, final ValidationMessage.Level value, final SafeHtmlBuilder sb) { if (value == null) { return;/* w ww.j av a 2 s. c o m*/ } switch (value) { case ERROR: sb.appendHtmlConstant(htmlErrorImageHtml); break; case INFO: sb.appendHtmlConstant(htmlInformationImageHtml); break; case WARNING: sb.appendHtmlConstant(htmlWarningImageHtml); } }