Added the selection of the channel
parent
6e47a4df98
commit
80a032d373
|
@ -119,7 +119,6 @@ class StringsAnswersUpdater implements javafx.event.EventHandler{
|
||||||
if (target.isSelected()) {
|
if (target.isSelected()) {
|
||||||
String answer = target.getId().split("-")[0];
|
String answer = target.getId().split("-")[0];
|
||||||
this.answer = answer;
|
this.answer = answer;
|
||||||
System.out.println(answer);
|
|
||||||
this.uncheckBoxes(target);
|
this.uncheckBoxes(target);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,22 @@
|
||||||
package meerkat.voting.gui.straight_channel_section;
|
package meerkat.voting.gui.straight_channel_section;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
import javafx.scene.input.MouseEvent;
|
import javafx.scene.input.MouseEvent;
|
||||||
import meerkat.voting.gui.TwoWayNode;
|
import meerkat.voting.gui.TwoWayNode;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
|
* Created by Vladimir Eliezer Tokarev on 8/27/2016.
|
||||||
* StraightChannelSectionController handle the behavior of select channel section screen
|
* StraightChannelSectionController handle the behavior of select channel section screen
|
||||||
*/
|
*/
|
||||||
public class StraightChannelSectionController extends TwoWayNode {
|
public class StraightChannelSectionController extends TwoWayNode {
|
||||||
|
private List<Integer> chanelValue;
|
||||||
|
private int pointer;
|
||||||
|
private boolean lock;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void ProceedToNameSelection(MouseEvent boutonPressed) {
|
private void ProceedToNameSelection(MouseEvent boutonPressed) {
|
||||||
|
@ -19,7 +27,55 @@ public class StraightChannelSectionController extends TwoWayNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
/**
|
||||||
|
* Creates the array of the canel value
|
||||||
|
*/
|
||||||
public void UpdateNode() {
|
public void UpdateNode() {
|
||||||
// Does it suppose to show the channel ?
|
this.pointer = 0;
|
||||||
|
this.lock = false;
|
||||||
|
this.chanelValue = new ArrayList<>();
|
||||||
|
this.chanelValue.add(0);
|
||||||
|
this.chanelValue.add(0);
|
||||||
|
this.chanelValue.add(0);
|
||||||
|
this.chanelValue.add(0);
|
||||||
|
this.updateVisualChanel();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the visual channel value
|
||||||
|
*/
|
||||||
|
private void updateVisualChanel(){
|
||||||
|
for (int i = 0 ; i < 4 ; i ++ ){
|
||||||
|
String id = "#textarea_"+i;
|
||||||
|
TextField textField = ((TextField)this.currentStage.getScene().lookup(id));
|
||||||
|
textField.setText(String.valueOf(this.chanelValue.get(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void numberPressed(MouseEvent mousePressed){
|
||||||
|
if (!this.lock) {
|
||||||
|
String value = ((Button) mousePressed.getSource()).getId().split("_")[1];
|
||||||
|
this.chanelValue.set(this.pointer, Integer.parseInt(value));
|
||||||
|
this.pointer++;
|
||||||
|
this.updateVisualChanel();
|
||||||
|
if (this.pointer == 4) {
|
||||||
|
this.lock = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void clearLastNumber(MouseEvent mousePressed){
|
||||||
|
if (this.pointer >= 1) {
|
||||||
|
int lastValueLocation = this.pointer - 1;
|
||||||
|
this.chanelValue.set(lastValueLocation, 0);
|
||||||
|
this.currentStage.show();
|
||||||
|
this.pointer--;
|
||||||
|
this.updateVisualChanel();
|
||||||
|
this.lock = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
<children>
|
<children>
|
||||||
<BorderPane prefHeight="67.0" prefWidth="46.0">
|
<BorderPane prefHeight="67.0" prefWidth="46.0">
|
||||||
<center>
|
<center>
|
||||||
<TextField maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="69.0" prefWidth="69.0" text="1" BorderPane.alignment="CENTER">
|
<TextField fx:id="textarea_0" maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="69.0" prefWidth="69.0" text="1" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="30.0" />
|
<Font size="30.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<center>
|
<center>
|
||||||
<TextField maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="69.0" prefWidth="69.0" text="6" BorderPane.alignment="CENTER">
|
<TextField fx:id="textarea_1" maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="69.0" prefWidth="69.0" text="6" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="30.0" />
|
<Font size="30.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
<center>
|
<center>
|
||||||
<TextField maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="54.0" prefWidth="69.0" text="8" BorderPane.alignment="CENTER">
|
<TextField fx:id="textarea_2" maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="54.0" prefWidth="69.0" text="8" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="30.0" />
|
<Font size="30.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="55.0" prefWidth="70.0" GridPane.columnIndex="3">
|
<BorderPane prefHeight="55.0" prefWidth="70.0" GridPane.columnIndex="3">
|
||||||
<center>
|
<center>
|
||||||
<TextField maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="54.0" prefWidth="69.0" text="5" BorderPane.alignment="CENTER">
|
<TextField fx:id="textarea_3" maxHeight="74.0" maxWidth="74.0" minHeight="54.0" minWidth="58.0" prefHeight="54.0" prefWidth="69.0" text="5" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="30.0" />
|
<Font size="30.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
<children>
|
<children>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="2" BorderPane.alignment="CENTER">
|
<Button fx:id="button_2" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="2" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" />
|
<BorderPane prefHeight="200.0" prefWidth="200.0" />
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="3" BorderPane.alignment="CENTER">
|
<Button fx:id="button_3" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="3" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -186,14 +186,14 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="4" BorderPane.alignment="CENTER">
|
<Button fx:id="button_4" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="4" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="1">
|
<Button fx:id="button_1" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="1">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
<children>
|
<children>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="5" BorderPane.alignment="CENTER">
|
<Button fx:id="button_5" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="5" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -222,7 +222,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="6" BorderPane.alignment="CENTER">
|
<Button fx:id="button_6" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="6" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -231,7 +231,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="7" BorderPane.alignment="CENTER">
|
<Button fx:id="button_7" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="7" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -240,7 +240,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="3">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="8" BorderPane.alignment="CENTER">
|
<Button fx:id="button_8" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="8" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" />
|
<BorderPane prefHeight="200.0" prefWidth="200.0" />
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<center>
|
<center>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="0" BorderPane.alignment="CENTER">
|
<Button fx:id="button_0" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="0" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
@ -271,14 +271,14 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
<right>
|
<right>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="138.0" text="Clear Last" BorderPane.alignment="CENTER">
|
<Button fx:id="button_clear_last" mnemonicParsing="false" onMousePressed="#clearLastNumber" prefHeight="54.0" prefWidth="138.0" text="Clear Last" BorderPane.alignment="CENTER">
|
||||||
<font>
|
<font>
|
||||||
<Font size="24.0" />
|
<Font size="24.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<Button mnemonicParsing="false" prefHeight="54.0" prefWidth="69.0" text="9">
|
<Button fx:id="button_9" mnemonicParsing="false" onMousePressed="#numberPressed" prefHeight="54.0" prefWidth="69.0" text="9">
|
||||||
<font>
|
<font>
|
||||||
<Font size="25.0" />
|
<Font size="25.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|
Loading…
Reference in New Issue