Exemple #1
0
 public static void saveHistory() {
   if (historyFile == null)
     return;
   historyFile.addWindowInfo(windowName, webFrame, null);
   //    prop.setProperty("webMakerInfoWidth", "" + webPanels[0].getInfoWidth());
   //    prop.setProperty("webMakerInfoHeight", "" + webPanels[0].getInfoHeight());
   prop.setProperty("webMakerAppletPath", remoteAppletPath);
   prop.setProperty("webMakerLocalAppletPath", localAppletPath);
   prop.setProperty("webMakerPageAuthorName", pageAuthorName);
   historyFile.addProperties(prop);
 }
Exemple #2
0
 static void setAppletPath(String path, boolean isRemote) {
   if (path == null)
     path = "..";
   if (isRemote) {
     remoteAppletPath = path;
     prop.setProperty("webMakerAppletPath", remoteAppletPath);
     historyFile.addProperties(prop);
   } else {
     localAppletPath = path;
     prop.setProperty("webMakerLocalAppletPath", localAppletPath);
     historyFile.addProperties(prop);
   }
 }
Exemple #3
0
 static void setScriptButtonPercent(int percent){
   if (percent <10 || percent > 90)
     percent = 60;
   scriptButtonPercent = percent;
   prop.setProperty("webMakerScriptButtonPercent", ""+percent);
   historyFile.addProperties(prop);
 }
Exemple #4
0
 static void setWebPageAuthor(String pageAuthor) {
   if (pageAuthor == null)
     pageAuthor = GT._("Jmol Web Page Maker");
   pageAuthorName = pageAuthor;
   prop.setProperty("webMakerPageAuthorName", pageAuthorName);
   historyFile.addProperties(prop);
 }
Exemple #5
0
 static void setPopInDim(int appletWidth, int appletHeight) {
   if (appletWidth<25||appletWidth>3000)
     appletWidth = 300;
   if (appletHeight<25||appletHeight>3000)
     appletHeight = 300;
   popInWidth=appletWidth;
   popInHeight=appletHeight;
   prop.setProperty("webMakerPopInWidth", ""+appletWidth);
   prop.setProperty("webMakerPopInHeight", ""+appletHeight);
   historyFile.addProperties(prop);
 }
Exemple #6
0
  public static WebExport createAndShowGUI(JmolViewer vwr,
                                           HistoryFile historyFile, String wName) {

    if (vwr == null)
      runStatus = STAND_ALONE;

    //Create and set up the window.
    if (webFrame != null) {
      webFrame.setVisible(true);
      webFrame.toFront();
      return webExport;
    }
    webFrame = new JFrame(GT._("Jmol Web Page Maker"));
    //Set title bar icon
    String imageName = "org/openscience/jmol/app/images/icon.png";
    URL imageUrl = vwr.getClass().getClassLoader().getResource(imageName);
    ImageIcon jmolIcon = new ImageIcon(imageUrl);
    webFrame.setIconImage(jmolIcon.getImage());
    windowName = wName;
    historyFile.repositionWindow(windowName, webFrame, 700, 400, true);
    if (runStatus == STAND_ALONE) {
      //Make sure we have nice window decorations.
      JFrame.setDefaultLookAndFeelDecorated(true);
      JDialog.setDefaultLookAndFeelDecorated(true);
      webFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    } else {
      webFrame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    }

    //Create and set up the content pane.
    webExport = new WebExport(vwr, historyFile);
    webExport.setOpaque(true); //content panes must be opaque
    webFrame.setContentPane(webExport);
    webFrame.addWindowListener(webExport);

    //Display the window.
    webFrame.pack();
    webFrame.setVisible(true);
    if (runStatus == STAND_ALONE) {
      //LogPanel.Log("Jmol_Web_Page_Maker is running as a standalone application");
    } else {
      //LogPanel.Log("Jmol_Web_Page_Maker is running as a plug-in");
    }

    return webExport;
  }
Exemple #7
0
  private WebExport(JmolViewer vwr, HistoryFile hFile) {
    super(new BorderLayout());

    historyFile = hFile;
    remoteAppletPath = historyFile.getProperty("webMakerAppletPath", "..");
    localAppletPath = historyFile.getProperty("webMakerLocalAppletPath", "..");
    pageAuthorName = historyFile.getProperty("webMakerPageAuthorName",
        GT._("Jmol Web Page Maker"));
    popInWidth=PT.parseInt(historyFile.getProperty("webMakerPopInWidth", "300"));
    popInHeight=PT.parseInt(historyFile.getProperty("webMakerPopInHeight", "300"));
    scriptButtonPercent = PT.parseInt(historyFile.getProperty(
        "webMakerScriptButtonPercent", "60"));

    //Define the tabbed pane
    JTabbedPane mainTabs = new JTabbedPane();

    //Create file chooser
    JFileChooser fc = new JFileChooser();

    webPanels = new WebPanel[2];
    
    if (runStatus != STAND_ALONE) {
      //Add tabs to the tabbed pane

      JPanel introPanel = new JPanel();
      String introFileName = "WebExportIntro";
      URL url = GuiMap.getHtmlResource(this, introFileName);
      if (url == null) {
        System.err.println(GT.o(GT._("Couldn't find file: {0}"), introFileName+".html"));
      }
      JEditorPane intro = new JEditorPane();
      if (url != null) {
        try {
          intro.setPage(url);
        } catch (IOException e) {
          System.err.println("Attempted to read a bad URL: " + url);
        }
      }
      intro.setEditable(false);
      JScrollPane introPane = new JScrollPane(intro);
      introPane.setMaximumSize(new Dimension(450, 350));
      introPane.setPreferredSize(new Dimension(400, 300));
      introPanel.setLayout(new BorderLayout());
      introPanel.add(introPane);
      introPanel.setMaximumSize(new Dimension(450, 350));
      introPanel.setPreferredSize(new Dimension(400, 300));

      mainTabs.add(GT._("Introduction"), introPanel);

      webPanels[0] = new PopInJmol(vwr, fc, webPanels, 0);
      webPanels[1] = new ScriptButtons(vwr, fc, webPanels, 1);

      int w = Integer.parseInt(historyFile.getProperty("webMakerInfoWidth",
          "300"));
      int h = Integer.parseInt(historyFile.getProperty("webMakerInfoHeight",
          "350"));

      mainTabs.addTab(GT._("Pop-In Jmol"), webPanels[0].getPanel(w, h));
      mainTabs.addTab(GT._("ScriptButton Jmol"), webPanels[1].getPanel(w, h));

      // Uncomment to activate the test panel
      //    Test TestCreator = new Test((Viewer)vwr);
      //    JComponent Test = TestCreator.Panel();
      //    Maintabs.addTab("Tests",Test);
    }

    showMoleculesAndOrbitals = (runStatus == STAND_ALONE || JmolViewer
        .checkOption(vwr, "webMakerAllTabs"));
    if (showMoleculesAndOrbitals) {
      //mainTabs.addTab("Orbitals", (new Orbitals()).getPanel());
      //mainTabs.addTab("Molecules", (new Molecules()).getPanel());
    }

    //The LogPanel should always be the last one

    mainTabs.addTab(GT._("Log"), LogPanel.getPanel());

    //Add the tabbed pane to this panel
    add(mainTabs);

    //Create the small log

    add(LogPanel.getMiniPanel(), BorderLayout.SOUTH);

    //Uncomment the following line to use scrolling tabs.
    //tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);

  }