Пример #1
0
  private boolean refreshDir() throws IOException, InterruptedException, ExecutionException {
    final Map<File, Future<List<GeneratedImage>>> createdFiles2 = dirWatcher.buildCreatedFiles();
    boolean changed = false;

    for (Map.Entry<File, Future<List<GeneratedImage>>> ent : createdFiles2.entrySet()) {
      final File file = ent.getKey();
      removeAllThatUseThisFile(file);
      final Future<List<GeneratedImage>> future = ent.getValue();
      final SimpleLine2 simpleLine = new SimpleLine2(file, null, future);
      currentDirectoryListing2.add(simpleLine);
      changed = true;
    }

    for (SimpleLine2 line : new ArrayList<SimpleLine2>(currentDirectoryListing2)) {
      if (line.pendingAndFinished()) {
        currentDirectoryListing2.remove(line);
        changed = true;
        final Future<List<GeneratedImage>> future = line.getFuture();
        for (GeneratedImage im : future.get()) {
          mayRefreshImageWindow(im.getPngFile());
          final SimpleLine2 simpleLine = new SimpleLine2(line.getFile(), im, null);
          currentDirectoryListing2.add(simpleLine);
        }
      }
    }
    Collections.sort(currentDirectoryListing2);
    return changed;
  }
Пример #2
0
 private void removeAllThatUseThisFile(File file) {
   for (final Iterator<SimpleLine2> it = currentDirectoryListing2.iterator(); it.hasNext(); ) {
     final SimpleLine2 line = it.next();
     if (line.getFile().equals(file)) {
       it.remove();
     }
   }
 }
Пример #3
0
 private void doubleClick(SimpleLine2 simpleLine, ListModel listModel, int index) {
   for (ImageWindow2 win : openWindows2) {
     if (win.getSimpleLine().equals(simpleLine)) {
       win.setVisible(true);
       win.setExtendedState(Frame.NORMAL);
       return;
     }
   }
   if (simpleLine.getGeneratedImage() != null) {
     openWindows2.add(new ImageWindow2(simpleLine, this, listModel, index));
   }
 }