Package org.openscience.jchempaint.controller.undoredo

Examples of org.openscience.jchempaint.controller.undoredo.IUndoRedoable


                    counter++;
                    if(counter==container.getAtomCount())
                        lastplaced=null;
                }
                if(chemModelRelay.getUndoRedoFactory()!=null && chemModelRelay.getUndoRedoHandler()!=null){
                    IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit(chemModelRelay.getIChemModel(), ac.getBuilder().newInstance(IAtomContainer.class,ac), null, GT.get("Add Functional Group"), chemModelRelay);
                    chemModelRelay.getUndoRedoHandler().postEdit(undoredo);
                }
                chemModelRelay.getController2DModel().setDrawElement(x);
            }else if(x!=null && x.length()>0){
                if(Character.isLowerCase(x.toCharArray()[0]))
                    x=Character.toUpperCase(x.charAt(0))+x.substring(1);
                IsotopeFactory ifa=XMLIsotopeFactory.getInstance(chemModelRelay.getIChemModel().getBuilder());
                IIsotope iso=ifa.getMajorIsotope(x);
                if(iso!=null){
                    if(closestAtom==null){
                        IAtomContainer addatom=chemModelRelay.getIChemModel().getBuilder().newInstance(IAtomContainer.class);
                        addatom.addAtom(chemModelRelay.addAtomWithoutUndo(x, worldCoord, false));
                        if(chemModelRelay.getUndoRedoFactory()!=null && chemModelRelay.getUndoRedoHandler()!=null){
                            IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit(chemModelRelay.getIChemModel(), addatom, null, GT.get("Add Atom"), chemModelRelay);
                            chemModelRelay.getUndoRedoHandler().postEdit(undoredo);
                        }
                    }else{
                        chemModelRelay.setSymbol(closestAtom, x);
                    }
View Full Code Here


        chemModel.setReactionSet(reactionSet);
        chemModel.getMoleculeSet().removeAtomContainer(oldcontainer);
        if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
            chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
        if(controllerhub.getUndoRedoFactory()!=null && controllerhub.getUndoRedoHandler()!=null){
            IUndoRedoable undoredo = controllerhub.getUndoRedoFactory().getMakeReactantOrProductInNewReactionEdit(chemModel, newContainer, oldcontainer, true, "Make Reactant in new Reaction");
            controllerhub.getUndoRedoHandler().postEdit(undoredo);
        }
        controllerhub.structureChanged();
    }
View Full Code Here

        reaction.addReactant(mol);
        chemModel.getMoleculeSet().removeAtomContainer(oldcontainer);
        if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
            chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
        if(controllerhub.getUndoRedoFactory()!=null && controllerhub.getUndoRedoHandler()!=null){
            IUndoRedoable undoredo = controllerhub.getUndoRedoFactory().getMakeReactantOrProductInExistingReactionEdit(chemModel, newContainer, oldcontainer, reactionId, true, "Make Reactant in "+reactionId);
            controllerhub.getUndoRedoHandler().postEdit(undoredo);
        }
        controllerhub.structureChanged();
    }
View Full Code Here

        chemModel.setReactionSet(reactionSet);
        chemModel.getMoleculeSet().removeAtomContainer(oldcontainer);
        if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
            chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
        if(controllerhub.getUndoRedoFactory()!=null && controllerhub.getUndoRedoHandler()!=null){
            IUndoRedoable undoredo = controllerhub.getUndoRedoFactory().getMakeReactantOrProductInNewReactionEdit(chemModel, newContainer, oldcontainer, false, "Make Reactant in new Reaction");
            controllerhub.getUndoRedoHandler().postEdit(undoredo);
        }
        controllerhub.structureChanged();
    }
View Full Code Here

        reaction.addProduct(mol);
        chemModel.getMoleculeSet().removeAtomContainer(oldcontainer);
        if(chemModel.getMoleculeSet().getAtomContainerCount()==0)
            chemModel.getMoleculeSet().addAtomContainer(chemModel.getBuilder().newInstance(IAtomContainer.class));
        if(controllerhub.getUndoRedoFactory()!=null && controllerhub.getUndoRedoHandler()!=null){
            IUndoRedoable undoredo = controllerhub.getUndoRedoFactory().getMakeReactantOrProductInExistingReactionEdit(chemModel, newContainer, oldcontainer, reactionId, false, "Make Reactant in "+reactionId);
            controllerhub.getUndoRedoHandler().postEdit(undoredo);
        }
        controllerhub.structureChanged();
    }
View Full Code Here

                    if(undoredocontainer.getBondNumber(atom, innerAtom)>-1)
                        undoredocontainer.removeBond(undoredocontainer.getBondNumber(atom, innerAtom));
                }
            }
            if(chemModelRelay.getUndoRedoFactory()!=null && chemModelRelay.getUndoRedoHandler()!=null){
                IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit(chemModelRelay.getIChemModel(), newRing, null, "Ring" + " " + ringSize, chemModelRelay);
                chemModelRelay.getUndoRedoHandler().postEdit(undoredo);
            }
            //and perform the merge
            chemModelRelay.mergeMolecules(null);
           
View Full Code Here

                containerForUndoRedo.addBond(newBond);
            }
        }

        if (factory != null && handler != null) {
            IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit
            (chemModelRelay.getIChemModel(), containerForUndoRedo, removedContainer, "Add Bond",chemModelRelay);
            handler.postEdit(undoredo);
        }
        chemModelRelay.updateView();
   
View Full Code Here

            UndoRedoHandler handler = chemModelRelay.getUndoRedoHandler();
            IAtomContainer containerForUndoRedo = chemModelRelay.getIChemModel().getBuilder().newInstance(IAtomContainer.class);
            IBond bond = chemModelRelay.addBond( newAtom, atom, stereoForNewBond);
            containerForUndoRedo.addBond(bond);
            if (factory != null && handler != null) {
                IUndoRedoable undoredo = chemModelRelay.getUndoRedoFactory().getAddAtomsAndBondsEdit
                (chemModelRelay.getIChemModel(), containerForUndoRedo, null, "Add Bond",chemModelRelay);
                handler.postEdit(undoredo);
            }

           
View Full Code Here

TOP

Related Classes of org.openscience.jchempaint.controller.undoredo.IUndoRedoable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.