|
@@ -1,5 +1,7 @@
|
|
|
package com.example.application.views.list;
|
|
package com.example.application.views.list;
|
|
|
|
|
|
|
|
|
|
+import com.example.application.data.ArrowValue;
|
|
|
|
|
+import com.example.application.data.DataThingy;
|
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
|
import com.vaadin.flow.component.Component;
|
|
import com.vaadin.flow.component.Component;
|
|
|
import com.vaadin.flow.component.Key;
|
|
import com.vaadin.flow.component.Key;
|
|
@@ -19,6 +21,8 @@ import java.io.IOException;
|
|
|
public class Spotting extends HorizontalLayout {
|
|
public class Spotting extends HorizontalLayout {
|
|
|
private boolean start_right = false;
|
|
private boolean start_right = false;
|
|
|
private BufferedWriter writer;
|
|
private BufferedWriter writer;
|
|
|
|
|
+ private DataThingy data = new DataThingy();
|
|
|
|
|
+
|
|
|
//left
|
|
//left
|
|
|
VerticalLayout left = new VerticalLayout(Alignment.END);
|
|
VerticalLayout left = new VerticalLayout(Alignment.END);
|
|
|
TextField left_one = new TextField("Pfeil 1");
|
|
TextField left_one = new TextField("Pfeil 1");
|
|
@@ -45,30 +49,24 @@ public class Spotting extends HorizontalLayout {
|
|
|
for (Component c : left.getChildren().toList()){
|
|
for (Component c : left.getChildren().toList()){
|
|
|
if(c instanceof TextField){
|
|
if(c instanceof TextField){
|
|
|
((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
|
- ((TextField)c).setAllowedCharPattern("[0-9mx]");
|
|
|
|
|
- ((TextField)c).setMaxLength(1);
|
|
|
|
|
|
|
+ ((TextField)c).setAllowedCharPattern("[0-9mx*]");
|
|
|
|
|
+ ((TextField)c).setMaxLength(2);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
for (Component c : right.getChildren().toList()){
|
|
for (Component c : right.getChildren().toList()){
|
|
|
if(c instanceof TextField) {
|
|
if(c instanceof TextField) {
|
|
|
((TextField) c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
((TextField) c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
|
|
|
- ((TextField) c).setAllowedCharPattern("[0-9mx]");
|
|
|
|
|
- ((TextField)c).setMaxLength(1);
|
|
|
|
|
|
|
+ ((TextField) c).setAllowedCharPattern("[0-9mx*]");
|
|
|
|
|
+ ((TextField)c).setMaxLength(2);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void write(){
|
|
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_three.getValue()};
|
|
|
|
|
- try {
|
|
|
|
|
- writer = new BufferedWriter(new FileWriter("C:/tst/test.txt"));
|
|
|
|
|
- writer.write(gson.toJson(vals));
|
|
|
|
|
- writer.close();
|
|
|
|
|
- } catch (IOException e) {
|
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ String[] vals_l = {left_one.getValue(),left_two.getValue(),left_three.getValue()};
|
|
|
|
|
+ String[] vals_r = {right_one.getValue(),right_two.getValue(),right_three.getValue()};
|
|
|
|
|
+ data.write(vals_l,vals_r);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|