Package org.openscience.jchempaint.controller

Examples of org.openscience.jchempaint.controller.ControllerHub


        this.controllerModel = new ControllerModel();

        UndoRedoHandler undoredohandler = new UndoRedoHandler();
        undoredohandler.addIUndoListener(this);
        // connect the Renderer to the Hub
        this.hub = new ControllerHub(controllerModel, renderer, chemModel,
                this, undoredohandler, new SwingUndoRedoFactory(), isViewer, applet);
        pbg.setControllerHub(hub);
        pag.setControllerHub(hub);
        ptg.setControllerHub(hub);
View Full Code Here


            toolbar2.add(box);
        }
        if (orientation == SwingConstants.HORIZONTAL) {
            toolbar2.add(Box.createHorizontalGlue());
        }
        ControllerHub relay = chemPaintPanel.get2DHub();
        IControllerModule m = new SelectSquareModule(relay);
        m.setID("select");
        relay.setFallbackModule(m);
        return toolbar2;
    }
View Full Code Here

            }
      if(tocopyclone.getAtomCount()>0 || tocopyclone.getBondCount()>0)
          addToClipboard(sysClip, tocopyclone);
     
        }else if (type.equals("selectAll")) {
            ControllerHub hub = jcpPanel.get2DHub();
            IChemObjectSelection allSelection =
                new LogicalSelection(LogicalSelection.Type.ALL);

            allSelection.select(hub.getIChemModel());
            renderModel.setSelection(allSelection);
            SelectSquareModule succusorModule = new SelectSquareModule(hub);
            succusorModule.setID("select");
            MoveModule newActiveModule = new MoveModule(hub, succusorModule);
            newActiveModule.setID("move");
            hub.setActiveDrawModule(newActiveModule);

        } else if (type.equals("selectFromChemObject")) {

          // FIXME: implement for others than Reaction, Atom, Bond
          IChemObject object = getSource(e);
View Full Code Here

    /* (non-Javadoc)
     * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent)
     */
    public void keyReleased(KeyEvent arg0) {
        JChemPaintRendererModel model = renderPanel.getRenderer().getRenderer2DModel();
        ControllerHub relay = renderPanel.getHub();
        if (model.getHighlightedAtom() != null) {
            try {
                IAtom closestAtom = model.getHighlightedAtom();
                char x = arg0.getKeyChar();               
                if (Character.isLowerCase(x))
                    x = Character.toUpperCase(x);
                System.out.println(x);
                IsotopeFactory ifa;
                ifa = XMLIsotopeFactory.getInstance(closestAtom.getBuilder());
                IIsotope iso = ifa.getMajorIsotope(Character.toString(x));
                if (iso != null) {
                    relay.setSymbol(closestAtom, Character.toString(x));
                }
                this.get2DHub().updateView();
            } catch (IOException e) {
                announceError(e);
            }
View Full Code Here

public class ChangeModeAction extends JCPAction {

    private static final long serialVersionUID = -4056416630614934238L;

    public void actionPerformed(ActionEvent e) {
        ControllerHub hub = jcpPanel.get2DHub();
        IControllerModule newActiveModule=null;
        if (type.equals("lasso")) {
          newActiveModule=new SelectLassoModule(hub);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("select")) {
          newActiveModule=new SelectSquareModule(hub);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("triangle")) {
          newActiveModule=new AddRingModule(hub, 3, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("square")) {
          newActiveModule=new AddRingModule(hub, 4, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("pentagon")) {
          newActiveModule=new AddRingModule(hub, 5, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("hexagon")) {
          newActiveModule=new AddRingModule(hub, 6, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("heptagon")) {
          newActiveModule=new AddRingModule(hub, 7, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("octagon")) {
          newActiveModule=new AddRingModule(hub, 8, false);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("benzene")) {
          newActiveModule=new AddRingModule(hub, 6, true);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("atomatommapping")) {
          newActiveModule=new AtomAtomMappingModule(hub);
            hub.getController2DModel().setDrawElement("C");
        } else if (type.equals("rotate")) {
          newActiveModule=new RotateModule(hub);
        } else if (type.equals("rotate3d")) {
          newActiveModule=new Rotate3DModule(hub);
        } else if (type.equals("reactionArrow")) {
            newActiveModule=new ReactionArrowModule(hub);
        } else if (type.equals("chain")) {
            newActiveModule=new ChainModule(hub);
        }
        if(newActiveModule!=null){
          newActiveModule.setID(type);
          hub.setActiveDrawModule(newActiveModule);
        }
    }
View Full Code Here

TOP

Related Classes of org.openscience.jchempaint.controller.ControllerHub

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.