Beispiel #1
0
  private void updateItemsAvailability() {
    if (getStorageModels() == null) {
      return;
    }

    behavior.updateItemsAvailability();
  }
Beispiel #2
0
  @Override
  public void initialize() {
    super.initialize();

    behavior.initialize();

    initDataCenter();
  }
Beispiel #3
0
  @Override
  public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) {
    super.eventRaised(ev, sender, args);

    if (ev.matchesDefinition(ListModel.selectedItemChangedEventDefinition)) {
      if (sender == getDataCenter()) {
        dataCenter_SelectedItemChanged();
      } else if (sender == getHost()) {
        host_SelectedItemChanged();
      } else if (sender == getAvailableStorageTypeItems()) {
        storageType_SelectedItemChanged();
      } else if (sender == getAvailableStorageDomainTypeItems()) {
        behavior.setStorageTypeItems();
      }
    } else if (ev.matchesDefinition(ListModel.itemsChangedEventDefinition)) {
      if (sender == getAvailableStorageTypeItems()) {
        storageItemsChanged();
      }
    } else if (ev.matchesDefinition(NfsStorageModel.pathChangedEventDefinition)) {
      nfsStorageModel_PathChanged(sender);
    }
  }
  @Override
  public void UpdateItemsAvailability() {
    super.UpdateItemsAvailability();

    storage_pool dataCenter = (storage_pool) getModel().getDataCenter().getSelectedItem();

    for (IStorageModel item : Linq.<IStorageModel>Cast(getModel().getItems())) {
      Model model = (Model) item;

      storage_domains isoStorage = DataProvider.GetIsoDomainByDataCenterId(dataCenter.getId());
      storage_domains exportStorage =
          DataProvider.GetExportDomainByDataCenterId(dataCenter.getId());

      // available type/function items are:
      // all in case of Unassigned DC.
      // ISO in case the specified DC doesn't have an attached ISO domain.
      // Export in case the specified DC doesn't have an attached export domain.
      model.setIsSelectable(
          (dataCenter.getId().equals(StorageModel.UnassignedDataCenterId)
              || (item.getRole() == StorageDomainType.ISO && isoStorage == null)
              || (item.getRole() == StorageDomainType.ImportExport && exportStorage == null)));
    }
  }
Beispiel #5
0
 private void dataCenter_SelectedItemChanged() {
   updateItemsAvailability();
   behavior.updateDataCenterAlert();
 }