use of org.ovirt.engine.ui.common.widget.label.StringValueLabel in project ovirt-engine by oVirt.
the class TemplatesTree method getNodeItem.
@Override
protected TreeItem getNodeItem(DiskImage disk) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$ //$NON-NLS-2$
addTextBoxToPanel(panel, new StringValueLabel(), "", "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), disk.getSize(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Double>(), disk.getActualSize(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getCreationDate(), "140px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(disk.getImageId());
return treeItem;
}
use of org.ovirt.engine.ui.common.widget.label.StringValueLabel in project ovirt-engine by oVirt.
the class VMsTree method getDiskNode.
private TreeItem getDiskNode(ArrayList<Disk> disks) {
if (disks.isEmpty()) {
return null;
}
VerticalPanel vPanel = new VerticalPanel();
// $NON-NLS-1$
vPanel.setWidth("100%");
for (Disk disk : disks) {
HorizontalPanel panel = new HorizontalPanel();
ImageResource image = resources.diskImage();
String name = disk.getDiskAlias();
// $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");
boolean isDiskImage = disk.getDiskStorageType() == DiskStorageType.IMAGE;
Double actualSize = isDiskImage ? ((DiskImage) disk).getActualDiskWithSnapshotsSize() : (long) ((LunDisk) disk).getLun().getDeviceSize();
Long virtualSize = isDiskImage ? disk.getSize() : (long) (((LunDisk) disk).getLun().getDeviceSize() * Math.pow(1024, 3));
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), virtualSize, "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Double>(SizeConverter.SizeUnit.GiB), actualSize, "110px");
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getDiskStorageType() == DiskStorageType.IMAGE ? ((DiskImage) disk).getCreationDate() : null, // $NON-NLS-1$
"140px");
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
vPanel.add(panel);
}
TreeItem treeItem = new TreeItem(vPanel);
treeItem.setUserObject(disks.get(0).getId());
return treeItem;
}
use of org.ovirt.engine.ui.common.widget.label.StringValueLabel in project ovirt-engine by oVirt.
the class AbstractSubTabTree method addTextBoxToPanel.
protected void addTextBoxToPanel(HorizontalPanel panel, WidgetTooltip item, String text, String width) {
Widget w = item.getWidget();
if (w instanceof Label) {
Label label = (Label) item.getWidget();
label.setText(text);
addItemToPanel(panel, item, width);
} else if (w instanceof StringValueLabel) {
StringValueLabel label = (StringValueLabel) item.getWidget();
label.setValue(text);
addItemToPanel(panel, item, width);
} else {
// $NON-NLS-1$
throw new ClassCastException("tooltipped label contains unknown Widget: " + w.getClass());
}
}
use of org.ovirt.engine.ui.common.widget.label.StringValueLabel in project ovirt-engine by oVirt.
the class DisksTree method getRootItem.
@Override
protected TreeItem getRootItem(DiskImage disk) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
DiskVmElement dve = disk.getDiskVmElements().iterator().next();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "25px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$
addItemToPanel(panel, dve.isReadOnly() ? new Image(resources.readOnlyDiskIcon()) : new Image(), "60px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(SizeConverter.SizeUnit.BYTES), disk.getActualSizeInBytes(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<ImageStatus>(), disk.getImageStatus(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<VolumeType>(), disk.getVolumeType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskInterface>(), dve.getDiskInterface(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new FullDateTimeLabel(), disk.getCreationDate(), "140px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(disk.getId());
return treeItem;
}
use of org.ovirt.engine.ui.common.widget.label.StringValueLabel in project ovirt-engine by oVirt.
the class StoragesTree method getNodeItem.
@Override
protected TreeItem getNodeItem(DiskModel diskModel) {
HorizontalPanel panel = new HorizontalPanel();
panel.setSpacing(1);
// $NON-NLS-1$
panel.setWidth("100%");
DiskImage disk = (DiskImage) diskModel.getDisk();
// $NON-NLS-1$
addItemToPanel(panel, new Image(resources.diskImage()), "30px");
// $NON-NLS-1$
addTextBoxToPanel(panel, new StringValueLabel(), disk.getDiskAlias(), "");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DiskSizeLabel<Long>(), disk.getSizeInGigabytes(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<ImageStatus>(), disk.getImageStatus(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<VolumeType>(), disk.getVolumeType(), "120px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskInterface>(), disk.getDiskVmElements().iterator().next().getDiskInterface(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new EnumLabel<DiskStorageType>(), disk.getDiskStorageType(), "110px");
// $NON-NLS-1$
addValueLabelToPanel(panel, new DateLabel(), disk.getCreationDate(), "100px");
TreeItem treeItem = new TreeItem(panel);
treeItem.setUserObject(getEntityId(diskModel));
return treeItem;
}
Aggregations