/*
 * 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.layout.HBox;

import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;

import javafx.scene.input.MouseEvent;

/**
 * @author Jamie Lynn
 */

public class SchoolBus extends CustomNode{

public override function create(): Node {

    visible = false;
    id = "SchoolBus";
        Group{
            content:[
                    Text {
                        translateX: Constants.WINDOW_WIDTH/2 - 175
                        translateY: Constants.WINDOW_HEIGHT/5
                        font : Font {size: 40}
                        fill: Color.WHITE
                        content: "School Bus Application"
                    }

                    ToggleButton{
                        id:"btnStartStop"
                        index: 0
                        translateX: Constants.WINDOW_WIDTH/2 - Constants.BUTTON_SIZE/2;
                        translateY: Constants.WINDOW_HEIGHT/3;
                        imageButton1: CommonFunctionsFX.getImage("play_lg");
                        imageButton2: CommonFunctionsFX.getImage("stop1_lg");
                        //Start
                        onclickButton1Action: function(){
                           //Set the vehicle type as SCHOOL BUS
                                mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_TYPE, structures.Constants.TYPE_SCHOOL_STRING);
                                //Insert the roadsign flag for dynamic signs
                                mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_ROADSIGN_ENABLE, "Yes");
                        }
                        //Stop
                        onclickButton2Action: function(){
                             //Remove roadsign flag from hashtable
                                mdot.Main.getMe().removeObject(structures.Constants.HASH_ROADSIGN_ENABLE);

                                //Change type back to vehicle
                                mdot.Main.getMe().setObjectAsString(structures.Constants.HASH_TYPE, structures.Constants.TYPE_VEHICLE.toString());
                        }
                    }
                ]
            }
    }
}
