Exemple #1
0
 /** @return a list of hidden packs */
 private List<Pack> getHiddenPacks() {
   List<Pack> hiddenPacks = new ArrayList<Pack>();
   for (Pack availablePack : installData.getAvailablePacks()) {
     if (availablePack.isHidden()) {
       hiddenPacks.add(availablePack);
     }
   }
   return hiddenPacks;
 }
Exemple #2
0
 /** @return a list of visible packs */
 public List<Pack> getVisiblePacks() {
   List<Pack> visiblePacks = new ArrayList<Pack>();
   for (Pack availablePack : installData.getAvailablePacks()) {
     if (!availablePack.isHidden()) {
       visiblePacks.add(availablePack);
     }
   }
   return visiblePacks;
 }
Exemple #3
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));
  }