package com.henrypump.poc;

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

/**
 * Created by patrickjmcd on 2/3/17.
 */
public class GUI extends Frame {
    private TextField txtRunStatus;
    private TextField txtSurfacePosition, txtSurfaceLoad, txtDownholePosition, txtDownholeLoad;
    private final POC attachedPOC;

    GUI(POC attachedPOC){
        this.attachedPOC = attachedPOC;
        //create components
        txtRunStatus=new TextField();
        txtRunStatus.setBounds(60,50,100,20);
        txtRunStatus.setText(Integer.toString(attachedPOC.thisWell.getRunStatus()));

        txtSurfacePosition = new TextField();
        txtSurfacePosition.setBounds(30,80,100,20);

        txtSurfaceLoad = new TextField();
        txtSurfaceLoad.setBounds(150,80,100,20);

        txtDownholePosition = new TextField();
        txtDownholePosition.setBounds(30,110,100,20);

        txtDownholeLoad = new TextField();
        txtDownholeLoad.setBounds(150,110,100,20);


        Button startButton = new Button("START");
        startButton.setBounds(100,150,80,30);

        Button stopButton = new Button("STOP");
        stopButton.setBounds(100,200,80,30);

        //register listener
//        startButton.addActionListener(new ActionListener(){
//            public void actionPerformed(ActionEvent e){
//                this.attachedPOC.thisWell.start("guibutton");
//                txtRunStatus.setText(Integer.toString(thisWell.getRunStatus()));
//            }
//        });
//
//        stopButton.addActionListener(new ActionListener(){
//            public void actionPerformed(ActionEvent e){
//                thisWell.stop("guibutton");
//                txtRunStatus.setText(Integer.toString(thisWell.getRunStatus()));
//            }
//        });

        //add components and set size, layout and visibility
        add(startButton);
        add(stopButton);
        add(txtRunStatus);
        add(txtSurfacePosition);
        add(txtSurfaceLoad);
        add(txtDownholePosition);
        add(txtDownholeLoad);
        setSize(300,300);
        setLayout(null);
        setVisible(true);
    }
};
