fx gui with mainController and navigator (incomplete again)
							parent
							
								
									5113c2235b
								
							
						
					
					
						commit
						c8044fc93d
					
				|  | @ -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); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | @ -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); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue