Exemple #1
0
    /** ok, the importer has now finished, we can tidy up now */
    public final void doFinished() {
      // also have a pass through to set the stepper in any narratives
      // try to set the pointer to the TimeStepper in the narratives, if there are any
      Session newSession = _theApplication.getCurrentSession();
      if (newSession != null) {
        Layers theData = newSession.getData();
        Debrief.GUI.Views.PlainView pv = newSession.getCurrentView();
        if (pv instanceof Debrief.GUI.Views.AnalysisView) {
          int len = theData.size();
          for (int i = 0; i < len; i++) {
            Layer ly = theData.elementAt(i);
            if (ly instanceof Debrief.Wrappers.NarrativeWrapper) {
              @SuppressWarnings("unused")
              Debrief.Wrappers.NarrativeWrapper nw = (Debrief.Wrappers.NarrativeWrapper) ly;
            } // whether this is a narrative
          } // through the layers
        } // whether this is an analysis view
      } // if we managed to create a session

      // put the filename into the MRU
      Debrief.GUI.Frames.Application.addToMru(_theFile.getPath());

      // and restore the application cursor
      _theApplication.restoreCursor();
    }
  void doEditFilename() {
    // create the file open dialog
    final JFileChooser jf = new JFileChooser();

    // cancel multiple selections
    jf.setMultiSelectionEnabled(false);

    // set the start directory
    if (_lastDirectory != null) {
      jf.setCurrentDirectory(new File(_lastDirectory));
    } else {

      String val = "";

      // see if we have an old directory to retrieve
      val = Application.getThisProperty("RANGE_Directory");

      // give it a default value, if we have to
      if (val == null) val = "";

      // try to get the import directory
      jf.setCurrentDirectory(new File(val));
    }

    // open the dialog
    final int state = jf.showOpenDialog(null);

    // do we have a valid file?
    if (state == JFileChooser.APPROVE_OPTION) {
      // retrieve the filename
      final File theFile = jf.getSelectedFile();
      _theFilename = theFile.getPath();

      // retrieve the directory name
      _lastDirectory = theFile.getParent();

      // trigger a refresh
      refreshForm();
    } else if (state == JFileChooser.CANCEL_OPTION) {
      _theFilename = null;
    }
  }
Exemple #3
0
    public final void execute() {

      _theApplication.setCursor(java.awt.Cursor.WAIT_CURSOR);

      // collate the list of files to importe
      java.io.File[] fList = new java.io.File[] {_theFile};

      MWC.Utilities.ReaderWriter.ImportManager.BaseImportCaller caller =
          new MWC.Utilities.ReaderWriter.ImportManager.BaseImportCaller(fList, null) {
            // handle a single file getting finished
            public void fileFinished(java.io.File fName, Layers newData) {}

            // handle all of the files getting finished
            public void allFilesFinished(java.io.File[] fNames, Layers newData) {
              doFinished();
            }
          };

      caller.start();
    }