@Override
  public void ExecuteCommand(UICommand command) {
    super.ExecuteCommand(command);

    if (StringHelper.stringsEqual(command.getName(), "AddHost")) {
      AddHost();
    }
    if (StringHelper.stringsEqual(command.getName(), "OnConfirmPMHost")) {
      OnConfirmPMHost();
    }
    if (StringHelper.stringsEqual(command.getName(), "OnAddHost")) {
      OnAddHost();
    }
    if (StringHelper.stringsEqual(command.getName(), "SelectHost")) {
      SelectHost();
    }
    if (StringHelper.stringsEqual(command.getName(), "OnSelectHost")) {
      OnSelectHost();
    }
    if (StringHelper.stringsEqual(command.getName(), "Cancel")) {
      Cancel();
    }
    if (StringHelper.stringsEqual(command.getName(), "CancelConfirm")) {
      CancelConfirm();
    }
    if (StringHelper.stringsEqual(command.getName(), "CancelConfirmWithFocus")) {
      CancelConfirmWithFocus();
    }
  }
示例#2
0
 public static Network FindNetworkByName(ArrayList<Network> items, String name) {
   for (Network n : items) {
     if (StringHelper.stringsEqual(n.getname(), name)) {
       return n;
     }
   }
   return null;
 }
示例#3
0
 public static NetworkInterface FindInterfaceByNetworkName(
     ArrayList<NetworkInterface> items, String name) {
   for (NetworkInterface i : items) {
     if (StringHelper.stringsEqual(i.getNetworkName(), name)) {
       return i;
     }
   }
   return null;
 }
示例#4
0
 public static VdcReturnValueBase FindVdcReturnValueByDescription(
     ArrayList<VdcReturnValueBase> items, String description) {
   for (VdcReturnValueBase i : items) {
     if (StringHelper.stringsEqual(i.getDescription(), description)) {
       return i;
     }
   }
   return null;
 }
  @Override
  public void ExecuteCommand(UICommand command) {
    super.ExecuteCommand(command);

    if (command == getNewCommand()) {
      New();
    } else if (command == getEditCommand()) {
      Edit();
    } else if (command == getRemoveCommand()) {
      remove();
    } else if (StringHelper.stringsEqual(command.getName(), "OnSave")) {
      OnSave();
    } else if (StringHelper.stringsEqual(command.getName(), "Cancel")) {
      Cancel();
    } else if (StringHelper.stringsEqual(command.getName(), "OnRemove")) {
      OnRemove();
    }
  }
  @Override
  public void ExecuteCommand(UICommand command) {
    super.ExecuteCommand(command);

    if (command == getManageCommand()) {
      Manage();
    } else if (command == getSetAsDisplayCommand()) {
      SetAsDisplay();
    } else if (StringHelper.stringsEqual(command.getName(), "OnManage")) {
      OnManage();
    } else if (StringHelper.stringsEqual(command.getName(), "New")) {
      New();
    } else if (StringHelper.stringsEqual(command.getName(), "OnSave")) {
      OnSave();
    } else if (StringHelper.stringsEqual(command.getName(), "Cancel")) {
      Cancel();
    }
  }
  public void PostGetClusterNetworkList_Edit(java.util.ArrayList<network> network_list) {
    VmNetworkInterface nic = (VmNetworkInterface) getSelectedItem();
    int nicCount = Linq.<VmNetworkInterface>Cast(getItems()).size();
    java.util.ArrayList<network> networks = new java.util.ArrayList<network>();
    for (network a : network_list) {
      if (a.getStatus() == NetworkStatus.Operational) {
        networks.add(a);
      }
    }

    VmInterfaceModel model = (VmInterfaceModel) getWindow();
    model.getNetwork().setItems(networks);
    network network = null;
    for (network a : networks) {
      if (StringHelper.stringsEqual(a.getname(), nic.getNetworkName())) {
        network = a;
        break;
      }
    }
    model.getNetwork().setSelectedItem(network);

    Integer selectedNicType = nic.getType();
    java.util.ArrayList<VmInterfaceType> nicTypes =
        DataProvider.GetNicTypeList(
            getEntityStronglyTyped().getos(),
            VmInterfaceType.forValue(selectedNicType) == VmInterfaceType.rtl8139_pv);
    model.getNicType().setItems(nicTypes);

    if (selectedNicType == null || !nicTypes.contains(VmInterfaceType.forValue(selectedNicType))) {
      selectedNicType = DataProvider.GetDefaultNicType(getEntityStronglyTyped().getos()).getValue();
    }

    model.getNicType().setSelectedItem(VmInterfaceType.forValue(selectedNicType));

    model.getName().setEntity(nic.getName());
    model.getMAC().setIsAvailable(false);

    UICommand tempVar = new UICommand("OnSave", 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);
  }
 public void setOrigin(String value) {
   if (!StringHelper.stringsEqual(origin, value)) {
     origin = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Origin"));
   }
 }
