From 093bd56fbd83f494b765cd64559026c2abca04ae Mon Sep 17 00:00:00 2001
From: Saad bin Abid <abid@fortiss.org>
Date: Fri, 19 Jun 2020 13:23:33 +0200
Subject: [PATCH] added files for Error View implementation in JavaFX

Issue-Ref: 4018
Issue-Url: https://af3-developer.fortiss.org/issues/4018

Signed-off-by: Saad bin Abid <abid@fortiss.org>
---
 .../build.properties                          |  3 +-
 org.fortiss.tooling.kernel.ui/plugin.xml      |  6 ++
 .../ui/internal/views/ErrorViewFXLayout.fxml  | 33 +++++++++
 .../views/ErrorViewFXLayoutController.java    | 68 +++++++++++++++++++
 .../internal/views/ErrorViewFXViewPart.java   | 45 ++++++++++++
 5 files changed, 154 insertions(+), 1 deletion(-)
 create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayout.fxml
 create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayoutController.java
 create mode 100644 org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXViewPart.java

diff --git a/org.fortiss.tooling.kernel.ui/build.properties b/org.fortiss.tooling.kernel.ui/build.properties
index 18adab1cb..1554d67f7 100644
--- a/org.fortiss.tooling.kernel.ui/build.properties
+++ b/org.fortiss.tooling.kernel.ui/build.properties
@@ -5,6 +5,7 @@ output.. = build/
 bin.includes = .,\
                plugin.xml,\
                icons/,\
-               META-INF/
+               META-INF/,\
+               src/
 src.includes = schema/,\
                icons/
diff --git a/org.fortiss.tooling.kernel.ui/plugin.xml b/org.fortiss.tooling.kernel.ui/plugin.xml
index 314a12759..febc45db9 100644
--- a/org.fortiss.tooling.kernel.ui/plugin.xml
+++ b/org.fortiss.tooling.kernel.ui/plugin.xml
@@ -54,6 +54,12 @@
             name="Kernel Introspection System Service (KISS)"
             restorable="true">
       </view>
+      <view
+   			 class="org.fortiss.tooling.kernel.ui.internal.views.ErrorViewFXViewPart" 
+   			 id="org.fortiss.tooling.kernel.ui.internal.views.ErrorViewFXViewPart" 
+  			 name="Error FXView" 
+   			 restorable="true">
+</view>
    </extension>
    <extension
          point="org.eclipse.core.runtime.adapters">
diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayout.fxml b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayout.fxml
new file mode 100644
index 000000000..e5893b692
--- /dev/null
+++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayout.fxml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.TreeTableColumn?>
+<?import javafx.scene.control.TreeTableView?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.layout.Pane?>
+<?import javafx.scene.text.Font?>
+
+<AnchorPane prefHeight="360.0" prefWidth="614.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1">
+   <children>
+      <Pane layoutX="-81.0" layoutY="-160.0" prefHeight="367.0" prefWidth="622.0" AnchorPane.bottomAnchor="-7.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="-8.0" AnchorPane.topAnchor="0.0">
+         <children>
+            <Label fx:id="displayLabel" layoutX="106.0" layoutY="155.0">
+               <font>
+                  <Font size="24.0" />
+               </font></Label>
+            <TreeTableView layoutX="6.0" layoutY="30.0" prefHeight="327.0" prefWidth="595.0">
+               <columns>
+                  <TreeTableColumn fx:id="El" prefWidth="146.39999103546143" text="Element" />
+                  <TreeTableColumn fx:id="Ex" prefWidth="221.59999084472656" text="Explanation" />
+                  <TreeTableColumn fx:id="Pr" prefWidth="224.0001220703125" text="Project" />
+               </columns>
+            </TreeTableView>
+            <Label layoutX="6.0" layoutY="7.0" prefHeight="17.0" prefWidth="87.0" text="Error View" wrapText="true">
+               <font>
+                  <Font name="Arial Bold Italic" size="15.0" />
+               </font>
+            </Label>
+         </children>
+      </Pane>
+   </children>
+</AnchorPane>
diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayoutController.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayoutController.java
new file mode 100644
index 000000000..d9f35a418
--- /dev/null
+++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXLayoutController.java
@@ -0,0 +1,68 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2020 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.kernel.ui.internal.views;
+
+import org.eclipse.emf.ecore.EObject;
+import org.fortiss.tooling.common.ui.javafx.layout.CompositeFXControllerBase;
+
+import javafx.fxml.FXML;
+import javafx.scene.Node;
+import javafx.scene.control.TreeTableColumn;
+import javafx.scene.control.TreeTableView;
+
+/**
+ * 
+ * Let's say hello to the world.
+ * 
+ * 
+ * 
+ * Controller class for the "Hello world!" view. References the FXML layout and contains all control
+ * 
+ * logic.
+ * 
+ * 
+ * 
+ * @author abid
+ * 
+ */
+
+public class ErrorViewFXLayoutController extends CompositeFXControllerBase<Node, Node> {
+
+	/** {@inheritDoc} */
+
+	/**
+	 * {@link TreeTableView} displaying the ECU's name and safety level.
+	 */
+	@FXML
+	private TreeTableView<EObject> view;
+
+	@FXML
+	private TreeTableColumn El;
+
+	@Override
+
+	public String getFXMLLocation() {
+
+		return "ErrorViewFXLayout.fxml";
+	}
+
+	/** {@inheritDoc} */
+	@Override
+	public void initialize() {
+		// TODO Auto-generated method stub
+
+	}
+}
diff --git a/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXViewPart.java b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXViewPart.java
new file mode 100644
index 000000000..108d10374
--- /dev/null
+++ b/org.fortiss.tooling.kernel.ui/src/org/fortiss/tooling/kernel/ui/internal/views/ErrorViewFXViewPart.java
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------+
+| Copyright 2020 fortiss GmbH                                              |
+|                                                                          |
+| Licensed under the Apache License, Version 2.0 (the "License");          |
+| you may not use this file except in compliance with the License.         |
+| You may obtain a copy of the License at                                  |
+|                                                                          |
+|    http://www.apache.org/licenses/LICENSE-2.0                            |
+|                                                                          |
+| Unless required by applicable law or agreed to in writing, software      |
+| distributed under the License is distributed on an "AS IS" BASIS,        |
+| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
+| See the License for the specific language governing permissions and      |
+| limitations under the License.                                           |
++--------------------------------------------------------------------------*/
+package org.fortiss.tooling.kernel.ui.internal.views;
+
+import org.fortiss.tooling.common.ui.javafx.AF3FXViewPart;
+
+/**
+ * 
+ * Let's say hello to the world.
+ * 
+ * 
+ * 
+ * Wrapper for the {@link ErrorViewFXViewPart}. This class can be referenced in the
+ * 
+ * {@code plugins.xml} file to register the view.
+ * 
+ * 
+ * 
+ * @author abid
+ * 
+ */
+
+public class ErrorViewFXViewPart extends AF3FXViewPart {
+
+	/** Constructor. */
+
+	public ErrorViewFXViewPart() throws Exception {
+
+		super(new ErrorViewFXLayoutController(), null);
+	}
+
+}
-- 
GitLab