use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class VmModelBehaviorBase method initTemplateDisks.
protected void initTemplateDisks(List<DiskImage> disks) {
disks.sort(new DiskByDiskAliasComparator());
ArrayList<DiskModel> list = new ArrayList<>();
for (DiskImage disk : disks) {
DiskModel diskModel = new DiskModel();
diskModel.getAlias().setEntity(disk.getDiskAlias());
diskModel.getVolumeType().setIsAvailable(false);
switch(disk.getDiskStorageType()) {
case IMAGE:
diskModel.setSize(new EntityModel<>((int) disk.getSizeInGigabytes()));
ListModel volumes = new ListModel();
volumes.setItems(disk.getVolumeType() == VolumeType.Preallocated ? new ArrayList<>(Collections.singletonList(VolumeType.Preallocated)) : AsyncDataProvider.getInstance().getVolumeTypeList(), disk.getVolumeType());
diskModel.setVolumeType(volumes);
break;
case CINDER:
CinderDisk cinderDisk = (CinderDisk) disk;
diskModel.setSize(new EntityModel<>((int) cinderDisk.getSizeInGigabytes()));
ListModel volumeTypes = new ListModel();
volumeTypes.setItems(new ArrayList<>(Collections.singletonList(cinderDisk.getVolumeType())), cinderDisk.getVolumeType());
diskModel.setVolumeType(volumeTypes);
ListModel volumeFormats = new ListModel();
volumeFormats.setItems(new ArrayList<>(Collections.singletonList(cinderDisk.getVolumeFormat())), cinderDisk.getVolumeFormat());
diskModel.setVolumeFormat(volumeFormats);
break;
}
diskModel.setDisk(disk);
list.add(diskModel);
}
getModel().setDisks(list);
updateIsDisksAvailable();
initStorageDomains();
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class InstanceTypeAttachDetachManager method manageInstanceType.
public void manageInstanceType(InstanceType instanceType) {
this.managedInstanceType = instanceType;
setAttachedTo(instanceType);
modelToProperValue = new HashMap<>();
for (Model model : detachableModels) {
if (model instanceof ListModel) {
modelToProperValue.put(model, ((ListModel) model).getSelectedItem());
} else if (model instanceof EntityModel) {
modelToProperValue.put(model, ((EntityModel) model).getEntity());
}
}
if (!alreadyRegistered) {
model.getInstanceTypes().getSelectedItemChangedEvent().addListener(this);
listenToDetachableFields(detachableModels);
alreadyRegistered = true;
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class DisksTree method getNodeHeader.
@Override
protected TreeItem getNodeHeader() {
EntityModelCellTable<ListModel> table = new EntityModelCellTable<>(false, true);
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.empty(), "20px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.domainNameDisksTree(), "");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.domainTypeDisksTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.statusDisksTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.freeSpaceDisksTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.usedSpaceDisksTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.totalSpaceDisksTree(), "130px");
table.setRowData(new ArrayList());
// $NON-NLS-1$
table.setWidth("100%");
// $NON-NLS-1$
table.setHeight("30px");
return new TreeItem(table);
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class StoragesTree method getNodeHeader.
@Override
protected TreeItem getNodeHeader() {
EntityModelCellTable<ListModel> table = new EntityModelCellTable<>(false, true);
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.empty(), "30px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.aliasDisk(), "");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.sizeStorageTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.statusStorageTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.allocationStorageTree(), "120px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.interfaceStorageTree(), "110px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.typeDisk(), "110px");
// $NON-NLS-1$
table.addColumn(new EmptyColumn(), constants.creationDateStorageTree(), "100px");
table.setRowData(new ArrayList());
// $NON-NLS-1$
table.setWidth("100%");
// $NON-NLS-1$
table.setHeight("30px");
TreeItem item = new TreeItem(table);
item.setUserObject(NODE_HEADER);
item.getElement().getStyle().setPadding(0, Unit.PX);
return item;
}
use of org.ovirt.engine.ui.uicommonweb.models.ListModel in project ovirt-engine by oVirt.
the class NewHostModel method updateHostList.
private void updateHostList() {
Provider provider = getProviders().getSelectedItem();
if (provider == null) {
return;
}
AsyncDataProvider.getInstance().getExternalProviderHostList(new AsyncQuery<>(hosts -> {
ListModel<VDS> hostNameListModel = getExternalHostName();
hostNameListModel.setItems(hosts);
hostNameListModel.setIsChangeable(true);
setEnableSearchHost(true);
getProviders().setIsChangeable(true);
}), provider.getId(), true, getProviderSearchFilter().getEntity());
AsyncDataProvider.getInstance().getExternalProviderHostGroupList(new AsyncQuery<>(hostGroups -> {
ListModel externalHostGroupsListModel = getExternalHostGroups();
externalHostGroupsListModel.setItems(hostGroups);
externalHostGroupsListModel.setIsChangeable(true);
AsyncDataProvider.getInstance().getExternalProviderDiscoveredHostList(new AsyncQuery<>(hosts -> {
ListModel externalDiscoveredHostsListModel = getExternalDiscoveredHosts();
externalDiscoveredHostsListModel.setItems(hosts);
externalDiscoveredHostsListModel.setIsChangeable(true);
}), getProviders().getSelectedItem());
}), provider);
AsyncDataProvider.getInstance().getExternalProviderComputeResourceList(new AsyncQuery<>(computeResources -> {
ListModel externalComputeResourceListModel = getExternalComputeResource();
externalComputeResourceListModel.setItems(computeResources);
externalComputeResourceListModel.setIsChangeable(true);
}), provider);
}
Aggregations