Search in sources :

Example 6 with ListModel

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();
}
Also used : ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ArrayList(java.util.ArrayList) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) DiskByDiskAliasComparator(org.ovirt.engine.core.common.businessentities.comparators.DiskByDiskAliasComparator)

Example 7 with ListModel

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;
    }
}
Also used : ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) UnitVmModel(org.ovirt.engine.ui.uicommonweb.models.vms.UnitVmModel) Model(org.ovirt.engine.ui.uicommonweb.models.Model) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel)

Example 8 with ListModel

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);
}
Also used : EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) EmptyColumn(org.ovirt.engine.ui.common.widget.table.column.EmptyColumn) TreeItem(com.google.gwt.user.client.ui.TreeItem) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) TemplateDiskListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateDiskListModel) ArrayList(java.util.ArrayList)

Example 9 with ListModel

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;
}
Also used : EntityModelCellTable(org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable) EmptyColumn(org.ovirt.engine.ui.common.widget.table.column.EmptyColumn) TreeItem(com.google.gwt.user.client.ui.TreeItem) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) TemplateStorageListModel(org.ovirt.engine.ui.uicommonweb.models.templates.TemplateStorageListModel) ArrayList(java.util.ArrayList)

Example 10 with ListModel

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);
}
Also used : ApplicationModeHelper(org.ovirt.engine.ui.uicommonweb.models.ApplicationModeHelper) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) List(java.util.List) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) ExternalHostGroup(org.ovirt.engine.core.common.businessentities.ExternalHostGroup) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) ExternalDiscoveredHost(org.ovirt.engine.core.common.businessentities.ExternalDiscoveredHost) Provider(org.ovirt.engine.core.common.businessentities.Provider) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) VDS(org.ovirt.engine.core.common.businessentities.VDS) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) ArrayList(java.util.ArrayList) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) Provider(org.ovirt.engine.core.common.businessentities.Provider) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)

Aggregations

ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)43 ArrayList (java.util.ArrayList)29 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)19 List (java.util.List)17 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)11 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)11 SearchableListModel (org.ovirt.engine.ui.uicommonweb.models.SearchableListModel)9 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)8 EntityModelCellTable (org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable)8 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)8 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)7 TreeItem (com.google.gwt.user.client.ui.TreeItem)6 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)6 Model (org.ovirt.engine.ui.uicommonweb.models.Model)6 Provider (org.ovirt.engine.core.common.businessentities.Provider)5 QueryType (org.ovirt.engine.core.common.queries.QueryType)5 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)5 Collections (java.util.Collections)4 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)4 Linq (org.ovirt.engine.ui.uicommonweb.Linq)4