示例#9
0
 @Override
 public boolean Match(Map.Entry<String, String> source) {
   return StringHelper.stringsEqual(source.getKey(), timeZone);
 }
 public void setCpuInfo(String value) {
   if (!StringHelper.stringsEqual(cpuInfo, value)) {
     cpuInfo = value;
     OnPropertyChanged(new PropertyChangedEventArgs("CpuInfo"));
   }
 }
 public void setUsbPolicy(String value) {
   if (!StringHelper.stringsEqual(usbPolicy, value)) {
     usbPolicy = value;
     OnPropertyChanged(new PropertyChangedEventArgs("UsbPolicy"));
   }
 }
 public void setStorageDomain(String value) {
   if (!StringHelper.stringsEqual(storageDomain, value)) {
     storageDomain = value;
     OnPropertyChanged(new PropertyChangedEventArgs("StorageDomain"));
   }
 }
示例#13
0
 @Override
 public boolean Match(SanTargetModel source) {
   return StringHelper.stringsEqual(source.getName(), target.getName())
       && StringHelper.stringsEqual(source.getAddress(), target.getAddress())
       && StringHelper.stringsEqual(source.getPort(), target.getPort());
 }
 public void setParticipantDisks(String value) {
   if (!StringHelper.stringsEqual(participantDisks, value)) {
     participantDisks = value;
     OnPropertyChanged(new PropertyChangedEventArgs("ParticipantDisks"));
   }
 }
 public void setName(String value) {
   if (!StringHelper.stringsEqual(name, value)) {
     name = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Name")); // $NON-NLS-1$
   }
 }
  private void UpdateProperties() {
    VM vm = (VM) getEntity();

    setName(vm.getvm_name());
    setDescription(vm.getvm_description());
    setQuotaName(
        vm.getStaticData().getQuotaId() != null ? vm.getStaticData().getQuotaId().toString() : "");
    setTemplate(vm.getvmt_name());
    setDefinedMemory(vm.getvm_mem_size_mb() + " MB");
    setMinAllocatedMemory(vm.getMinAllocatedMem() + " MB");

    Translator translator = EnumTranslator.Create(VmOsType.class);
    setOS(translator.get(vm.getvm_os()));

    translator = EnumTranslator.Create(DisplayType.class);
    setDefaultDisplayType(translator.get(vm.getdefault_display_type()));

    translator = EnumTranslator.Create(OriginType.class);
    setOrigin(translator.get(vm.getorigin()));

    setHasHighlyAvailable(vm.getvm_type() == VmType.Server);
    setIsHighlyAvailable(vm.getauto_startup());

    setHasPriority(vm.getvm_type() == VmType.Server);
    setPriority(PriorityToString(vm.getpriority()));

    setHasMonitorCount(vm.getvm_type() == VmType.Desktop);
    setMonitorCount(vm.getnum_of_monitors());

    setHasUsbPolicy(true);
    translator = EnumTranslator.Create(UsbPolicy.class);
    setUsbPolicy(translator.get(vm.getusb_policy()));

    setCpuInfo(
        vm.getnum_of_cpus()
            + " "
            + "("
            + vm.getnum_of_sockets()
            + " Socket(s), "
            + vm.getcpu_per_socket()
            + " Core(s) per Socket)");

    setHasDomain(DataProvider.IsWindowsOsType(vm.getvm_os()));
    setDomain(vm.getvm_domain());

    setHasTimeZone(DataProvider.IsWindowsOsType(vm.getvm_os()));
    setTimeZone(vm.gettime_zone());

    setHasCustomProperties(!StringHelper.stringsEqual(vm.getCustomProperties(), ""));
    setCustomProperties(getHasCustomProperties() ? "Configured" : "Not-Configured");

    setHasAlert(
        vm.getVmPauseStatus() != VmPauseStatus.NONE
            && vm.getVmPauseStatus() != VmPauseStatus.NOERR);
    if (getHasAlert()) {
      translator = EnumTranslator.Create(VmPauseStatus.class);
      setAlert(translator.get(vm.getVmPauseStatus()));
    } else {
      setAlert(null);
    }

    setHasDefaultHost(vm.getdedicated_vm_for_vds() != null);
    if (getHasDefaultHost()) {
      Frontend.RunQuery(
          VdcQueryType.Search,
          new SearchParameters(
              "Host: cluster = " + vm.getvds_group_name() + " sortby name", SearchType.VDS),
          new AsyncQuery(
              this,
              new INewAsyncCallback() {
                @Override
                public void OnSuccess(Object target, Object returnValue) {

                  VmGeneralModel model = (VmGeneralModel) target;
                  VM localVm = (VM) model.getEntity();
                  if (localVm == null) {
                    return;
                  }
                  java.util.ArrayList<VDS> hosts =
                      (java.util.ArrayList<VDS>)
                          ((VdcQueryReturnValue) returnValue).getReturnValue();
                  for (VDS host : hosts) {
                    if (localVm.getdedicated_vm_for_vds() != null
                        && host.getId().equals(localVm.getdedicated_vm_for_vds())) {
                      model.setDefaultHost(host.getvds_name());
                      break;
                    }
                  }
                }
              }));
    } else {
      setDefaultHost("Any Host in Cluster");
    }
  }
 public void setPriority(String value) {
   if (!StringHelper.stringsEqual(priority, value)) {
     priority = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Priority"));
   }
 }
 public void setCustomProperties(String value) {
   if (!StringHelper.stringsEqual(customProperties, value)) {
     customProperties = value;
     OnPropertyChanged(new PropertyChangedEventArgs("CustomProperties"));
   }
 }
 public void setDefaultHost(String value) {
   if (!StringHelper.stringsEqual(defaultHost, value)) {
     defaultHost = value;
     OnPropertyChanged(new PropertyChangedEventArgs("DefaultHost"));
   }
 }
 public void setTimeZone(String value) {
   if (!StringHelper.stringsEqual(timeZone, value)) {
     timeZone = value;
     OnPropertyChanged(new PropertyChangedEventArgs("TimeZone"));
   }
 }
