From: <ha...@us...> - 2009-11-23 13:54:35
|
Revision: 11779 http://jmol.svn.sourceforge.net/jmol/?rev=11779&view=rev Author: hansonr Date: 2009-11-23 13:54:08 +0000 (Mon, 23 Nov 2009) Log Message: ----------- version=11.9.10_dev # bug fix: occasional null pointer error during ZAP due to continued rendering by # previous graphic painting thread # code: refactoring of FileManager and clean-up of Viewer code # in relation to model loading. Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/ModelManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/viewer/ModelManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2009-11-23 13:17:09 UTC (rev 11778) +++ trunk/Jmol/src/org/jmol/viewer/ModelManager.java 2009-11-23 13:54:08 UTC (rev 11779) @@ -39,18 +39,9 @@ this.viewer = viewer; } - ModelSet clear() { - fullPathName = fileName = null; - modelLoader = null; - return null; - } - ModelSet zap() { - clear(); - fullPathName = fileName; - //System.out.println(modelLoader + " zap old"); + fullPathName = fileName = null; modelLoader = new ModelLoader(viewer, "empty"); - //System.out.println(modelLoader + " zap new"); return (ModelSet) modelLoader; } @@ -62,39 +53,32 @@ return fullPathName; } - ModelSet merge(Object atomSetCollection ) { - //System.out.println(modelLoader + " merging a"); - modelLoader = new ModelLoader(viewer, atomSetCollection, - modelLoader, "merge"); - if (modelLoader.getAtomCount() == 0) + ModelSet createModelSet(String fullPathName, String fileName, + Object atomSetCollection, boolean isAppend) { + // 11.9.10 11/22/2009 bh adjusted to never allow a null return + if (isAppend) { + if (atomSetCollection != null) + modelLoader = new ModelLoader(viewer, atomSetCollection, modelLoader, + "merge"); + } else if (atomSetCollection == null) { zap(); - //System.out.println(modelLoader + " merging b"); - return (ModelSet) modelLoader; - } - - ModelSet createModelSet(String fullPathName, String fileName, Object atomSetCollection, boolean isAppend) { - if (atomSetCollection == null) { - clear(); - return null; + } else { + this.fullPathName = fullPathName; + this.fileName = fileName; + String modelSetName = viewer.getModelAdapter().getAtomSetCollectionName( + atomSetCollection); + if (modelSetName != null) { + modelSetName = modelSetName.trim(); + if (modelSetName.length() == 0) + modelSetName = null; + } + if (modelSetName == null) + modelSetName = reduceFilename(fileName); + modelLoader = new ModelLoader(viewer, atomSetCollection, null, + modelSetName); + if (modelLoader.getAtomCount() == 0) + zap(); } - if (isAppend) - return merge(atomSetCollection); - this.fullPathName = fullPathName; - this.fileName = fileName; - String modelSetName = viewer.getModelAdapter().getAtomSetCollectionName(atomSetCollection); - if (modelSetName != null) { - modelSetName = modelSetName.trim(); - if (modelSetName.length() == 0) - modelSetName = null; - } - if (modelSetName == null) - modelSetName = reduceFilename(fileName); - //System.out.println(modelLoader + " setclient a"); - modelLoader = new ModelLoader(viewer, atomSetCollection, null, modelSetName); - //haveFile = true; - //System.out.println(modelLoader + " setclient b"); - if (modelLoader.getAtomCount() == 0) - zap(); return (ModelSet) modelLoader; } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2009-11-23 13:17:09 UTC (rev 11778) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2009-11-23 13:54:08 UTC (rev 11779) @@ -2039,9 +2039,6 @@ */ private String createModelSet(String fullPathName, String fileName, Object atomSetCollection, boolean isAppend) { - // maybe there needs to be a call to clear() - // or something like that here - // for when CdkEditBus calls this directly // null fullPathName implies we are doing a merge pushHoldRepaint("createModelSet"); setErrorMessage(null); @@ -2230,7 +2227,7 @@ clearAllMeasurements(); if (minimizer != null) minimizer.setProperty("clear", null); - modelSet = modelManager.clear(); + //modelSet = modelManager.clear(); if (haveDisplay) { mouseManager.clear(); actionManager.clear(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |