From 84cf66afde762984076512efa06994798149889a Mon Sep 17 00:00:00 2001
From: sknobl2s <sebastian.knoblauch@smail.inf.h-brs.de>
Date: Mon, 19 Jun 2017 19:52:16 +0200
Subject: [PATCH] =?UTF-8?q?TransaktionsBestaetigung=20hinzugef=C3=BCgt=20(?=
 =?UTF-8?q?Workaround=20f=C3=BCr=20den=20Screencast=20bei=20Bedarf)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/main/java/org/s4s/gui/InitView.java       |  1 +
 .../gui/views/TransaktionsBestaetigung.java   | 51 +++++++++++++++++++
 .../java/org/s4s/gui/views/WarenkorbView.java |  5 +-
 .../java/org/s4s/services/util/Views.java     |  1 +
 4 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 src/main/java/org/s4s/gui/views/TransaktionsBestaetigung.java

diff --git a/src/main/java/org/s4s/gui/InitView.java b/src/main/java/org/s4s/gui/InitView.java
index ca28a8b..4f125e2 100644
--- a/src/main/java/org/s4s/gui/InitView.java
+++ b/src/main/java/org/s4s/gui/InitView.java
@@ -45,6 +45,7 @@ public class InitView extends UI {
         navi.addView(Views.SHOPERSTELLUNGSBESTAETIGUNG, ShoperstellungsBestätigung.class);
         navi.addView(Views.REGISTRIERUNGSBESTAETIGUNG, RegistrierungsBestaetigung.class);
         navi.addView(Views.KONTAKTBESTAETIGUNG, Kontaktbestaetigung.class);
+        navi.addView(Views.TRANSAKTIONSBESTAETIGUNG, TransaktionsBestaetigung.class);
         //Test der RegistrierungsView
         UI.getCurrent().getNavigator().navigateTo(Views.WELCOME);
         setHeight(100f, Unit.PERCENTAGE);
diff --git a/src/main/java/org/s4s/gui/views/TransaktionsBestaetigung.java b/src/main/java/org/s4s/gui/views/TransaktionsBestaetigung.java
new file mode 100644
index 0000000..0a8e827
--- /dev/null
+++ b/src/main/java/org/s4s/gui/views/TransaktionsBestaetigung.java
@@ -0,0 +1,51 @@
+/*
+ * To change this license header, choose License Headers in Project Properties.
+ * To change this template file, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.s4s.gui.views;
+
+import com.vaadin.navigator.View;
+import com.vaadin.navigator.ViewChangeListener;
+import com.vaadin.ui.Button;
+import com.vaadin.ui.Label;
+import com.vaadin.ui.Panel;
+import com.vaadin.ui.UI;
+import com.vaadin.ui.VerticalLayout;
+import org.s4s.services.util.Views;
+
+/**
+ *
+ * @author Sebas
+ */
+public class TransaktionsBestaetigung extends TemplateView implements View {
+
+    @Override
+    public void enter(ViewChangeListener.ViewChangeEvent event) {
+        this.setUp();
+    }
+
+    private void setUp() {
+        Panel panel = new Panel();
+        panel.setSizeUndefined();
+
+        VerticalLayout content = new VerticalLayout();
+
+        Button button = new Button("Zurück zur Startseite");
+        button.addClickListener(e
+                -> UI.getCurrent().getNavigator().navigateTo(Views.WELCOME));
+
+        Label label = new Label("Vielen Dank für ihre Einkauf");
+
+        content.addComponent(label);
+        content.addComponent(button);
+
+        content.setMargin(true);
+
+        panel.setContent(content);
+        //this.addComponent(panel);
+        //this.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
+
+        super.setUpFooterAndHeader(panel);
+    }
+}
diff --git a/src/main/java/org/s4s/gui/views/WarenkorbView.java b/src/main/java/org/s4s/gui/views/WarenkorbView.java
index 3964888..2469cda 100644
--- a/src/main/java/org/s4s/gui/views/WarenkorbView.java
+++ b/src/main/java/org/s4s/gui/views/WarenkorbView.java
@@ -96,14 +96,15 @@ public class WarenkorbView extends TemplateView {
 
             Button buyButton = new Button("Kaufen!");
             buyButton.addClickListener((Button.ClickEvent event) -> {
-                TransactionControl t = new TransactionControl();
+                TransactionControl tr = new TransactionControl();
                 try {
-                    t.createTransactions();
+                    tr.createTransactions();
                 } catch (DAOException ex) {
                     Logger.getLogger(WarenkorbView.class.getName()).log(Level.SEVERE, null, ex);
                 } catch (SQLException ex) {
                     Logger.getLogger(WarenkorbView.class.getName()).log(Level.SEVERE, null, ex);
                 }
+                UI.getCurrent().getNavigator().navigateTo(Views.TRANSAKTIONSBESTAETIGUNG);
             });
 
             buttonLayout.addComponent(buyButton);
diff --git a/src/main/java/org/s4s/services/util/Views.java b/src/main/java/org/s4s/services/util/Views.java
index 7a7a35e..06dba71 100644
--- a/src/main/java/org/s4s/services/util/Views.java
+++ b/src/main/java/org/s4s/services/util/Views.java
@@ -24,6 +24,7 @@ public final class Views {
     public final static String SHOPERSTELLUNGSBESTAETIGUNG = "shoperstellungsbestaetigung";
     public final static String REGISTRIERUNGSBESTAETIGUNG = "registrierungsbestaetigung";
     public final static String KONTAKTBESTAETIGUNG = "kontaktbestaetigung";
+    public final static String TRANSAKTIONSBESTAETIGUNG = "transaktionsbestaetigung";
 
     private Views() {
 
-- 
GitLab