moved code for fx to voting-booth-gui

android-scanner
Laura Radaelli 2017-01-25 16:01:13 +02:00
parent 0cf9390fa5
commit 480f4e52bb
30 changed files with 51 additions and 69 deletions

View File

@ -71,6 +71,9 @@ dependencies {
testCompile 'junit:junit:4.+'
runtime 'org.codehaus.groovy:groovy:2.4.+'
// Jar that creates QRcodes
compile 'com.google.zxing:core:3.3.0'
}

View File

@ -1,15 +1,16 @@
package meerkat.voting;
package meerkat.voting.gui;
import com.google.protobuf.ByteString;
import meerkat.crypto.DigitalSignature;
import meerkat.crypto.Encryption;
import meerkat.protobuf.Voting;
import meerkat.voting.ToyEncryption;
import meerkat.voting.ToySignature;
import meerkat.voting.controller.VotingBoothImpl;
import meerkat.voting.encryptor.VBCryptoManager;
import meerkat.voting.encryptor.VBCryptoManagerImpl;
import meerkat.voting.gui.ui.GraphicalUI;
import meerkat.voting.output.FXWindowOutputDevice;
import meerkat.voting.output.SystemConsoleOutputDevice;
import meerkat.voting.gui.uiFX.GraphicalUI;
import meerkat.voting.gui.output.FXWindowOutputDevice;
import meerkat.voting.storage.StorageManager;
import meerkat.voting.storage.StorageManagerMockup;

View File

@ -1,22 +1,8 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
import javafx.fxml.FXML;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
import meerkat.protobuf.Voting;
import meerkat.voting.controller.callbacks.CastOrAuditCallback;
import meerkat.voting.controller.callbacks.ControllerCallback;
import meerkat.voting.controller.callbacks.VoterCancelThrowable;
import meerkat.voting.gui.ui.UIUtils;
import meerkat.voting.gui.ui.VotingBoothUI;
import meerkat.voting.gui.ui.uicommands.CastOrAuditUICommand;
import meerkat.voting.gui.ui.uicommands.RaceVotingUICommand;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
//import meerkat.voting.gui.ui.UIUtils;

View File

