
package edu.calpoly.csc480.Corral.Seer;

import java.awt.*;
import javax.swing.*;

import com.bcurry.www.swing.*;
import com.bcurry.www.swing.dialog.*;

public class BaseRulesView extends ModalConfirmDialog {
	public BaseRulesView() {
		super(null, "Define Rules...");
	}

	final public BaseRules getDocument()			{return rules;}
	
	public void setDocument(BaseRules rules) {
		this.rules = rules;
	}
	
	protected BaseRules rules;
	
	protected NumberField turnCostField, moveCostField;
	protected NumberField distanceHintCostField, directionHintCostField;

	protected JPanel makePanel() {
		JPanel panel;
		
		panel = new JPanel(new GridLayout(0, 2), true);
		panel.setName("The Rules");
		
		panel.add(new JLabel("Turning Cost:  ", SwingConstants.RIGHT));
		panel.add(turnCostField = new NumberField(rules.turnCost));
		
		panel.add(new JLabel("Movement Cost:  ", SwingConstants.RIGHT));
		panel.add(moveCostField = new NumberField(rules.moveCost));
		
		panel.add(new JLabel("Distance Hint Cost:  ", SwingConstants.RIGHT));
		panel.add(
		 distanceHintCostField  = new NumberField(rules.distanceHintCost));

		panel.add(new JLabel("Direction Hint Cost:  ", SwingConstants.RIGHT));
		panel.add(
		 directionHintCostField = new NumberField(rules.directionHintCost));
		
		return panel;
	}
	
	protected void doOK() {
		rules.turnCost = turnCostField.getInteger();
		rules.moveCost = moveCostField.getInteger();
		rules.distanceHintCost  = distanceHintCostField.getInteger();
		rules.directionHintCost = directionHintCostField.getInteger();
	}
}