fixed printing auditing. Added separator.
parent
9db8d8708a
commit
95700f360e
|
@ -6,16 +6,19 @@ package meerkat.voting.gui.controllersFX;
|
||||||
import javafx.embed.swing.SwingFXUtils;
|
import javafx.embed.swing.SwingFXUtils;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.layout.StackPane;
|
import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.layout.VBox;
|
import javafx.scene.layout.VBox;
|
||||||
|
import javafx.scene.control.ScrollPane;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import meerkat.voting.gui.ui.CommandPend;
|
import meerkat.voting.gui.ui.CommandPend;
|
||||||
import meerkat.voting.gui.ui.uicommands.UICommand;
|
import meerkat.voting.gui.ui.uicommands.UICommand;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -26,10 +29,9 @@ import java.io.InputStream;
|
||||||
public class PrinterController {
|
public class PrinterController {
|
||||||
|
|
||||||
/** Holder of vista. */
|
/** Holder of vista. */
|
||||||
@FXML
|
@FXML private VBox vBox;
|
||||||
private VBox vBox;
|
@FXML private ScrollPane scrollPane;
|
||||||
@FXML
|
@FXML private Text content;
|
||||||
private Text content;
|
|
||||||
|
|
||||||
|
|
||||||
public void clean() {
|
public void clean() {
|
||||||
|
@ -40,6 +42,7 @@ public class PrinterController {
|
||||||
Text txt = new Text(s);
|
Text txt = new Text(s);
|
||||||
vBox.getChildren().add(txt);
|
vBox.getChildren().add(txt);
|
||||||
vBox.getScene().getWindow().sizeToScene();
|
vBox.getScene().getWindow().sizeToScene();
|
||||||
|
adjustScrolling(vBox);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addContent(BufferedImage i) {
|
public void addContent(BufferedImage i) {
|
||||||
|
@ -50,6 +53,20 @@ public class PrinterController {
|
||||||
// String old_content = content.getText();
|
// String old_content = content.getText();
|
||||||
// content.setText(old_content+"\n"+s);
|
// content.setText(old_content+"\n"+s);
|
||||||
vBox.getScene().getWindow().sizeToScene();
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -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
|
* Loads the 'LOADING' vista
|
||||||
* vistaHolder pane of the main application layout.
|
* vistaHolder pane of the main application layout.
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class FXWindowOutputDevice extends AsyncRunnableOutputDevice {
|
||||||
*/
|
*/
|
||||||
public void doAudit(AuditOutputCommand command) {
|
public void doAudit(AuditOutputCommand command) {
|
||||||
logger.debug("entered method doAudit");
|
logger.debug("entered method doAudit");
|
||||||
|
VistaNavigator.printFXSeparator();
|
||||||
String msg = "Auditing";
|
String msg = "Auditing";
|
||||||
VistaNavigator.printFX(msg);
|
VistaNavigator.printFX(msg);
|
||||||
BallotSecrets ballotSecrets = command.getBallotSecrets();
|
BallotSecrets ballotSecrets = command.getBallotSecrets();
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.scene.control.ScrollPane?>
|
||||||
|
<?import javafx.scene.layout.Pane?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?scenebuilder-stylesheet vista.css?>
|
<?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.controllersFX.PrinterController">
|
<Pane prefHeight="486.0" prefWidth="352.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="meerkat.voting.gui.controllersFX.PrinterController">
|
||||||
|
<children>
|
||||||
|
<ScrollPane fx:id="scrollPane" prefHeight="486.0" prefWidth="352.0">
|
||||||
|
<content>
|
||||||
|
<VBox fx:id="vBox" prefHeight="479.0" prefWidth="350.0" style="-fx-background-color: white;">
|
||||||
<children>
|
<children>
|
||||||
|
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
</content>
|
||||||
|
</ScrollPane>
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
|
|
Loading…
Reference in New Issue