package depart.frontal.vues;

import ca.ntro.app.Ntro;
import ca.ntro.app.frontend.ViewFx;
import depart.commun.messages.MsgA;
import depart.frontal.evenements.EvtB;
import depart.maquettes.MaquetteDepart;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.Pane;
import depart.frontal.fragments.FragmentA;
import ca.ntro.app.frontend.ViewLoader;
import ca.ntro.app.session.Session;
import depart.commun.valeurs.ValeurA;

public class VueA extends ViewFx {

	@FXML
	private Button boutonB;

	@FXML
	private Pane conteneurA;

	
	private ViewLoader<FragmentA> viewLoader;

	@Override
	public void initialize() {
		Ntro.assertNotNull(boutonB);
		Ntro.assertNotNull(conteneurA);
		
		boutonB.setOnAction(evtFx -> {
			
			Ntro.newMessage(MsgA.class)
			    .setId(MaquetteDepart.idAuHasard())
			    .send();
			
		});
	}

	public void methodeB(ViewLoader<FragmentA> paramA) {
		this.viewLoader = paramA;
	}


	public void methodeE() {
		conteneurA.getChildren().clear();
	}

	public void methodeF(ValeurA paramC) {
		FragmentA varA = viewLoader.createView();
		paramC.methodeA(varA);
		
		conteneurA.getChildren().add(varA.rootNode());
	}
}
