From: <sh...@us...> - 2009-09-22 11:19:10
|
Revision: 14860 http://cdk.svn.sourceforge.net/cdk/?rev=14860&view=rev Author: shk3 Date: 2009-09-22 11:19:04 +0000 (Tue, 22 Sep 2009) Log Message: ----------- unifying several methods Modified Paths: -------------- jchempaint/trunk/EditorApplet.html jchempaint/trunk/src/main/org/openscience/jchempaint/applet/JChemPaintAbstractApplet.java Modified: jchempaint/trunk/EditorApplet.html =================================================================== --- jchempaint/trunk/EditorApplet.html 2009-09-22 11:05:12 UTC (rev 14859) +++ jchempaint/trunk/EditorApplet.html 2009-09-22 11:19:04 UTC (rev 14860) @@ -21,7 +21,7 @@ <a href="javascript:alert(document.Editor.getSmilesChiral())">show stereo smiles</a> <a href="javascript:document.Editor.makeHydrogensExplicit()">Make hydrogens explicit</a> <a href="javascript:document.Editor.clear()">clear</a> -<a href="javascript:document.Editor.addMolFileWithReplace('\n CDK 1/19/07,10:3\n\n 2 1 0 0 0 0 0 0 0 0999 V2000 \n 252.0000 1022.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 227.0000 1047.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2 1 1 0 0 0 0 \nM END')">insert CC (as mol file)</a> +<a href="javascript:document.Editor.setMolFile('\n CDK 1/19/07,10:3\n\n 2 1 0 0 0 0 0 0 0 0999 V2000 \n 2.520000 10.220000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2.270000 10.470000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0\n 2 1 1 0 0 0 0 \nM END')">insert CC (as mol file)</a> <a href="javascript:document.Editor.setSmiles('CCC')">insert CCC (as SMILES)</a> <blockquote> <hr> Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/applet/JChemPaintAbstractApplet.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/applet/JChemPaintAbstractApplet.java 2009-09-22 11:05:12 UTC (rev 14859) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/applet/JChemPaintAbstractApplet.java 2009-09-22 11:19:04 UTC (rev 14860) @@ -389,7 +389,12 @@ .getInstance().newMolecule()); InsertTextPanel.generateModel(theJcpp, cdkmol, false); theJcpp.get2DHub().updateView(); - repaint(); + // the newly opened file should nicely fit the screen + theJcpp.getRenderPanel().setFitToScreen(true); + theJcpp.getRenderPanel().update( + theJcpp.getRenderPanel().getGraphics()); + // enable zooming by removing constraint + theJcpp.getRenderPanel().setFitToScreen(false); } /** @@ -411,13 +416,7 @@ newmol.append(System.getProperty("file.separator")); s = e + 1; } - newmol.append(mol.substring(s)); - MDLV2000Reader reader = new MDLV2000Reader(new StringReader(mol)); - IMolecule cdkmol = (IMolecule) reader.read(DefaultChemObjectBuilder - .getInstance().newMolecule()); - theJcpp.setChemModel(ChemModelManipulator.newChemModel(cdkmol)); - theJcpp.get2DHub().updateView(); - repaint(); + setMolFile(newmol.toString()); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |