use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VmRunOncePopupWidget method updateBootSequenceItems.
private void updateBootSequenceItems() {
// Update list box
bootSequenceBox.clear();
bootSequenceBox.setVisibleItemCount(bootSequenceModel.getItems().size());
// Set items
for (EntityModel bootItem : bootSequenceModel.getItems()) {
bootSequenceBox.addItem(bootItem.getTitle());
updateItemAvailability(bootItem.getTitle(), bootItem.getIsChangable());
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class DataCenterGuideModel method onAttachStorage.
public void onAttachStorage() {
ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
ArrayList<StorageDomain> items = new ArrayList<>();
for (EntityModel<StorageDomain> a : model.getItems()) {
if (a.getIsSelected()) {
items.add(a.getEntity());
}
}
if (items.size() > 0) {
for (StorageDomain sd : items) {
attachStorageToDataCenter(sd.getId(), getEntity().getId());
}
}
cancel();
postAction();
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class DataCenterListModel method recoveryStorage.
public void recoveryStorage() {
final ConfirmationModel windowModel = new ConfirmationModel();
setWindow(windowModel);
windowModel.setTitle(ConstantsManager.getInstance().getConstants().dataCenterReInitializeTitle());
windowModel.setHelpTag(HelpTag.data_center_re_initialize);
// $NON-NLS-1$
windowModel.setHashName("data_center_re-initialize");
windowModel.getLatch().setIsAvailable(true);
windowModel.getLatch().setIsChangeable(true);
windowModel.startProgress();
AsyncDataProvider.getInstance().getStorageDomainList(new AsyncQuery<>(storageDomainList -> {
windowModel.stopProgress();
List<EntityModel> models = new ArrayList<>();
for (StorageDomain a : storageDomainList) {
if (a.getStorageDomainType() == StorageDomainType.Data && (a.getStorageDomainSharedStatus() == StorageDomainSharedStatus.Unattached)) {
EntityModel tempVar = new EntityModel();
tempVar.setEntity(a);
models.add(tempVar);
}
}
windowModel.setItems(models);
if (models.size() > 0) {
EntityModel entityModel = models.size() != 0 ? models.get(0) : null;
if (entityModel != null) {
entityModel.setIsSelected(true);
}
}
if (models.isEmpty()) {
windowModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
windowModel.getLatch().setIsAvailable(false);
// $NON-NLS-1$
UICommand tempVar2 = new UICommand("Cancel", DataCenterListModel.this);
tempVar2.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar2.setIsDefault(true);
tempVar2.setIsCancel(true);
windowModel.getCommands().add(tempVar2);
} else {
// $NON-NLS-1$
UICommand tempVar3 = UICommand.createDefaultOkUiCommand("OnRecover", DataCenterListModel.this);
windowModel.getCommands().add(tempVar3);
// $NON-NLS-1$
UICommand tempVar4 = UICommand.createCancelUiCommand("Cancel", DataCenterListModel.this);
windowModel.getCommands().add(tempVar4);
}
}));
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method onAttach.
public void onAttach() {
ListModel<EntityModel<StorageDomain>> model = (ListModel<EntityModel<StorageDomain>>) getWindow();
List<StorageDomain> selectedDataStorageDomains = new ArrayList<>();
if (getEntity() == null) {
cancel();
return;
}
selectedStorageDomains = new ArrayList<>();
for (EntityModel<StorageDomain> a : model.getItems()) {
if (a.getIsSelected()) {
StorageDomain storageDomain = a.getEntity();
selectedStorageDomains.add(storageDomain);
if (storageDomain.getStorageDomainType() == StorageDomainType.Data) {
selectedDataStorageDomains.add(storageDomain);
}
}
}
if (selectedStorageDomains.isEmpty()) {
cancel();
return;
}
AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
if (!attachedStorageDomains.isEmpty()) {
ConfirmationModel confirmationModel = new ConfirmationModel();
setWindow(null);
setWindow(confirmationModel);
List<String> stoageDomainNames = attachedStorageDomains.stream().map(StorageDomainStatic::getStorageName).collect(Collectors.toList());
confirmationModel.setItems(stoageDomainNames);
confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
confirmationModel.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
confirmationModel.setHelpTag(HelpTag.attach_storage_domain_confirmation);
// $NON-NLS-1$
confirmationModel.setHashName("attach_storage_domain_confirmation");
confirmationModel.getLatch().setIsAvailable(true);
confirmationModel.getLatch().setIsChangeable(true);
// $NON-NLS-1$
UICommand onApprove = new UICommand("OnAttachApprove", DataCenterStorageListModel.this);
onApprove.setTitle(ConstantsManager.getInstance().getConstants().ok());
onApprove.setIsDefault(true);
confirmationModel.getCommands().add(onApprove);
// $NON-NLS-1$
UICommand cancel = new UICommand("Cancel", DataCenterStorageListModel.this);
cancel.setTitle(ConstantsManager.getInstance().getConstants().cancel());
cancel.setIsCancel(true);
confirmationModel.getCommands().add(cancel);
} else {
executeAttachStorageDomains();
}
}), getEntity(), selectedDataStorageDomains);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeBrickModel method addBrick.
private void addBrick() {
VDS server = servers.getSelectedItem();
String brickDir = null;
if (getShowBricksList().getEntity()) {
brickDir = bricksFromServer.getSelectedItem();
} else {
brickDir = getBrickDirectory().getEntity();
}
if (server == null) {
setMessage(ConstantsManager.getInstance().getConstants().emptyServerBrickMsg());
return;
}
if (brickDir == null || brickDir.trim().length() == 0) {
setMessage(ConstantsManager.getInstance().getConstants().emptyBrickDirectoryMsg());
return;
}
brickDir = brickDir.trim();
if (!validateBrickDirectory(brickDir)) {
return;
}
GlusterBrickEntity brickEntity = new GlusterBrickEntity();
brickEntity.setServerId(server.getId());
brickEntity.setServerName(server.getHostName());
brickEntity.setBrickDirectory(brickDir);
EntityModel<GlusterBrickEntity> entityModel = new EntityModel<>(brickEntity);
List<EntityModel<GlusterBrickEntity>> items = (List<EntityModel<GlusterBrickEntity>>) bricks.getItems();
if (items == null) {
items = new ArrayList<>();
}
for (EntityModel<GlusterBrickEntity> model : items) {
GlusterBrickEntity existingBrick = model.getEntity();
if (existingBrick.getServerId().equals(brickEntity.getServerId()) && existingBrick.getBrickDirectory().equals(brickEntity.getBrickDirectory())) {
setMessage(ConstantsManager.getInstance().getConstants().duplicateBrickMsg());
return;
}
}
items.add(entityModel);
bricks.setItems(null);
bricks.setItems(items);
clearBrickDetails();
}
Aggregations