package cn.hmsoft.ltc.controller;

import java.net.URL;
import java.util.ResourceBundle;

import cn.hmsoft.ltc.common.constants.LtContext;
import de.felixroske.jfxsupport.FXMLController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;


/**
 * 提示框页面
 * @author zq
 *
 */
@FXMLController
public class WarningController implements Initializable {
	
	@FXML 
	private AnchorPane warningAnchorPane;
	@FXML 
	private Label warningLab;
	@FXML
	private Button confirmBtn; 
	

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		
	}
	
	/**
	 * 确定
	 * @param event
	 */
	public void doConfirmFun(ActionEvent event) {
		// 关闭当前窗体
		((Node) (event.getSource())).getScene().getWindow().hide();
	}
	
	
	/**
	 * 提示框
	 * @param strTitle  标题
	 * @param waringStr  提示框内容
	 */
	public void getDialog(String strTitle,String waringStr) {
		try {
            AnchorPane page = FXMLLoader.load(getClass().getResource("/view/WarningView.fxml"));
            Scene newScene = new Scene(page);
            Stage stage = new Stage();
            //设置内容
            warningLab = new Label(waringStr);
            warningLab.setFont(Font.font("Cambria", 20));
            //把label填充到AnchorPane
            page.getChildren().add(warningLab);
            page.setCenterShape(true);
            //设置标题
            stage.setTitle(strTitle);
            stage.setScene(newScene);
            stage.show();
        }catch (Exception e){
            e.printStackTrace();
        }
	}
}
