List of usage examples for com.google.gwt.safehtml.shared SafeHtmlBuilder toSafeHtml
public SafeHtml toSafeHtml()
From source file:org.roda.wui.client.common.utils.HtmlSnippetUtils.java
public static SafeHtml getAIPStateHTML(AIPState aipState) { SafeHtmlBuilder b = new SafeHtmlBuilder(); switch (aipState) { case ACTIVE: b.append(SafeHtmlUtils.fromSafeConstant(OPEN_SPAN_CLASS_LABEL_SUCCESS)); break;//from w w w .jav a2 s . c om case UNDER_APPRAISAL: b.append(SafeHtmlUtils.fromSafeConstant(OPEN_SPAN_CLASS_LABEL_WARNING)); break; default: b.append(SafeHtmlUtils.fromSafeConstant(OPEN_SPAN_CLASS_LABEL_DANGER)); break; } b.append(SafeHtmlUtils.fromString(messages.aipState(aipState))); b.append(SafeHtmlUtils.fromSafeConstant(CLOSE_SPAN)); return b.toSafeHtml(); }
From source file:org.roda.wui.client.common.utils.HtmlSnippetUtils.java
public static SafeHtml getRepresentationTypeHTML(String type, boolean isOriginal) { SafeHtmlBuilder b = new SafeHtmlBuilder(); b.append(SafeHtmlUtils.fromSafeConstant(OPEN_H4_CLASS_LABEL_SUCCESS)); b.append(SafeHtmlUtils.fromString(type)); b.append(SafeHtmlUtils.fromSafeConstant(CLOSE_SPAN)); b.append(SafeHtmlUtils.fromSafeConstant(OPEN_SPAN_ORIGINAL_LABEL_SUCCESS)); if (isOriginal) { b.append(SafeHtmlUtils.fromString(messages.originalRepresentation())); } else {//from w ww.ja v a 2 s . c o m b.append(SafeHtmlUtils.fromString(messages.alternativeRepresentation())); } b.append(SafeHtmlUtils.fromSafeConstant(CLOSE_SPAN)); return b.toSafeHtml(); }
From source file:org.roda.wui.client.ingest.process.ShowJob.java
private void update() { // set end date dateEndedLabel.setVisible(job.getEndDate() != null); dateEnded.setVisible(job.getEndDate() != null); if (job.getEndDate() != null) { dateEnded.setText(dateTimeFormat.format(job.getEndDate())); }//from w w w.ja v a2 s. c o m // set duration duration.setText(Humanize.durationInDHMS(job.getStartDate(), job.getEndDate(), DHMSFormat.LONG)); // set state status.setHTML(HtmlSnippetUtils.getJobStateHtml(job)); // set state details boolean hasStateDetails = StringUtils.isNotBlank(job.getStateDetails()); stateDetailsLabel.setVisible(hasStateDetails); stateDetailsValue.setVisible(hasStateDetails); if (hasStateDetails) { stateDetailsValue.setText(job.getStateDetails()); } // set counters SafeHtmlBuilder b = new SafeHtmlBuilder(); b.append(SafeHtmlUtils.fromSafeConstant("<span class='label-default'>")); b.append(messages.showJobProgressCompletionPercentage(job.getJobStats().getCompletionPercentage())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); if (job.getJobStats().getSourceObjectsCount() > 0) { b.append(SafeHtmlUtils.fromSafeConstant(" <span class='label-default'>")); b.append(messages.showJobProgressTotalCount(job.getJobStats().getSourceObjectsCount())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); } if (job.getJobStats().getSourceObjectsProcessedWithSuccess() > 0) { b.append(SafeHtmlUtils.fromSafeConstant(" <span class='label-success'>")); b.append(messages .showJobProgressSuccessfulCount(job.getJobStats().getSourceObjectsProcessedWithSuccess())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); } if (job.getJobStats().getSourceObjectsProcessedWithFailure() > 0) { b.append(SafeHtmlUtils.fromSafeConstant(" <span class='label-danger'>")); b.append(messages.showJobProgressFailedCount(job.getJobStats().getSourceObjectsProcessedWithFailure())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); } if (job.getJobStats().getSourceObjectsBeingProcessed() > 0) { b.append(SafeHtmlUtils.fromSafeConstant(" <span class='label-info'>")); b.append(messages.showJobProgressProcessingCount(job.getJobStats().getSourceObjectsBeingProcessed())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); } if (job.getJobStats().getSourceObjectsWaitingToBeProcessed() > 0) { b.append(SafeHtmlUtils.fromSafeConstant(" <span class='label-warning'>")); b.append( messages.showJobProgressWaitingCount(job.getJobStats().getSourceObjectsWaitingToBeProcessed())); b.append(SafeHtmlUtils.fromSafeConstant("</span>")); } progress.setHTML(b.toSafeHtml()); buttonStop.setText(messages.stopButton()); buttonStop.setVisible(!job.isInFinalState()); buttonStop.setEnabled(!job.isStopping()); buttonAppraisal.setText(messages.appraisalTitle() + " (" + job.getJobStats().getOutcomeObjectsWithManualIntervention() + ")"); buttonAppraisal.setVisible(job.getJobStats().getOutcomeObjectsWithManualIntervention() > 0); scheduleUpdateStatus(); }
From source file:org.roda.wui.client.main.BreadcrumbUtils.java
private static BreadcrumbItem getBreadcrumbItem(final IndexedDIP dip) { SafeHtmlBuilder b = new SafeHtmlBuilder(); // TODO get icon from config b.append(SafeHtmlUtils.fromSafeConstant("<i class='fa fa-play-circle-o'></i>")); b.append(SafeHtmlUtils.fromString(dip.getTitle())); SafeHtml label = b.toSafeHtml(); return new BreadcrumbItem(label, dip.getTitle(), new Command() { @Override//from www. ja v a 2 s. c o m public void execute() { HistoryUtils.openBrowse(dip); } }); }
From source file:org.roda.wui.client.main.BreadcrumbUtils.java
private static BreadcrumbItem getBreadcrumbItem(final DIPFile dipFile) { SafeHtmlBuilder b = new SafeHtmlBuilder(); // TODO get icon from config b.append(SafeHtmlUtils.fromSafeConstant("<i class='fa fa-play-circle'></i>")); b.append(SafeHtmlUtils.fromString(dipFile.getId())); SafeHtml label = b.toSafeHtml(); return new BreadcrumbItem(label, dipFile.getId(), new Command() { @Override/* ww w . j a va 2 s . c o m*/ public void execute() { HistoryUtils.openBrowse(dipFile); } }); }
From source file:org.roda.wui.client.main.BreadcrumbUtils.java
private static SafeHtml getBreadcrumbLabel(String label, String level) { SafeHtml elementLevelIconSafeHtml = DescriptionLevelUtils.getElementLevelIconSafeHtml(level, false); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(elementLevelIconSafeHtml).append(SafeHtmlUtils.fromString(label)); return builder.toSafeHtml(); }
From source file:org.roda.wui.client.main.BreadcrumbUtils.java
private static SafeHtml getBreadcrumbLabel(IndexedAIP aip) { SafeHtml breadcrumbLabel;/* w ww . j ava 2 s.c o m*/ SafeHtml elementLevelIconSafeHtml; if (aip.getGhost()) { elementLevelIconSafeHtml = DescriptionLevelUtils.getElementLevelIconSafeHtml(RodaConstants.AIP_GHOST, true); SafeHtmlBuilder builder = new SafeHtmlBuilder(); builder.append(elementLevelIconSafeHtml); breadcrumbLabel = builder.toSafeHtml(); } else { elementLevelIconSafeHtml = DescriptionLevelUtils.getElementLevelIconSafeHtml(aip.getLevel(), false); SafeHtmlBuilder builder = new SafeHtmlBuilder(); String label = aip.getTitle() != null ? aip.getTitle() : aip.getId(); builder.append(elementLevelIconSafeHtml).append(SafeHtmlUtils.fromString(label)); breadcrumbLabel = builder.toSafeHtml(); } return breadcrumbLabel; }
From source file:org.roda.wui.client.main.Menu.java
private MenuItem customMenuItem(String icon, String label, String styleNames, MenuBar subMenu, ScheduledCommand command) {//w w w. ja v a 2s .co m SafeHtmlBuilder b = new SafeHtmlBuilder(); String iconHTML = "<i class='" + icon + "'></i>"; b.append(SafeHtmlUtils.fromSafeConstant(iconHTML)); if (label != null) b.append(SafeHtmlUtils.fromSafeConstant(label)); MenuItem menuItem; if (subMenu != null) { menuItem = new MenuItem(b.toSafeHtml(), subMenu); } else if (command != null) { menuItem = new MenuItem(b.toSafeHtml(), command); } else { menuItem = new MenuItem(b.toSafeHtml()); } menuItem.addStyleName("menu-item"); menuItem.addStyleName(styleNames); return menuItem; }
From source file:org.roda.wui.client.main.Menu.java
private void setLanguageMenu() { String locale = LocaleInfo.getCurrentLocale().getLocaleName(); // Getting supported languages and their display name Map<String, String> supportedLanguages = new HashMap<>(); for (String localeName : LocaleInfo.getAvailableLocaleNames()) { if (!"default".equals(localeName)) { supportedLanguages.put(localeName, LocaleInfo.getLocaleNativeDisplayName(localeName)); }//from ww w . j a v a 2 s .co m } languagesMenu.clearItems(); for (final Entry<String, String> entry : supportedLanguages.entrySet()) { final String key = entry.getKey(); final String value = entry.getValue(); if (key.equals(locale)) { SafeHtmlBuilder b = new SafeHtmlBuilder(); String iconHTML = "<i class='fa fa-check'></i>"; b.append(SafeHtmlUtils.fromSafeConstant(value)); b.append(SafeHtmlUtils.fromSafeConstant(iconHTML)); MenuItem languageMenuItem = new MenuItem(b.toSafeHtml()); languageMenuItem.addStyleName("menu-item-language-selected"); languageMenuItem.addStyleName("menu-item-language"); languagesMenu.addItem(languageMenuItem); selectedLanguage = value; } else { MenuItem languageMenuItem = new MenuItem(SafeHtmlUtils.fromSafeConstant(value), new ScheduledCommand() { @Override public void execute() { JavascriptUtils.changeLocale(key); } }); languagesMenu.addItem(languageMenuItem); languageMenuItem.addStyleName("menu-item-language"); } } }
From source file:org.roda.wui.common.client.widgets.wcag.AccessibleHeaderOrFooterBuilder.java
private SafeHtml getSortingIcon(boolean isAscending) { AbstractCellTable<T> table = getTable(); SafeHtmlBuilder shb = new SafeHtmlBuilder(); if (isAscending) { table.getResources().sortAscending(); shb.appendEscaped("A"); } else {/*from w w w.j a v a2 s.c o m*/ table.getResources().sortDescending(); shb.appendEscaped("D"); } return shb.toSafeHtml(); }