private void onResetAllParameters() {
    ConfirmationModel model = (ConfirmationModel) getWindow();

    if (model.getProgress() != null) {
      return;
    }

    if (getEntity() == null) {
      return;
    }
    GlusterVolumeEntity volume = getEntity();

    ResetGlusterVolumeOptionsParameters parameters =
        new ResetGlusterVolumeOptionsParameters(volume.getId(), null, false);

    model.startProgress();

    Frontend.getInstance()
        .runAction(
            VdcActionType.ResetGlusterVolumeOptions,
            parameters,
            new IFrontendActionAsyncCallback() {

              @Override
              public void executed(FrontendActionAsyncResult result) {
                ConfirmationModel localModel = (ConfirmationModel) result.getState();
                localModel.stopProgress();
                cancel();
              }
            },
            model);
  }
  private void onRemove() {
    if (getSelectedItems() != null && getSelectedItems().size() > 0) {
      ConfirmationModel model = (ConfirmationModel) getWindow();

      if (model.getProgress() != null) {
        return;
      }

      ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>();
      for (Object perm : getSelectedItems()) {
        PermissionsOperationsParameters tempVar = new PermissionsOperationsParameters();
        tempVar.setPermission((Permission) perm);
        list.add(tempVar);
      }

      model.startProgress(null);

      Frontend.getInstance()
          .runMultipleAction(
              VdcActionType.RemoveSystemPermission,
              list,
              new IFrontendMultipleActionAsyncCallback() {
                @Override
                public void executed(FrontendMultipleActionAsyncResult result) {

                  ConfirmationModel localModel = (ConfirmationModel) result.getState();
                  localModel.stopProgress();
                  cancel();
                }
              },
              model);
    }
  }
  private void onDisableHook() {
    if (getConfirmWindow() == null) {
      return;
    }

    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();

    if (model.getProgress() != null) {
      return;
    }

    ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>();

    for (Object item : getSelectedItems()) {
      GlusterHookEntity hook = (GlusterHookEntity) item;
      list.add(new GlusterHookParameters(hook.getId()));
    }

    model.startProgress();

    Frontend.getInstance()
        .runMultipleAction(
            VdcActionType.DisableGlusterHook,
            list,
            new IFrontendMultipleActionAsyncCallback() {
              @Override
              public void executed(FrontendMultipleActionAsyncResult result) {

                ConfirmationModel localModel = (ConfirmationModel) result.getState();
                localModel.stopProgress();
                cancelConfirmation();
              }
            },
            model);
  }
  @Override
  public void edit(final ConfirmationModel object) {
    Driver.driver.edit(object);

    // Bind "Latch.IsAvailable"
    object
        .getLatch()
        .getPropertyChangedEvent()
        .addListener(
            new IEventListener() {

              @Override
              public void eventRaised(Event ev, Object sender, EventArgs args) {
                if ("IsAvailable".equals(((PropertyChangedEventArgs) args).PropertyName)) {
                  EntityModel entity = (EntityModel) sender;
                  if (entity.getIsAvailable()) {
                    latch.setVisible(true);
                  }
                }
              }
            });

    object
        .getItemsChangedEvent()
        .addListener(
            new IEventListener() {

              @Override
              public void eventRaised(Event ev, Object sender, EventArgs args) {
                updateMessage(object);
              }
            });
  }
  private void onForceSave() {
    ConfirmationModel confirmationModel = (ConfirmationModel) getConfirmWindow();
    if (confirmationModel != null && !confirmationModel.validate()) {
      return;
    }
    cancelConfirm();

    getSanStorageModel().setForce(true);
    onSave();
  }
  private void resetParameter() {
    if (getWindow() != null) {
      return;
    }

    if (getSelectedItem() == null) {
      return;
    }
    GlusterVolumeOptionEntity selectedOption = getSelectedItem();

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().resetOptionVolumeTitle());
    model.setHelpTag(HelpTag.reset_option);
    model.setHashName("reset_option"); // $NON-NLS-1$
    model.setMessage(ConstantsManager.getInstance().getConstants().resetOptionVolumeMsg());

    ArrayList<String> list = new ArrayList<String>();
    list.add(selectedOption.getKey());
    model.setItems(list);

    UICommand okCommand =
        UICommand.createDefaultOkUiCommand("OnResetParameter", this); // $NON-NLS-1$
    model.getCommands().add(okCommand);
    UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancel", this); // $NON-NLS-1$
    model.getCommands().add(cancelCommand);
  }
