use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class DataCenterListModel method newEntity.
public void newEntity() {
if (getWindow() != null) {
return;
}
DataCenterModel model = new DataCenterModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().newDataCenterTitle());
model.setHelpTag(HelpTag.new_data_center);
// $NON-NLS-1$
model.setHashName("new_data_center");
model.setIsNew(true);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand 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.UICommand in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method detach.
public void detach() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().detachStorageTitle());
model.setHelpTag(HelpTag.detach_storage);
// $NON-NLS-1$
model.setHashName("detach_storage");
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDetachFollowingStoragesMsg());
List<String> list = new ArrayList<>();
boolean shouldAddressWarnning = false;
for (StorageDomain item : getSelectedItems()) {
list.add(item.getStorageName());
if (item.getStorageDomainType().isDataDomain()) {
shouldAddressWarnning = true;
break;
}
}
model.setItems(list);
if (containsLocalStorage(model)) {
shouldAddressWarnning = false;
model.getForce().setIsAvailable(true);
model.getForce().setIsChangeable(true);
model.setForceLabel(ConstantsManager.getInstance().getConstants().storageRemovePopupFormatLabel());
model.setNote(ConstantsManager.getInstance().getMessages().detachNote(getLocalStoragesFormattedString()));
}
if (shouldAddressWarnning) {
model.setNote(ConstantsManager.getInstance().getConstants().detachWarnningNote());
}
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnDetach", this);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class DataCenterStorageListModel method postAttachInternal.
private void postAttachInternal(List<EntityModel> models) {
ListModel listModel = (ListModel) getWindow();
listModel.setItems(models);
if (models.isEmpty()) {
listModel.setMessage(ConstantsManager.getInstance().getConstants().thereAreNoCompatibleStorageDomainsAttachThisDcMsg());
// $NON-NLS-1$
UICommand tempVar = new UICommand("Cancel", this);
tempVar.setTitle(ConstantsManager.getInstance().getConstants().close());
tempVar.setIsDefault(true);
tempVar.setIsCancel(true);
listModel.getCommands().add(tempVar);
} else {
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createDefaultOkUiCommand("OnAttach", this);
listModel.getCommands().add(tempVar2);
// $NON-NLS-1$
UICommand tempVar3 = UICommand.createCancelUiCommand("Cancel", this);
listModel.getCommands().add(tempVar3);
}
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class IscsiBondModel method createSaveButon.
private void createSaveButon() {
// $NON-NLS-1$
UICommand onSaveCommand = new UICommand("OnSave", this);
onSaveCommand.setTitle(constants.ok());
onSaveCommand.setIsDefault(true);
getCommands().add(onSaveCommand);
}
Aggregations