diff --git a/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/MainController.java b/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/MainController.java new file mode 100644 index 0000000..689a266 --- /dev/null +++ b/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/MainController.java @@ -0,0 +1,58 @@ +package meerkat.voting.gui.ui.controllersFX; + +/** + * Created by Laura on 12/16/2016. + */ +import javafx.fxml.FXML; +import javafx.scene.Node; +import javafx.scene.Parent; +import javafx.scene.layout.StackPane; +import meerkat.protobuf.Voting; +import meerkat.voting.controller.callbacks.VoterCancelThrowable; +import org.slf4j.Logger; +import meerkat.voting.gui.ui.uicommands.ChannelChoiceUICommand; +import meerkat.voting.gui.ui.uicommands.UICommand; + +import java.io.IOException; +import java.util.List; + +/** + * Main controller class for the entire layout. + */ +public class MainController { + + private UICommand currentCommand; + + /** Holder of a switchable vista. */ + @FXML + private StackPane vistaHolder; + + /** + * Replaces the vista displayed in the vista holder with a new vista. + * + * @param node the vista node to be swapped in. + */ + public void setVista(Node node) { + vistaHolder.getChildren().setAll(node); + } + + public void setCurrentCommand(UICommand command) { + this.currentCommand = command; + } + + public UICommand getCurrentCommand() { + while (this.currentCommand==null) { + ; + } + return this.currentCommand; + } + + public void showChannelChoiceScreen(ChannelChoiceUICommand command, Logger logger) { + this.currentCommand = command; + System.out.println("in FX showChannelChoiceScreen"); +// UIUtils.assertQuestionsAreValid (command.getQuestions(), logger); + + VistaNavigator.loadVista(VistaNavigator.CHANNEL_CHOICE); + } + +} \ No newline at end of file diff --git a/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/Vista1Controller.java b/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/Vista1Controller.java new file mode 100644 index 0000000..99f0924 --- /dev/null +++ b/voting-booth/src/main/java/meerkat/voting/gui/ui/controllersFX/Vista1Controller.java @@ -0,0 +1,23 @@ +package meerkat.voting.gui.ui.controllersFX; + +/** + * Created by Laura on 12/16/2016. + */ +import javafx.event.ActionEvent; +import javafx.fxml.FXML; + +/** + * Controller class for the first vista. + */ +public class Vista1Controller { + + /** + * Event handler fired when the user requests a new vista. + * + */ + @FXML + void nextPane() { + VistaNavigator.loadVista(VistaNavigator.VISTA_2); + } + +} \ No newline at end of file