@ -1,11 +1,7 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.control.Toggle;
import javafx.scene.control.ToggleGroup;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.Pane;
import javafx.scene.layout.VBox;
import javafx.scene.text.Text;
@ -14,9 +10,7 @@ import meerkat.voting.controller.callbacks.VoterCancelThrowable;
//import meerkat.voting.gui.ui.UIUtils;
import meerkat.voting.gui.ui.UIUtils;
import meerkat.voting.gui.ui.uicommands.ChannelChoiceUICommand;
import meerkat.voting.gui.ui.uicommands.UICommand;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
import javafx.fxml.FXML;
import meerkat.voting.gui.ui.uicommands.StartSessionUICommand;

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
/**
* Created by Laura on 01/12/2017.

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
/**
* Created by Laura on 12/16/2016.

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
/**
* Created by Laura on 01/12/2017.

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
/**
* Created by Laura on 12/16/2016.
@ -6,7 +6,7 @@ package meerkat.voting.gui.ui.controllersFX;
import javafx.application.Platform;
import javafx.fxml.FXMLLoader;
import javafx.scene.Node;
import meerkat.voting.gui.ui.GraphicalUI;
import meerkat.voting.gui.uiFX.GraphicalUI;
import meerkat.voting.gui.ui.uicommands.UICommand;
import java.awt.image.BufferedImage;

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
import javafx.fxml.FXML;
import javafx.scene.control.ToggleGroup;
@ -8,7 +8,6 @@ import javafx.scene.text.Text;
import meerkat.protobuf.Voting;
import meerkat.voting.controller.callbacks.VoterCancelThrowable;
import meerkat.voting.gui.ui.UIUtils;
import meerkat.voting.gui.ui.uicommands.ChannelChoiceUICommand;
import meerkat.voting.gui.ui.uicommands.RaceVotingUICommand;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package meerkat.voting.gui.ui.controllersFX;
package meerkat.voting.gui.controllersFX;
import javafx.fxml.FXML;
import meerkat.voting.gui.ui.uicommands.StartSessionUICommand;

View File

@ -1,4 +1,4 @@
package meerkat.voting.output;
package meerkat.voting.gui.output;
import com.google.protobuf.ByteString;
import com.google.zxing.WriterException;
@ -6,8 +6,8 @@ import meerkat.protobuf.Crypto.EncryptionRandomness;
import meerkat.protobuf.Crypto.RandomnessGenerationProof;
import meerkat.protobuf.Voting.BallotSecrets;
import meerkat.protobuf.Voting.PlaintextBallot;
import meerkat.protobuf.Voting.SignedEncryptedBallot;
import meerkat.voting.gui.ui.controllersFX.VistaNavigator;
import meerkat.voting.gui.controllersFX.VistaNavigator;
import meerkat.voting.output.AsyncRunnableOutputDevice;
import meerkat.voting.output.outputcommands.AuditOutputCommand;
import meerkat.voting.output.outputcommands.CancelOutputCommand;
import meerkat.voting.output.outputcommands.CastOutputCommand;

View File

@ -1,4 +1,4 @@
package meerkat.voting.output;
package meerkat.voting.gui.output;
/**
* Created by Laura on 1/25/2017.

View File

@ -1,8 +1,7 @@
package meerkat.voting.gui.ui;
package meerkat.voting.gui.uiFX;
import com.google.common.util.concurrent.FutureCallback;
import javafx.application.Application;
import javafx.fxml.FXML;
import javafx.geometry.Insets;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
@ -16,7 +15,11 @@ import meerkat.protobuf.Voting.BallotQuestion;
import meerkat.protobuf.Voting.UIElement;
import meerkat.protobuf.Voting.UIElementDataType;
import meerkat.voting.controller.callbacks.*;
import meerkat.voting.gui.ui.controllersFX.VistaNavigator;
import meerkat.voting.gui.controllersFX.VistaNavigator;
import meerkat.voting.gui.ui.CommandPend;
import meerkat.voting.gui.ui.TickerTimerTask;
import meerkat.voting.gui.ui.UIUtils;
import meerkat.voting.gui.ui.VotingBoothUI;
import meerkat.voting.gui.ui.uicommands.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,8 +1,10 @@
package meerkat.voting.gui.ui;
package meerkat.voting.gui.uiFX;
import meerkat.voting.gui.managment.VotingBoothGUIManager;
import meerkat.protobuf.Voting;
import meerkat.voting.controller.callbacks.*;
import meerkat.voting.gui.ui.CommandPend;
import meerkat.voting.gui.ui.TickerTimerTask;
import meerkat.voting.gui.ui.uicommands.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

View File

@ -1,18 +1,16 @@
package meerkat.voting.gui.ui;
package meerkat.voting.gui.uiFX;
/**
* Created by Laura on 12/12/2016.
*/
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.stage.Screen;
import javafx.stage.Stage;
import meerkat.voting.gui.ui.controllersFX.MainController;
import meerkat.voting.gui.ui.controllersFX.PrinterController;
import meerkat.voting.gui.ui.controllersFX.VistaNavigator;
import meerkat.voting.gui.controllersFX.MainController;
import meerkat.voting.gui.controllersFX.PrinterController;
import meerkat.voting.gui.controllersFX.VistaNavigator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javafx.fxml.FXMLLoader;

View File

@ -4,7 +4,7 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Text?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.CastOrAuditController">
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.CastOrAuditController">
<children>
<Text fx:id="question" layoutX="84.0" layoutY="89.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Cast or Audit?" textAlignment="CENTER" wrappingWidth="431.3046875" />
<Button layoutX="150.0" layoutY="200.0" mnemonicParsing="false" onMousePressed="#cast" prefHeight="50.0" prefWidth="90.0" text="Cast" />

View File

@ -4,7 +4,7 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Text?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.ChannelChoiceController">
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.ChannelChoiceController">
<children>
<Button layoutX="469.0" layoutY="343.0" mnemonicParsing="false" onMousePressed="#nextQuestion" text="Next" />
<Text fx:id="question" layoutX="84.0" layoutY="89.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Click 'Next' to see the first question." wrappingWidth="431.3046875" />

View File

@ -7,7 +7,7 @@
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.text.Font?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.EmptyStartController">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.EmptyStartController">
<columnConstraints>
<ColumnConstraints />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />

View File

@ -3,7 +3,7 @@
<?import javafx.scene.layout.StackPane?>
<?import javafx.scene.text.Text?>
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.LoadingController">
<StackPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.LoadingController">
<children>
<Text fx:id="loading_text" strokeType="OUTSIDE" strokeWidth="0.0" text="Loading..." />
</children>

View File

@ -6,7 +6,7 @@
<?import javafx.scene.layout.VBox?>
<?scenebuilder-stylesheet vista.css?>
<VBox prefHeight="709.0" prefWidth="1259.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.MainController">
<VBox prefHeight="709.0" prefWidth="1259.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.MainController">
<children>
<Label fx:id="headerLabel" maxWidth="1.7976931348623157E308" prefHeight="70.0" prefWidth="1162.0" text="Header of Election" textFill="#939090" VBox.vgrow="NEVER">
<VBox.margin>

