From: <sh...@us...> - 2009-05-21 16:51:08
|
Revision: 14595 http://cdk.svn.sourceforge.net/cdk/?rev=14595&view=rev Author: shk3 Date: 2009-05-21 16:50:59 +0000 (Thu, 21 May 2009) Log Message: ----------- added gui for atom-atom-mapping; if add to existing reaction is done with just one reactions, dialog no longer pops up Modified Paths: -------------- jchempaint/trunk/src/main/org/openscience/jchempaint/JCPMenuTextMaker.java jchempaint/trunk/src/main/org/openscience/jchempaint/JCPToolBar.java jchempaint/trunk/src/main/org/openscience/jchempaint/JChemPaintPanel.java jchempaint/trunk/src/main/org/openscience/jchempaint/RenderPanel.java jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java jchempaint/trunk/src/main/org/openscience/jchempaint/action/CreateReactionAction.java jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties Added Paths: ----------- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/atomatommap.gif Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/JCPMenuTextMaker.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/JCPMenuTextMaker.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/JCPMenuTextMaker.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -190,6 +190,7 @@ entries.put("redoTooltip", GT._("Redo Action")); entries.put("saveAsTooltip", GT._("Save to a file")); entries.put("undoTooltip", GT._("Undo Action")); + entries.put("atomatommappingTooltip", GT._("Add an atom-atom-mapping")); entries.put("bondMenuTitle", GT._("Bond Popup Menu")); entries.put("chemmodelMenuTitle", GT._("ChemModel Popup Menu")); entries.put("reactionMenuTitle", GT._("Reaction Popup Menu")); Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/JCPToolBar.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/JCPToolBar.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/JCPToolBar.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -141,10 +141,7 @@ { astr = key; } - //FIXME: make it choose the correct controller? - System.out.println("astr: " + astr + " key: " + key); JCPAction a = new JCPAction().getAction(chemPaintPanel, astr); - //JCPActionChangeMode a = new JCPActionChangeMode(chemPaintPanel, key); if (a != null) { b.setActionCommand(astr); @@ -169,7 +166,6 @@ logger.debug(e); } }else{ - //FIXME: make the correct actionlistener for the atom types? or whatever these are.... b=new JButton(key); ChangeModeAction a = new ChangeModeAction (); a.setJChemPaintPanel(chemPaintPanel); @@ -189,6 +185,10 @@ chemPaintPanel.redoButton=b; if(key.equals("undo")) chemPaintPanel.undoButton=b; + if(key.equals("atomatommapping")){ + chemPaintPanel.atomAtomMappingButton=b; + b.setEnabled(false); + } return b; } Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/JChemPaintPanel.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/JChemPaintPanel.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/JChemPaintPanel.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -103,6 +103,7 @@ protected JButton moveButton = null; protected JButton undoButton; protected JButton redoButton; + public JButton atomAtomMappingButton; protected JMenuItem undoMenu; protected JMenuItem redoMenu; private LoggingTool logger = new LoggingTool(this); Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/RenderPanel.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/RenderPanel.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/RenderPanel.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -28,7 +28,6 @@ */ package org.openscience.jchempaint; -import java.awt.Color; import java.awt.Container; import java.awt.Dimension; import java.awt.Graphics; Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/action/ChangeModeAction.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -38,6 +38,7 @@ import org.openscience.cdk.controller.AddBondModule; import org.openscience.cdk.controller.AddRingModule; import org.openscience.cdk.controller.AlterBondStereoModule; +import org.openscience.cdk.controller.AtomAtomMappingModule; import org.openscience.cdk.controller.ChangeFormalChargeModule; import org.openscience.cdk.controller.ControllerHub; import org.openscience.cdk.controller.CycleSymbolModule; @@ -123,6 +124,9 @@ } else if (type.equals("benzene")) { hub.setActiveDrawModule(new AddRingModule(hub, 6, true)); hub.getController2DModel().setDrawElement("C"); + } else if (type.equals("atomatommapping")) { + hub.setActiveDrawModule(new AtomAtomMappingModule(hub)); + hub.getController2DModel().setDrawElement("C"); } else if (type.length() == 1 || type.length() == 2) { // I assume something with length of 1 is an atom name // (C/H/O/N/etc.) Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/action/CreateReactionAction.java =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/action/CreateReactionAction.java 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/action/CreateReactionAction.java 2009-05-21 16:50:59 UTC (rev 14595) @@ -97,6 +97,7 @@ if ("addReactantToNew".equals(type)) { hub.makeReactantInNewReaction(newContainer, container); + this.jcpPanel.atomAtomMappingButton.setEnabled(true); } else if ("addReactantToExisting".equals(type)) { if (reactionSet.getReactionCount() == 0) @@ -108,7 +109,9 @@ { Object[] ids = getReactionIDs(reactionSet); - String s = (String) JOptionPane.showInputDialog( + String s = (String)ids[0]; + if(ids.length>1){ + s = (String) JOptionPane.showInputDialog( null, "Reaction Chooser", "Choose reaction to add reaction to", @@ -117,9 +120,11 @@ ids, ids[0] ); + } if ((s != null) && (s.length() > 0)) { hub.makeReactantInExistingReaction(s, newContainer, container); + this.jcpPanel.atomAtomMappingButton.setEnabled(true); } else { logger.error("No reaction selected"); @@ -128,6 +133,7 @@ } else if ("addProductToNew".equals(type)) { hub.makeProductInNewReaction(newContainer, container); + this.jcpPanel.atomAtomMappingButton.setEnabled(true); } else if ("addProductToExisting".equals(type)) { if (reactionSet.getReactionCount() == 0) @@ -138,7 +144,9 @@ } else { Object[] ids = getReactionIDs(reactionSet); - String s = (String) JOptionPane.showInputDialog( + String s = (String)ids[0]; + if(ids.length>1){ + s = (String) JOptionPane.showInputDialog( null, "Reaction Chooser", "Choose reaction to add reaction to", @@ -147,10 +155,12 @@ ids, ids[0] ); + } if ((s != null) && (s.length() > 0)) { hub.makeProductInExistingReaction(s, newContainer, container); + this.jcpPanel.atomAtomMappingButton.setEnabled(true); } else { logger.error("No reaction selected"); Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_applet.properties 2009-05-21 16:50:59 UTC (rev 14595) @@ -103,6 +103,6 @@ toolbar=open saveAs new - undo redo - bond \ cyclesymbol periodictable enterelement - up_bond down_bond plus minus - move \ eraser lasso select cleanup - triangle square pentagon \ - hexagon heptagon octagon benzene + hexagon heptagon octagon benzene atomatommapping elementtoolbar=C H O N P S F Cl Br I Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JCPGUI_stable.properties 2009-05-21 16:50:59 UTC (rev 14595) @@ -104,6 +104,6 @@ undo redo bond - \ cyclesymbol periodictable enterelement up_bond down_bond plus minus move - \ eraser lasso select cleanup triangle - square pentagon \ - hexagon heptagon octagon benzene + hexagon heptagon octagon benzene atomatommapping elementtoolbar=C H O N P S F Cl Br I Modified: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties =================================================================== --- jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties 2009-05-21 16:27:42 UTC (rev 14594) +++ jchempaint/trunk/src/main/org/openscience/jchempaint/resources/JChemPaintResources.properties 2009-05-21 16:50:59 UTC (rev 14595) @@ -71,6 +71,7 @@ jcplogoImage=resources/large-bin/jcplogo.gif undoImage=resources/small-bin/undo.gif redoImage=resources/small-bin/redo.gif +atomatommappingImage=resources/small-bin/atomatommap.gif ####################################################### # Action definition # ####################################################### @@ -208,6 +209,7 @@ benzeneAction=org.openscience.jchempaint.action.ChangeModeAction@benzene up_bondAction=org.openscience.jchempaint.action.ChangeModeAction@up_bond down_bondAction=org.openscience.jchempaint.action.ChangeModeAction@down_bond +atomatommappingAction=org.openscience.jchempaint.action.ChangeModeAction@atomatommapping ####################################################### # Labels definition # Added: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/atomatommap.gif =================================================================== (Binary files differ) Property changes on: jchempaint/trunk/src/main/org/openscience/jchempaint/resources/small-bin/atomatommap.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |