/** * checks an atom line for "ANGSTROMS", possibly overriding the data's natural units, BOHR * (similar to Gaussian CUBE files). * * @param isXLowToHigh * @param isAngstroms * @param strAtomCount * @param atomLine * @param bs * @return isAngstroms */ protected static boolean checkAtomLine( boolean isXLowToHigh, boolean isAngstroms, String strAtomCount, String atomLine, SB bs) { if (atomLine.indexOf("ANGSTROMS") >= 0) isAngstroms = true; int ac = (strAtomCount == null ? Integer.MAX_VALUE : javajs.util.PT.parseInt(strAtomCount)); switch (ac) { case Integer.MIN_VALUE: ac = 0; atomLine = " " + atomLine.substring(atomLine.indexOf(" ") + 1); break; case Integer.MAX_VALUE: ac = Integer.MIN_VALUE; break; default: String s = "" + ac; atomLine = atomLine.substring(atomLine.indexOf(s) + s.length()); } if (isAngstroms) { if (atomLine.indexOf("ANGSTROM") < 0) atomLine += " ANGSTROMS"; } else { if (atomLine.indexOf("BOHR") < 0) atomLine += " BOHR"; } atomLine = (ac == Integer.MIN_VALUE ? "" : (isXLowToHigh ? "+" : "-") + Math.abs(ac)) + atomLine + "\n"; bs.append(atomLine); return isAngstroms; }
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); }