Ver código fonte

initial commit

Philipp 2 anos atrás
pai
commit
f9e87ee843

+ 23 - 0
frontend/index.html

@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<!--
+This file is auto-generated by Vaadin.
+-->
+
+<html>
+<head>
+  <meta charset="UTF-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1" />
+  <style>
+    body, #outlet {
+      height: 100vh;
+      width: 100%;
+      margin: 0;
+    }
+  </style>
+  <!-- index.ts is included here automatically (either by the dev server or during the build) -->
+</head>
+<body>
+  <!-- This outlet div is where the views are rendered -->
+  <div id="outlet"></div>
+</body>
+</html>

+ 0 - 0
frontend/themes/flowcrmtutorial/theme-editor.css


+ 10 - 3
mvnw

@@ -3,9 +3,9 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <!-- Project from https://start.vaadin.com/ -->
-    <groupId>com.example.application</groupId>
-    <artifactId>flowcrmtutorial</artifactId>
-    <name>flowcrmtutorial</name>
+    <groupId>rocks.cybermuell.spotting</groupId>
+    <artifactId>spottingweb</artifactId>
+    <name>spottingweb</name>
     <version>1.0-SNAPSHOT</version>
     <packaging>jar</packaging>
 
@@ -13,6 +13,8 @@
         <java.version>17</java.version>
         <vaadin.version>24.1.3</vaadin.version>
         <selenium.version>4.10.0</selenium.version>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
     </properties>
 
     <parent>
@@ -89,6 +91,11 @@
             <artifactId>vaadin-testbench-junit5</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.google.code.gson</groupId>
+            <artifactId>gson</artifactId>
+            <version>2.10.1</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 0 - 18
src/main/java/com/example/application/views/list/ListView.java

@@ -1,33 +1,15 @@
 package com.example.application.views.list;
 
-import com.vaadin.flow.component.html.H2;
-import com.vaadin.flow.component.html.Image;
-import com.vaadin.flow.component.html.Paragraph;
 import com.vaadin.flow.component.orderedlayout.VerticalLayout;
 import com.vaadin.flow.router.PageTitle;
 import com.vaadin.flow.router.Route;
-import com.vaadin.flow.theme.lumo.LumoUtility.Margin;
 
 @PageTitle("list")
 @Route(value = "")
 public class ListView extends VerticalLayout {
 
     public ListView() {
-        setSpacing(false);
 
-        Image img = new Image("images/empty-plant.png", "placeholder plant");
-        img.setWidth("200px");
-        add(img);
-
-        H2 header = new H2("This place intentionally left empty");
-        header.addClassNames(Margin.Top.XLARGE, Margin.Bottom.MEDIUM);
-        add(header);
-        add(new Paragraph("It’s a place where you can grow your own UI 🤗"));
-
-        setSizeFull();
-        setJustifyContentMode(JustifyContentMode.CENTER);
-        setDefaultHorizontalComponentAlignment(Alignment.CENTER);
-        getStyle().set("text-align", "center");
     }
 
 }

+ 73 - 0
src/main/java/com/example/application/views/list/Spotting.java

@@ -0,0 +1,73 @@
+package com.example.application.views.list;
+
+import com.google.gson.Gson;
+import com.vaadin.flow.component.Component;
+import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
+import com.vaadin.flow.component.orderedlayout.VerticalLayout;
+import com.vaadin.flow.component.textfield.TextField;
+import com.vaadin.flow.router.PageTitle;
+import com.vaadin.flow.router.Route;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+
+
+@PageTitle("Spotting")
+@Route(value = "spotting")
+public class Spotting extends HorizontalLayout {
+    private BufferedWriter writer;
+    //left
+    VerticalLayout left = new VerticalLayout(Alignment.END);
+    TextField left_one = new TextField("Pfeil 1");
+    TextField left_two = new TextField("Pfeil 2");
+    TextField left_three = new TextField("Pfeil 3");
+
+
+    //right
+    VerticalLayout right = new VerticalLayout(Alignment.START);
+    TextField right_one = new TextField("Pfeil 1");
+    TextField right_two = new TextField("Pfeil 2");
+    TextField right_three = new TextField("Pfeil 3");
+
+
+
+    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)
+                ((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> write());
+        }
+        for (Component c : right.getChildren().toList()){
+            if(c instanceof TextField)
+                ((TextField)c).addValueChangeListener(textFieldStringComponentValueChangeEvent -> 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_two.getValue()};
+        for (String s : vals)
+            System.out.println(s);
+        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);
+        }
+    }
+
+
+}