Esempio n. 1
0
  /**
   * 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;
      }
    }
  }
Esempio n. 2
0
  public PacksModel(InstallData idata) {
    this.installData = idata;
    this.rules = idata.getRules();
    try {
      this.messages = idata.getMessages().newMessages(PackHelper.LANG_FILE_NAME);
    } catch (com.izforge.izpack.api.exception.ResourceNotFoundException ex) {
      this.messages = idata.getMessages();
    }
    this.variables = idata.getVariables();
    this.packsToInstall = idata.getSelectedPacks();

    this.modifyInstallation = Boolean.valueOf(idata.getVariable(InstallData.MODIFY_INSTALLATION));
    this.installedPacks = loadInstallationInformation(modifyInstallation);

    this.packs = getVisiblePacks();
    this.hiddenPacks = getHiddenPacks();
    this.allPacks = idata.getAvailablePacks();
    this.nameToRow = getNametoRowMapping(packs);
    this.nameToPack = getNametoPackMapping(allPacks);

    this.packs = setPackProperties(packs, nameToPack);
    this.checkValues = initCheckValues(packs, packsToInstall);

    updateConditions(true);
    updatePacksToInstall();
  }
 /**
  * This returns true if a Shortcut should or can be created. Returns false to suppress Creation
  *
  * @param shortcutSpec
  * @return true if condition is resolved positive
  */
 private boolean checkConditions(IXMLElement shortcutSpec) {
   boolean result = true;
   String condition = shortcutSpec.getAttribute(SPEC_ATTRIBUTE_CONDITION);
   if (condition != null) {
     result = installData.getRules().isConditionTrue(condition);
   }
   return result;
 }