Example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant

Introduction

In this page you can find the example usage for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant.

Prototype

public static SafeHtml fromSafeConstant(String s) 

Source Link

Document

Returns a SafeHtml constructed from a safe string, i.e., without escaping the string.

Usage

From source file:org.roda.wui.client.management.ShowNotification.java

/**
 * Create a new panel to view a notification
 *
 *//*from  w  w w. j a  v  a2  s. c o m*/
public ShowNotification(Notification notification) {
    initWidget(uiBinder.createAndBindUi(this));

    notificationId.setText(notification.getId());
    notificationSubject.setText(notification.getSubject());
    notificationBody.setHTML(notification.getBody());
    notificationSentOn.setText(
            DateTimeFormat.getFormat(PredefinedFormat.DATE_TIME_MEDIUM).format(notification.getSentOn()));
    notificationFromUser.setText(notification.getFromUser());
    notificationIsAcknowledged
            .setText(messages.isAcknowledged(Boolean.toString(notification.isAcknowledged()).toLowerCase()));
    acknowledgedUsersKey.setVisible(false);
    notAcknowledgedUsersKey.setVisible(false);

    List<String> recipientUsers = new ArrayList<>(notification.getRecipientUsers());

    for (String user : notification.getAcknowledgedUsers().keySet()) {
        String ackDate = notification.getAcknowledgedUsers().get(user);
        acknowledgedUsersKey.setVisible(true);
        acknowledgedUsersValue.setHTML(SafeHtmlUtils.fromSafeConstant(acknowledgedUsersValue.getHTML() + "<p>"
                + user + " <span class='small-and-gray'> " + ackDate + "</span></p>"));
        recipientUsers.remove(user);
    }

    for (String user : recipientUsers) {
        notAcknowledgedUsersKey.setVisible(true);
        notAcknowledgedUsersValue.setHTML(
                SafeHtmlUtils.fromSafeConstant(notAcknowledgedUsersValue.getHTML() + "<p>" + user + "</p>"));
    }

    stateValue.setHTML(HtmlSnippetUtils.getNotificationStateHTML(notification.getState()));
    stateLabel.setVisible(notification.getState() != null);
    stateValue.setVisible(notification.getState() != null);
}

From source file:org.roda.wui.common.client.tools.DescriptionLevelUtils.java

public static SafeHtml getTopIconSafeHtml() {
    return SafeHtmlUtils.fromSafeConstant(TOP_ICON);
}

From source file:org.roda.wui.common.client.tools.DescriptionLevelUtils.java

public static HTMLPanel getTopIconHTMLPanel() {
    return new HTMLPanel(SafeHtmlUtils.fromSafeConstant(TOP_ICON));
}

From source file:org.roda.wui.common.client.tools.DescriptionLevelUtils.java

public static SafeHtml getElementLevelIconSafeHtml(String levelString, boolean showText) {
    SafeHtml ret = null;/*from   www .ja  v  a2s. com*/

    DescriptionLevel level = getDescriptionLevel(levelString);
    if (level != null) {
        StringBuilder b = new StringBuilder();
        b.append("<i class='");
        b.append(level.getIconClass());
        b.append("'></i>");
        appendLevel(b, showText, level.getLabel());
        ret = SafeHtmlUtils.fromSafeConstant(b.toString());
    }

    return ret;
}

From source file:org.roda.wui.common.client.tools.DescriptionLevelUtils.java

public static SafeHtml getRepresentationTypeIcon(String representationType, boolean showText) {
    if (levelsConfiguration == null) {
        logger.error("Requiring a description level while their are not yet loaded");
        return null;
    }/* ww  w  . j  ava  2s  . c  o m*/

    String representationTypeKey = representationType.toLowerCase();
    String icon;
    if (levelsConfiguration.getRepresentationTypesIcons().containsKey(representationTypeKey)) {
        icon = levelsConfiguration.getRepresentationTypesIcons().get(representationTypeKey);
    } else if (levelsConfiguration.getRepresentationTypesIcons()
            .containsKey(RodaConstants.REPRESENTATION_TYPE_DEFAULT)) {
        icon = levelsConfiguration.getRepresentationTypesIcons().get(RodaConstants.REPRESENTATION_TYPE_DEFAULT);
    } else {
        icon = levelsConfiguration.getRepresentationClass();
    }

    StringBuilder b = new StringBuilder();
    b.append("<i class='");
    if (icon != null) {
        b.append(icon);
    }

    b.append("'></i>");
    appendLevel(b, showText, representationType);
    return SafeHtmlUtils.fromSafeConstant(b.toString());
}

