package edu.kit.iks.Cryptographics.DiffieHellman.Demonstration;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import edu.kit.iks.Cryptographics.VisualizationContainerController;
import edu.kit.iks.CryptographicsLib.AbstractVisualizationController;
import edu.kit.iks.CryptographicsLib.AbstractVisualizationInfo;

public class AliceChooseSecretController extends AbstractVisualizationController {
	private AliceChooseSecretView view;
	
	public AliceChooseSecretController(AbstractVisualizationInfo visualizationInfo) {
		super(visualizationInfo);
	}

	@Override
	public String getHelp() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void loadView() {
		// TODO Auto-generated method stub
		this.view = new AliceChooseSecretView();
		this.view.setRemember(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				// TODO Auto-generated method stub
				((VisualizationContainerController) getParentController()).presentNextVisualizationController();
			}
		});
		
		this.getView().getNextButton().addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				view.startDemo();
			}
		});
		
		this.getView().getBackButton().addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				
				((VisualizationContainerController) getParentController()).presentPreviousVisualizationController();
			}
		});
	}
	
	/*
	 * (non-Javadoc)
	 * @see edu.kit.iks.CryptographicsLib.AbstractController#unloadView()
	 */
	@Override
	public void unloadView() {
		this.getView().getColorChannel().stopTimer();
		this.view = null;
	}
	
	@Override
	public AliceChooseSecretView getView() {
		return (AliceChooseSecretView) this.view;
	}
}

@@ -1184,24 +1184,165 @@
 nEvent e) %7B%0A
+%09%09%09%09for(ActionListener al : getView().getNextButton().getActionListeners()) %7B%0A%09%09%09%09%09getView().getNextButton().removeActionListener(al);%0A%09%09%09%09%7D%0A
 %09%09%09%09view.sta

fix bug caused by not removing actionlistener from button in alicechoosesecretView