示例#21
0
 @Override
 public boolean Match(ServerCpu source) {
   return StringHelper.stringsEqual(source.getCpuName(), cpuName);
 }
 public void setOS(String value) {
   if (!StringHelper.stringsEqual(os, value)) {
     os = value;
     OnPropertyChanged(new PropertyChangedEventArgs("OS"));
   }
 }
 public void setDefaultDisplayType(String value) {
   if (!StringHelper.stringsEqual(defaultDisplayType, value)) {
     defaultDisplayType = value;
     OnPropertyChanged(new PropertyChangedEventArgs("DefaultDisplayType"));
   }
 }
示例#24
0
 @Override
 public boolean Match(LunModel source) {
   return StringHelper.stringsEqual(source.getLunId(), lun.getLunId());
 }
 public void setDescription(String value) {
   if (!StringHelper.stringsEqual(description, value)) {
     description = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Description"));
   }
 }
 public void setAlert(String value) {
   if (!StringHelper.stringsEqual(alert, value)) {
     alert = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Alert"));
   }
 }
 public void setApps(String value) {
   if (!StringHelper.stringsEqual(apps, value)) {
     apps = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Apps"));
   }
 }
 public void setTemplate(String value) {
   if (!StringHelper.stringsEqual(template, value)) {
     template = value;
     OnPropertyChanged(new PropertyChangedEventArgs("Template"));
   }
 }
 public void setGetLUNsFailure(String value) {
   if (!StringHelper.stringsEqual(getLUNsFailure, value)) {
     getLUNsFailure = value;
     OnPropertyChanged(new PropertyChangedEventArgs("GetLUNsFailure"));
   }
 }
 public void setDefinedMemory(String value) {
   if (!StringHelper.stringsEqual(definedMemory, value)) {
     definedMemory = value;
     OnPropertyChanged(new PropertyChangedEventArgs("DefinedMemory"));
   }
 }