List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromTrustedString
public static SafeHtml fromTrustedString(String s)
From source file:org.jboss.hal.client.deployment.DeploymentPreview.java
License:Apache License
void contextRoot(PreviewAttributes<T> attributes, Deployment deployment) { if (deployment.hasSubsystem(UNDERTOW)) { ModelNode contextRoot = failSafeGet(deployment, String.join("/", SUBSYSTEM, UNDERTOW, CONTEXT_ROOT)); if (contextRoot.isDefined()) { attributes.append(model -> new PreviewAttribute(Names.CONTEXT_ROOT, span().textContent(contextRoot.asString()).data(LINK, "").get())); }// www.j a v a 2s . c o m } else if (deployment.hasNestedSubsystem(UNDERTOW)) { HTMLElement ul = ul().get(); for (Subdeployment subdeployment : deployment.getSubdeployments()) { ModelNode contextRoot = failSafeGet(subdeployment, String.join("/", SUBSYSTEM, UNDERTOW, CONTEXT_ROOT)); if (contextRoot.isDefined()) { SafeHtml contextHtml = SafeHtmlUtils .fromTrustedString(" <span data-link>" + contextRoot.asString() + "</span>"); SafeHtml safeHtml = new SafeHtmlBuilder().appendEscaped(subdeployment.getName() + " ") .appendHtmlConstant("→") //NON-NLS .append(contextHtml).toSafeHtml(); ul.appendChild(li().innerHtml(safeHtml).get()); } } attributes.append(model -> new PreviewAttribute(Names.CONTEXT_ROOTS, ul)); } }
From source file:org.jboss.hal.client.runtime.configurationchanges.ConfigurationChangeDisplay.java
License:Apache License
@Override @SuppressWarnings("HardCodedStringLiteral") public SafeHtml getDescriptionHtml() { SafeHtmlBuilder html = new SafeHtmlBuilder(); if (hideDescriptionWhenLarge()) { html.append(SafeHtmlUtils.fromTrustedString("<pre class=\"" + formControlStatic + " " + wrap + "\">")); }/*www . j a v a 2 s . c om*/ item.changes().forEach(m -> { String op = m.get(OPERATION).asString(); ResourceAddress address = new ResourceAddress(m.get(ADDRESS)); html.append(SafeHtmlUtils .fromTrustedString(resources.constants().operation() + ": <strong>" + op + "</strong><br/>")); html.append(SafeHtmlUtils.fromTrustedString( resources.constants().address() + ": <strong>" + address + "</strong><br/>")); HTMLPreElement elem = pre().css(formControlStatic, wrap).get(); m.asPropertyList().forEach(prop -> { boolean allowedProperties = !(prop.getName().equals(OPERATION) || prop.getName().equals(ADDRESS) || prop.getName().equals(OPERATION_HEADERS)); if (allowedProperties) { html.append(SafeHtmlUtils.fromTrustedString( " " + prop.getName() + COLON + prop.getValue() + "<br/>")); } }); }); if (hideDescriptionWhenLarge()) { html.append(SafeHtmlUtils.fromTrustedString("</pre>")); } return html.toSafeHtml(); }
From source file:org.jboss.hal.client.runtime.subsystem.undertow.ListenerPreview.java
License:Apache License
@Override public void update(NamedNode item) { // the HAL_LISTENER_TYPE and HAL_WEB_SERVER is added to the model in ListenerColumn class. String listenerType = item.asModelNode().get(HAL_LISTENER_TYPE).asString(); String webserver = item.asModelNode().get(HAL_WEB_SERVER).asString(); ResourceAddress address = AddressTemplate.of(WEB_SERVER_ADDRESS + "/" + listenerType + "=" + item.getName()) .resolve(statementContext, webserver); Operation operation = new Operation.Builder(address, READ_RESOURCE_OPERATION).param(INCLUDE_RUNTIME, true) .build();/*from w ww . j a va 2 s . c o m*/ dispatcher.execute(operation, result -> { NamedNode listenerResult = new NamedNode(result); previewAttributes.refresh(listenerResult); boolean statisticsEnabled = listenerResult.get(RECORD_REQUEST_START_TIME).asBoolean(false); if (statisticsEnabled) { Map<String, Long> processingTimes = new HashMap<>(); long procTime = result.get(PROCESSING_TIME).asLong(); long maxProcTime = result.get(MAX_PROCESSING_TIME).asLong(); // convert nanoseconds to milliseconds if (procTime > 0) { procTime = procTime / 1000000; } if (maxProcTime > 0) { maxProcTime = maxProcTime / 1000000; } // the order of rows is determined at update time. processingTimes.put(MAX_PROCESSING_TIME, maxProcTime); processingTimes.put(PROCESSING_TIME, procTime); processingTime.update(processingTimes); Map<String, Long> metricUpdates = new HashMap<>(7); metricUpdates.put(REQUEST_COUNT, result.get(REQUEST_COUNT).asLong()); metricUpdates.put(ERROR_COUNT, result.get(ERROR_COUNT).asLong()); requests.update(metricUpdates); } else { SafeHtml desc = SafeHtmlUtils.fromTrustedString( resources.messages().undertowListenerProcessingDisabled(listenerType, webserver)); noStatistics.setDescription(desc); } setVisible(noStatistics.element(), !statisticsEnabled); setVisible(processingElement, statisticsEnabled); setVisible(requestsElement, statisticsEnabled); }); }
From source file:org.jbpm.console.ng.bd.client.util.DataGridUtils.java
License:Apache License
public static SafeHtml createDivStart(String title, String defaultValue) { if (title == null || "".equals(title)) title = defaultValue;//from w w w.ja v a2 s .c o m return SafeHtmlUtils.fromTrustedString("<div title=\"" + title.trim() + "\">"); }
From source file:org.jbpm.console.ng.bd.client.util.DataGridUtils.java
License:Apache License
public static SafeHtml createDivEnd() { return SafeHtmlUtils.fromTrustedString("</div>"); }
From source file:org.jbpm.console.ng.bd.client.util.DataGridUtils.java
License:Apache License
public static int calculateWidth(final String value) { if (value == null || value.length() == 0) return 0; com.google.gwt.dom.client.Element m = getCharacterMeasuringElement(DEPLOYMENTS_SIZE_CALCULATOR); if (m != null) { SafeHtmlBuilder sb = new SafeHtmlBuilder(); sb.append(SafeHtmlUtils.fromTrustedString(value)); m.setInnerHTML(sb.toSafeHtml().asString()); int a = m.getClientWidth(); int b = m.getOffsetWidth(); return a; }/*from w w w. j ava 2s . c o m*/ return 0; }
From source file:org.jbpm.console.ng.es.client.editors.jobdetails.JobDetailsPopup.java
License:Apache License
public void setRequest(RequestSummary r, List<ErrorSummary> errors, List<RequestParameterSummary> params) { this.jobRetries.setText(String.valueOf(r.getExecutions())); if ((errors != null) && errors.size() > 0) { errorsOccurredList.clear();//from www . j a v a 2 s . com errorControlGroup.setVisible(true); for (ErrorSummary error : errors) { String html = "<strong>" + error.getMessage() + "</strong><br/>" + error.getStacktrace(); this.errorsOccurredList.add(new HTML(SafeHtmlUtils.fromTrustedString(html))); } } else { errorControlGroup.setVisible(false); } if (params != null) { this.dataProvider.getList().clear(); this.dataProvider.getList().addAll(params); this.dataProvider.refresh(); } }
From source file:org.jbpm.console.ng.es.client.editors.jobdetails.JobDetailsViewImpl.java
License:Apache License
@Override public void setRequest(RequestSummary r, List<ErrorSummary> errors, List<RequestParameterSummary> params) { this.jobRetries.setText(String.valueOf(r.getExecutions())); if (errors != null) { for (ErrorSummary error : errors) { String html = "<strong>" + error.getMessage() + "</strong><br/>" + error.getStacktrace(); this.errorsOccurredList.add(new HTML(SafeHtmlUtils.fromTrustedString(html))); }/*from ww w .j a v a 2 s . co m*/ } if (params != null) { for (RequestParameterSummary param : params) { this.dataProvider.getList().add(param); } dataProvider.addDataDisplay(executionParametersGrid); } }
From source file:org.jbpm.console.ng.pr.client.util.DataGridUtils.java
License:Apache License
public static SafeHtml createDivStart(String title, String defaultValue) { if (title == null || "".equals(title)) { title = defaultValue;/*from w w w .jav a 2 s. co m*/ } return SafeHtmlUtils.fromTrustedString("<div title=\"" + title.trim() + "\">"); }
From source file:org.jbpm.workbench.es.client.editors.jobdetails.JobDetailsPopup.java
License:Apache License
public void setRequest(RequestSummary r, List<ErrorSummary> errors, List<RequestParameterSummary> params) { this.jobRetries.setText(String.valueOf(r.getExecutions())); if (errors != null && errors.size() > 0) { errorControlGroup.setVisible(true); String html = ""; for (ErrorSummary error : errors) { html += "<strong>" + error.getMessage() + "</strong><br/>" + error.getStacktrace() + "<br><br>"; }//from w ww.ja va 2s .c o m this.errorsOccurredList.setHTML(SafeHtmlUtils.fromTrustedString(html)); } else { errorControlGroup.setVisible(false); } if (params != null) { this.dataProvider.getList().clear(); this.dataProvider.getList().addAll(params); this.dataProvider.refresh(); } }