/*
 * SchoolBus.fx
 *
 * Created on Nov 30, 2009, 8:30:44 PM
 */
package mdot_gui;

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.Node;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.control.CheckBox;
import mdot.Main;

/**
 * @author Jamie Lynn
 */
public class Configuration extends CustomNode {

    public override function create(): Node {
        visible = false;
        id = "Configuration";
        var cbConfig: CheckBox;
        Group {
            content: [
                Text {
                    translateX: Constants.WINDOW_WIDTH / 2 - 100
                    translateY: Constants.WINDOW_HEIGHT / 5
                    font: Font { size: 40 }
                    fill: Color.WHITE
                    content: "Configuration"
                }
                cbConfig = CheckBox {
                    allowTriState: false
                    translateX: Constants.WINDOW_WIDTH / 2 - 50
                    translateY: Constants.WINDOW_HEIGHT / 3
                    override var selected on replace {
                                if (selected) {
                                    Main.getMe().setObjectAsString(structures.Constants.HASH_TRACKING, "Yes");
                                } else {
                                    Main.getMe().removeObject(structures.Constants.HASH_TRACKING);
                                }
                            }
                }
                Text {
                    translateX: Constants.WINDOW_WIDTH / 2 - 30
                    translateY: Constants.WINDOW_HEIGHT / 3 + 16
                    font: Font { size: 20 }
                    fill: Color.WHITE
                    content: "Track Vehicle"
                }
                Group {
                    var cbDriverAge: CheckBox;
                    content: [
                        cbDriverAge = CheckBox {
                            translateX: Constants.WINDOW_WIDTH / 2 - 50
                            translateY: Constants.WINDOW_HEIGHT / 2.5
                            allowTriState: false
                            override var selected on replace {

                                        if (selected) {
                                            CommonFunctionsFX.DisableApps(Applications.driverRestriction);
                                        } else {
                                            CommonFunctionsFX.EnableApps(Applications.driverRestriction);
                                        }

                                    }
                        }
                        Text {
                            translateX: Constants.WINDOW_WIDTH / 2 - 30
                            translateY: Constants.WINDOW_HEIGHT / 2.5 + 16
                            font: Font { size: 20 }
                            fill: Color.WHITE
                            content: "Age Restriction"
                        }
                    ]
                }
            ]
        }
    }

}
