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

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;

import javax.swing.JLabel;

import org.xnap.commons.i18n.I18n;

import edu.kit.iks.CryptographicsLib.Configuration;
import edu.kit.iks.CryptographicsLib.VisualizationView;

/**
 * Explains one-way functions
 * 
 * @author kai
 *
 */

public class OnewayView extends VisualizationView {
	
	/**
	 * Localization instance
	 */
	private static I18n i18n = Configuration.getInstance().getI18n(OnewayView.class);
	
	private JLabel onewayExplain;

	private String help = i18n.tr("No help");
	
	private String explain = i18n.tr("To achive this, we use " +
				"something called one-way function. This function is easy to compute " +
				"in one direction, but difficult to reverse.");
	
	private static final long serialVersionUID = 6243104730541136349L;
	
	public OnewayView() {
		super();
		GridBagLayout layout = new GridBagLayout();
		GridBagConstraints gbc = new GridBagConstraints();
		this.setLayout(layout);
		gbc.gridx = 2;
		gbc.gridy = 2;
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		layout.setConstraints(this.getNextButton(), gbc);
		gbc.gridx = 0;
		gbc.gridy = 2;
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		layout.setConstraints(this.getBackButton(), gbc);
		this.onewayExplain = new JLabel();
		this.onewayExplain.setText("<html><div style=\"width:200px\">" + explain + "</div></html>");
		gbc.gridx = 1;
		gbc.gridy = 1;
		gbc.weightx = 0.1;
		gbc.weighty = 0.1;
		this.add(onewayExplain, gbc);
		
	}

	public String getHelp() {
		return help ;
	}

}

@@ -332,17 +332,37 @@
 unctions
+ and visualizes them
 %0A
-
  * %0A * @
@@ -551,24 +551,60 @@
 w.class);%0A%09%0A
+%09/** hold the explanation string */%0A
 %09private JLa
@@ -623,16 +623,42 @@
 plain;%0A%0A
+%09/** no help need here */%0A
 %09private
@@ -690,24 +690,51 @@
 o help%22);%0A%09%0A
+%09/** explanation string */%0A
 %09private Str
@@ -984,16 +984,65 @@
 349L;%0A%09%0A
+%09/**%0A%09 * Construct subcomponents and layout%0A%09 */%0A
 %09public 
@@ -1695,16 +1695,77 @@
 %0A%09%09%0A%09%7D%0A%0A
+%09/**%0A%09 * return help string%0A%09 * @return the help string%0A%09 */%0A
 %09public 

add comments