Package org.jmol.export.history

Examples of org.jmol.export.history.HistoryFile


                                          JmolViewer viewer,
                                          String fileName, Object historyFileObject,
                                          String windowName,
                                          boolean allowAppend) {

    HistoryFile historyFile = (HistoryFile) historyFileObject;

    if (openChooser == null) {
      openChooser = new FileChooser();
      Object temp = UIManager.get("FileChooser.fileNameLabelText");
      UIManager.put("FileChooser.fileNameLabelText", GT._("File or URL:"));
      getXPlatformLook(openChooser);
      UIManager.put("FileChooser.fileNameLabelText", temp);
    }
    if (openPreview == null
        && (viewer.isApplet() || Boolean.valueOf(
            System.getProperty("openFilePreview", "true")).booleanValue())) {
      openPreview = new FilePreview(openChooser, viewer.getModelAdapter(), allowAppend,
          appletContext);
    }

    if (historyFile != null) {
      Dimension dim = historyFile.getWindowSize(windowName);
      if (dim != null)
        openChooser.setDialogSize(dim);
      Point loc = historyFile.getWindowPosition(windowName);
      if (loc != null)
        openChooser.setDialogLocation(loc);
    }

    openChooser.resetChoosableFileFilters();

    if (fileName != null) {
      int pt = fileName.lastIndexOf(".");
      String sType = fileName.substring(pt + 1);
      if (pt >= 0 && sType.length() > 0)
        openChooser.addChoosableFileFilter(new TypeFilter(sType));
      if (fileName.indexOf(".") == 0)
        fileName = "Jmol" + fileName;
      if (fileName.length() > 0)
        openChooser.setSelectedFile(new File(fileName));
    }
    //System.out.println("fileName for dialog: " + fileName);
    if (fileName == null || fileName.indexOf(":") < 0 && fileName.indexOf("/") != 0) {
      File dir = FileManager.getLocalDirectory(viewer, true);
      //System.out.println("directory for dialog: " + dir.getAbsolutePath());
      openChooser.setCurrentDirectory(dir);
    }
    File file = null;
    if (openChooser.showOpenDialog(this) == JFileChooser.APPROVE_OPTION)
      file = openChooser.getSelectedFile();


    if (file == null)
      return closePreview();
   
    if (historyFile != null)
      historyFile.addWindowInfo(windowName, openChooser.getDialog(), null);

    String url = FileManager.getLocalUrl(file);
    if (url != null) {
      fileName = url;
    } else {
View Full Code Here


      System.exit(1);
    }
    File ujmoldir = new File(new File(System.getProperty("user.home")), ".jmol");
    ujmoldir.mkdirs();
    userPropsFile = new File(ujmoldir, "properties");
    historyFile = new HistoryFile(new File(ujmoldir, "history"),
        "Jmol's persistent values");

   
    parseCommandLine(args);
  }
View Full Code Here

TOP

Related Classes of org.jmol.export.history.HistoryFile

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.