Esempio n. 1
0
    public void propertyChange(PropertyChangeEvent e) {
      Object source = e.getSource();
      int index = list.getSelectedIndex();
      if (index == -1) {
        return;
      }
      if (source.equals(waitField)) {
        try {
          waitField.commitEdit();
        } catch (java.text.ParseException x) {
          printer.printError(x.toString());
        }
        if (waitField.isEditable()) {
          int wait = ((Number) waitField.getValue()).intValue();

          directoryList.getDirectory(index).setWaitInterval(wait);
        }
      } else if (source.equals(checkField)) {
        try {
          checkField.commitEdit();
        } catch (java.text.ParseException x) {
          printer.printError(x.toString());
        }
        if (checkField.isEditable()) {
          int check = ((Number) checkField.getValue()).intValue();
          directoryList.getDirectory(index).setInterval(check);
        }
      }
    }
Esempio n. 2
0
    public void actionPerformed(ActionEvent e) {
      int index = list.getSelectedIndex();
      try {
        waitField.commitEdit();
        checkField.commitEdit();
      } catch (java.text.ParseException x) {
        printer.printError(x.toString());
        return;
      }
      Directory task = directoryList.getDirectory(index);
      startButton.setEnabled(false);
      task.setWaitInterval(((Number) waitField.getValue()).intValue());
      task.setInterval(((Number) checkField.getValue()).intValue());
      Path destination = task.getDestination();
      Path directory = task.getDirectory();
      task.backupNumber = 1;

      timer = new Timer();
      timer.schedule(
          new CopyTask(directory, destination, task.waitInterval, printer, copy), 0, task.interval);
      timers.add(timer);

      stopButton.setEnabled(true);
      log.setCaretPosition(log.getDocument().getLength());
    }