Exemplo n.º 1
0
  static String TimeStamp_WebLink() {
	  return " <small>" + GT.o(GT._("Page skeleton and JavaScript generated by export to web function using {0} on {1}."),
          new String[] {" <a href=\"http://jmol.sourceforge.net\">Jmol " + JmolViewer.getJmolVersion() + "</a> ",
          DateFormat.getDateInstance().format(new Date()) }) + "</small><br />";
	      //Specify medium verbosity on the date and time
  }
Exemplo n.º 2
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);

  }
Exemplo n.º 3
0
  AboutDialog(JFrame fr, JmolViewer vwr) {

    super(fr, GT._("About Jmol"), true);
    this.vwr = vwr;
    try {
      aboutURL = this.getClass().getClassLoader().getResource(
          JmolResourceHandler.getStringX("About.aboutURL"));
      if (aboutURL != null) {
        html = new JEditorPane();
        html.setContentType("text/html");
        html.setText(GuiMap.getResourceString(this, aboutURL.getPath()));
      } else {
        html = new JEditorPane("text/plain", GT.o(GT._(
            "Unable to find url \"{0}\"."), JmolResourceHandler
                .getStringX("About.aboutURL")));
      }
      html.setEditable(false);
      html.addHyperlinkListener(this);
    } catch (MalformedURLException e) {
      Logger.warn("Malformed URL: " + e);
    } catch (IOException e) {
      Logger.warn("IOException: " + e);
    }
    scroller = new JScrollPane() {

      @Override
      public Dimension getPreferredSize() {
        return new Dimension(500, 400);
      }

      @Override
      public float getAlignmentX() {
        return LEFT_ALIGNMENT;
      }
    };
    scroller.getViewport().add(html);

    JPanel htmlWrapper = new JPanel(new BorderLayout());
    htmlWrapper.setAlignmentX(LEFT_ALIGNMENT);
    htmlWrapper.add(scroller, BorderLayout.CENTER);
    JPanel container = new JPanel();
    container.setLayout(new BorderLayout());
    container.add(htmlWrapper, BorderLayout.CENTER);


/*    
    thisURL = aboutURL;
    JPanel buttonPanel = new JPanel();
    buttonPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    buttonPanel.setLayout(new BorderLayout());

    // create browser "back" button
    backButton = new JButton(GT._("back"));
    backButton.setEnabled(false);

    backButton.addActionListener(new ActionListener() {

      public void actionPerformed(ActionEvent e) {
        back();
      }
    });

    // create return-to-start dialog button
    JButton returnUserGuide = new JButton(GT._("back to About"));
    returnUserGuide.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        backTo(aboutURL);
      }
    });
    buttonPanel.add(returnUserGuide, BorderLayout.WEST);
    buttonPanel.add(backButton, BorderLayout.CENTER);
    getRootPane().setDefaultButton(returnUserGuide);

    JButton ok = new JButton(GT._("OK"));
    final AboutDialog aboutDialog = this;
    ok.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        aboutDialog.setVisible(false);
      }
    });
    buttonPanel.add(ok, BorderLayout.EAST);
    getRootPane().setDefaultButton(ok);
    //container.add(buttonPanel, BorderLayout.SOUTH);
*/
    getContentPane().add(container);
    pack();
    Dimension screenSize = this.getToolkit().getScreenSize();
    Dimension size = this.getSize();
    screenSize.height = screenSize.height / 2;
    screenSize.width = screenSize.width / 2;
    size.height = size.height / 2;
    size.width = size.width / 2;
    int y = screenSize.height - size.height;
    int x = screenSize.width - size.width;
    this.setLocation(x, y);
  }