use of com.google.gwt.resources.client.ImageResource in project ovirt-engine by oVirt.
the class VMsTree method getSnapshotNode.
private TreeItem getSnapshotNode(List<DiskImage> disks) {
VerticalPanel vPanel = new VerticalPanel();
// $NON-NLS-1$
vPanel.setWidth("100%");
for (DiskImage disk : disks) {
HorizontalPanel panel = new HorizontalPanel();
ImageResource image = resources.snapshotImage();
String name = disk.getDescription();
// $NON-NLS-1$
addItemToPanel(panel, new Image(image), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), name, "");
// $NON-NLS-1$ //$NON-NLS-2$
addTextBoxToPanel(panel, new StringValueLabel(), "", "80px");
// $NON-NLS-1$ //$NON-NLS-2$
addTextBoxToPanel(panel, new StringValueLabel(), "", "160px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Double>(SizeConverter.SizeUnit.GiB), disk.getActualSize(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getCreationDate(), "140px");
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
vPanel.add(panel);
}
TreeItem treeItem = new TreeItem(vPanel);
// $NON-NLS-1$
treeItem.setUserObject(disks.get(0).getId() + "snapshot");
return treeItem;
}
use of com.google.gwt.resources.client.ImageResource in project ovirt-engine by oVirt.
the class BrickStatusCell method render.
@Override
public void render(Context context, GlusterBrickEntity brick, SafeHtmlBuilder sb, String id) {
// Nothing to render if no brick is provided:
if (brick == null) {
return;
}
// Find the image corresponding to the status of the brick:
GlusterStatus status = brick.getStatus();
ImageResource statusImage = null;
switch(status) {
case DOWN:
statusImage = resources.downImage();
break;
case UP:
statusImage = resources.upImage();
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());
if (brick.getUnSyncedEntries() != null && brick.getUnSyncedEntries() > 0) {
SafeHtml alertImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(resources.alertImage()).getHTML());
sb.append(templates.statusWithAlertTemplate(statusImageHtml, alertImageHtml, id, status.toString()));
} else {
sb.append(templates.statusTemplate(statusImageHtml, id, status.toString()));
}
}
use of com.google.gwt.resources.client.ImageResource 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()));
}
use of com.google.gwt.resources.client.ImageResource in project ovirt-engine by oVirt.
the class VmStatusCell method render.
@Override
public void render(Context context, VM vm, SafeHtmlBuilder sb, String id) {
// Nothing to render if no vm is provided:
if (vm == null) {
return;
}
// Find the image corresponding to the status of the vm:
VMStatus status = vm.getStatus();
ImageResource statusImage;
switch(status) {
case Up:
if (vm.isRunOnce()) {
statusImage = resources.runOnceUpImage();
} else {
statusImage = resources.vmStatusRunning();
}
break;
case SavingState:
statusImage = resources.vmStatusWait();
break;
case RestoringState:
statusImage = resources.vmStatusWait();
break;
case PoweringUp:
statusImage = resources.vmStatusStarting();
break;
case PoweringDown:
statusImage = resources.vmStatusPoweringDown();
break;
case RebootInProgress:
statusImage = resources.rebootInProgress();
break;
case WaitForLaunch:
statusImage = resources.waitForLaunch();
break;
case ImageLocked:
statusImage = resources.vmStatusWait();
break;
case MigratingFrom:
case MigratingTo:
statusImage = resources.migrationImage();
break;
case Suspended:
statusImage = resources.suspendedImage();
break;
case Paused:
statusImage = resources.pauseImage();
break;
case Unknown:
case Unassigned:
statusImage = resources.questionMarkImage();
break;
case NotResponding:
statusImage = resources.questionMarkImage();
break;
default:
statusImage = resources.downStatusImage();
break;
}
// Generate the HTML for status image
SafeHtml statusImageHtml = SafeHtmlUtils.fromTrustedString(AbstractImagePrototype.create(statusImage).getHTML());
if (vm.getLockInfo() != null && vm.getLockInfo().isExclusive()) {
ImageResource lockImageResource = resources.vmLocked();
// Get the image html
AbstractImagePrototype imagePrototype = AbstractImagePrototype.create(lockImageResource);
SafeHtml lockImageHtml = SafeHtmlUtils.fromTrustedString(imagePrototype.getHTML());
statusImageHtml = templates.lockedStatusTemplate(lockImageHtml, statusImageHtml);
}
if (VmStatusColumn.needsAlert(vm)) {
sb.append(templates.statusWithAlertTemplate(statusImageHtml, getAlertImageResource(vm), id, status.toString()));
} else {
sb.append(templates.statusTemplate(statusImageHtml, id, status.toString()));
}
}
use of com.google.gwt.resources.client.ImageResource in project ovirt-engine by oVirt.
the class VmStatusCell method getAlertImageResource.
private static SafeHtml getAlertImageResource(VM vm) {
ImageResource alertImageResource = resources.alertImage();
AbstractImagePrototype imagePrototype = AbstractImagePrototype.create(alertImageResource);
String html = imagePrototype.getHTML();
return SafeHtmlUtils.fromTrustedString(html);
}
Aggregations