Example #7
0
 private ConfirmationModel getImportCertificateConfirmationModel(CertificateInfo certInfo) {
   ConfirmationModel confirmationModel = new ConfirmationModel();
   if (certInfo.getSelfSigned()) {
     confirmationModel.setMessage(
         ConstantsManager.getInstance()
             .getMessages()
             .approveRootCertificateTrust(certInfo.getSubject(), certInfo.getSHA1Fingerprint()));
   } else {
     confirmationModel.setMessage(
         ConstantsManager.getInstance()
             .getMessages()
             .approveCertificateTrust(
                 certInfo.getSubject(), certInfo.getIssuer(), certInfo.getSHA1Fingerprint()));
   }
   confirmationModel.setTitle(
       ConstantsManager.getInstance().getConstants().importProviderCertificateTitle());
   confirmationModel.setHelpTag(HelpTag.import_provider_certificate);
   confirmationModel.setHashName("import_provider_certificate"); // $NON-NLS-1$
   UICommand importCertificateCommand = new UICommand(CMD_IMPORT_CERTIFICATE, this);
   importCertificateCommand.setTitle(ConstantsManager.getInstance().getConstants().yes());
   importCertificateCommand.setIsDefault(false);
   confirmationModel.getCommands().add(importCertificateCommand);
   UICommand cancelImport = new UICommand(CMD_CANCEL_IMPORT, this);
   cancelImport.setTitle(ConstantsManager.getInstance().getConstants().no());
   cancelImport.setIsCancel(true);
   cancelImport.setIsDefault(true);
   confirmationModel.getCommands().add(cancelImport);
   return confirmationModel;
 }
  private void disableHook() {
    if (getWindow() != null) {
      return;
    }

    if (getSelectedItems() == null || getSelectedItems().size() == 0) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().confirmDisableGlusterHooks());
    model.setHelpTag(HelpTag.disable_hooks);
    model.setHashName("disable_hooks"); // $NON-NLS-1$
    model.setMessage(ConstantsManager.getInstance().getConstants().disableGlusterHooksMessage());

    ArrayList<String> list = new ArrayList<String>();
    for (GlusterHookEntity hook : getSelectedItems()) {
      list.add(hook.getName());
    }
    model.setItems(list);

    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnDisableHook", this); // $NON-NLS-1$
    model.getCommands().add(okCommand);
    UICommand cancelCommand =
        UICommand.createCancelUiCommand("OnCancelConfirmation", this); // $NON-NLS-1$
    model.getCommands().add(cancelCommand);
  }
Example #9
0
  private void unplug() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    model.startProgress();

    Frontend.getInstance()
        .runMultipleAction(
            VdcActionType.HotUnPlugDiskFromVm,
            createHotPlugDiskToVmParameters(false),
            new IFrontendMultipleActionAsyncCallback() {
              @Override
              public void executed(FrontendMultipleActionAsyncResult result) {
                model.stopProgress();
                setWindow(null);
              }
            },
            this);
  }
Example #10
0
  public void remove() {
    if (getWindow() != null) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeUsersTitle());
    model.setHelpTag(HelpTag.remove_user);
    model.setHashName("remove_user"); // $NON-NLS-1$

    ArrayList<String> list = new ArrayList<String>();
    for (DbUser item : Linq.<DbUser>cast(getSelectedItems())) {
      list.add(item.getFirstName());
    }
    model.setItems(list);

    UICommand tempVar = new UICommand("OnRemove", this); // $NON-NLS-1$
    tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
    tempVar.setIsDefault(true);
    model.getCommands().add(tempVar);
    UICommand tempVar2 = new UICommand("Cancel", this); // $NON-NLS-1$
    tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
    tempVar2.setIsCancel(true);
    model.getCommands().add(tempVar2);
  }
  @Override
  public void executeCommand(UICommand command) {
    super.executeCommand(command);

    if (CMD_REMOVE.equals(command.getName())) {
      onRemove();
    } else if (CMD_CANCEL.equals(command.getName())) {
      cancel();
    }
  }
  private void OnRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();

    if (model.getProgress() != null) {
      return;
    }

    java.util.ArrayList<VdcActionParametersBase> list =
        new java.util.ArrayList<VdcActionParametersBase>();
    for (Object item : getSelectedItems()) {
      VmNetworkInterface a = (VmNetworkInterface) item;
      list.add(
          new RemoveVmTemplateInterfaceParameters(getEntityStronglyTyped().getId(), a.getId()));
    }

    model.StartProgress(null);

    Frontend.RunMultipleAction(
        VdcActionType.RemoveVmTemplateInterface,
        list,
        new IFrontendMultipleActionAsyncCallback() {
          @Override
          public void Executed(FrontendMultipleActionAsyncResult result) {

            ConfirmationModel localModel = (ConfirmationModel) result.getState();
            localModel.StopProgress();
            Cancel();
          }
        },
        model);
  }
  protected void forceCreationWarning(ArrayList<String> usedLunsMessages) {
    ConfirmationModel confirmationModel = new ConfirmationModel();
    setConfirmWindow(confirmationModel);

    confirmationModel.setTitle(constants.forceStorageDomainCreation());
    confirmationModel.setMessage(constants.lunsAlreadyPartOfSD());
    confirmationModel.setHelpTag(HelpTag.force_lun_disk_creation);
    confirmationModel.setHashName("force_lun_disk_creation"); // $NON-NLS-1$
    confirmationModel.setItems(usedLunsMessages);

    UICommand forceSaveCommand = new UICommand("OnForceSave", this); // $NON-NLS-1$
    forceSaveCommand.setTitle(constants.ok());
    forceSaveCommand.setIsDefault(true);
    confirmationModel.getCommands().add(forceSaveCommand);

    UICommand cancelconfirmCommand = new UICommand("CancelConfirm", this); // $NON-NLS-1$
    cancelconfirmCommand.setTitle(constants.cancel());
    cancelconfirmCommand.setIsCancel(true);
    confirmationModel.getCommands().add(cancelconfirmCommand);
  }
  private void remove() {
    if (getWindow() != null) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeSystemPermissionsTitle());
    model.setHelpTag(HelpTag.remove_system_permission);
    model.setHashName("remove_system_permission"); // $NON-NLS-1$
    model.setItems(getSelectedItems());

    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this); // $NON-NLS-1$
    model.getCommands().add(tempVar);
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this); // $NON-NLS-1$
    model.getCommands().add(tempVar2);
  }
  private void resetAllParameters() {
    if (getWindow() != null) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().resetAllOptionsTitle());
    model.setHelpTag(HelpTag.reset_all_options);
    model.setHashName("reset_all_options"); // $NON-NLS-1$
    model.setMessage(ConstantsManager.getInstance().getConstants().resetAllOptionsMsg());

    UICommand okCommand =
        UICommand.createDefaultOkUiCommand("OnResetAllParameters", this); // $NON-NLS-1$
    model.getCommands().add(okCommand);
    UICommand cancelCommand = UICommand.createCancelUiCommand("OnCancel", this); // $NON-NLS-1$
    model.getCommands().add(cancelCommand);
  }
