use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VmDevicesListModel method onHotUnplug.
public void onHotUnplug(VmDeviceFeEntity deviceEntity) {
if (getEntity() == null) {
return;
}
if (deviceEntity == null || deviceEntity.getVmDevice().getType() != VmDeviceGeneralType.MEMORY) {
return;
}
final Optional<Integer> memorySizeOptional = VmDeviceCommonUtils.getSizeOfMemoryDeviceMb(deviceEntity.getVmDevice());
if (!memorySizeOptional.isPresent()) {
return;
}
final int memorySizeMb = memorySizeOptional.get();
setSelectedItem(deviceEntity);
ConfirmationModel confirmationModel = new ConfirmationModel();
confirmationModel.setTitle(constants.memoryHotUnplug());
confirmationModel.setHelpTag(HelpTag.template_not_found_on_export_domain);
confirmationModel.setMessage(messages.memoryHotUnplugConfirmation(memorySizeMb, getEntity().getName()));
confirmationModel.getCommands().add(memoryHotUnplugCommand);
confirmationModel.getCommands().add(cancelMemoryHotUnplugCommand);
setConfirmWindow(confirmationModel);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class VmDiskListModel method confirmUnplug.
private void confirmUnplug() {
ConfirmationModel model = new ConfirmationModel();
model.setTitle(ConstantsManager.getInstance().getConstants().deactivateVmDisksTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantDeactivateVMDisksMsg());
// $NON-NLS-1$
model.setHashName("deactivate_vm_disk");
setWindow(model);
ArrayList<String> items = new ArrayList<>();
for (Disk selected : getSelectedItems()) {
items.add(selected.getDiskAlias());
}
model.setItems(items);
// $NON-NLS-1$
UICommand unPlug = UICommand.createDefaultOkUiCommand("OnUnplug", this);
model.getCommands().add(unPlug);
// $NON-NLS-1$
UICommand cancel = UICommand.createCancelUiCommand("Cancel", this);
model.getCommands().add(cancel);
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class EditVmInterfaceModel method confirmSave.
private void confirmSave() {
// Check if the nic was unplugged
if (getNic().isPlugged() && !getPlugged().getEntity()) {
ConfirmationModel model = new ConfirmationModel();
model.setTitle(ConstantsManager.getInstance().getConstants().unplugVnicTitle());
model.setMessage(ConstantsManager.getInstance().getConstants().areYouSureYouWantUnplugVnicMsg());
// $NON-NLS-1$
model.setHashName("unplug_vnic");
getSourceModel().setConfirmWindow(model);
UICommand approveCommand = UICommand.createDefaultOkUiCommand(ON_APPROVE_COMMAND, this);
model.getCommands().add(approveCommand);
// $NON-NLS-1$
UICommand cancel = UICommand.createCancelUiCommand(ABORT_COMMAMD, this);
model.getCommands().add(cancel);
} else {
onSave();
}
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class UserModule method getPermissionListProvider.
@Provides
@Singleton
public SearchableDetailModelProvider<Permission, UserListModel, UserPermissionListModel> getPermissionListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<UserRolesPopupPresenterWidget> popupProvider, final Provider<RolePermissionsRemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> mainModelProvider, final Provider<UserPermissionListModel> modelProvider) {
SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel> result = new SearchableDetailTabModelProvider<Permission, UserListModel, UserPermissionListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand, Model windowModel) {
UserPermissionListModel model = getModel();
if (lastExecutedCommand == model.getAddRoleToUserCommand()) {
return popupProvider.get();
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserPermissionListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getRemoveCommand()) {
return removeConfirmPopupProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setMainModelProvider(mainModelProvider);
result.setModelProvider(modelProvider);
return result;
}
use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.
the class UserModule method getUserListProvider.
// Main List Model
@Provides
@Singleton
public MainModelProvider<DbUser, UserListModel> getUserListProvider(EventBus eventBus, Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<AssignTagsPopupPresenterWidget> assignTagsPopupProvider, final Provider<PermissionsPopupPresenterWidget> popupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<UserListModel> modelProvider) {
MainViewModelProvider<DbUser, UserListModel> result = new MainViewModelProvider<DbUser, UserListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(UserListModel source, UICommand lastExecutedCommand, Model windowModel) {
UserListModel model = getModel();
if (lastExecutedCommand == model.getAssignTagsCommand()) {
return assignTagsPopupProvider.get();
} else if (lastExecutedCommand == model.getAddCommand()) {
return popupProvider.get();
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(UserListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getRemoveCommand()) {
return removeConfirmPopupProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setModelProvider(modelProvider);
return result;
}
Aggregations