コード例 #1
0
ファイル: PacksModel.java プロジェクト: slipcon/izpack
  /**
   * Select/Deselect pack(s) based on packsData mapping. This is related to the onSelect and
   * onDeselect attributes for packs. User is not allowed to has a required pack for onSelect and
   * onDeselect.
   *
   * @param packsData
   */
  private void selectionUpdate(Map<String, String> packsData) {
    RulesEngine rules = installData.getRules();
    for (Map.Entry<String, String> packData : packsData.entrySet()) {
      int value, packPos;
      String packName = packData.getKey();
      String condition = packData.getValue();

      if (condition != null && !rules.isConditionTrue(condition)) {
        return; // Do nothing if condition is false
      }

      Pack pack;

      if (packName.startsWith("!")) {
        packName = packName.substring(1);
        pack = nameToPack.get(packName);
        packPos = getPos(packName);
        value = DESELECTED;
      } else {
        pack = nameToPack.get(packName);
        packPos = getPos(packName);
        value = SELECTED;
      }
      if (!pack.isRequired() && dependenciesResolved(pack)) {
        checkValues[packPos] = value;
      }
    }
  }