Implementing the usage of voting booth gui config
parent
68291d34f3
commit
5267c7026f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -18,7 +18,7 @@ public class Main extends Application {
|
|||
ChainBuilder.Build(primaryStage, config);
|
||||
primaryStage.setTitle("Meerkat Polling Station");
|
||||
primaryStage.show();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
launch(args);
|
||||
|
|
|
@ -13,28 +13,28 @@ public abstract class TwoWayNode {
|
|||
protected Scene next;
|
||||
protected Scene previous;
|
||||
protected Stage currentStage;
|
||||
protected Scene currentNode;
|
||||
protected Scene currentScene;
|
||||
protected VotingBoothConfiguration config;
|
||||
|
||||
/**
|
||||
* Sets which next TwoWayNode
|
||||
* @param nextObject
|
||||
* @param nextObject the next TwoWayNode to which the flow will eventual arrive
|
||||
*/
|
||||
public void SetNext(TwoWayNode nextObject) {
|
||||
this.next = nextObject.GetNode();
|
||||
void SetNext(TwoWayNode nextObject) {
|
||||
this.next = nextObject.GetCurrentScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets which previous TwoWayNode
|
||||
* @param previousObject
|
||||
* @param previousObject the object that is one twoWayNode before current object
|
||||
*/
|
||||
public void SetPrevious(TwoWayNode previousObject) {
|
||||
this.previous = previousObject.GetNode();
|
||||
void SetPrevious(TwoWayNode previousObject) {
|
||||
this.previous = previousObject.GetCurrentScene();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the stage of current object
|
||||
* @param primaryStage
|
||||
* @param primaryStage the primary stage on which all the panels displayed
|
||||
*/
|
||||
public void SetStage(Stage primaryStage) {
|
||||
this.currentStage = primaryStage;
|
||||
|
@ -42,18 +42,18 @@ public abstract class TwoWayNode {
|
|||
|
||||
/**
|
||||
* Sets the current parent node
|
||||
* @param parent
|
||||
* @param parent the object that is the current new scene
|
||||
*/
|
||||
public void SetParent(Parent parent) {
|
||||
this.currentNode = new Scene(parent);
|
||||
public void SetCurrentScene(Parent parent) {
|
||||
this.currentScene = new Scene(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* GetNode return the paren node that represents current object
|
||||
* GetCurrentScene return the paren node that represents current object
|
||||
* @return Paren object
|
||||
*/
|
||||
public Scene GetNode() {
|
||||
return this.currentNode;
|
||||
private Scene GetCurrentScene() {
|
||||
return this.currentScene;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,4 +63,10 @@ public abstract class TwoWayNode {
|
|||
public void SetConfig(VotingBoothConfiguration config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should updates the visual state of the node baed on pased configuration
|
||||
* this method will be called right before we going get this node to be represented
|
||||
*/
|
||||
public abstract void UpdateNode();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import meerkat.voting.VotingBooth;
|
|||
import meerkat.voting.ui.VotingBoothUI;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.validation.constraints.Null;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -23,4 +23,17 @@ public class SelectCandidateNameController extends TwoWayNode {
|
|||
this.currentStage.setScene(this.next);
|
||||
this.currentStage.show();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the voter options according to the VotingBoothConfiguration
|
||||
*/
|
||||
private void UpdateVoterOptions(){
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UpdateNode() {
|
||||
this.UpdateVoterOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,4 +19,9 @@ public class StraightChannelSectionController extends TwoWayNode {
|
|||
this.currentStage.setScene(this.next);
|
||||
this.currentStage.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UpdateNode() {
|
||||
// Does it suppose to show the channel ?
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public class StraightChannelSectionLoader {
|
|||
StraightChannelSectionController controller = fxmlLoader.getController();
|
||||
|
||||
// set the controller to be functional TwoWayNode
|
||||
controller.SetParent(straightChannelSection);
|
||||
controller.SetCurrentScene(straightChannelSection);
|
||||
controller.SetStage(currentStage);
|
||||
|
||||
// set the controller to have the configuration file
|
||||
|
|
|
@ -7,4 +7,9 @@ import meerkat.voting.gui.TwoWayNode;
|
|||
* VoteHaveBeenCastController is in charge of handle the vote that have been casted
|
||||
*/
|
||||
public class VoteHaveBeenCastController extends TwoWayNode {
|
||||
|
||||
@Override
|
||||
public void UpdateNode() {
|
||||
// This panel doesn't have any questions representations that why there is nothing ti show here
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public class VoteHaveBeenCastLoader {
|
|||
VoteHaveBeenCastController controller = fxmlLoader.getController();
|
||||
|
||||
// set the controller to be functional TwoWayNode
|
||||
controller.SetParent(voteHaveBeenCast);
|
||||
controller.SetCurrentScene(voteHaveBeenCast);
|
||||
controller.SetStage(currentStage);
|
||||
|
||||
// set the controller to have the configuration file
|
||||
|
|
|
@ -17,4 +17,9 @@ public class WelcomeSplashController extends TwoWayNode {
|
|||
this.currentStage.setScene(this.next);
|
||||
this.currentStage.show();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UpdateNode() {
|
||||
// There is no questions relevant to this panel so this method does nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class WelcomeSplashLoader {
|
|||
WelcomeSplashController controller = this.fxmlLoader.getController();
|
||||
|
||||
// set the controller to be functional TwoWayNode
|
||||
controller.SetParent(welcomeSplash);
|
||||
controller.SetCurrentScene(welcomeSplash);
|
||||
controller.SetStage(currentStage);
|
||||
|
||||
// set the controller to have the configuration file
|
||||
|
|
Loading…
Reference in New Issue