package depart.frontal.fragments;

import ca.ntro.app.Ntro;
import ca.ntro.app.frontend.ViewFragmentFx;
import depart.frontal.evenements.EvtB;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;

public class FragmentA extends ViewFragmentFx {
	
	@FXML
	private Label labelA;

	@FXML
	private Label labelB;

	@FXML
	private Button buttonA;
	
	private String attrA;

	@Override
	public void initialize() {
		Ntro.assertNotNull(labelA);
		Ntro.assertNotNull(labelB);
		Ntro.assertNotNull(buttonA);
		
		buttonA.setOnAction(evtFx -> {
			
			Ntro.newEvent(EvtB.class)
			    .setId(attrA)
			    .trigger();

		});
	}

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

	public void methodeB(double paramA) {
		labelB.setText(String.valueOf(paramA));
	}

}
