use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class FenceAgentModel method confirmRemove.
/**
* Confirm the removal of the model.
*/
public void confirmRemove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(constants.areYouSureTitle());
String confirmMessage = "";
if (concurrentList.isEmpty()) {
confirmMessage = messages.confirmDeleteFenceAgent(getDisplayString());
} else {
StringBuilder builder = new StringBuilder();
builder.append(getDisplayString());
for (FenceAgentModel concurrentModel : concurrentList) {
// $NON-NLS-1$
builder.append("\n");
builder.append(concurrentModel.getDisplayString());
}
confirmMessage = messages.confirmDeleteAgentGroup(builder.toString());
}
model.setMessage(confirmMessage);
model.getLatch().setIsAvailable(true);
model.getLatch().setIsChangeable(true);
UICommand tempVar = UICommand.createDefaultOkUiCommand(ON_REMOVE, this);
model.getCommands().add(tempVar);
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 UpgradeConfirmationModel method initialize.
@Override
public void initialize() {
setTitle(constants.upgradeHostTitle());
setHelpTag(HelpTag.upgrade_host);
setHashName(HelpTag.upgrade_host.name);
if (host.getVmCount() > 0) {
setMessage(constants.areYouSureYouWantToUpgradeTheFollowingHostWithRunningVmsMsg());
} else {
setMessage(constants.areYouSureYouWantToUpgradeTheFollowingHostMsg());
}
UICommand upgradeCommand = new UICommand(ON_UPGRADE, this);
upgradeCommand.setTitle(constants.ok());
upgradeCommand.setIsDefault(true);
getCommands().add(upgradeCommand);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class NumaSupportModel method initCommands.
protected void initCommands() {
UICommand command = new UICommand(SUBMIT_NUMA_SUPPORT, this);
command.setTitle(ConstantsManager.getInstance().getConstants().ok());
getCommands().add(command);
// $NON-NLS-1$
getCommands().add(UICommand.createDefaultCancelUiCommand("Cancel", this));
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class StorageListModel method edit.
private void edit() {
StorageDomain storage = getSelectedItem();
if (getWindow() != null) {
return;
}
StorageModel model = new StorageModel(new NewEditStorageModelBehavior());
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().editDomainTitle());
model.setHelpTag(HelpTag.edit_domain);
// $NON-NLS-1$
model.setHashName("edit_domain");
model.setStorage(storage);
model.getName().setEntity(storage.getStorageName());
model.getDescription().setEntity(storage.getDescription());
model.getComment().setEntity(storage.getComment());
model.setOriginalName(storage.getStorageName());
model.getDataCenter().setIsChangeable(false);
model.getFormat().setIsChangeable(false);
boolean isStorageNameEditable = model.isStorageActive() || model.isNewStorage();
boolean isStorageInMaintenance = !model.isNewStorage() && model.getStorage().getStatus() == StorageDomainStatus.Maintenance;
model.getHost().setIsChangeable(false);
model.getName().setIsChangeable(isStorageNameEditable);
// set the field domain type to non editable
model.getAvailableStorageTypeItems().setIsChangeable(false);
model.getAvailableStorageDomainTypeItems().setIsChangeable(false);
model.setIsChangeable(isStorageNameEditable && !isStorageInMaintenance);
model.getWarningLowSpaceIndicator().setEntity(storage.getWarningLowSpaceIndicator());
model.getWarningLowSpaceSize().setEntity(ConstantsManager.getInstance().getMessages().bracketsWithGB(storage.getWarningLowSpaceSize()));
model.getWarningLowSpaceSize().setIsAvailable(true);
model.getCriticalSpaceActionBlocker().setEntity(storage.getCriticalSpaceActionBlocker());
IStorageModel item = prepareStorageForEdit(storage, model);
model.setStorageModels(new ArrayList<>(Arrays.asList(new IStorageModel[] { item })));
model.setCurrentStorageItem(item);
model.initialize();
UICommand command;
// $NON-NLS-1$
command = UICommand.createDefaultOkUiCommand("OnSave", this);
model.getCommands().add(command);
// $NON-NLS-1$
command = createCancelCommand("Cancel");
model.getCommands().add(command);
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class StorageListModel method checkDomainAttachedToDc.
private void checkDomainAttachedToDc(String commandName, List<StorageDomain> storageDomains, StorageServerConnections storageServerConnections) {
final StorageModel storageModel = (StorageModel) getWindow();
StoragePool storagePool = storageModel.getDataCenter().getSelectedItem();
final UICommand okCommand = UICommand.createDefaultOkUiCommand(commandName, this);
if (storagePool.getId().equals(Guid.Empty)) {
okCommand.execute();
return;
}
VDS host = storageModel.getHost().getSelectedItem();
AsyncDataProvider.getInstance().getStorageDomainsWithAttachedStoragePoolGuid(new AsyncQuery<>(attachedStorageDomains -> {
if (!attachedStorageDomains.isEmpty()) {
ConfirmationModel model = new ConfirmationModel();
setConfirmWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().storageDomainsAttachedToDataCenterWarningMessage());
model.setHelpTag(HelpTag.import_storage_domain_confirmation);
// $NON-NLS-1$
model.setHashName("import_storage_domain_confirmation");
List<String> stoageDomainNames = new ArrayList<>();
for (StorageDomainStatic domain : attachedStorageDomains) {
stoageDomainNames.add(domain.getStorageName());
}
model.setItems(stoageDomainNames);
// $NON-NLS-1$
UICommand cancelCommand = createCancelCommand("CancelImportConfirm");
model.getCommands().add(okCommand);
model.getCommands().add(cancelCommand);
} else {
okCommand.execute();
}
}), storagePool, storageDomains, storageServerConnections, host.getId());
}
Aggregations