// Path: src/main/java/de/hartz/vpn/helper/RadioButtonWithDescription.java
// public class RadioButtonWithDescription extends JPanel {
// 
//     private JRadioButton radioButton;
//     private Component descriptionComponent;
// 
//     public RadioButtonWithDescription(String radioButtonText, String description) {
//         this(radioButtonText, description, null);
//     }
// 
//     public RadioButtonWithDescription(String radioButtonText, String description, ActionListener actionListener) {
//         this(radioButtonText, getDescriptionLabel(description) , actionListener);
//     }
// 
//     public RadioButtonWithDescription(String radioButtonText, Component descriptionComponent, ActionListener actionListener) {
//         this.descriptionComponent = descriptionComponent;
//         setLayout(new GridLayout(2,1));
// 
//         radioButton = new JRadioButton(radioButtonText);
//         radioButton.setMaximumSize(new Dimension(radioButton.getWidth(), 50));
//         if (actionListener != null) {
//             radioButton.addActionListener(actionListener);
//         }
//         JPanel leftTabulator = new JPanel(new GridLayout());
//         leftTabulator.setAlignmentX(LEFT_ALIGNMENT);
//         leftTabulator.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
// 
//         add(radioButton);
//         add(leftTabulator);
//         leftTabulator.add(descriptionComponent);
//     }
// 
//     public void setEnabled(boolean enabled) {
//         radioButton.setEnabled(enabled);
//         setDescriptionComponentEnabled(enabled);
//     }
// 
//     public void setDescriptionComponentEnabled(boolean enabled) {
//         setSubComponentsEnabled(descriptionComponent, enabled);
//     }
// 
//     private void setSubComponentsEnabled(Component component,boolean enabled) {
//         if (component instanceof JPanel) {
//             Component[] components = ((JPanel) component).getComponents();
// 
//             for (Component c: components) {
//                 if ( c instanceof JPanel) {
//                     setSubComponentsEnabled(c, enabled);
//                 }
//                 c.setEnabled(enabled);
//             }
//         }
//         component.setEnabled(false);
//     }
// 
//     public void setSelected(boolean selected) {
//         radioButton.setSelected(selected);
//     }
// 
//     public void addToGroup(ButtonGroup group) {
//         group.add(radioButton);
//     }
// 
//     public boolean isEventSource(Object source) {
//         return radioButton == source;
//     }
// 
//     private static JTextArea getDescriptionLabel(String description) {
//         JTextArea descriptionLabel = new JTextArea(description);
//         descriptionLabel.setWrapStyleWord(true);
//         descriptionLabel.setLineWrap(true);
//         descriptionLabel.setEditable(false);
//         descriptionLabel.setEnabled(false);
//         descriptionLabel.setBorder(null);
//         descriptionLabel.setOpaque(false);
//         descriptionLabel.setFont(new Font("Helvetica", Font.PLAIN, 12));
// 
//         return descriptionLabel;
//     }
// 
// }
// 
// Path: src/main/java/de/hartz/vpn/main/installation/InstallationPanel.java
// public abstract class InstallationPanel extends JPanel implements Logger {
// 
//     public abstract void onSelect();
// 
//     /**
//      *
//      * @return boolean indicating whether deselecting is possible.
//      */
//     public abstract boolean onDeselect();
// 
//     /**
//      * Method indicating whether the panel is the last installation step.
//      * @return
//      */
//     public boolean isFinishingPanel() {
//         return false;
//     }
// 
//     public void addLogLine(String line) {
//         System.out.println(line);
//     }
// }


import de.hartz.vpn.helper.RadioButtonWithDescription;
import de.hartz.vpn.main.installation.InstallationPanel;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
package de.hartz.vpn.main.installation.server;



/**
 * Created by kaiha on 28.05.2017.
 */
public class StartPanel extends InstallationPanel implements ActionListener {

    private RadioButtonWithDescription expressRadioButton;
    private RadioButtonWithDescription customRadioButton;

    private boolean isExpressInstallation;

    public StartPanel() {
        isExpressInstallation = true;

        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

        String configString = "UDP, ";
        configString += "Using TAP Device so Broadcasts are supported, ";
        configString += "No Authentication, ";
        configString += "AES-128-CBC Encryption, ";
        configString += "RSA Key Size of 512 Bit";

        expressRadioButton = new RadioButtonWithDescription( "Express installation. Use default settings.", "For users with less experience includes following settings:" + configString, this);
        expressRadioButton.setSelected(isExpressInstallation);

        customRadioButton = new RadioButtonWithDescription( "Custom installation. Choose settings step by step.", "Customize the settings like security, performance etc.", this);
        customRadioButton.setSelected(!isExpressInstallation);
        customRadioButton.setEnabled(false);

        ButtonGroup group = new ButtonGroup();
        customRadioButton.addToGroup(group);
        expressRadioButton.addToGroup(group);

        this.add(expressRadioButton);
        this.add(customRadioButton);
    }