Example #16
0
  private void confirmUnplug() {
    ConfirmationModel model = new ConfirmationModel();
    model.setTitle(ConstantsManager.getInstance().getConstants().deactivateVmDisksTitle());
    model.setMessage(
        ConstantsManager.getInstance().getConstants().areYouSureYouWantDeactivateVMDisksMsg());
    model.setHashName("deactivate_vm_disk"); // $NON-NLS-1$
    setWindow(model);

    ArrayList<String> items = new ArrayList<String>();
    for (Disk selected : getSelectedItems()) {
      items.add(selected.getDiskAlias());
    }
    model.setItems(items);

    UICommand unPlug = UICommand.createDefaultOkUiCommand("OnUnplug", this); // $NON-NLS-1$
    model.getCommands().add(unPlug);

    UICommand cancel = UICommand.createCancelUiCommand("Cancel", this); // $NON-NLS-1$
    model.getCommands().add(cancel);
  }
  private void remove() {
    if (getWindow() != null) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removePermissionTitle());
    model.setHelpTag(HelpTag.remove_permission);
    model.setHashName("remove_permission"); // $NON-NLS-1$
    model.setItems(getSelectedItems());

    UICommand tempVar = new UICommand("OnRemove", this); // $NON-NLS-1$
    tempVar.setTitle(ConstantsManager.getInstance().getConstants().ok());
    tempVar.setIsDefault(true);
    model.getCommands().add(tempVar);
    UICommand tempVar2 = new UICommand("Cancel", this); // $NON-NLS-1$
    tempVar2.setTitle(ConstantsManager.getInstance().getConstants().cancel());
    tempVar2.setIsCancel(true);
    model.getCommands().add(tempVar2);
  }
  private void remove() {
    if (getWindow() != null) {
      return;
    }

    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle("Remove Network Interface(s)");
    model.setMessage("Network Interface(s)");

    java.util.ArrayList<String> items = new java.util.ArrayList<String>();
    for (Object item : getSelectedItems()) {
      VmNetworkInterface a = (VmNetworkInterface) item;
      items.add(a.getName());
    }
    model.setItems(items);

    UICommand tempVar = new UICommand("OnRemove", this);
    tempVar.setTitle("OK");
    tempVar.setIsDefault(true);
    model.getCommands().add(tempVar);
    UICommand tempVar2 = new UICommand("Cancel", this);
    tempVar2.setTitle("Cancel");
    tempVar2.setIsCancel(true);
    model.getCommands().add(tempVar2);
  }
 private void updateMessage(ConfirmationModel object) {
   String storageName = "<b>" + object.getItems().iterator().next() + "</b>";
   String formattedMessage = StringFormat.format(rawMessage, storageName);
   messageLabel.setHTML(SafeHtmlUtils.fromTrustedString(formattedMessage));
 }