Addded logging to all of the panels.

android-scanner
VladimirEliTokarev 2016-10-24 16:31:48 +03:00
parent 37f8893224
commit 0af9d94a73
19 changed files with 150 additions and 16 deletions

View File

@ -3,6 +3,8 @@ package meerkat.voting.gui.panels.ballot_summary;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -11,12 +13,16 @@ import java.io.IOException;
* BallotSummaryController handle the behavior of ballot summary screen
*/
public class BallotSummaryController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(VotersChoicesAdder.class);
@FXML
private void GetToSelectByPicture(MouseEvent mousePressed){
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to select candidate by picture panel.");
}
@FXML
@ -25,6 +31,7 @@ public class BallotSummaryController extends TwoWayNode {
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to cast or audit panel.");
}
/**
@ -33,15 +40,16 @@ public class BallotSummaryController extends TwoWayNode {
private void ShowAllVotersChoices() throws IOException {
VotersChoicesAdder votersChoicesAdder = new VotersChoicesAdder(this.currentStage, this.votersBallot);
votersChoicesAdder.ShowVotersChoices();
this.logger.debug("Created voters choises adder and added all the choises.");
}
@Override
public void UpdateNode() {
try {
this.ShowAllVotersChoices();
this.logger.debug("Showed all the voters answers.");
} catch (IOException e) {
e.printStackTrace();
// TODO: log about it
this.logger.error(e.getMessage());
}
}
}

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.ballot_summary;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* BallotSummaryLoader gives the option to whatch summary of voter actions
*/
public class BallotSummaryLoader {
private final Logger logger = LoggerFactory.getLogger(BallotSummaryLoader.class);
private static final String BALLOT_SUMMARY_FXML_PATH = "/view/ballot_summary.fxml";
private Stage currentStage;
@ -24,6 +28,7 @@ public class BallotSummaryLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(BALLOT_SUMMARY_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created ballot summary loader object.");
}
/**
@ -42,6 +47,7 @@ public class BallotSummaryLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Returns ballot summary controller object.");
return controller;
}

View File

@ -10,6 +10,8 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.VotersBallot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@ -20,7 +22,9 @@ import java.util.List;
* Created by Vladimir Eliezer Tokarev on 10/5/2016.
* This object add all the information inputed by the voter and displays it in the right section
*/
public class VotersChoicesAdder {
class VotersChoicesAdder {
private final Logger logger = LoggerFactory.getLogger(VotersChoicesAdder.class);
private Stage currentStage;
private int rowIndex;
private VotersBallot votersBallot;
@ -32,12 +36,13 @@ public class VotersChoicesAdder {
// The lookup works only after the css have been randered
this.currentStage.getScene().getRoot().applyCss();
this.logger.debug("Created voters choises adder.");
}
/**
* Adds all of the voters choises to the right panel
*/
public void ShowVotersChoices() throws IOException {
void ShowVotersChoices() throws IOException {
this.RemoveAllAnswers();
this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel));
this.addAnswer(this.getNameChoice(this.votersBallot.VotersNameSelection));
@ -45,6 +50,7 @@ public class VotersChoicesAdder {
Label error = new Label();
error.setPrefSize(250,30);
this.addAnswer(error);
this.logger.debug("Add all the choises of the voter to the represent grid pane.");
}
/**
@ -52,6 +58,7 @@ public class VotersChoicesAdder {
*/
private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size());
this.logger.debug("Removed all the previous voters choises.");
}
/**
@ -76,6 +83,7 @@ public class VotersChoicesAdder {
container.add(borderPane, 0, this.rowIndex);
this.currentStage.show();
this.logger.debug("Added other answer to answers pane.");
}
/**
@ -94,6 +102,7 @@ public class VotersChoicesAdder {
imageView.setImage(image);
}
this.logger.debug("Wraps given image into image answer and returns it.");
return imageView;
}
@ -111,6 +120,7 @@ public class VotersChoicesAdder {
borderPane.setCenter(label);
borderPane.setPrefSize(250, 30);
}
this.logger.debug("Adds the voters channel selection into grid pane and returns it.");
return borderPane;
}
@ -128,6 +138,7 @@ public class VotersChoicesAdder {
borderPane.setCenter(label);
borderPane.setPrefSize(250,30);
}
this.logger.debug("Wraps the given answer name by candidate in grid pane and returns it.");
return borderPane;
}
}

View File

@ -3,6 +3,8 @@ package meerkat.voting.gui.panels.cast_or_audit;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
@ -10,12 +12,15 @@ import meerkat.voting.gui.managment.TwoWayNode;
*/
public class CastOrAuditController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(CastOrAuditController.class);
@FXML
private void GetToVoteHaveBeenCast(MouseEvent mousePressed) {
this.currentStage.close();
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to vote have been cast panel.");
}
@FXML
@ -24,6 +29,7 @@ public class CastOrAuditController extends TwoWayNode {
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to thank for auditing panel.");
}
@Override

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.cast_or_audit;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* CastOrAuditLoader creates starlight channel section object and sets its controller
*/
public class CastOrAuditLoader {
private final Logger logger = LoggerFactory.getLogger(CastOrAuditLoader.class);
private static final String CAST_OR_AUDIT_FXML_PATH = "/view/cast_or_audit.fxml";
private Stage currentStage;
@ -24,6 +28,7 @@ public class CastOrAuditLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(CAST_OR_AUDIT_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created cast or audit loader object.");
}
/**
@ -42,6 +47,7 @@ public class CastOrAuditLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Returns cast or qaudit controller object.");
return controller;
}

View File

@ -14,6 +14,8 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import meerkat.protobuf.BallotQuestionUIElementOuterClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@ -29,10 +31,12 @@ import java.util.Objects;
* This object updates the visual representations of the voters binaryDatas
*/
class PicturesAnswersUpdater implements EventHandler{
private final Logger logger = LoggerFactory.getLogger(PicturesAnswersUpdater.class);
private Stage currentStage;
private int columIndex;
private List<ByteString> allAvailableAnswers;
private ByteString answer;
private FutureCallback<ByteString> imageUpdate;
PicturesAnswersUpdater(Stage primaryStage) {
@ -41,6 +45,7 @@ class PicturesAnswersUpdater implements EventHandler{
// The lookup works only after the css have been randered
this.currentStage.getScene().getRoot().applyCss();
this.allAvailableAnswers = new ArrayList<>();
this.logger.debug("Created pictures answers updater.");
}
/**
@ -72,6 +77,7 @@ class PicturesAnswersUpdater implements EventHandler{
}
}
this.currentStage.show();
this.logger.debug("Updated the all the pictures answers.");
}
/**
@ -88,9 +94,9 @@ class PicturesAnswersUpdater implements EventHandler{
*/
private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size());
this.logger.debug("Removed all the current answers.");
}
/**
* Creates binaryData element which is grid pane with the binaryData and check box
*
@ -119,6 +125,7 @@ class PicturesAnswersUpdater implements EventHandler{
gridPane.setPrefSize(100, 100);
gridPane.setPadding(new Insets(10));
this.logger.debug("Wraped the given picrute in grid panel and returens it.");
return gridPane;
}
@ -136,6 +143,7 @@ class PicturesAnswersUpdater implements EventHandler{
container.add(newAnswer, this.columIndex, 0);
this.currentStage.show();
this.logger.debug("Added the answer picture to the answers grid pane.");
}
/**
@ -152,7 +160,7 @@ class PicturesAnswersUpdater implements EventHandler{
checkBox.fire();
}
}
this.logger.debug("Unchecked all the answers that the voter hasnt selected.");
}
@Override

View File

@ -5,6 +5,8 @@ import com.google.protobuf.ByteString;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
@ -12,12 +14,15 @@ import meerkat.voting.gui.managment.TwoWayNode;
*/
public class SelectCandidateByPictureController extends TwoWayNode implements FutureCallback<ByteString> {
private final Logger logger = LoggerFactory.getLogger(SelectCandidateByPictureController.class);
@FXML
private void GetToSelectByName(MouseEvent mousePressed){
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to select candidate by name panel.");
}
@FXML
@ -26,6 +31,7 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to ballot summary panel.");
}
/**
@ -35,6 +41,7 @@ public class SelectCandidateByPictureController extends TwoWayNode implements Fu
PicturesAnswersUpdater updater = new PicturesAnswersUpdater(this.currentStage);
updater.SetImageUpdate(this);
updater.UpdateAnswers(this.config.NameSelectionByPictureQuestion);
this.logger.debug("Created pictures answers updater and updated the answers.");
}
@Override

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.select_candidate_by_picture;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
/**
@ -13,6 +15,7 @@ import java.io.IOException;
*/
public class SelectCandidateByPictureLoader {
private final Logger logger = LoggerFactory.getLogger(SelectCandidateByPictureLoader.class);
private static final String SELECT_CANDIDATE_BY_PICTURE_FXML_PATH = "/view/select_candidate_by_picture.fxml";
private Stage currentStage;
@ -24,6 +27,7 @@ public class SelectCandidateByPictureLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(SELECT_CANDIDATE_BY_PICTURE_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created the select candidate by picture loader object.");
}
/**
@ -42,6 +46,7 @@ public class SelectCandidateByPictureLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created select candidate by picture controller object.");
return controller;
}

View File

@ -4,18 +4,23 @@ import com.google.common.util.concurrent.FutureCallback;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
* SelectCandidateNameController handle the behavior of select by name screen
*/
public class SelectCandidateNameController extends TwoWayNode implements FutureCallback<String>{
private final Logger logger = LoggerFactory.getLogger(SelectCandidateNameController.class);
@FXML
private void GetToSelectChannel(MouseEvent mousePressed){
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to straigth select channel panel.");
}
@FXML
@ -24,6 +29,7 @@ public class SelectCandidateNameController extends TwoWayNode implements FutureC
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to select candidate by name panel.");
}
/**
@ -33,6 +39,7 @@ public class SelectCandidateNameController extends TwoWayNode implements FutureC
StringsAnswersUpdater updater = new StringsAnswersUpdater(this.currentStage);
updater.UpdateAnswers(this.config.NameSelectionQuestion);
updater.SetUpdateAnswers(this);
this.logger.debug("Created strings answer updater and updated the answers.");
}
@Override

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.select_candidate_name;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* SelectCandidateNameLoader creates the option to choose by name
*/
public class SelectCandidateNameLoader {
private final Logger logger = LoggerFactory.getLogger(SelectCandidateNameLoader.class);
private static final String SELECT_CANDIDATE_NAME_FXML_PATH = "/view/select_candidate_name.fxml";
private Stage currentStage;
@ -24,6 +28,7 @@ public class SelectCandidateNameLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(SELECT_CANDIDATE_NAME_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created the select candidate name loader object.");
}
/**
@ -42,6 +47,7 @@ public class SelectCandidateNameLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created and returns the get select candidate name controller object.");
return controller;
}

View File

@ -9,6 +9,8 @@ import javafx.scene.control.Label;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import meerkat.protobuf.BallotQuestionUIElementOuterClass;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collections;
@ -22,6 +24,8 @@ import java.util.Objects;
* the different names that there are in the config object and saves the use answer
*/
class StringsAnswersUpdater implements javafx.event.EventHandler{
private final Logger logger = LoggerFactory.getLogger(StringsAnswersUpdater.class);
private Stage currentStage;
private int rowAmount;
private FutureCallback<String> updateAnswer;
@ -31,6 +35,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
this.rowAmount = 0;
// The lookup works only after the css have been randered
this.currentStage.getScene().getRoot().applyCss();
this.logger.debug("Created new StringsAnswersUpdater object.");
}
/**
@ -54,6 +59,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
*/
private void RemoveAllAnswers() {
this.GetAnswersContainer().getChildren().remove(0, this.GetAnswersContainer().getChildren().size() );
this.logger.debug("Removed all current answers from answers grid pane.");
}
/**
@ -75,6 +81,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
GridPane.setConstraints(checkBox, 10, 1);
gridPane.getChildren().addAll(label, checkBox);
this.logger.debug("Wraped answer (" + answer + " ) in answer element and returned it.");
return gridPane;
}
@ -90,6 +97,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
this.rowAmount++;
container.add(newAnswer, 0, this.rowAmount);
this.logger.debug("Added " + answer + " to all answers");
}
/**
@ -109,6 +117,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
this.AddAnswer(bytesAnswer.toStringUtf8());
}
this.currentStage.show();
this.logger.debug("Removed all the old answers and add all the news ones.");
}
/**
@ -124,7 +133,7 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
checkBox.fire();
}
}
this.logger.debug("Unchecked all the answers that the voter havnt choose.");
}
@Override

View File

@ -5,6 +5,8 @@ import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
@ -14,6 +16,9 @@ import java.util.List;
* StraightChannelSectionController handle the behavior of select channel section screen
*/
public class StraightChannelSectionController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(StraightChannelSectionLoader.class);
private List<Integer> chanelValue;
private int pointer;
private boolean lock;
@ -24,6 +29,7 @@ public class StraightChannelSectionController extends TwoWayNode {
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Created the proceess to name selection object loader.");
}
@Override
@ -33,11 +39,16 @@ public class StraightChannelSectionController extends TwoWayNode {
public void UpdateNode() {
this.pointer = 0;
this.lock = false;
// created the channel value list
// every value in the list represents one of the cells values
this.chanelValue = new ArrayList<>();
this.chanelValue.add(0);
this.chanelValue.add(0);
this.chanelValue.add(0);
this.chanelValue.add(0);
this.logger.debug("Created and filled with zeros the channel value.");
this.updateVisualChanel();
}
@ -57,6 +68,7 @@ public class StraightChannelSectionController extends TwoWayNode {
TextField textField = ((TextField)this.currentStage.getScene().lookup(id));
textField.setText(String.valueOf(this.chanelValue.get(i)));
}
this.logger.debug("Updated the visual representation of the channel (its visual value).");
}
@FXML
@ -70,6 +82,7 @@ public class StraightChannelSectionController extends TwoWayNode {
if (this.pointer == 4) {
this.lock = true;
}
this.logger.debug("The " + value +" button have been pressed, then this value was pushed to channel value.");
}
}
@ -77,12 +90,14 @@ public class StraightChannelSectionController extends TwoWayNode {
private void clearLastNumber(MouseEvent mousePressed){
if (this.pointer >= 1) {
int lastValueLocation = this.pointer - 1;
int lastValue = this.chanelValue.get(lastValueLocation);
this.chanelValue.set(lastValueLocation, 0);
this.currentStage.show();
this.pointer--;
this.updateVisualChanel();
this.UpdateVotersChoise();
this.lock = false;
this.logger.debug("The last value was removed from channel value (the value was " + lastValue + " ).");
}
}

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.straight_channel_section;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,9 @@ import java.io.IOException;
* StraightChannelSectionLoader creates starlight channel section object and sets its controller
*/
public class StraightChannelSectionLoader {
private final Logger logger = LoggerFactory.getLogger(StraightChannelSectionLoader.class);
private static final String STRAIGHT_CHANNEL_LOADER_FXML_PATH = "/view/straight_channel_section.fxml";
private Stage currentStage;
@ -24,6 +29,7 @@ public class StraightChannelSectionLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(STRAIGHT_CHANNEL_LOADER_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created the straight channel section loader object.");
}
/**
@ -42,6 +48,7 @@ public class StraightChannelSectionLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created the straight channel section controller.");
return controller;
}

View File

@ -3,6 +3,8 @@ package meerkat.voting.gui.panels.thank_for_audditing;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Vladimir Eliezer Tokarev on 10/5/2016.
@ -10,12 +12,15 @@ import meerkat.voting.gui.managment.TwoWayNode;
*/
public class ThankForAuditingController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(ThankForAuditingLoader.class);
@FXML
private void GetBackToStart(MouseEvent boutonPressed) {
this.currentStage.close();
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping back to the welcome splash screen.");
}
@Override

View File

@ -5,6 +5,8 @@ import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* This class load the pannel that represent the thank u message
*/
public class ThankForAuditingLoader {
private final Logger logger = LoggerFactory.getLogger(ThankForAuditingLoader.class);
private static final String THANK_FOR_AUDITING_FXML_PATH = "/view/thank_for_auditing.fxml";
private Stage currentStage;
@ -24,6 +28,7 @@ public class ThankForAuditingLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(THANK_FOR_AUDITING_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created the Thank for auditing Loader object.");
}
/**
@ -42,6 +47,7 @@ public class ThankForAuditingLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created the thank for auditing controller object.");
return controller;
}
}

View File

@ -8,6 +8,8 @@ import net.sourceforge.barbecue.BarcodeException;
import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.BarcodeImageHandler;
import net.sourceforge.barbecue.output.OutputException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
@ -20,6 +22,8 @@ import java.io.IOException;
*/
public class VoteHaveBeenCastController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(VoteHaveBeenCastController.class);
/**
* This method prints the whole VotersBalliot into barcode
*/
@ -29,6 +33,7 @@ public class VoteHaveBeenCastController extends TwoWayNode {
BufferedImage image = BarcodeImageHandler.getImage(barcode);
File outputfile = new File("VotersBallot.png");
ImageIO.write(image, "png", outputfile);
this.logger.debug("Created the bar code with voters choises at VotersBallot.png.");
}
@FXML
@ -38,6 +43,7 @@ public class VoteHaveBeenCastController extends TwoWayNode {
this.currentStage.setScene(this.previous.GetCurrentScene());
this.previous.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping back to the welcome splash panel.");
}
@Override

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.vote_have_been_cast;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* VoteHaveBeenCastLoader laods the screen that in charge of handling the voting end
*/
public class VoteHaveBeenCastLoader {
private final Logger logger = LoggerFactory.getLogger(VoteHaveBeenCastLoader.class);
private static final String VOTE_HAVE_BEEN_CAST_FXML_PATH = "/view/vote_have_been_cast.fxml";
private Stage currentStage;
@ -24,12 +28,12 @@ public class VoteHaveBeenCastLoader {
this.fxmlLoader = new FXMLLoader(getClass().getResource(VOTE_HAVE_BEEN_CAST_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
this.logger.debug("Created the vote have been cast loader.");
}
/**
* Creates welcome splash parent node and sets it to the controller
* @return TwoWayNode
* @throws IOException
*/
public TwoWayNode GetVoteHaveBeenCast() throws IOException {
Parent voteHaveBeenCast = fxmlLoader.load();
@ -42,6 +46,7 @@ public class VoteHaveBeenCastLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created the vote have been cast controller.");
return controller;
}
}

View File

@ -3,6 +3,8 @@ package meerkat.voting.gui.panels.welcome_splash;
import javafx.fxml.FXML;
import javafx.scene.input.MouseEvent;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
@ -10,12 +12,15 @@ import meerkat.voting.gui.managment.TwoWayNode;
*/
public class WelcomeSplashController extends TwoWayNode {
private final Logger logger = LoggerFactory.getLogger(WelcomeSplashController.class);
@FXML
private void StartVotingProcess(MouseEvent mousePressed) {
this.currentStage.close();
this.currentStage.setScene(this.next.GetCurrentScene());
this.next.UpdateNode();
this.currentStage.show();
this.logger.debug("Jumping to the select channel object.");
}
@Override

View File

@ -3,8 +3,10 @@ package meerkat.voting.gui.panels.welcome_splash;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.stage.Stage;
import meerkat.voting.gui.managment.TwoWayNode;
import meerkat.voting.gui.configuration.VotingBoothConfiguration;
import meerkat.voting.gui.managment.TwoWayNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
@ -13,6 +15,8 @@ import java.io.IOException;
* WelcomeSplashLoader creates welcome spalash object and sets its controller
*/
public class WelcomeSplashLoader {
private final Logger logger = LoggerFactory.getLogger(WelcomeSplashLoader.class);
private static final String WELCOME_SPLASH_FXML_PATH = "/view/welcome_splash_screen.fxml";
private Stage currentStage;
@ -21,6 +25,7 @@ public class WelcomeSplashLoader {
public WelcomeSplashLoader(Stage primaryStage, VotingBoothConfiguration config) throws IOException
{
this.logger.debug("Created the welcome splash loader which loads the first pannel.");
this.fxmlLoader = new FXMLLoader(getClass().getResource(WELCOME_SPLASH_FXML_PATH));
this.currentStage = primaryStage;
this.config = config;
@ -42,6 +47,7 @@ public class WelcomeSplashLoader {
// set the controller to have the configuration file
controller.SetConfig(this.config);
this.logger.debug("Created the welcome splash controller.");
return controller;
}
}