package de.ibsys.planningTool.controller;

import de.ibsys.planningTool.controller.tab.CapPlaController;
import de.ibsys.planningTool.controller.tab.ExportController;
import de.ibsys.planningTool.controller.tab.ForeCastController;
import de.ibsys.planningTool.controller.tab.XmlInputController;
import de.ibsys.planningTool.model.XmlInputData;
import de.ibsys.planningTool.model.xmlExportModel.DirectSell;
import de.ibsys.planningTool.model.xmlExportModel.Item;
import de.ibsys.planningTool.model.xmlExportModel.Order;
import de.ibsys.planningTool.model.xmlExportModel.WorkTime;
import de.ibsys.planningTool.util.I18N;
import javafx.fxml.FXML;
import javafx.scene.control.Tab;

import static de.ibsys.planningTool.util.I18N.*;

/**
 * Created by minhnguyen on 17.07.16.
 */
public class MainController {

	private String language = "de";
	private String country = "DE";

	private ResourceBundle translation;

	// Init Tabs
	@FXML
	public Tab welcome;

	@FXML
	public Tab forecast;

	@FXML
	public Tab disposition;

	@FXML
	public Tab exportTab;

	private XmlInputData xmlInputData;

	private List<Item> sellWish;

	private List<DirectSell> directSellList;

	private List<Order> orderList;

    @FXML
    private CapPlaController capPlaController;

    @FXML
    public void initialize() {
        System.out.println("Start Application");
        foreCastController.init(this);
        xmlInputController.init(this);
        exportController.init(this);
        capPlaController.init(this);
        xmlInputData = new XmlInputData();
        sellWish = new ArrayList<>();
        directSellList = new ArrayList<>();
        orderList = new ArrayList<>();
        productionList = new ArrayList<>();
        workTimeList = new ArrayList<>();
        forecastProductionList = new HashMap<>();
    }

	private List<WorkTime> workTimeList;

	// Program Production plan
	private Map<String, Item> forecastProductionList;

	@FXML
	private ForeCastController foreCastController;

	@FXML
	private XmlInputController xmlInputController;

	@FXML
	private ExportController exportController;

	@FXML
	public void initialize() {
		System.out.println("Start Application");
		foreCastController.init(this);
		xmlInputController.init(this);
		exportController.init(this);
		xmlInputData = new XmlInputData();
		sellWish = new ArrayList<>();
		directSellList = new ArrayList<>();
		orderList = new ArrayList<>();
		productionList = new ArrayList<>();
		workTimeList = new ArrayList<>();
		forecastProductionList = new HashMap<>();

		changeUILanguage();
	}

	public XmlInputData getXmlInputData() {
		return xmlInputData;
	}

	public void setXmlInputData(XmlInputData xmlInputData) {
		this.xmlInputData = xmlInputData;
	}

	public List<Item> getSellWish() {
		return sellWish;
	}

	public void setSellWish(List<Item> sellWish) {
		this.sellWish = sellWish;
	}

	public List<DirectSell> getDirectSellList() {
		return directSellList;
	}

	public void setDirectSellList(List<DirectSell> directSellList) {
		this.directSellList = directSellList;
	}

	public List<Order> getOrderList() {
		return orderList;
	}

	public void setOrderList(List<Order> orderList) {
		this.orderList = orderList;
	}

	public List<Item> getProductionList() {
		return productionList;
	}

	public void setProductionList(List<Item> productionList) {
		this.productionList = productionList;
	}

	public List<WorkTime> getWorkTimeList() {
		return workTimeList;
	}

	public void setWorkTimeList(List<WorkTime> workTimeList) {
		this.workTimeList = workTimeList;
	}

	public Map<String, Item> getForecastProductionList() {
		return forecastProductionList;
	}

	public void setForecastProductionList(Map<String, Item> forecastProductionList) {
		this.forecastProductionList = forecastProductionList;
	}
	
	public String getLanguage() {
		return language;
	}

	public void setLanguage(String language) {
		this.language = language;
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public void deleteSellLists() {
		sellWish.clear();
		directSellList.clear();
		forecastProductionList.clear();
	}

	public ResourceBundle getTranslation() {
		return translation;
	}

	public void setTranslation(ResourceBundle translation) {
		this.translation = translation;
	}

	public void changeUILanguage() {
		translation = I18N.translation(language, country);

		welcome.setText(translation.getString(WELCOME));
		forecast.setText(translation.getString(FORECAST));
		disposition.setText(translation.getString(DISPOSITION));
		exportTab.setText(translation.getString(Export_TAB));

		foreCastController.initUIComponents();
		exportController.initUIComponents();
		xmlInputController.initUIComponents();
	}

}

@@ -671,16 +671,37 @@
 l.Tab;%0A%0A
+import java.util.*;%0A%0A
 import s
@@ -741,16 +741,16 @@
 I18N.*;%0A
-
 %0A/**%0A * 
@@ -1208,613 +1208,43 @@
 t;%0A%0A
-    @FXML%0A    private CapPlaController capPlaController;%0A%0A    @FXML%0A    public void initialize() %7B%0A        System.out.println(%22Start Application%22);%0A        foreCastController.init(this);%0A        xmlInputController.init(this);%0A        exportController.init(this);%0A        capPlaController.init(this);%0A        xmlInputData = new XmlInputData();%0A        sellWish = new ArrayList%3C%3E();%0A        directSellList = new ArrayList%3C%3E();%0A        orderList = new ArrayList%3C%3E();%0A        productionList = new ArrayList%3C%3E();%0A        workTimeList = new ArrayList%3C%3E();%0A        forecastProductionList = new HashMap%3C%3E();%0A    %7D
+%09private List%3CItem%3E productionList;
 %0A%0A%09p
@@ -1356,24 +1356,76 @@
 ctionList;%0A%0A
+%09@FXML%0A%09private CapPlaController capPlaController;%0A%0A
 %09@FXML%0A%09priv
@@ -1720,16 +1720,16 @@
 (this);%0A
-
 %09%09export
@@ -1743,32 +1743,63 @@
 ler.init(this);%0A
+%09%09capPlaController.init(this);%0A
 %09%09xmlInputData =

fix merge fail