use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VnicProfileListModel method remove.
public void remove() {
if (getConfirmWindow() != null) {
return;
}
ConfirmationModel model = new RemoveVnicProfileModel(this, getSelectedItems(), true);
setConfirmWindow(model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class EditProviderModel method showConfirmation.
private void showConfirmation() {
if (providedNetworks.isEmpty()) {
actualSave();
return;
}
// $NON-NLS-1$
StringBuilder networkList = new StringBuilder("Networks:\n");
for (Network network : providedNetworks) {
// $NON-NLS-1$
networkList.append("- ").append(network.getName()).append('\n');
}
ConfirmationModel confirmationModel = new ConfirmationModel();
confirmationModel.setTitle(ConstantsManager.getInstance().getConstants().providerUrlWarningTitle());
confirmationModel.setMessage(ConstantsManager.getInstance().getMessages().providerUrlWarningText(networkList.toString()));
UICommand cmdOk = UICommand.createDefaultOkUiCommand(CMD_APPROVE, this);
confirmationModel.getCommands().add(cmdOk);
// $NON-NLS-1$
UICommand cmdCancel = UICommand.createCancelUiCommand(CMD_CANCEL, this);
confirmationModel.getCommands().add(cmdCancel);
sourceListModel.setConfirmWindow(confirmationModel);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class QuotaListModel method remove.
public void remove() {
if (getWindow() != null) {
return;
}
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(ConstantsManager.getInstance().getConstants().removeQuotasTitle());
model.setHelpTag(HelpTag.remove_quota);
// $NON-NLS-1$
model.setHashName("remove_quota");
ArrayList<String> list = new ArrayList<>();
for (Quota a : getSelectedItems()) {
list.add(a.getQuotaName());
}
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.models.ConfirmationModel in project ovirt-engine by oVirt.
the class PoolVmListModel method onDetach.
public void onDetach() {
ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
boolean latchChecked = !model.validate();
if (model.getProgress() != null || latchChecked) {
return;
}
ArrayList<ActionParametersBase> list = new ArrayList<>();
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
list.add(new RemoveVmFromPoolParameters(vm.getId(), true, true));
}
model.startProgress();
Frontend.getInstance().runMultipleAction(ActionType.RemoveVmFromPool, list, result -> {
ConfirmationModel localModel = (ConfirmationModel) result.getState();
localModel.stopProgress();
cancel();
}, model);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VmListModel method powerAction.
private void powerAction(String actionName, String title, String message, boolean reasonVisible) {
ConfirmationModel model = new ConfirmationModel();
setWindow(model);
model.setTitle(title);
model.setReasonVisible(reasonVisible);
if (actionName.equals(SHUTDOWN)) {
model.setHelpTag(HelpTag.shutdown_virtual_machine);
// $NON-NLS-1$
model.setHashName("shutdown_virtual_machine");
} else if (actionName.equals(STOP)) {
model.setHelpTag(HelpTag.stop_virtual_machine);
// $NON-NLS-1$
model.setHashName("stop_virtual_machine");
} else if (actionName.equals(REBOOT)) {
model.setHelpTag(HelpTag.reboot_virtual_machine);
// $NON-NLS-1$
model.setHashName("reboot_virtual_machine");
}
model.setMessage(message);
ArrayList<String> items = new ArrayList<>();
boolean stoppingSingleVM = getSelectedItems().size() == 1 && (actionName.equals(SHUTDOWN) || actionName.equals(STOP));
for (Object item : getSelectedItems()) {
VM vm = (VM) item;
items.add(vm.getName());
// is populated with the current reason so the user can edit it.
if (stoppingSingleVM && reasonVisible && VMStatus.PoweringDown.equals(vm.getStatus())) {
model.getReason().setEntity(vm.getStopReason());
}
}
model.setItems(items);
// $NON-NLS-1$
UICommand tempVar = new UICommand("On" + actionName, this);
tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
tempVar.setIsDefault(true);
model.getCommands().add(tempVar);
// $NON-NLS-1$
UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(tempVar2);
}
Aggregations