use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.
the class ImportVmsModel method initDataCenters.
private void initDataCenters() {
getDataCenters().getSelectedItemChangedEvent().addListener((ev, sender, args) -> {
clearVms();
exportDomain.setEntity(null);
loadProviders();
StoragePool dataCenter = dataCenters.getSelectedItem();
Frontend.getInstance().runQuery(QueryType.GetStorageDomainsByStoragePoolId, new IdQueryParameters(dataCenter.getId()), new AsyncQuery<>(createGetStorageDomainsByStoragePoolIdCallback()));
});
dataCenters.getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() {
@Override
public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
AsyncDataProvider.getInstance().getHostListByDataCenter(new AsyncQuery<>(hosts -> {
List<VDS> upHosts = filterUpHosts(hosts);
proxyHosts.setItems(addAnyHostInCluster(upHosts));
xenProxyHosts.setItems(addAnyHostInCluster(upHosts));
kvmProxyHosts.setItems(addAnyHostInCluster(upHosts));
ImportVmsModel.this.hosts.setItems(upHosts);
stopProgress();
}), dataCenters.getSelectedItem().getId());
}
private List<VDS> filterUpHosts(List<VDS> hosts) {
List<VDS> result = new ArrayList<>();
for (VDS host : hosts) {
if (host.getStatus() == VDSStatus.Up) {
result.add(host);
}
}
return result;
}
private List<VDS> addAnyHostInCluster(List<VDS> hosts) {
List<VDS> result = new ArrayList<>(hosts);
// Any host in the cluster
result.add(0, null);
return result;
}
});
AsyncDataProvider.getInstance().getDataCenterList(new AsyncQuery<>(returnValue -> {
List<StoragePool> dataCenters = new ArrayList<>();
for (StoragePool a : returnValue) {
if (a.getStatus() == StoragePoolStatus.Up) {
dataCenters.add(a);
}
}
if (dataCenters.isEmpty()) {
getDataCenters().setIsChangeable(false);
getImportSources().setIsChangeable(false);
setError(constants.notAvailableWithNoUpDC());
stopProgress();
return;
}
Collections.sort(dataCenters, new NameableComparator());
ImportVmsModel.this.dataCenters.setItems(dataCenters);
}));
}
use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.
the class HostNetworkProviderWidget method edit.
@Override
public void edit(HostNetworkProviderModel model) {
driver.edit(model);
final NeutronAgentModel neutronAgentModel = model.getNeutronAgentModel();
neutronAgentWidget.edit(neutronAgentModel);
neutronAgentWidget.setVisible(neutronAgentModel.isPluginConfigurationAvailable().getEntity());
IEventListener<EventArgs> providerPluginTypeListener = (ev, sender, args) -> neutronAgentWidget.setVisible(model.getNetworkProviderType().getSelectedItem() == OPENSTACK_NETWORK && model.providerPluginTypeIsOpenstack());
model.getNetworkProviderType().getSelectedItemChangedEvent().addListener(providerPluginTypeListener);
model.getProviderPluginType().getSelectedItemChangedEvent().addListener(providerPluginTypeListener);
}
use of org.ovirt.engine.ui.uicompat.EventArgs in project ovirt-engine by oVirt.
the class RegisterVmModel method postClustersInit.
private void postClustersInit() {
validateAllMacs();
for (final RegisterVmData registerVmData : getEntities().getItems()) {
final IEventListener<EventArgs> validateMacsListener = (ev, sender, args) -> validateVmMacs(Collections.singletonList(registerVmData));
registerVmData.getReassignMacs().getEntityChangedEvent().addListener(validateMacsListener);
registerVmData.getCluster().getSelectedItemChangedEvent().addListener(validateMacsListener);
}
}
Aggregations