Search in sources :

Example 1 with GlusterSnapshotStatus

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus in project ovirt-engine by oVirt.

the class GlusterVolumeSnapshotStatusColumn method getTooltip.

@Override
public SafeHtml getTooltip(GlusterVolumeSnapshotEntity snapshot) {
    // Nothing to render if no snapshot is provided:
    if (snapshot == null) {
        return null;
    }
    // Find the image corresponding to the status of the brick:
    GlusterSnapshotStatus status = snapshot.getStatus();
    String tooltip;
    switch(status) {
        case ACTIVATED:
            tooltip = constants.up();
            break;
        case DEACTIVATED:
            tooltip = constants.down();
            break;
        case UNKNOWN:
            tooltip = constants.unknown();
            break;
        default:
            tooltip = constants.down();
    }
    return SafeHtmlUtils.fromSafeConstant(tooltip);
}
Also used : GlusterSnapshotStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus)

Example 2 with GlusterSnapshotStatus

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus in project ovirt-engine by oVirt.

the class GlusterVolumeSnapshotStatusCell method render.

@Override
public void render(Context context, GlusterVolumeSnapshotEntity snapshot, SafeHtmlBuilder sb, String id) {
    // Nothing to render if no snapshot is provided:
    if (snapshot == null) {
        return;
    }
    // Find the image corresponding to the status of the brick:
    GlusterSnapshotStatus status = snapshot.getStatus();
    ImageResource statusImage = null;
    switch(status) {
        case ACTIVATED:
            statusImage = resources.upImage();
            break;
        case DEACTIVATED:
            statusImage = resources.downImage();
            break;
        case UNKNOWN:
            statusImage = resources.questionMarkImage();
            break;
        default:
            statusImage = resources.downImage();
    }
    // Generate the HTML for the image:
    SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML());
    sb.append(templates.statusTemplate(statusImageHtml, id, status.toString()));
}
Also used : ImageResource(com.google.gwt.resources.client.ImageResource) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) GlusterSnapshotStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus)

Aggregations

GlusterSnapshotStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterSnapshotStatus)2 ImageResource (com.google.gwt.resources.client.ImageResource)1 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)1