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;

public class VueA extends ViewFx {

	@FXML
	private Label labelA;

	@FXML
	private Button boutonA;

	@FXML
	private Button boutonB;

	@Override
	public void initialize() {
		Ntro.assertNotNull(labelA);
		Ntro.assertNotNull(boutonA);
		Ntro.assertNotNull(boutonB);
		
		boutonA.setOnAction(evtFx -> {

			Ntro.newEvent(EvtB.class).trigger();
			
		});
		
		boutonB.setOnAction(evtFx -> {
			
			Ntro.newMessage(MsgA.class)
			    .setParamA(MaquetteDepart.chaineAuHasard())
			    .setParamB(MaquetteDepart.entierAuHasard())
			    .send();
			
		});
	}

	public void methodeA(String paramA) {
		labelA.setText(paramA);
	}

}
