2016-06-18 10:52:29 -04:00
|
|
|
package polling_station_dashboard.search.submitVoter.java;
|
|
|
|
|
2016-06-18 11:19:38 -04:00
|
|
|
import javafx.fxml.FXMLLoader;
|
|
|
|
import javafx.scene.Parent;
|
2016-06-18 12:00:02 -04:00
|
|
|
import javafx.scene.control.Label;
|
2016-06-18 11:19:38 -04:00
|
|
|
import javafx.scene.layout.Pane;
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
2016-06-18 12:00:02 -04:00
|
|
|
import java.util.HashMap;
|
2016-06-18 11:19:38 -04:00
|
|
|
|
2016-06-18 10:52:29 -04:00
|
|
|
/**
|
|
|
|
* Created by Vladimir Eliezer Tokarev on 18/06/2016.
|
2016-06-18 11:19:38 -04:00
|
|
|
* SubmitVoterLoader Loads the submit voter fxml
|
2016-06-18 10:52:29 -04:00
|
|
|
*/
|
|
|
|
public class SubmitVoterLoader {
|
2016-06-18 11:19:38 -04:00
|
|
|
|
|
|
|
private static final String SUBMIT_VOTER_FXML_PATH = "../fxml/submit_voter.fxml";
|
|
|
|
|
|
|
|
private Stage currentStage;
|
2016-06-18 12:00:02 -04:00
|
|
|
private FXMLLoader fxmlLoader;
|
|
|
|
|
|
|
|
private void ResetVoterParams(HashMap<String, String> voter, Parent root)
|
|
|
|
{
|
|
|
|
((Label)root.lookup("#IDNumberValue")).setText(voter.get("IDNumber"));
|
|
|
|
((Label)root.lookup("#EligibleToVoteValue")).setText(voter.get("EligibleToVote"));
|
|
|
|
((Label)root.lookup("#StatusValue")).setText(voter.get("Status"));
|
|
|
|
((Label)root.lookup("#ChannelValue")).setText(voter.get("Channel"));
|
|
|
|
}
|
2016-06-18 11:19:38 -04:00
|
|
|
|
|
|
|
public SubmitVoterLoader (Stage primaryStage) throws IOException
|
|
|
|
{
|
|
|
|
currentStage = primaryStage;
|
2016-06-18 12:00:02 -04:00
|
|
|
this.fxmlLoader = new FXMLLoader(getClass().getResource(SUBMIT_VOTER_FXML_PATH));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void GenerateVoterSubmit(HashMap<String, String> voter) throws IOException
|
|
|
|
{
|
|
|
|
Parent root = this.fxmlLoader.load();
|
|
|
|
ResetVoterParams(voter, root);
|
2016-06-18 11:19:38 -04:00
|
|
|
|
2016-06-18 12:00:02 -04:00
|
|
|
SubmitVoterController controller = fxmlLoader.getController();
|
2016-06-18 11:19:38 -04:00
|
|
|
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
|
|
|
addEditPane.getChildren().add(root);
|
2016-06-18 12:00:02 -04:00
|
|
|
controller.SetStage(currentStage);
|
2016-06-18 11:19:38 -04:00
|
|
|
}
|
2016-06-18 10:52:29 -04:00
|
|
|
}
|