package de.lazyzero.kkMulticopterFlashTool.gui.widgets;

import static lu.tudor.santec.i18n.Translatrix._;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;

import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;

public class ReceiverEvaluationPanel extends JPanel {

	private static final long serialVersionUID = 1L;

	private CellConstraints cc;

	private JLabel rxRollLabel;

	private JLabel rxPitchLabel;

	private JLabel rxThrottleLabel;

	private JLabel rxYawLabel;

	private JTextField rxRollValue;

	private JTextField rxPitchValue;

	private JTextField rxThrottleValue;

	private JTextField rxYawValue;

	public ReceiverEvaluationPanel() {
		initGUI();
	}
	
	private void initGUI() {
		// create the CellContraints
		cc = new CellConstraints();

		// create the Layout for Panel this
		String panelColumns = "3dlu,pref:grow,3dlu";
		String panelRows = "3dlu,pref,3dlu,pref,3dlu,pref,3dlu,pref,3dlu,pref,3dlu,pref,3dlu,pref,3dlu,pref,3dlu";
		FormLayout panelLayout = new FormLayout(panelColumns, panelRows);
		this.setLayout(panelLayout);
		
		this.setBorder(new TitledBorder(_("ReceiverEvaluationPanel.title")));
		rxRollLabel = new JLabel(_("ReceiverEvaluationPanel.rxRollLabel") + ":");
		rxPitchLabel = new JLabel(_("ReceiverEvaluationPanel.rxPitchLabel") + ":");
		rxThrottleLabel = new JLabel(_("ReceiverEvaluationPanel.rxThrottleLabel") + ":");
		rxYawLabel = new JLabel(_("ReceiverEvaluationPanel.rxYawLabel") + ":");
		
		rxRollValue = new JTextField();
		rxPitchValue = new JTextField();
		rxThrottleValue = new JTextField();
		rxYawValue = new JTextField();
		
		rxRollValue.setEditable(false);
		rxPitchValue.setEditable(false);
		rxThrottleValue.setEditable(false);
		rxYawValue.setEditable(false);
		
		this.add(rxRollLabel, cc.xy(2, 2));
		this.add(rxRollValue, cc.xy(2, 4));
		this.add(rxPitchLabel, cc.xy(2, 6));
		this.add(rxPitchValue, cc.xy(2, 8));
		this.add(rxThrottleLabel, cc.xy(2, 10));
		this.add(rxThrottleValue, cc.xy(2, 12));
		this.add(rxYawLabel, cc.xy(2, 14));
		this.add(rxYawValue, cc.xy(2, 16));
	}

	public void setRoll(String roll) {
		rxRollValue.setText(roll);
	}

	public void setPitch(String pitch) {
		rxPitchValue.setText(pitch);
	}

	public void setThrottle(String throttle) {
		rxThrottleValue.setText(throttle);
	}

	public void setYaw(String yaw) {
		rxYawValue.setText(yaw);
	}
	
	
}
