Package qat.components

Examples of qat.components.StatusWindow


      if (projectFile.showSaveDialog(this)==JFileChooser.APPROVE_OPTION) {       
        String oldProjectDir = Common.getProjectResultsDirectory(projectFileName);
        projectFileName = Utils.ensureSuffix(projectFile.getSelectedFile().getCanonicalPath(),Common.PROJECT_FILE_SUFFIX);
        saveProject(projectFileName,false);
        // now we need to copy the results if they exist
        StatusWindow waitWindow = new StatusWindow(this,Resources.getString("pleaseWait"),"");
        try {
          SwingUtils.copy(oldProjectDir,Common.getProjectResultsDirectory(projectFileName),waitWindow);
        }
        catch (Exception e) {
          // don't report errors - shouldn't be usefull here
        }
        finally {
          waitWindow.setVisible(false);
        }                   
      }
    }
    catch (java.io.IOException e) {
      showError(Resources.getString("unexpectedError")+e.getMessage(),
View Full Code Here


  public void saveProject(boolean quiet) {
    saveProject(projectFileName, quiet);
  }

  public void saveProject(String fileName, boolean quiet) {
    StatusWindow waitWindow;
    if (!quiet)
      waitWindow = new StatusWindow(this,
          Resources.getString("pleaseWait"),
          Resources.getString("savingProject")+" :"+fileName);
    else
      waitWindow = null;
    projectFileName = fileName;

    try {
      if (!quiet) waitWindow.setMessage(Resources.getString("projectProperties"));
      // create the file & parent dirs if they don't exist
      Utils.touch(projectFileName);
      // charge with the keyword history properties
      keywordComponent.saveKeyWordHistToProperties(projectProperties);
      // store version information for this properties file
      setProperty(Common.PROPERTIES_VERSION,Common.CURRENT_PROPERTIES_VERSION);

      // save the project.properties file
      BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(projectFileName));
      getProjectProperties().store(out,Common.SERIALIZED_NODE_HEADERV11);
      out.flush();
      out.close();
      // save the tree structure
      if (!quiet) waitWindow.setMessage(Resources.getString("savingTree"));
      saveTree(serializedTreeName);
    }
    catch (Exception e) {
      showError("3:"+Resources.getString("unexpectedError")+e.toString(),
          Resources.getString("error"),
          JOptionPane.ERROR_MESSAGE);
    }
    finally {
      if (!quiet)
        waitWindow.setVisible(false);
      projectPropertiesChanged();
      testTreeChanged();
    }
  }
View Full Code Here

    projectFile.setApproveButtonText(Resources.getString("importProject"));
    ExtensionFileFilter filter = new ExtensionFileFilter(Common.PROJECT_FILE_SUFFIX,"Project files");
    projectFile.addChoosableFileFilter(filter);
    projectFile.setFileFilter(filter);
    if (projectFile.showSaveDialog(this)==JFileChooser.APPROVE_OPTION) {
      StatusWindow waitWindow = new StatusWindow(this,Resources.getString("pleaseWait"),"");
      try {
        String importProjectName = Utils.removeSuffix(Utils.extractFileName(projectFile.getSelectedFile().getCanonicalPath()));
        String importProjectPath = Utils.extractPath(projectFile.getSelectedFile().getCanonicalPath());
        String importResultsDirectory = importProjectPath+File.separator+Common.RESULTS_DIR_NAME+File.separator+importProjectName;
        String src, dest;
        waitWindow.setMessage("Project file");
        // copy the prj file to our .qat directory
        src=projectFile.getSelectedFile().getCanonicalPath();
        dest=Common.getHarnessBaseDirectory();
        //System.out.println("Copying :"+src+" to :"+dest);
        SwingUtils.copy(src,dest,waitWindow);

        waitWindow.setMessage("Serialiased file");
        // copy the ser file to out .qat directory
        src = Utils.ensureSuffix(projectFile.getSelectedFile().getCanonicalPath(),Common.SERIALIZED_TREE_EXTENSION);
        dest = Common.getHarnessBaseDirectory();
        //System.out.println("Copying :"+src+" to :"+dest);
        SwingUtils.copy(src,dest,waitWindow);

        // copy the results directory to out .qat/harness/results directory
        try {
          waitWindow.setMessage("Results");
          src = importResultsDirectory;
          dest = Common.getHarnessBaseDirectory()+File.separator+Common.RESULTS_DIR_NAME+File.separator+importProjectName;
          //System.out.println("Copying :"+src+" to :"+dest);
          SwingUtils.copy(src,dest,waitWindow);
        }
        catch (IOException e) {
          // don't report, it only means no results directory was found to be copied.
        }

        // load this project
        loadProject(Common.getHarnessBaseDirectory()+File.separator+Utils.ensureSuffix(importProjectName,Common.PROJECT_FILE_SUFFIX));
      }
      catch (Exception e) {
        e.printStackTrace();
      }
      finally {
        waitWindow.setVisible(false);
      }
      projectPropertiesChanged();
    }
  }
View Full Code Here

        showError(e.toString(),
            Resources.getString("error"),
            JOptionPane.ERROR_MESSAGE);
      }
      // now copy it
      StatusWindow waitWindow = new StatusWindow(this,Resources.getString("pleaseWait"),"");
      try {
        String exportProjectName = Utils.removeSuffix(Utils.extractFileName(projectFile.getSelectedFile().getCanonicalPath()));
        String exportProjectPath = Utils.extractPath(projectFile.getSelectedFile().getCanonicalPath());
        String exportResultsDirectory = exportProjectPath+File.separator+Common.RESULTS_DIR_NAME+File.separator+exportProjectName;
        String src, dest;

        // copy the prj file to our .qat directory
        src=Common.getHarnessBaseDirectory()+File.separator+Utils.ensureSuffix(Common.getProjectName(projectFileName),Common.PROJECT_FILE_SUFFIX);
        dest=exportProjectPath+File.separator+Utils.ensureSuffix(exportProjectName,Common.PROJECT_FILE_SUFFIX);
        //System.out.println("Copying :"+src+" to :"+dest);
        SwingUtils.copy(src,dest,waitWindow);

        // copy the ser file to out .qat directory
        src=Common.getHarnessBaseDirectory()+File.separator+Utils.ensureSuffix(Common.getProjectName(projectFileName),Common.SERIALIZED_TREE_EXTENSION);
        dest=exportProjectPath+File.separator+Utils.ensureSuffix(exportProjectName,Common.SERIALIZED_TREE_EXTENSION);
        //System.out.println("Copying :"+src+" to :"+dest);
        SwingUtils.copy(src,dest,waitWindow);

        // copy the results directory to out .qat/harness/results directory
        try {
          src = Common.getProjectResultsDirectory(projectFileName);
          dest=exportResultsDirectory;
          Utils.checkSubDirsExist(dest);
          //System.out.println("Copying :"+src+" to :"+dest);
          SwingUtils.copy(src,dest,waitWindow);
        }
        catch (IOException e) {
          // don't report, it only means no results directory was found to be copied.
        }

      }
      catch (Exception e) {
        e.printStackTrace();
      }
      finally {
        waitWindow.setVisible(false);
      }
    }
  }
View Full Code Here

    testDir.setDialogTitle(Resources.getString("selectTestDir"));
    testDir.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

    try {
      if (testDir.showOpenDialog(this)==JFileChooser.APPROVE_OPTION) {
        StatusWindow waitWindow = new StatusWindow(this,
            Resources.getString("pleaseWait"),
            Resources.getString("loadingProject"));
        testTree.loadNewTestDir(testDir.getSelectedFile().getCanonicalPath(),
            waitWindow);
        waitWindow.setVisible(false);
      }
    }
    catch (java.io.IOException e) {
      showError(Resources.getString("unexpectedError")+e.getMessage(),
          Resources.getString("error"),
View Full Code Here

  public void parseTests() {
    parseTests(true);
  }

  public void parseTests(boolean visible) {
    StatusWindow waitWindow = new StatusWindow(this,
        Resources.getString("pleaseWait"),
        Resources.getString("reloadingProject"),
        visible);
    setWaitCursor();
    // remove previous trace & stderr/stdout files
    waitWindow.setMessage(getProperty(Common.PROJECTPATH_KEY, Resources.getString("clearResults")));
    try {
      SwingUtils.delete(Common.getProjectResultsDirectory(projectFileName),waitWindow);
    }
    catch (IOException e) {
      //e.printStackTrace();
      // not too important - we can ignore this error
      // because maybe it doesn't exist yet
    }

    // load the new tests of the disk
    waitWindow.setMessage(getProperty(Common.PROJECTPATH_KEY, testTree.getProjectRoot()));
    testTree.loadNewTestDir(getProperty(Common.PROJECTPATH_KEY, testTree.getProjectRoot()),
        waitWindow);

    // update the keyword list
    keywordComponent.loadTestsKeywords();
    setDefaultCursor();
    waitWindow.setVisible(false);
    projectPropertiesChanged();
    testTreeChanged();
    updateStatus(Resources.getString("finishedParsing"));
  }
View Full Code Here

  /**
   * This will relook at the disk only from this directory onwards, instead of re-parsing the entire
   * tree off disk.
   */
  public void reloadDirectory(TestTreeNode testNode) {
    StatusWindow waitWindow = new StatusWindow(this,
        Resources.getString("pleaseWait"),
        Resources.getString("reloadDirectory"));
    testTree.parseTestsFrom(testNode,waitWindow);
    waitWindow.setVisible(false);
    updateStatus(Resources.getString("finishedParsing"));
 
View Full Code Here

  public void editProjectCallback(EditProject editProject) {
    projectProperties = editProject.getProperties();
    projectPropertiesChanged();
    keywordComponent.loadKeyWordHistFromProperties(projectProperties);
    if (editProject.needToReloadTests()) {
      StatusWindow waitWindow = new StatusWindow(this,
          Resources.getString("pleaseWait"),
          Resources.getString("reloadingProject"));
      testTree.loadNewTestDir(getProperty(Common.PROJECTPATH_KEY, Common.getHarnessBaseDirectory()),
          waitWindow);
      setProperty(Common.PROJECTPATH_KEY,testTree.getProjectRoot());
      waitWindow.setVisible(false);
    }     
  }
View Full Code Here

    JFileChooser dirChooser = new JFileChooser(projectFileName);
    dirChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    dirChooser.setDialogTitle(Resources.getString("selectHtmlRootDir"));
    dirChooser.setApproveButtonText("Generate");
    if (dirChooser.showOpenDialog(this)==JFileChooser.APPROVE_OPTION) {
      StatusWindow status= new StatusWindow(this,Resources.getString("generating"),Resources.getString("pleaseWait"));
      try {
        generateHtmlReport(dirChooser.getSelectedFile().getCanonicalPath(),status);
      }
      catch (Exception ex) {
        showError(Resources.getString("unexpectedError")+ex.getMessage(),
            Resources.getString("error"),
            JOptionPane.ERROR_MESSAGE)
      }
      finally {
        status.setVisible(false);
      }
    }
  }
View Full Code Here

  }

  private void printTestTree(int printType) {   
    PrintManager p = new PrintManager("Print job title",this);
    if (p.startPrint()) {
      StatusWindow waitWindow = new StatusWindow(this,Resources.getString("pleaseWait"),"Printing in progress");
      ReportObject report = new ReportObject(testTree);
      report.printTree(p,projectFileName,printType);
      p.endPrint();
      waitWindow.setVisible(false);
    }
  }
View Full Code Here

TOP

Related Classes of qat.components.StatusWindow

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.