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);
}
}