Package org.openscience.jchempaint.controller.undoredo

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


        if(moleculeSet.getAtomContainer(0).getAtomCount()==0)
            moleculeSet.getAtomContainer(0).add(molecule);
        else
            moleculeSet.addAtomContainer(molecule);

        IUndoRedoFactory undoRedoFactory= chemPaintPanel.get2DHub().getUndoRedoFactory();
        UndoRedoHandler undoRedoHandler= chemPaintPanel.get2DHub().getUndoRedoHandler();
       
        if (undoRedoFactory!=null) {
            IUndoRedoable undoredo = undoRedoFactory.getAddAtomsAndBondsEdit(chemPaintPanel.get2DHub().getIChemModel(),
            molecule, null, "Paste", chemPaintPanel.get2DHub());
            undoRedoHandler.postEdit(undoredo);
        }
       
        chemPaintPanel.getChemModel().setMoleculeSet(moleculeSet);
View Full Code Here


        e.printStackTrace();
      }
    }

    // Undo section to undo/redo the merge
    IUndoRedoFactory factory = getUndoRedoFactory();
    UndoRedoHandler handler = getUndoRedoHandler();
    if (movedDistance != null && factory != null && handler != null) {
      // we look if anything has been moved which was not merged
      IAtomContainer undoRedoContainer = getIChemModel().getBuilder()
          .newInstance(IAtomContainer.class);

      if (renderer.getRenderer2DModel().getSelection()
          .getConnectedAtomContainer() != null) {
        undoRedoContainer.add(renderer.getRenderer2DModel()
            .getSelection().getConnectedAtomContainer());
      }

      Iterator<IAtom> it2 = mergeMap.keySet().iterator();
      while (it2.hasNext()) {
        IAtom remove = it2.next();
        undoRedoContainer.removeAtom(remove);
      }
      IUndoRedoable moveundoredo = getUndoRedoFactory().getMoveAtomEdit(
          undoRedoContainer, movedDistance, "Move atom");
      IUndoRedoable undoredo = factory.getMergeMoleculesEdit(mergedAtoms,
          containers, droppedContainers, removedBondss,
          bondsWithReplacedAtoms, movedDistance, mergedPartnerAtoms,
          moveundoredo, oldRGroupHash, newRGroupHash,
          "Move and merge atoms", this);
      handler.postEdit(undoredo);
View Full Code Here

                Point2d[] coords = atomCoordsMap.get(atom);
                coords[0] = atom.getPoint2d();
            }

            /* Post the rotation */
            IUndoRedoFactory factory = chemModelRelay.getUndoRedoFactory();
            UndoRedoHandler handler = chemModelRelay.getUndoRedoHandler();
            if (factory != null && handler != null) {
                IUndoRedoable undoredo = factory.getChangeCoordsEdit(
                        atomCoordsMap, "Rotation");
                handler.postEdit(undoredo);
            }
        }
    }
View Full Code Here

    @Override
    public void mouseClickedUp( Point2d worldCoord ) {
        chemModelRelay.clearPhantoms();
        if(isBond) return;

        IUndoRedoFactory factory = chemModelRelay.getUndoRedoFactory();
        UndoRedoHandler handler = chemModelRelay.getUndoRedoHandler();
        IAtomContainer containerForUndoRedo = chemModelRelay.getIChemModel().getBuilder().newInstance(IAtomContainer.class);
       
        IAtom newAtom;
        if(newSource) {
View Full Code Here

            IAtom atom = chemModelRelay.addAtom( chemModelRelay.getController2DModel().getDrawElement(), chemModelRelay.getController2DModel().getDrawIsotopeNumber(), dest, chemModelRelay.getController2DModel().getDrawPseudoAtom() );
            if(chemModelRelay.getController2DModel().getDrawIsotopeNumber()!=0)
                atom.setMassNumber(chemModelRelay.getController2DModel().getDrawIsotopeNumber());

            IUndoRedoFactory factory = chemModelRelay.getUndoRedoFactory();
            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) {
View Full Code Here

TOP

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

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.