diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/PrinterController.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/PrinterController.java index b23dcc9..b2e7ded 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/PrinterController.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/PrinterController.java @@ -6,16 +6,19 @@ package meerkat.voting.gui.controllersFX; import javafx.embed.swing.SwingFXUtils; import javafx.fxml.FXML; import javafx.scene.Node; +import javafx.scene.control.*; import javafx.scene.control.Label; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.StackPane; import javafx.scene.layout.VBox; +import javafx.scene.control.ScrollPane; import javafx.scene.text.Text; import meerkat.voting.gui.ui.CommandPend; import meerkat.voting.gui.ui.uicommands.UICommand; import javax.imageio.ImageIO; +import java.awt.*; import java.awt.image.BufferedImage; import java.io.IOException; import java.io.InputStream; @@ -26,10 +29,9 @@ import java.io.InputStream; public class PrinterController { /** Holder of vista. */ - @FXML - private VBox vBox; - @FXML - private Text content; + @FXML private VBox vBox; + @FXML private ScrollPane scrollPane; + @FXML private Text content; public void clean() { @@ -40,6 +42,7 @@ public class PrinterController { Text txt = new Text(s); vBox.getChildren().add(txt); vBox.getScene().getWindow().sizeToScene(); + adjustScrolling(vBox); } public void addContent(BufferedImage i) { @@ -50,6 +53,20 @@ public class PrinterController { // String old_content = content.getText(); // content.setText(old_content+"\n"+s); vBox.getScene().getWindow().sizeToScene(); + adjustScrolling(vBox); + } + + private void adjustScrolling(VBox content) { + scrollPane.setContent(content); + scrollPane.setFitToHeight(true); + } + + public void addSeparator() { + Separator sep = new Separator(); + sep.setMaxWidth(vBox.getPrefWidth()); + vBox.getChildren().add(sep); + adjustScrolling(vBox); + } } \ No newline at end of file diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/VistaNavigator.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/VistaNavigator.java index 76cf9da..1149dd1 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/VistaNavigator.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/controllersFX/VistaNavigator.java @@ -170,6 +170,19 @@ public class VistaNavigator { ); } + /** + * Prints an horizontal separator into the printer application layout. + */ + public static void printFXSeparator() { + Platform.runLater(new Runnable() { + @Override + public void run() { + printerController.addSeparator(); + } + } + ); + } + /** * Loads the 'LOADING' vista * vistaHolder pane of the main application layout. diff --git a/voting-booth-gui/src/main/java/meerkat/voting/gui/output/FXWindowOutputDevice.java b/voting-booth-gui/src/main/java/meerkat/voting/gui/output/FXWindowOutputDevice.java index 21da53a..f5fd725 100644 --- a/voting-booth-gui/src/main/java/meerkat/voting/gui/output/FXWindowOutputDevice.java +++ b/voting-booth-gui/src/main/java/meerkat/voting/gui/output/FXWindowOutputDevice.java @@ -60,6 +60,7 @@ public class FXWindowOutputDevice extends AsyncRunnableOutputDevice { */ public void doAudit(AuditOutputCommand command) { logger.debug("entered method doAudit"); + VistaNavigator.printFXSeparator(); String msg = "Auditing"; VistaNavigator.printFX(msg); BallotSecrets ballotSecrets = command.getBallotSecrets(); diff --git a/voting-booth-gui/src/main/resources/views/printer.fxml b/voting-booth-gui/src/main/resources/views/printer.fxml index aefb38a..d8ee827 100644 --- a/voting-booth-gui/src/main/resources/views/printer.fxml +++ b/voting-booth-gui/src/main/resources/views/printer.fxml @@ -1,10 +1,20 @@ + + - - + + + + + + - + + + + +