    public boolean isExpressInstallation() {
// Path: src/main/java/de/hartz/vpn/helper/RadioButtonWithDescription.java
// public class RadioButtonWithDescription extends JPanel {
// 
//     private JRadioButton radioButton;
//     private Component descriptionComponent;
// 
//     public RadioButtonWithDescription(String radioButtonText, String description) {
//         this(radioButtonText, description, null);
//     }
// 
//     public RadioButtonWithDescription(String radioButtonText, String description, ActionListener actionListener) {
//         this(radioButtonText, getDescriptionLabel(description) , actionListener);
//     }
// 
//     public RadioButtonWithDescription(String radioButtonText, Component descriptionComponent, ActionListener actionListener) {
//         this.descriptionComponent = descriptionComponent;
//         setLayout(new GridLayout(2,1));
// 
//         radioButton = new JRadioButton(radioButtonText);
//         radioButton.setMaximumSize(new Dimension(radioButton.getWidth(), 50));
//         if (actionListener != null) {
//             radioButton.addActionListener(actionListener);
//         }
//         JPanel leftTabulator = new JPanel(new GridLayout());
//         leftTabulator.setAlignmentX(LEFT_ALIGNMENT);
//         leftTabulator.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0));
// 
//         add(radioButton);
//         add(leftTabulator);
//         leftTabulator.add(descriptionComponent);
//     }
// 
//     public void setEnabled(boolean enabled) {
//         radioButton.setEnabled(enabled);
//         setDescriptionComponentEnabled(enabled);
//     }
// 
//     public void setDescriptionComponentEnabled(boolean enabled) {
//         setSubComponentsEnabled(descriptionComponent, enabled);
//     }
// 
//     private void setSubComponentsEnabled(Component component,boolean enabled) {
//         if (component instanceof JPanel) {
//             Component[] components = ((JPanel) component).getComponents();
// 
//             for (Component c: components) {
//                 if ( c instanceof JPanel) {
//                     setSubComponentsEnabled(c, enabled);
//                 }
//                 c.setEnabled(enabled);
//             }
//         }
//         component.setEnabled(false);
//     }
// 
//     public void setSelected(boolean selected) {
//         radioButton.setSelected(selected);
//     }
// 
//     public void addToGroup(ButtonGroup group) {
//         group.add(radioButton);
//     }
// 
//     public boolean isEventSource(Object source) {
//         return radioButton == source;
//     }
// 
//     private static JTextArea getDescriptionLabel(String description) {
//         JTextArea descriptionLabel = new JTextArea(description);
//         descriptionLabel.setWrapStyleWord(true);
//         descriptionLabel.setLineWrap(true);
//         descriptionLabel.setEditable(false);
//         descriptionLabel.setEnabled(false);
//         descriptionLabel.setBorder(null);
//         descriptionLabel.setOpaque(false);
//         descriptionLabel.setFont(new Font("Helvetica", Font.PLAIN, 12));
// 
//         return descriptionLabel;
//     }
// 
// }
// 
// Path: src/main/java/de/hartz/vpn/main/installation/InstallationPanel.java
// public abstract class InstallationPanel extends JPanel implements Logger {
// 
//     public abstract void onSelect();
// 
//     /**
//      *
//      * @return boolean indicating whether deselecting is possible.
//      */
//     public abstract boolean onDeselect();
// 
//     /**
//      * Method indicating whether the panel is the last installation step.
//      * @return
//      */
//     public boolean isFinishingPanel() {
//         return false;
//     }
// 
//     public void addLogLine(String line) {
//         System.out.println(line);
//     }
// }


// Path: src/main/java/de/hartz/vpn/main/installation/server/StartPanel.java
import de.hartz.vpn.helper.RadioButtonWithDescription;
import de.hartz.vpn.main.installation.InstallationPanel;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

package de.hartz.vpn.main.installation.server;



/**
 * Created by kaiha on 28.05.2017.
 */
public class StartPanel extends InstallationPanel implements ActionListener {

    private RadioButtonWithDescription expressRadioButton;
    private RadioButtonWithDescription customRadioButton;

    private boolean isExpressInstallation;

    public StartPanel() {
        isExpressInstallation = true;

        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

        String configString = "UDP, ";
        configString += "Using TAP Device so Broadcasts are supported, ";
        configString += "No Authentication, ";
        configString += "AES-128-CBC Encryption, ";
        configString += "RSA Key Size of 512 Bit";

        expressRadioButton = new RadioButtonWithDescription( "Express installation. Use default settings.", "For users with less experience includes following settings:" + configString, this);
        expressRadioButton.setSelected(isExpressInstallation);

        customRadioButton = new RadioButtonWithDescription( "Custom installation. Choose settings step by step.", "Customize the settings like security, performance etc.", this);
        customRadioButton.setSelected(!isExpressInstallation);
        customRadioButton.setEnabled(false);

        ButtonGroup group = new ButtonGroup();
        customRadioButton.addToGroup(group);
        expressRadioButton.addToGroup(group);

        this.add(expressRadioButton);
        this.add(customRadioButton);
    }

    public boolean isExpressInstallation() {
        return isExpressInstallation;