コード例 #1
0
ファイル: PoolModule.java プロジェクト: imzhulei/ovirt-engine
 @Provides
 @Singleton
 public SearchableDetailModelProvider<VM, PoolListModel, PoolVmListModel> getPoolVmListProvider(
     EventBus eventBus,
     Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
     final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider,
     final Provider<PoolListModel> mainModelProvider,
     final Provider<PoolVmListModel> modelProvider) {
   SearchableDetailTabModelProvider<VM, PoolListModel, PoolVmListModel> result =
       new SearchableDetailTabModelProvider<VM, PoolListModel, PoolVmListModel>(
           eventBus, defaultConfirmPopupProvider) {
         @Override
         public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
             getConfirmModelPopup(PoolVmListModel source, UICommand lastExecutedCommand) {
           if (lastExecutedCommand == getModel().getDetachCommand()) {
             return removeConfirmPopupProvider.get();
           } else {
             return super.getConfirmModelPopup(source, lastExecutedCommand);
           }
         }
       };
   result.setMainModelProvider(mainModelProvider);
   result.setModelProvider(modelProvider);
   return result;
 }
コード例 #2
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<AuditLog, StorageListModel, StorageEventListModel>
      getStorageEventListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<EventPopupPresenterWidget> eventPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<StorageEventListModel> modelProvider) {

    SearchableDetailTabModelProvider<AuditLog, StorageListModel, StorageEventListModel> result =
        new SearchableDetailTabModelProvider<AuditLog, StorageListModel, StorageEventListModel>(
            eventBus, defaultConfirmPopupProvider) {
          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
              StorageEventListModel source, UICommand lastExecutedCommand, Model windowModel) {
            if (lastExecutedCommand.equals(getModel().getDetailsCommand())) {
              return eventPopupProvider.get();
            } else {
              return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
          }
        };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #3
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<
          VmTemplate, StorageListModel, StorageRegisterTemplateListModel>
      getStorageRegisterTemplateListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<RegisterTemplatePopupPresenterWidget> registerEntityPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<StorageRegisterTemplateListModel> modelProvider) {

    SearchableDetailTabModelProvider<VmTemplate, StorageListModel, StorageRegisterTemplateListModel>
        result =
            new SearchableDetailTabModelProvider<
                VmTemplate, StorageListModel, StorageRegisterTemplateListModel>(
                eventBus, defaultConfirmPopupProvider) {
              @Override
              public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
                  StorageRegisterTemplateListModel source,
                  UICommand lastExecutedCommand,
                  Model windowModel) {
                if (lastExecutedCommand == getModel().getImportCommand()) {
                  return registerEntityPopupProvider.get();
                } else {
                  return super.getModelPopup(source, lastExecutedCommand, windowModel);
                }
              }
            };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #4
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<StorageDomain, StorageListModel, StorageDataCenterListModel>
      getStorageDataCenterListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<FindSingleDcPopupPresenterWidget> singlePopupProvider,
          final Provider<FindMultiDcPopupPresenterWidget> multiPopupProvider,
          final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<StorageDataCenterListModel> modelProvider) {
    SearchableDetailTabModelProvider<StorageDomain, StorageListModel, StorageDataCenterListModel>
        result =
            new SearchableDetailTabModelProvider<
                StorageDomain, StorageListModel, StorageDataCenterListModel>(
                eventBus, defaultConfirmPopupProvider) {
              @Override
              public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
                  StorageDataCenterListModel source,
                  UICommand lastExecutedCommand,
                  Model windowModel) {
                StorageDataCenterListModel model = getModel();

                if (lastExecutedCommand == model.getAttachCommand()) {
                  if (model.getAttachMultiple()) {
                    return multiPopupProvider.get();
                  } else {
                    return singlePopupProvider.get();
                  }
                } else {
                  return super.getModelPopup(source, lastExecutedCommand, windowModel);
                }
              }

              @Override
              public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
                  getConfirmModelPopup(
                      StorageDataCenterListModel source, UICommand lastExecutedCommand) {
                if (lastExecutedCommand == getModel().getDetachCommand()
                    || lastExecutedCommand.getName().equals("OnAttach")) { // $NON-NLS-1$) {
                  return removeConfirmPopupProvider.get();
                } else {
                  return super.getConfirmModelPopup(source, lastExecutedCommand);
                }
              }
            };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #5
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<VmTemplate, StorageListModel, TemplateBackupModel>
      getTemplateBackupProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<ImportTemplatePopupPresenterWidget> importTemplatePopupProvider,
          final Provider<ImportCloneDialogPresenterWidget> importClonePopupProvider,
          final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<TemplateBackupModel> modelProvider) {

    SearchableDetailTabModelProvider<VmTemplate, StorageListModel, TemplateBackupModel> result =
        new SearchableDetailTabModelProvider<VmTemplate, StorageListModel, TemplateBackupModel>(
            eventBus, defaultConfirmPopupProvider) {
          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
              TemplateBackupModel source, UICommand lastExecutedCommand, Model windowModel) {
            if (lastExecutedCommand == getModel().getRestoreCommand()) {
              return importTemplatePopupProvider.get();
            } else {
              return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
          }

          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
              getConfirmModelPopup(TemplateBackupModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
              return removeConfirmPopupProvider.get();
            } else if (source.getConfirmWindow() instanceof ImportCloneModel) {
              return importClonePopupProvider.get();
            } else {
              return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
          }
        };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #6
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<DiskProfile, StorageListModel, DiskProfileListModel>
      getStorageDiskProfileListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<DiskProfilePopupPresenterWidget> newProfilePopupProvider,
          final Provider<DiskProfilePopupPresenterWidget> editProfilePopupProvider,
          final Provider<RemoveConfirmationPopupPresenterWidget> removeConfirmPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<DiskProfileListModel> modelProvider) {
    SearchableDetailTabModelProvider<DiskProfile, StorageListModel, DiskProfileListModel> result =
        new SearchableDetailTabModelProvider<DiskProfile, StorageListModel, DiskProfileListModel>(
            eventBus, defaultConfirmPopupProvider) {
          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
              DiskProfileListModel source, UICommand lastExecutedCommand, Model windowModel) {
            if (lastExecutedCommand == getModel().getNewCommand()) {
              return newProfilePopupProvider.get();
            } else if (lastExecutedCommand == getModel().getEditCommand()) {
              return editProfilePopupProvider.get();
            } else {
              return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
          }

          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
              getConfirmModelPopup(DiskProfileListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) { // $NON-NLS-1$
              return removeConfirmPopupProvider.get();
            } else {
              return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
          }
        };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #7
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<Disk, StorageListModel, StorageDiskListModel>
      getStorageDiskListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<VmDiskRemovePopupPresenterWidget> removeConfirmPopupProvider,
          final Provider<UploadImagePopupPresenterWidget> uploadImagePopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<StorageDiskListModel> modelProvider) {

    SearchableDetailTabModelProvider<Disk, StorageListModel, StorageDiskListModel> result =
        new SearchableDetailTabModelProvider<Disk, StorageListModel, StorageDiskListModel>(
            eventBus, defaultConfirmPopupProvider) {
          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends Model, ?> getModelPopup(
              StorageDiskListModel source, UICommand lastExecutedCommand, Model windowModel) {
            if (lastExecutedCommand == getModel().getUploadCommand()
                || lastExecutedCommand == getModel().getResumeUploadCommand()) {
              return uploadImagePopupProvider.get();
            } else {
              return super.getModelPopup(source, lastExecutedCommand, windowModel);
            }
          }

          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
              getConfirmModelPopup(StorageDiskListModel source, UICommand lastExecutedCommand) {
            if (lastExecutedCommand == getModel().getRemoveCommand()) {
              return removeConfirmPopupProvider.get();
            } else {
              return super.getConfirmModelPopup(source, lastExecutedCommand);
            }
          }
        };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }
コード例 #8
0
  @Provides
  @Singleton
  public SearchableDetailModelProvider<Disk, StorageListModel, StorageRegisterDiskListModel>
      getStorageRegisterDiskListProvider(
          EventBus eventBus,
          Provider<DefaultConfirmationPopupPresenterWidget> defaultConfirmPopupProvider,
          final Provider<StorageListModel> mainModelProvider,
          final Provider<StorageRegisterDiskListModel> modelProvider) {

    SearchableDetailTabModelProvider<Disk, StorageListModel, StorageRegisterDiskListModel> result =
        new SearchableDetailTabModelProvider<Disk, StorageListModel, StorageRegisterDiskListModel>(
            eventBus, defaultConfirmPopupProvider) {
          @Override
          public AbstractModelBoundPopupPresenterWidget<? extends ConfirmationModel, ?>
              getConfirmModelPopup(
                  StorageRegisterDiskListModel source, UICommand lastExecutedCommand) {
            return super.getConfirmModelPopup(source, lastExecutedCommand);
          }
        };
    result.setMainModelProvider(mainModelProvider);
    result.setModelProvider(modelProvider);
    return result;
  }