Added the creation of the barcode
parent
5a78f723e5
commit
c474bc5ffb
|
@ -59,6 +59,9 @@ dependencies {
|
|||
// Json configuraiton parsing
|
||||
compile name: 'java-json'
|
||||
|
||||
// Jar that creates barcodes
|
||||
compile name: 'barbecue-1.5-beta1'
|
||||
|
||||
testCompile 'junit:junit:4.+'
|
||||
|
||||
runtime 'org.codehaus.groovy:groovy:2.4.+'
|
||||
|
|
|
@ -13,7 +13,12 @@ import java.util.List;
|
|||
* 3. the ByteString (that contains bytes of image) of the person the voter selected
|
||||
*/
|
||||
public class VotersBallot {
|
||||
public List<Integer> Votershannel;
|
||||
public List<Integer> VoterChannel;
|
||||
public String VotersNameSelection;
|
||||
public ByteString VotersImageSelection;
|
||||
|
||||
public String toString(){
|
||||
return this.VotersNameSelection +"---"+ this.VoterChannel.get(0) + "" + this.VoterChannel.get(1) +
|
||||
this.VoterChannel.get(2) + "" + this.VoterChannel.get(3);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ public class VotersChoicesAdder {
|
|||
*/
|
||||
public void ShowVotersChoices() throws IOException {
|
||||
this.RemoveAllAnswers();
|
||||
this.addAnswer(this.getChannelChoice(this.votersBallot.Votershannel));
|
||||
this.addAnswer(this.getChannelChoice(this.votersBallot.VoterChannel));
|
||||
this.addAnswer(this.getNameChoice(this.votersBallot.VotersNameSelection));
|
||||
this.addAnswer(this.getImageChoice(this.votersBallot.VotersImageSelection));
|
||||
Label error = new Label();
|
||||
|
|
|
@ -45,7 +45,7 @@ public class StraightChannelSectionController extends TwoWayNode {
|
|||
* Updates the channel in the voters choise
|
||||
*/
|
||||
private void UpdateVotersChoise(){
|
||||
this.votersBallot.Votershannel = this.chanelValue;
|
||||
this.votersBallot.VoterChannel = this.chanelValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,6 +3,16 @@ package meerkat.voting.gui.panels.vote_have_been_cast;
|
|||
import javafx.fxml.FXML;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import meerkat.voting.gui.managment.TwoWayNode;
|
||||
import net.sourceforge.barbecue.Barcode;
|
||||
import net.sourceforge.barbecue.BarcodeException;
|
||||
import net.sourceforge.barbecue.BarcodeFactory;
|
||||
import net.sourceforge.barbecue.BarcodeImageHandler;
|
||||
import net.sourceforge.barbecue.output.OutputException;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
|
||||
|
@ -10,8 +20,20 @@ import meerkat.voting.gui.managment.TwoWayNode;
|
|||
*/
|
||||
public class VoteHaveBeenCastController extends TwoWayNode {
|
||||
|
||||
/**
|
||||
* This method prints the whole VotersBalliot into barcode
|
||||
*/
|
||||
private void createBarCode() throws BarcodeException, OutputException, IOException {
|
||||
Barcode barcode = BarcodeFactory.createCode128(this.votersBallot.toString());
|
||||
barcode.setFont(null);
|
||||
BufferedImage image = BarcodeImageHandler.getImage(barcode);
|
||||
File outputfile = new File("VotersBallot.png");
|
||||
ImageIO.write(image, "png", outputfile);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void backToWelcomeSplash(MouseEvent mousePress){
|
||||
private void backToWelcomeSplash(MouseEvent mousePress) throws BarcodeException, OutputException, IOException {
|
||||
this.createBarCode();
|
||||
this.currentStage.close();
|
||||
this.currentStage.setScene(this.previous.GetCurrentScene());
|
||||
this.previous.UpdateNode();
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue