<commit_before>package edu.kit.iks.Cryptographics;

import java.awt.BorderLayout;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.ParseException;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.synth.SynthLookAndFeel;

import edu.kit.iks.CryptographicsLib.AbstractController;
import edu.kit.iks.CryptographicsLib.AbstractVisualizationInfo;
import edu.kit.iks.CryptographicsLib.Logger;
import edu.kit.iks.CryptographicsLib.PopoverView;

/**
 * An instance of this class is the main controller, delegating all performed
 * tasks to its subcontrollers like StartController (teaser) or controllers
 * visualizing a cryptographic procedure
 * 
 * @author <NAME>
 */
public class MainController extends AbstractController {

	/**
	 * A sandbox for subcontrollers to inflate their contents
	 */
	private JFrame frame;

	/**
	 * An instance of the start controller, showing a teaser to draw attention
	 */
	private StartController startController;

	/**
	 * An instance of a container controller, visualizing a cryptographic
	 * procedure inside
	 */
	private VisualizationContainerController visualizationContainerController;

	/**
	 * Just loads the frame. This controller is specially since it does not load a view.
	 */
	@Override
	public void loadView() {
		this.loadLookAndFeel();
		this.loadFrame();
	}

	/**
	 * Loads the JFrame
	 */
	private void loadFrame() {
		this.frame = new JFrame("Cryptographics");
		
		if (Logger.debugModeActive()) {
			this.frame.setSize(1366, 768); // Basic size for testing. Needs to be
										   // fullscreen in the end
		} else {
			this.frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
			this.frame.setUndecorated(true);
		}
		
		this.frame.setVisible(true);
		this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Extract the glassPane. We use this for displaying popovers.
		JPanel popoverContainerView = (JPanel)this.frame.getGlassPane();
		PopoverView.setContainerView(popoverContainerView);
	}
	
	/**
	 * Loads the custom look and feel.
	 */
	private void loadLookAndFeel() {
		if (!Logger.debugModeActive()) {
			SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
			
			try {
				lookAndFeel.load(new File("resources/theme/manifest.xml").toURI().toURL());
			} catch (MalformedURLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			try {
				UIManager.setLookAndFeel(lookAndFeel);
			} catch (UnsupportedLookAndFeelException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	/**<commit_msg>+ Added some debug comments<commit_after>package edu.kit.iks.Cryptographics;

import java.awt.BorderLayout;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.text.ParseException;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import javax.swing.plaf.synth.SynthLookAndFeel;

import edu.kit.iks.CryptographicsLib.AbstractController;
import edu.kit.iks.CryptographicsLib.AbstractVisualizationInfo;
import edu.kit.iks.CryptographicsLib.Logger;
import edu.kit.iks.CryptographicsLib.PopoverView;

/**
 * An instance of this class is the main controller, delegating all performed
 * tasks to its subcontrollers like StartController (teaser) or controllers
 * visualizing a cryptographic procedure
 * 
 * @author <NAME>her
 */
public class MainController extends AbstractController {

	/**
	 * A sandbox for subcontrollers to inflate their contents
	 */
	private JFrame frame;

	/**
	 * An instance of the start controller, showing a teaser to draw attention
	 */
	private StartController startController;

	/**
	 * An instance of a container controller, visualizing a cryptographic
	 * procedure inside
	 */
	private VisualizationContainerController visualizationContainerController;

	/**
	 * Just loads the frame. This controller is specially since it does not load a view.
	 */
	@Override
	public void loadView() {
		this.loadLookAndFeel();
		this.loadFrame();
	}

	/**
	 * Loads the JFrame
	 */
	private void loadFrame() {
		this.frame = new JFrame("Cryptographics");
		
		if (Logger.debugModeActive()) {
			this.frame.setSize(1366, 768); // Basic size for testing. Needs to be
										   // fullscreen in the end
			Logger.d("MainController", "loadFrame", "Fullscreen mode disabled due to debugging.");
		} else {
			this.frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
			this.frame.setUndecorated(true);
		}
		
		this.frame.setVisible(true);
		this.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		
		// Extract the glassPane. We use this for displaying popovers.
		JPanel popoverContainerView = (JPanel)this.frame.getGlassPane();
		PopoverView.setContainerView(popoverContainerView);
	}
	
	/**
	 * Loads the custom look and feel.
	 */
	private void loadLookAndFeel() {
		if (!Logger.debugModeActive()) {
			SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
			
			try {
				lookAndFeel.load(new File("resources/theme/manifest.xml").toURI().toURL());
			} catch (MalformedURLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (ParseException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
			try {
				UIManager.setLookAndFeel(lookAndFeel);
			} catch (UnsupportedLookAndFeelException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		} else {
			Logger.d("MainController", "loadLookAndFeel", "Look and feel disabled due to debugging.");
		}
	}

	/**
{'fraction_non_alphanumeric': 0.10227653163709408, 'fraction_numerical': 0.002343488449949782, 'mean_word_length': 3.966749792186201, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1464365', 'n_tokens_mistral': 2040, 'n_tokens_neox': 1761, 'n_words': 456}