use of org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider 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;
}
use of org.ovirt.engine.ui.common.uicommon.model.MainViewModelProvider in project ovirt-engine by oVirt.
the class TemplateModule method getTemplateListProvider.
// Main List Model
@Provides
@Singleton
public MainModelProvider<VmTemplate, TemplateListModel> getTemplateListProvider(EventBus eventBus, final Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider, final Provider<TemplateEditPresenterWidget> popupProvider, final Provider<VmExportPopupPresenterWidget> exportPopupProvider, final Provider<VmPopupPresenterWidget> createVmPopupProvider, final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider, final Provider<TemplateListModel> modelProvider, final Provider<VmDiskPopupPresenterWidget> newDiskPopupProvider, final Provider<SingleSelectionVmDiskAttachPopupPresenterWidget> attachDiskPopupProvider, final Provider<VmHighPerformanceConfigurationPresenterWidget> highPerformanceConfigurationProvider) {
MainViewModelProvider<VmTemplate, TemplateListModel> result = new MainViewModelProvider<VmTemplate, TemplateListModel>(eventBus, defaultConfirmPopupProvider) {
@Override
public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(TemplateListModel source, UICommand lastExecutedCommand, Model windowModel) {
TemplateListModel model = getModel();
if (lastExecutedCommand == model.getEditCommand()) {
return popupProvider.get();
} else if (lastExecutedCommand == getModel().getExportCommand()) {
return exportPopupProvider.get();
} else if (lastExecutedCommand == getModel().getCreateVmFromTemplateCommand()) {
if (windowModel instanceof AttachDiskModel) {
return attachDiskPopupProvider.get();
} else if ((windowModel instanceof NewDiskModel) || (windowModel instanceof EditDiskModel)) {
return newDiskPopupProvider.get();
} else {
return createVmPopupProvider.get();
}
} else {
return super.getModelPopup(source, lastExecutedCommand, windowModel);
}
}
@Override
public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?> getConfirmModelPopup(TemplateListModel source, UICommand lastExecutedCommand) {
if (lastExecutedCommand == getModel().getRemoveCommand()) {
return removeConfirmPopupProvider.get();
} else if ("OnSave".equals(lastExecutedCommand.getName())) {
// $NON-NLS-1$
return defaultConfirmPopupProvider.get();
} else if (// $NON-NLS-1$
"OnSaveVm".equals(lastExecutedCommand.getName()) && source.getConfirmWindow() instanceof VmHighPerformanceConfigurationModel) {
return highPerformanceConfigurationProvider.get();
} else {
return super.getConfirmModelPopup(source, lastExecutedCommand);
}
}
};
result.setModelProvider(modelProvider);
return result;
}
Aggregations