From 8cade5e03150ec2efd818931e11128f49eccf7cf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Ko=C5=BEusznik?= <jan@kozusznik.cz>
Date: Thu, 17 May 2018 16:54:27 +0200
Subject: [PATCH] basic logic

---
 .../ui/NewJobController.java                  | 48 +++++++++++++++++++
 .../haas_spim_benchmark/ui/NewJobView.fxml    |  4 +-
 .../haas_spim_benchmark/ui/NewJobWindow.java  | 22 +++++++++
 .../cz/it4i/fiji/haas/NewJobWindowShow.java   | 11 +++++
 4 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobController.java
 create mode 100644 haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java
 create mode 100644 haas-spim-benchmark/src/test/java/cz/it4i/fiji/haas/NewJobWindowShow.java

diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobController.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobController.java
new file mode 100644
index 00000000..2631710e
--- /dev/null
+++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobController.java
@@ -0,0 +1,48 @@
+package cz.it4i.fiji.haas_spim_benchmark.ui;
+
+import java.awt.Window;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import cz.it4i.fiji.haas.ui.CloseableControl;
+import cz.it4i.fiji.haas.ui.InitiableControl;
+import cz.it4i.fiji.haas.ui.JavaFXRoutines;
+import javafx.fxml.FXML;
+import javafx.scene.control.Button;
+import javafx.scene.layout.BorderPane;
+
+public class NewJobController extends BorderPane implements CloseableControl, InitiableControl {
+	@SuppressWarnings("unused")
+	private static Logger log = LoggerFactory.getLogger(cz.it4i.fiji.haas_spim_benchmark.ui.NewJobController.class);
+
+	@FXML
+	private Button btnCreate;
+	
+	private boolean create = false;
+
+	private Window ownerWindow;
+
+	public NewJobController() {
+		JavaFXRoutines.initRootAndController("NewJobView.fxml", this);
+		getStylesheets().add(getClass().getResource("NewJobView.css").toExternalForm());
+		btnCreate.setOnMouseClicked(X -> createPressed());
+	}
+
+	private void createPressed() {
+		create = true;
+		ownerWindow.setVisible(false);
+		ownerWindow.dispose();
+	}
+
+	@Override
+	public void close() {
+		log.info("close");
+	}
+
+	@Override
+	public void init(Window parameter) {
+		ownerWindow = parameter;
+	}
+
+}
diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobView.fxml b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobView.fxml
index 6c68c44d..41c00072 100644
--- a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobView.fxml
+++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobView.fxml
@@ -12,7 +12,7 @@
 <?import javafx.scene.layout.HBox?>
 <?import javafx.scene.layout.VBox?>
 
-<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
+<fx:root maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" type="BorderPane" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="cz.it4i.fiji.haas_spim_benchmark.ui.NewJobController">
    <center>
       <VBox BorderPane.alignment="CENTER">
          <children>
@@ -95,7 +95,7 @@
    <bottom>
       <BorderPane BorderPane.alignment="CENTER">
          <right>
-            <Button mnemonicParsing="false" prefHeight="22.0" prefWidth="71.0" text="Start" BorderPane.alignment="CENTER">
+            <Button fx:id="btnCreate" mnemonicParsing="false" prefHeight="22.0" prefWidth="71.0" text="Start" BorderPane.alignment="CENTER">
                <BorderPane.margin>
                   <Insets right="3.0" />
                </BorderPane.margin></Button>
diff --git a/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java
new file mode 100644
index 00000000..102f5f43
--- /dev/null
+++ b/haas-spim-benchmark/src/main/java/cz/it4i/fiji/haas_spim_benchmark/ui/NewJobWindow.java
@@ -0,0 +1,22 @@
+package cz.it4i.fiji.haas_spim_benchmark.ui;
+
+import java.awt.Window;
+import java.io.IOException;
+
+import cz.it4i.fiji.haas.ui.FXFrame;
+
+public class NewJobWindow extends FXFrame<NewJobController>{
+
+	private static final long serialVersionUID = 1L;
+	
+
+	
+	public NewJobWindow(Window parentWindow) throws IOException {
+		super(parentWindow,()->{
+			return new NewJobController();
+			
+		});
+		setTitle("Create job");
+	}
+	
+}
\ No newline at end of file
diff --git a/haas-spim-benchmark/src/test/java/cz/it4i/fiji/haas/NewJobWindowShow.java b/haas-spim-benchmark/src/test/java/cz/it4i/fiji/haas/NewJobWindowShow.java
new file mode 100644
index 00000000..525b110d
--- /dev/null
+++ b/haas-spim-benchmark/src/test/java/cz/it4i/fiji/haas/NewJobWindowShow.java
@@ -0,0 +1,11 @@
+package cz.it4i.fiji.haas;
+
+import java.io.IOException;
+
+import cz.it4i.fiji.haas_spim_benchmark.ui.NewJobWindow;
+
+public class NewJobWindowShow {
+	public static void main(String[] args) throws IOException {
+		new NewJobWindow(null).setVisible(true);
+	}
+}
-- 
GitLab