List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder appendHtmlConstant
public SafeHtmlBuilder appendHtmlConstant(String html)
From source file:org.rstudio.studio.client.workbench.views.vcs.common.diff.LineActionButtonRenderer.java
License:Open Source License
public void render(SafeHtmlBuilder builder, String text, String action) { {//from w w w . j av a2s . c om builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().button() + " " + ThemeStyles.INSTANCE.handCursor(), "data-action", action)); { builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().left())); builder.appendHtmlConstant("<br/></div>"); builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().center())); { builder.appendEscaped(text); } builder.appendHtmlConstant("</div>"); builder.append(SafeHtmlUtil.createOpenTag("div", "class", resources_.styles().right())); builder.appendHtmlConstant("<br/></div>"); } builder.appendHtmlConstant("</div>"); } }
From source file:org.rstudio.studio.client.workbench.views.vcs.git.GitStatusRenderer.java
License:Open Source License
@Override public SafeHtml render(String str) { if (str.length() != 2) return null; ImageResource indexImg = imgForStatus(str.charAt(0)); ImageResource treeImg = imgForStatus(str.charAt(1)); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(SafeHtmlUtils.fromTrustedString("<span " + "class=\"" + ctRes_.cellTableStyle().status() + "\" " + "title=\"" + SafeHtmlUtils.htmlEscape(descForStatus(str)) + "\">")); builder.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(indexImg).getHTML())); builder.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(treeImg).getHTML())); builder.appendHtmlConstant("</span>"); return builder.toSafeHtml(); }
From source file:org.rstudio.studio.client.workbench.views.vcs.svn.SVNStatusRenderer.java
License:Open Source License
@Override public SafeHtml render(String str) { if (str.length() != 1) return SafeHtmlUtils.fromString(str); ImageResource img = imgForStatus(str.charAt(0)); if (img == null) return SafeHtmlUtils.fromString(str); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(SafeHtmlUtils.fromTrustedString("<span " + "class=\"" + ctRes_.cellTableStyle().status() + "\" " + "title=\"" + SafeHtmlUtils.htmlEscape(descForStatus(str)) + "\">")); builder.append(SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(img).getHTML())); builder.appendHtmlConstant("</span>"); return builder.toSafeHtml(); }
From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java
License:Open Source License
@Deprecated @Override// ww w .j a v a 2s . co m public void setDownloadUrls(List<FileDownload> downloads) { if (downloads != null && downloads.size() > 0) { // build a list of links in HTML SafeHtmlBuilder sb = new SafeHtmlBuilder(); for (int i = 0; i < downloads.size(); i++) { FileDownload dl = downloads.get(i); sb.appendHtmlConstant("<a href=\"" + dl.getUrl() + "\" target=\"new\">") .appendEscaped(dl.getDisplay()) .appendHtmlConstant("</a> " + AbstractImagePrototype.create(icons.external16()).getHTML()); if (dl.getChecksum() != null) { sb.appendHtmlConstant(" <small>md5 checksum: ").appendEscaped(dl.getChecksum()) .appendHtmlConstant("</small>"); } sb.appendHtmlConstant("<br/>"); } safeDownloadHtml = sb.toSafeHtml(); // replace the view content if this is after initialization if (downloadContentContainer != null) { safeDownloadHtml = sb.toSafeHtml(); fillDownloadContentContainer(); } } else { setNoDownloads(); } }
From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java
License:Open Source License
@Override public void setDownloadLocations(List<LocationData> locations, String md5) { if (locations != null && locations.size() > 0) { // build a list of links in HTML SafeHtmlBuilder sb = new SafeHtmlBuilder(); String displayString = "Download"; // TODO : add display to LocationData for (int i = 0; i < locations.size(); i++) { LocationData dl = locations.get(i); sb.appendHtmlConstant("<a href=\"" + dl.getPath() + "\" target=\"new\">") .appendEscaped(displayString) .appendHtmlConstant("</a> " + AbstractImagePrototype.create(icons.external16()).getHTML()); if (md5 != null) { sb.appendHtmlConstant(" <small>md5 checksum: ").appendEscaped(md5) .appendHtmlConstant("</small>"); }//from ww w. j a v a 2s . c o m sb.appendHtmlConstant("<br/>"); } safeDownloadHtml = sb.toSafeHtml(); // replace the view content if this is after initialization if (downloadContentContainer != null) { safeDownloadHtml = sb.toSafeHtml(); fillDownloadContentContainer(); } } else { setNoDownloads(); } }
From source file:org.seamless.gwt.component.client.widget.ClickableTextColumn.java
License:Open Source License
@Override public void render(Cell.Context context, T object, SafeHtmlBuilder sb) { String value = getValue(object); if (value != null) { if (isStyled(object) && getStyleName() != null) { sb.appendHtmlConstant("<div class=\"" + getStyleName() + "\">"); } else {/*from w w w . j a v a 2 s . c om*/ sb.appendHtmlConstant("<div>"); } super.render(context, object, sb); sb.appendHtmlConstant("</div>"); } }
From source file:org.sigmah.offline.sync.Synchronizer.java
License:Open Source License
/** * Display an error message built from the returned errors. * // www .j ava 2s . com * @param result * Result of a synchronization. */ private void displayErrorNotification(final SynchronizeResult result) { final SafeHtmlBuilder errorBuilder = new SafeHtmlBuilder(); for (final Map.Entry<ContainerInformation, List<String>> entry : result.getErrors().entrySet()) { final ContainerInformation information = entry.getKey(); if (information.isProject()) { errorBuilder.appendHtmlConstant(I18N.CONSTANTS.project()); } else { errorBuilder.appendHtmlConstant(I18N.CONSTANTS.orgunit()); } errorBuilder.appendHtmlConstant(" ").appendEscaped(information.getName()).appendHtmlConstant(" - ") .appendEscaped(information.getFullName()) .appendHtmlConstant("<ul style=\"margin:0.5em 0 1em 1.5em;list-style:disc\">"); for (final String error : entry.getValue()) { errorBuilder.appendHtmlConstant("<li>").appendEscapedLines(error).appendHtmlConstant("</li>"); } errorBuilder.appendHtmlConstant("</ul>"); } if (result.isErrorConcernFiles()) { errorBuilder.appendHtmlConstant(I18N.MESSAGES.conflictFiles()); } errorBuilder.appendHtmlConstant(I18N.MESSAGES.conflictSentByMail()); N10N.error(errorBuilder.toSafeHtml().asString()); }
From source file:org.sigmah.offline.view.OfflineMenuPanel.java
License:Open Source License
private InlineHTML createHeader(String header, String statusLabel) { final SafeHtmlBuilder htmlBuilder = new SafeHtmlBuilder().appendHtmlConstant("<h1>").appendEscaped(header) .appendHtmlConstant("</h1>"); if (statusLabel != null) { htmlBuilder.appendHtmlConstant("<span style=\"margin-left: 2em; font-style: italic\">") .appendEscaped(statusLabel).appendHtmlConstant("</span>"); }/*from w w w . j a v a 2 s . c om*/ return new InlineHTML(htmlBuilder.toSafeHtml()); }
From source file:org.sigmah.shared.dispatch.FunctionalException.java
License:Open Source License
/** * Returns the functional exception message. * Method {@link FunctionalException#getParameter(int)} can be used to populate message dynamic parameters. * /*from w ww .j a va 2 s .c o m*/ * @param exception * The functional exception that may embed message parameter(s). * @param errorCode * Functional error code (cannot be {@code null}). * @return the functional exception message. */ private static String getMessage(final FunctionalException exception, final ErrorCode errorCode) { switch (errorCode) { case AUTHENTICATION_FAILURE: return I18N.CONSTANTS.loginConnectErrorBadLogin(); case ADMIN_MOVE_ORG_UNIT_ITSELF_AS_PARENT: return I18N.CONSTANTS.adminOrgUnitMoveErrorItself(); case ADMIN_MOVE_ORG_UNIT_CYCLE_DETECTED: return I18N.CONSTANTS.adminOrgUnitMoveErrorCycle(); case ADMIN_REMOVE_ORG_UNIT_HAS_CHILDREN: return I18N.CONSTANTS.adminOrgUnitRemoveHasChildren(); case ADMIN_REMOVE_ORG_UNIT_HAS_PROJECTS: return I18N.CONSTANTS.adminOrgUnitRemoveHasProjects(); case ADMIN_REMOVE_ORG_UNIT_IS_ROOT: return I18N.CONSTANTS.adminOrgUnitRemoveIsRoot(); case ADMIN_USER_DUPLICATE_EMAIL: return I18N.MESSAGES.existingEmailAddress(exception.getParameter(0)); case ADMIN_BACKUP_ARCHIVE_CREATION_FAILED: return I18N.MESSAGES.adminBackupArchiveCreationFailed(exception.getParameter(0)); case UPDATE_CONFLICT: final SafeHtmlBuilder ulBuilder = new SafeHtmlBuilder(); ulBuilder.appendHtmlConstant("<ul class=\"" + N10N.CSS_LIST + "\">"); for (final String error : exception.parameters) { ulBuilder.appendHtmlConstant("<li>").appendEscapedLines(error).appendHtmlConstant("</li>"); } ulBuilder.appendHtmlConstant("</ul>"); return I18N.MESSAGES.conflictError(ulBuilder.toSafeHtml().asString()); case IMPORTATION_SCHEME_IS_LINKED: return I18N.MESSAGES.adminImportationSchemesWarnModelsLinked(exception.getParameter(0)); case IMPORT_INVALID_COLUMN_REFERENCE: return I18N.MESSAGES.importInvalidColumnReference(exception.getParameter(0)); default: return errorCode.toString(); } }
From source file:org.smartsnip.client.ShortSnipCell.java
/** * //from w w w . j a va 2 s . co m * The render method with creates the list item */ @Override public void render(com.google.gwt.cell.client.Cell.Context context, XSnippet snip, SafeHtmlBuilder sb) { // Value can be null, so do a null check.. if (snip == null) { return; } sb.appendHtmlConstant("<table>"); // Add title sb.appendHtmlConstant("<tr><td><b>"); sb.appendHtmlConstant(snip.title); sb.appendHtmlConstant("</b>"); if (snip.isFavorite) sb.appendHtmlConstant(" <i>(Favourite)</i>"); if (snip.isOwn) sb.appendHtmlConstant(" <i>(Own snippet)</i>"); sb.appendHtmlConstant("</td></tr>"); // Add desc sb.appendHtmlConstant("<tr><td>"); sb.appendHtmlConstant(snip.description); sb.appendHtmlConstant("</td></tr>"); // Add language and license sb.appendHtmlConstant("<tr><td>"); sb.appendHtmlConstant(snip.language); sb.appendHtmlConstant(" -- "); sb.appendHtmlConstant(snip.license); sb.appendHtmlConstant("</td></tr>"); // Add view counts sb.appendHtmlConstant("<tr><td>"); sb.appendHtmlConstant(snip.viewcount + " views"); sb.appendHtmlConstant(" -- rating: " + getRating(snip.rating)); sb.appendHtmlConstant("</td></tr>"); sb.appendHtmlConstant("</table>"); // Add space sb.appendHtmlConstant("<br />"); }