View File

@ -3,7 +3,7 @@
<?import javafx.scene.layout.VBox?>
<?scenebuilder-stylesheet vista.css?>
<VBox fx:id="vBox" prefHeight="200.0" prefWidth="350.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.PrinterController">
<VBox fx:id="vBox" prefHeight="200.0" prefWidth="350.0" style="-fx-background-color: white;" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.PrinterController">
<children>
</children>

View File

@ -4,7 +4,7 @@
<?import javafx.scene.layout.Pane?>
<?import javafx.scene.text.Text?>
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.VotingController">
<Pane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.VotingController">
<children>
<Button layoutX="469.0" layoutY="343.0" mnemonicParsing="false" onMousePressed="#nextQuestion" text="Next" />
<Text fx:id="question" layoutX="84.0" layoutY="89.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Click 'Next' to see the first question." wrappingWidth="431.3046875" />

View File

@ -5,7 +5,7 @@
<?import java.lang.*?>
<?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.ui.controllersFX.WelcomeScreenController">
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.WelcomeScreenController">
<columnConstraints>
<ColumnConstraints />
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />

View File

@ -54,10 +54,6 @@ dependencies {
runtime 'ch.qos.logback:logback-classic:1.1.2'
runtime 'ch.qos.logback:logback-core:1.1.2'
// Jar that creates barcodes
compile group: 'net.sourceforge.barbecue', name: 'barbecue', version: '1.5-beta1'
compile 'com.google.zxing:core:3.3.0'
// Google protobufs
compile 'com.google.protobuf:protobuf-java:3.+'

View File

@ -8,7 +8,7 @@ import java.util.TimerTask;
/**
* A thread that sends the UI clock TickCommands in a given constant frequency
*/
class TickerTimerTask extends TimerTask {
public class TickerTimerTask extends TimerTask {
private CommandPend<UICommand> cmdPend;
public TickerTimerTask (CommandPend<UICommand> cmdPend) {
this.cmdPend = cmdPend;

View File

@ -32,7 +32,7 @@ public class UIUtils {
* @param question a ballot question to check
* @return True if the question data is only text
*/
static boolean isQuestionOnlyText(Voting.BallotQuestion question) {
public static boolean isQuestionOnlyText(Voting.BallotQuestion question) {
boolean isText = true;
if (question.getQuestion().getType() != Voting.UIElementDataType.TEXT
|| question.getDescription().getType() != Voting.UIElementDataType.TEXT) {
@ -52,7 +52,7 @@ public class UIUtils {
* @param questions list of the questions
* @param logger logger to which writing logs
*/
static void assertQuestionsAreValid (List<Voting.BallotQuestion> questions,Logger logger) {
public static void assertQuestionsAreValid (List<Voting.BallotQuestion> questions,Logger logger) {
for (int index = 0; index < questions.size(); ++index) {
Voting.BallotQuestion question = questions.get(index);
if (question.getIsMandatory()) {
@ -73,7 +73,7 @@ public class UIUtils {
* @param data string of data
* @return data converted to ut8 str
*/
static String bytesToString(ByteString data) {
public static String bytesToString(ByteString data) {
return data.toStringUtf8();
}

View File

@ -119,24 +119,24 @@ public abstract class AsyncRunnableOutputDevice implements BallotOutputDevice, R
* This method should be filled by an extending class. It should have the details of how to commit to a ballot
* @param command a CommitOutputCommand with the details and the callback
*/
abstract void doCommitToBallot(CommitOutputCommand command);
public abstract void doCommitToBallot(CommitOutputCommand command);
/**
* This method should be filled by an extending class. It should have the details of how to audit the ballot
* @param command a AuditOutputCommand with the details and the callback
*/
abstract void doAudit(AuditOutputCommand command);
public abstract void doAudit(AuditOutputCommand command);
/**
* This method should be filled by an extending class. It should have the details of how to cast the ballot
* @param command a CastOutputCommand with the details and the callback
*/
abstract void doCastBallot(CastOutputCommand command);
public abstract void doCastBallot(CastOutputCommand command);
/**
* This method should be filled by an extending class. It should have the details of how to cancel the ballot output
* @param command a CancelOutputCommand with the details and the callback
*/
abstract void doCancel(CancelOutputCommand command);
public abstract void doCancel(CancelOutputCommand command);
}