use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class OptionsModel method onEdit.
private void onEdit() {
if (getWindow() != null) {
return;
}
final EditOptionsModel model = new EditOptionsModel();
model.setTitle(constants.editOptionsTitle());
// $NON-NLS-1$
model.setHashName("edit_options");
setWindow(model);
UICommand okCommand = UICommand.createDefaultOkUiCommand(constants.ok(), this);
model.getCommands().add(okCommand);
UICommand cancelCommand = UICommand.createCancelUiCommand(constants.cancel(), this);
model.getCommands().add(cancelCommand);
AsyncDataProvider.getInstance().getUserProfile(model.asyncQuery(returnValue -> {
UserProfile profile = returnValue.getReturnValue();
if (profile != null) {
setUserProfile(profile);
model.getPublicKey().setEntity(profile.getSshPublicKey());
}
}));
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class PoolListModel method displayHighPerformanceConfirmationPopup.
protected void displayHighPerformanceConfirmationPopup() {
final PoolModel model = (PoolModel) getWindow();
if (model == null || model.getProgress() != null) {
return;
}
VmHighPerformanceConfigurationModel confirmModel = new VmHighPerformanceConfigurationModel();
// Handle CPU Pinning topology
final boolean isVmAssignedToSpecificHosts = !model.getIsAutoAssign().getEntity();
final boolean isVmCpuPinningSet = model.getCpuPinning().getIsChangable() && model.getCpuPinning().getEntity() != null && !model.getCpuPinning().getEntity().isEmpty();
confirmModel.addRecommendationForCpuPinning(isVmAssignedToSpecificHosts, isVmCpuPinningSet);
// Handle Huge Pages
KeyValueModel keyValue = model.getCustomPropertySheet();
// $NON-NLS-1$
final boolean isVmHugePagesSet = keyValue != null && keyValue.getUsedKeys().contains("hugepages");
confirmModel.addRecommendationForHugePages(isVmHugePagesSet);
// Handle KSM (Kernel Same Page Merging)
confirmModel.addRecommendationForKsm(model.getSelectedCluster().isEnableKsm(), model.getSelectedCluster().getName());
if (!confirmModel.getRecommendationsList().isEmpty()) {
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().configurationChangesForHighPerformancePoolTitle());
confirmModel.setHelpTag(HelpTag.configuration_changes_for_high_performance_pool);
// $NON-NLS-1$
confirmModel.setHashName("configuration_changes_for_high_performance_pool");
confirmModel.getCommands().add(// $NON-NLS-1$
new UICommand("OnSave_Phase2", PoolListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
confirmModel.getCommands().add(// $NON-NLS-1$
UICommand.createCancelUiCommand("CancelConfirmation", PoolListModel.this));
setConfirmWindow(null);
setConfirmWindow(confirmModel);
} else {
savePoolPostValidation();
}
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class QuotaUserListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeQuotaAssignmentFromUsersTitle());
model.setHelpTag(HelpTag.remove_quota_assignment_from_user);
// $NON-NLS-1$
model.setHashName("remove_quota_assignment_from_user");
ArrayList<String> list = new ArrayList<>();
for (Permission item : getSelectedItems()) {
list.add(item.getOwnerName());
}
model.setItems(list);
// $NON-NLS-1$
UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", 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 ManageBackupModel method validateSingleArchitecture.
protected boolean validateSingleArchitecture() {
// Checks if there are selected VMs of multiple architectures
ArchitectureType firstArch = null;
boolean multipleArchs = false;
for (T item : getSelectedItems()) {
ArchitectureType arch = getArchitectureFromItem(item);
if (firstArch == null) {
firstArch = arch;
} else {
if (!firstArch.equals(arch)) {
multipleArchs = true;
break;
}
}
}
if (multipleArchs) {
ConfirmationModel confirmModel = new ConfirmationModel();
setConfirmWindow(confirmModel);
confirmModel.setTitle(ConstantsManager.getInstance().getConstants().invalidImportTitle());
confirmModel.setHelpTag(HelpTag.multiple_archs_dialog);
// $NON-NLS-1$
confirmModel.setHashName("multiple_archs_dialog");
confirmModel.setMessage(ConstantsManager.getInstance().getConstants().invalidImportMsg());
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("multipleArchsOK", this);
confirmModel.getCommands().add(command);
setConfirmWindow(confirmModel);
return false;
}
return true;
}
use of org.ovirt.engine.ui.uicommonweb.UICommand in project ovirt-engine by oVirt.
the class RegisterDiskModel method init.
public void init() {
ICommandTarget target = (ICommandTarget) getEntity();
// $NON-NLS-1$
UICommand actionCommand = new UICommand("OnExecute", this);
actionCommand.setTitle(constants.ok());
actionCommand.setIsDefault(true);
getCommands().add(actionCommand);
// $NON-NLS-1$
UICommand cancelCommand = new UICommand("Cancel", target);
cancelCommand.setTitle(constants.cancel());
cancelCommand.setIsCancel(true);
getCommands().add(cancelCommand);
}
Aggregations