From: <ha...@us...> - 2010-12-17 14:50:21
|
Revision: 14800 http://jmol.svn.sourceforge.net/jmol/?rev=14800&view=rev Author: hansonr Date: 2010-12-17 14:50:14 +0000 (Fri, 17 Dec 2010) Log Message: ----------- version=12.0.25_dev # code: JUnit test for file reading GenNBO and CIF files lacks viewer object Modified Paths: -------------- branches/v12_0/Jmol/src/org/jmol/api/JmolAdapter.java branches/v12_0/Jmol/src/org/jmol/api/JmolViewer.java branches/v12_0/Jmol/src/org/jmol/viewer/Jmol.properties branches/v12_0/Jmol/src/org/jmol/viewer/Viewer.java branches/v12_0/Jmol/test/org/jmol/adapter/smarter/TestSmarterJmolAdapter.java Modified: branches/v12_0/Jmol/src/org/jmol/api/JmolAdapter.java =================================================================== --- branches/v12_0/Jmol/src/org/jmol/api/JmolAdapter.java 2010-12-17 14:49:24 UTC (rev 14799) +++ branches/v12_0/Jmol/src/org/jmol/api/JmolAdapter.java 2010-12-17 14:50:14 UTC (rev 14800) @@ -192,6 +192,7 @@ Hashtable htParams) { if (htParams == null) htParams = new Hashtable(); + htParams.put("viewer", JmolViewer.allocateViewer(null, this)); Object a = getAtomSetCollectionReader(name, type, bufferedReader, htParams); if (a instanceof String) return a; Modified: branches/v12_0/Jmol/src/org/jmol/api/JmolViewer.java =================================================================== --- branches/v12_0/Jmol/src/org/jmol/api/JmolViewer.java 2010-12-17 14:49:24 UTC (rev 14799) +++ branches/v12_0/Jmol/src/org/jmol/api/JmolViewer.java 2010-12-17 14:50:14 UTC (rev 14800) @@ -110,7 +110,6 @@ /** * OK, but safer to assign htmlName, URL bases, comandOptions, and statusListener now. * - * @deprecated * @param awtComponent * @param jmolAdapter * @return a viewer Modified: branches/v12_0/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v12_0/Jmol/src/org/jmol/viewer/Jmol.properties 2010-12-17 14:49:24 UTC (rev 14799) +++ branches/v12_0/Jmol/src/org/jmol/viewer/Jmol.properties 2010-12-17 14:50:14 UTC (rev 14800) @@ -4,6 +4,7 @@ version=12.0.25_dev +# code: JUnit test for file reading GenNBO and CIF files lacks viewer object # bug fix: GenNBO reader does not read MOs properly # bug fix: GenNBO reader does not read xxx.31 file P orbitals not in X Y Z order # bug fix: applying unit cell in LOAD command to XYZ file containing multiple models Modified: branches/v12_0/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/v12_0/Jmol/src/org/jmol/viewer/Viewer.java 2010-12-17 14:49:24 UTC (rev 14799) +++ branches/v12_0/Jmol/src/org/jmol/viewer/Viewer.java 2010-12-17 14:50:14 UTC (rev 14800) @@ -253,6 +253,11 @@ if (Logger.debugging) { Logger.debug("Viewer constructor " + this); } + isDataOnly = (display == null); + haveDisplay = (!isDataOnly && (commandOptions == null || commandOptions.indexOf("-n") < 0)); + mustRender = haveDisplay; + if (!haveDisplay) + display = null; this.display = display; this.modelAdapter = modelAdapter; strJavaVendor = System.getProperty("java.vendor"); @@ -280,7 +285,7 @@ scriptManager = new ScriptManager(this); transformManager = new TransformManager11(this); selectionManager = new SelectionManager(this); - if (display != null) { + if (haveDisplay) { if (multiTouch) { if (commandOptions.indexOf("-multitouch-sparshui-simulated") < 0) { int[] pixels = new int[1]; @@ -364,7 +369,7 @@ return isPreviewOnly; } - public boolean haveDisplay = true; + public boolean haveDisplay = false; public boolean autoExit = false; private boolean mustRender = true; @@ -432,11 +437,6 @@ isCmdLine_C_Option = (str.indexOf("-C") >= 0); listCommands = (str.indexOf("-l") >= 0); autoExit = (str.indexOf("-x") >= 0); - isDataOnly = (display == null); - haveDisplay = (display != null && str.indexOf("-n") < 0); - if (!haveDisplay) - display = null; - mustRender = haveDisplay; cd("."); } isPreviewOnly = (str.indexOf("#previewOnly") >= 0); @@ -4538,7 +4538,7 @@ } public void setCursor(int cursor) { - if (multiTouch || currentCursor == cursor || display == null) + if (multiTouch || currentCursor == cursor || !haveDisplay) return; int c; switch (currentCursor = cursor) { @@ -8537,9 +8537,8 @@ void repaint() { // from RepaintManager - if (display == null) - return; - display.repaint(); + if (haveDisplay) + display.repaint(); } public OutputStream getOutputStream(String localName, String[] fullPath) { @@ -8671,11 +8670,11 @@ } public boolean hasFocus() { - return (display != null && (isKiosk || display.hasFocus())); + return (haveDisplay && (isKiosk || display.hasFocus())); } public void setFocus() { - if (display != null && !display.hasFocus()) + if (haveDisplay && !display.hasFocus()) display.requestFocusInWindow(); } Modified: branches/v12_0/Jmol/test/org/jmol/adapter/smarter/TestSmarterJmolAdapter.java =================================================================== --- branches/v12_0/Jmol/test/org/jmol/adapter/smarter/TestSmarterJmolAdapter.java 2010-12-17 14:49:24 UTC (rev 14799) +++ branches/v12_0/Jmol/test/org/jmol/adapter/smarter/TestSmarterJmolAdapter.java 2010-12-17 14:50:14 UTC (rev 14800) @@ -13,6 +13,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.util.Hashtable; import java.util.zip.GZIPInputStream; import org.jmol.util.JUnitLogger; @@ -84,6 +85,9 @@ result.addDirectory(false, "gamess", "out", ";Gamess;GamessUS;GamessUK;"); result.addDirectory(false, "gaussian", "log", "Gaussian"); result.addDirectory(false, "gaussian", "out", "Gaussian"); + result.addDirectory(false, "gennbo", "out", "GenNBO"); + result.addDirectory(false, "gennbo", "36", "GenNBO"); + result.addDirectory(false, "gennbo", "37", "GenNBO"); result.addDirectory(false, "ghemical", "gpr", "GhemicalMM"); result.addDirectory(false, "gpt2", "gpt2","MopacGraphf"); result.addDirectory(false, "gromacs", "gro", "Gromacs"); @@ -220,7 +224,9 @@ fail("Wrong type for " + file.getPath() + ": " + fileType + " instead of " + typeAllowed); } } - Object result = adapter.getAtomSetCollectionFromReader(file.getName(), null, bReader, null); + Hashtable htParams = new Hashtable(); + htParams.put("fullPathName", file.getAbsolutePath()); + Object result = adapter.getAtomSetCollectionFromReader(file.getName(), null, bReader, htParams); assertNotNull("Nothing read for " + file.getPath(), result); assertFalse("Error returned for " + file.getPath() + ": " + result, result instanceof String); assertTrue("Not an AtomSetCollection for " + file.getPath(), result instanceof AtomSetCollection); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |