package gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

import controller.Controller;

/**
 * The frame which contains all panels.
 * 
 * @author Michael
 *
 */
public class ProgramFrame extends JFrame {

    private static final long serialVersionUID = 5047834266753718967L;
    // TODO use complete names
    private JPanel contentPane;
    private JPanel inPan;
    private JPanel ctrlPan;
    private JPanel statPanOpen;
    private JPanel statPanClosed;
    private JPanel vgPan;

    private Controller ctrl;

    /**
     * Creates a JFrame and its content. Sets the minimum Size to 1920x1080
     * Pixels and the Layout of the ContentPane.
     * 
     * @param ctrl
     *            The controller to which the actionListeners will correspond.
     * 
     * @see Controller
     * @see java.awt.event.ActionListener
     */

    public ProgramFrame(Controller ctrl) {

        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        // TODO constants for resolution
        setBounds(0, 0, 1920, 1080);
        // setMinimumSize(new Dimension(1920, 1080));
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPane.setLayout(new BorderLayout(0, 0));
        setContentPane(contentPane);

        inPan = new InputPanel(ctrl);
        contentPane.add(inPan, BorderLayout.WEST);

        JPanel centerPan = new JPanel();
        contentPane.add(centerPan, BorderLayout.CENTER);
        centerPan.setLayout(new BorderLayout(0, 0));

        // TODO
        /*
         * JPanel vgPan = ctrl.getVisualGraphPanel(); panel.add(panel_2,
         * BorderLayout.CENTER);
         */

        ctrlPan = new ControlPanel(ctrl);
        centerPan.add(ctrlPan, BorderLayout.SOUTH);

        statPanOpen = new StatePanelOpen(this);
        contentPane.add(statPanOpen, BorderLayout.EAST);

        statPanClosed = new StatePanelClosed(this);
    }

    /**
     * This method will switch between the StatePanelOpen and the
     * StatePanelClosed. Only one of them will be shown at a time.
     * 
     * @see StatePanelOpen
     * @see StatePanelClosed
     */
    public void switchStatePanel() {
        // TODO
    }

    /**
     * This method will return the InputPanel.
     * 
     * @return The InputPanel
     * @see InputPanel
     */
    public JPanel getInputPanel() {
        return inPan;
    }

    /**
     * This method will return the ControlPanel.
     * 
     * @return The ControlPanel
     * @see ControlPanel
     */
    public JPanel getControlPanel() {
        return ctrlPan;
    }

    /**
     * This method will return the StatePanelOpen.
     * 
     * @return The StatePanelOpen
     * @see StatePanelOpen
     */
    public JPanel getStatePanelOpen() {
        return statPanOpen;
    }
}

@@ -41,62 +41,8 @@
 ut;%0A
-import java.awt.Dimension;%0Aimport java.awt.EventQueue;
 %0A%0Aim
@@ -162,16 +162,57 @@
 troller;
+%0Aimport gui.visualgraph.VisualGraphPanel;
 %0A%0A/**%0A *
@@ -402,34 +402,8 @@
     
-// TODO use complete names
 %0A   
@@ -447,17 +447,21 @@
 ate 
-J
+Input
 Panel in
 Pan;
@@ -456,19 +456,24 @@
 Panel in
+put
 Pan
+el
 ;%0A    pr
@@ -482,22 +482,33 @@
 ate 
-J
+Control
 Panel c
+on
 tr
+o
 lPan
+el
 ;%0A  
@@ -517,30 +517,41 @@
 private 
-J
+State
 Panel
+Open
  stat
+e
 Pan
+el
 Open;%0A  
@@ -564,22 +564,35 @@
 ate 
-JPanel
+StatePanelClosed
  stat
+e
 Pan
+el
 Clos
@@ -607,28 +607,49 @@
 private 
-JPanel vg
+VisualGraphPanel visualGraph
 Pan
+el
 ;%0A%0A    p
@@ -1036,16 +1036,51 @@
  ctrl) %7B
+%0A        %0A        this.ctrl = ctrl;
 %0A%0A      
@@ -1460,19 +1460,24 @@
       in
+put
 Pan
+el
  = new I
@@ -1519,19 +1519,24 @@
 e.add(in
+put
 Pan
+el
 , Border
@@ -1857,22 +1857,27 @@
        c
+on
 tr
+o
 lPan
+el
  = new C
@@ -1918,22 +1918,27 @@
 an.add(c
+on
 tr
+o
 lPan
+el
 , Border
@@ -1961,27 +1961,30 @@
         stat
+e
 Pan
+el
 Open = new S
@@ -2028,27 +2028,30 @@
 ane.add(stat
+e
 Pan
+el
 Open, Border
@@ -2077,19 +2077,22 @@
     stat
+e
 Pan
+el
 Closed =
@@ -2527,33 +2527,37 @@
   */%0A    public 
-J
+Input
 Panel getInputPa
@@ -2581,19 +2581,24 @@
 eturn in
+put
 Pan
+el
 ;%0A    %7D%0A
@@ -2731,33 +2731,39 @@
   */%0A    public 
-J
+Control
 Panel getControl
@@ -2792,14 +2792,19 @@
 rn c
+on
 tr
+o
 lPan
+el
 ;%0A  
@@ -2955,22 +2955,30 @@
  public 
-J
+State
 Panel
+Open
  getStat
@@ -3011,19 +3011,22 @@
 urn stat
+e
 Pan
+el
 Open;%0A  

Change get methods for Panels so they return the subclass of jPanel