コード例 #1
0
  /**
   * Creates the list of FileScannerSelectorPanel consisting of a FileProperty and a list of engine
   * names
   *
   * @param template
   * @param video
   * @return list of FileScannerSelectorPanel
   */
  private List<FileScannerSelectorPanel> getSelectorPanels(
      DOFileImportTemplate template, FileType fileType) {

    // get the list of available plugins and create a map containing all available engines for a
    // file property
    List<DOFileScannerEngineConfiguration> filePropertyEngineNames =
        FileImportHelper.getFilePropertyEngines(template);

    // add all file properties with engine names
    String filePropertyPrefix = fileType.toString() + "_";
    ArrayList<FileScannerSelectorPanel> newFssps = new ArrayList<FileScannerSelectorPanel>();
    for (DOFileScannerEngineConfiguration engine : filePropertyEngineNames) {
      if (engine.getFileProperty().toString().startsWith(filePropertyPrefix)) {
        newFssps.add(new FileScannerSelectorPanel(engine));
      }
    }

    // sort the panels by localized name
    Collections.sort(
        newFssps,
        new Comparator<FileScannerSelectorPanel>() {
          @Override
          public int compare(FileScannerSelectorPanel o1, FileScannerSelectorPanel o2) {
            return o1.getLocalizedFilePropertyName().compareTo(o2.getLocalizedFilePropertyName());
          }
        });

    return newFssps;
  }