|
|
@@ -2,6 +2,7 @@ package com.example.application.views.list;
|
|
|
|
|
|
import com.google.gson.Gson;
|
|
|
import com.vaadin.flow.component.Component;
|
|
|
+import com.vaadin.flow.component.Key;
|
|
|
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
|
|
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|
|
import com.vaadin.flow.component.textfield.TextField;
|
|
|
@@ -16,6 +17,7 @@ import java.io.IOException;
|
|
|
@PageTitle("Spotting")
|
|
|
@Route(value = "spotting")
|
|
|
public class Spotting extends HorizontalLayout {
|
|
|
+ private boolean start_right = false;
|
|
|
private BufferedWriter writer;
|
|
|
//left
|
|
|
VerticalLayout left = new VerticalLayout(Alignment.END);
|
|
|
@@ -33,38 +35,38 @@ public class Spotting extends HorizontalLayout {
|
|
|
|
|
|
|
|
|
public Spotting(){
|
|
|
-
|
|
|
left.add(left_one,left_two,left_three);
|
|
|
right.add(right_one,right_two,right_three);
|
|
|
init_listeners();
|
|
|
add(left,right);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void init_listeners(){
|
|
|
for (Component c : left.getChildren().toList()){
|
|
|
- if(c instanceof TextField)
|
|
|
+ if(c instanceof TextField){
|
|
|
((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
|
+ ((TextField)c).setAllowedCharPattern("[0-9mx]");
|
|
|
+ ((TextField)c).setMaxLength(1);
|
|
|
+ }
|
|
|
}
|
|
|
for (Component c : right.getChildren().toList()){
|
|
|
- if(c instanceof TextField)
|
|
|
- ((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
|
+ if(c instanceof TextField) {
|
|
|
+ ((TextField) c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
|
+ ((TextField) c).setAllowedCharPattern("[0-9mx]");
|
|
|
+ ((TextField)c).setMaxLength(1);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void write(){
|
|
|
Gson gson = new Gson();
|
|
|
- String vals[] = {left_one.getValue(),left_two.getValue(),left_three.getValue(),right_one.getValue(),right_two.getValue(),right_two.getValue()};
|
|
|
- for (String s : vals)
|
|
|
- System.out.println(s);
|
|
|
+ String vals[] = {left_one.getValue()left_two.getValue(),left_three.getValue(),right_one.getValue(),right_two.getValue(),right_three.getValue()};
|
|
|
try {
|
|
|
- System.out.println("writey ditey");
|
|
|
writer = new BufferedWriter(new FileWriter("C:/tst/test.txt"));
|
|
|
writer.write(gson.toJson(vals));
|
|
|
writer.close();
|
|
|
} catch (IOException e) {
|
|
|
- System.out.println("fooook");
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
}
|