From source file:org.rstudio.core.client.SafeHtmlUtil.java

License:Open Source License

public static SafeHtml createEmpty() {
    return SafeHtmlUtils.fromSafeConstant("");
}

From source file:org.rstudio.studio.client.workbench.views.files.ui.FilesList.java

License:Open Source License

private Column<FileSystemItem, ImageResource> addIconColumn(final FileTypeRegistry fileTypeRegistry) {
    Column<FileSystemItem, ImageResource> iconColumn = new Column<FileSystemItem, ImageResource>(
            new ImageResourceCell()) {

        @Override//from ww  w.j  a va  2s  .c o  m
        public ImageResource getValue(FileSystemItem object) {
            if (object == parentPath_)
                return FileIconResources.INSTANCE.iconUpFolder();
            else
                return fileTypeRegistry.getIconForFile(object);
        }
    };
    iconColumn.setSortable(true);
    filesCellTable_.addColumn(iconColumn, SafeHtmlUtils.fromSafeConstant("<br/>"));
    filesCellTable_.setColumnWidth(iconColumn, 20, Unit.PX);

    sortHandler_.setComparator(iconColumn, new FilesListComparator() {
        @Override
        public int doCompare(FileSystemItem arg0, FileSystemItem arg1) {
            if (arg0.isDirectory() && !arg1.isDirectory())
                return 1;
            else if (arg1.isDirectory() && !arg0.isDirectory())
                return -1;
            else
                return arg0.getExtension().compareTo(arg1.getExtension());
        }
    });

    return iconColumn;
}

From source file:org.sagebionetworks.web.client.widget.entity.menu.ActionMenuViewImpl.java

@Override
public void createMenu(Entity entity, EntityType entityType, boolean isAdministrator, boolean canEdit) {
    int height = 25;
    if (downloadButton == null) {
        downloadButton = licensedDownloader.asWidget(entity);
        downloadButton.setHeight("25px");
        add(downloadButton);//from   w w w  .  ja  v a2  s.c o m
        this.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    }
    if (downloadButton instanceof Button) {
        Button dlButton = (Button) downloadButton;
        if (entity instanceof Locationable)
            dlButton.enable();
        else
            dlButton.disable();
    }
    // Configure the button
    licensedDownloader.configureHeadless(entity);

    // edit button
    if (editButton == null) {
        editButton = new Button(DisplayConstants.BUTTON_EDIT,
                AbstractImagePrototype.create(iconsImageBundle.editGrey16()));
        editButton.setHeight(25);
        this.add(editButton);
        this.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    }
    if (canEdit)
        editButton.enable();
    else
        editButton.disable();
    configureEditButton(entity, entityType);

    // share button
    if (shareButton == null) {
        shareButton = new Button(DisplayConstants.BUTTON_SHARE,
                AbstractImagePrototype.create(iconsImageBundle.mailGrey16()));
        shareButton.setHeight(25);
        this.add(shareButton);
        this.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    }
    if (isAdministrator)
        shareButton.enable();
    else
        shareButton.disable();
    configureShareButton(entity);

    // add Button
    if (addButton == null) {
        addButton = new Button(DisplayConstants.BUTTON_ADD,
                AbstractImagePrototype.create(iconsImageBundle.add16()));
        addButton.setHeight(25);
        this.add(addButton);
        this.add(new HTML(SafeHtmlUtils.fromSafeConstant("&nbsp;")));
    }
    if (canEdit)
        addButton.enable();
    else
        addButton.disable();
    configureAddMenu(entity, entityType);

    if (toolsButton == null) {
        toolsButton = new Button(DisplayConstants.BUTTON_TOOLS_MENU,
                AbstractImagePrototype.create(iconsImageBundle.adminToolsGrey16()));
        toolsButton.setHeight(25);
        this.add(toolsButton);
    }
    configureToolsMenu(entity, entityType, isAdministrator, canEdit);
}

From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void setLicenseHtml(String licenseHtml) {
    licenseTextHtml = SafeHtmlUtils.fromSafeConstant(licenseHtml);

    // replace the view content if this is after initialization
    if (licenseTextContainer != null) {
        refillLicenseTextContainer();// ww w .j ava  2 s . com
    }
}

From source file:org.sagebionetworks.web.client.widget.licenseddownloader.LicensedDownloaderViewImpl.java

License:Open Source License

@Override
public void clear() {
    // defaults//from  www .j  av a 2 s .c o m
    citationText = "";
    licenseTextHtml = SafeHtmlUtils.fromSafeConstant("");
    safeDownloadHtml = SafeHtmlUtils.fromSafeConstant("");
}