예제 #1
0
 @Override
 public boolean isTrue() {
   InstallData installData = getInstallData();
   if (installData != null) {
     String val = installData.getVariable(variablename);
     if (val == null) {
       return false;
     } else {
       Variables variables = installData.getVariables();
       return val.equals(variables.replace(value));
     }
   } else {
     return false;
   }
 }
예제 #2
0
  public PacksModel(PacksPanelInterface panel, GUIInstallData idata, RulesEngine rules) {
    this.idata = idata;
    modifyinstallation = Boolean.valueOf(idata.getVariable(InstallData.MODIFY_INSTALLATION));
    this.installedpacks = new HashMap<String, Pack>();

    if (modifyinstallation) {
      // installation shall be modified
      // load installation information

      try {
        FileInputStream fin =
            new FileInputStream(
                new File(
                    idata.getInstallPath()
                        + File.separator
                        + InstallData.INSTALLATION_INFORMATION));
        ObjectInputStream oin = new ObjectInputStream(fin);
        List<Pack> packsinstalled = (List<Pack>) oin.readObject();
        for (Pack installedpack : packsinstalled) {
          if ((installedpack.getLangPackId() != null)
              && (installedpack.getLangPackId().length() > 0)) {
            this.installedpacks.put(installedpack.getLangPackId(), installedpack);
          } else {
            this.installedpacks.put(installedpack.getName(), installedpack);
          }
        }
        this.removeAlreadyInstalledPacks(idata.getSelectedPacks());
        logger.fine("Found " + packsinstalled.size() + " installed packs");

        Properties variables = (Properties) oin.readObject();

        for (Object key : variables.keySet()) {
          idata.setVariable((String) key, (String) variables.get(key));
        }
        fin.close();
      } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      } catch (ClassNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
    this.rules = rules;

    this.packs = new ArrayList<Pack>();
    this.hiddenPacks = new ArrayList<Pack>();
    for (Pack availablePack : idata.getAvailablePacks()) {
      // only add a pack if not hidden
      if (!availablePack.isHidden()) {
        this.packs.add(availablePack);
      } else {
        this.hiddenPacks.add(availablePack);
      }
    }

    this.packsToInstall = idata.getSelectedPacks();
    this.panel = panel;
    variables = idata.getVariables();
    variables.set(INITAL_PACKSELECTION, Boolean.toString(true));
    messages = panel.getMessages();
    checkValues = new int[packs.size()];
    reverseDeps();
    initvalues();
    this.updateConditions(true);
    refreshPacksToInstall();
    variables.set(INITAL_PACKSELECTION, Boolean.toString(false));
  }