Willi Zschiebsch 4 jaren geleden
bovenliggende
commit
097a7609e6
70 gewijzigde bestanden met toevoegingen van 417 en 1260 verwijderingen
  1. 4 0
      .gitignore
  2. BIN
      .gradle/6.5.1/executionHistory/executionHistory.bin
  3. BIN
      .gradle/6.5.1/executionHistory/executionHistory.lock
  4. BIN
      .gradle/6.5.1/fileChanges/last-build.bin
  5. BIN
      .gradle/6.5.1/fileContent/fileContent.lock
  6. BIN
      .gradle/6.5.1/fileHashes/fileHashes.bin
  7. BIN
      .gradle/6.5.1/fileHashes/fileHashes.lock
  8. BIN
      .gradle/6.5.1/fileHashes/resourceHashesCache.bin
  9. 0 0
      .gradle/6.5.1/gc.properties
  10. BIN
      .gradle/6.5.1/javaCompile/classAnalysis.bin
  11. BIN
      .gradle/6.5.1/javaCompile/jarAnalysis.bin
  12. BIN
      .gradle/6.5.1/javaCompile/javaCompile.lock
  13. BIN
      .gradle/6.5.1/javaCompile/taskHistory.bin
  14. BIN
      .gradle/buildOutputCleanup/buildOutputCleanup.lock
  15. 0 2
      .gradle/buildOutputCleanup/cache.properties
  16. BIN
      .gradle/buildOutputCleanup/outputFiles.bin
  17. BIN
      .gradle/checksums/checksums.lock
  18. BIN
      .gradle/checksums/md5-checksums.bin
  19. BIN
      .gradle/checksums/sha1-checksums.bin
  20. 0 0
      .gradle/vcs-1/gc.properties
  21. 0 3
      .idea/.gitignore
  22. 0 6
      .idea/compiler.xml
  23. 0 22
      .idea/gradle.xml
  24. 0 20
      .idea/jarRepositories.xml
  25. 0 7
      .idea/misc.xml
  26. 0 6
      .idea/vcs.xml
  27. BIN
      build/classes/java/main/mdd/client/Connectable$1.class
  28. BIN
      build/classes/java/main/mdd/client/Connectable.class
  29. BIN
      build/classes/java/main/mdd/client/ConnectableType.class
  30. BIN
      build/classes/java/main/mdd/client/Connection.class
  31. BIN
      build/classes/java/main/mdd/client/FXMLDocumentController.class
  32. BIN
      build/classes/java/main/mdd/client/GUIEventHandler.class
  33. BIN
      build/classes/java/main/mdd/client/HelloWorldServer.class
  34. BIN
      build/classes/java/main/mdd/client/IGUIEventClient.class
  35. BIN
      build/classes/java/main/mdd/client/Input.class
  36. BIN
      build/classes/java/main/mdd/client/Main.class
  37. BIN
      build/classes/java/main/mdd/client/Module.class
  38. BIN
      build/classes/java/main/mdd/client/Output.class
  39. BIN
      build/classes/java/main/mdd/client/Processor.class
  40. BIN
      build/classes/java/main/mdd/client/WorkBench.class
  41. BIN
      build/classes/java/test/SampleTest.class
  42. 0 96
      build/reports/tests/test/classes/SampleTest.html
  43. 0 179
      build/reports/tests/test/css/base-style.css
  44. 0 84
      build/reports/tests/test/css/style.css
  45. 0 133
      build/reports/tests/test/index.html
  46. 0 194
      build/reports/tests/test/js/report.js
  47. 0 103
      build/reports/tests/test/packages/default-package.html
  48. 0 70
      build/resources/main/mdd/client/dark-theme.css
  49. 0 62
      build/resources/main/mdd/client/main.fxml
  50. 0 7
      build/test-results/test/TEST-SampleTest.xml
  51. 0 0
      build/test-results/test/binary/output.bin
  52. BIN
      build/test-results/test/binary/output.bin.idx
  53. BIN
      build/test-results/test/binary/results.bin
  54. 0 27
      build/tmp/compileJava/source-classes-mapping.txt
  55. 0 2
      build/tmp/compileTestJava/source-classes-mapping.txt
  56. 3 0
      src/main/META-INF/MANIFEST.MF
  57. 3 0
      src/main/java/META-INF/MANIFEST.MF
  58. 36 33
      src/main/java/mdd/client/Connectable.java
  59. 19 14
      src/main/java/mdd/client/Connection.java
  60. 2 12
      src/main/java/mdd/client/FXMLDocumentController.java
  61. 9 2
      src/main/java/mdd/client/GUIEventHandler.java
  62. 70 0
      src/main/java/mdd/client/GUIMain.java
  63. 7 8
      src/main/java/mdd/client/HelloWorldServer.java
  64. 1 3
      src/main/java/mdd/client/IGUIEventClient.java
  65. 2 39
      src/main/java/mdd/client/Main.java
  66. 41 42
      src/main/java/mdd/client/Module.java
  67. 118 39
      src/main/java/mdd/client/Processor.java
  68. 12 43
      src/main/java/mdd/client/WorkBench.java
  69. 87 0
      src/main/java/mdd/client/Workshop.java
  70. 3 2
      src/main/resources/mdd/client/main.fxml

+ 4 - 0
.gitignore

@@ -0,0 +1,4 @@
+.idea/*
+build/*
+out/*
+.gradle/*

BIN
.gradle/6.5.1/executionHistory/executionHistory.bin


BIN
.gradle/6.5.1/executionHistory/executionHistory.lock


BIN
.gradle/6.5.1/fileChanges/last-build.bin


BIN
.gradle/6.5.1/fileContent/fileContent.lock


BIN
.gradle/6.5.1/fileHashes/fileHashes.bin


BIN
.gradle/6.5.1/fileHashes/fileHashes.lock


BIN
.gradle/6.5.1/fileHashes/resourceHashesCache.bin


+ 0 - 0
.gradle/6.5.1/gc.properties


BIN
.gradle/6.5.1/javaCompile/classAnalysis.bin


BIN
.gradle/6.5.1/javaCompile/jarAnalysis.bin


BIN
.gradle/6.5.1/javaCompile/javaCompile.lock


BIN
.gradle/6.5.1/javaCompile/taskHistory.bin


BIN
.gradle/buildOutputCleanup/buildOutputCleanup.lock


+ 0 - 2
.gradle/buildOutputCleanup/cache.properties

@@ -1,2 +0,0 @@
-#Wed Jul 08 12:07:50 CEST 2020
-gradle.version=6.5.1

BIN
.gradle/buildOutputCleanup/outputFiles.bin


BIN
.gradle/checksums/checksums.lock


BIN
.gradle/checksums/md5-checksums.bin


BIN
.gradle/checksums/sha1-checksums.bin


+ 0 - 0
.gradle/vcs-1/gc.properties


+ 0 - 3
.idea/.gitignore

@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml

+ 0 - 6
.idea/compiler.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="CompilerConfiguration">
-    <bytecodeTargetLevel target="14" />
-  </component>
-</project>

+ 0 - 22
.idea/gradle.xml

@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="GradleMigrationSettings" migrationVersion="1" />
-  <component name="GradleSettings">
-    <option name="linkedExternalProjectsSettings">
-      <GradleProjectSettings>
-        <option name="delegatedBuild" value="true" />
-        <option name="testRunner" value="GRADLE" />
-        <option name="distributionType" value="LOCAL" />
-        <option name="externalProjectPath" value="$PROJECT_DIR$" />
-        <option name="gradleHome" value="D:/gradle/gradle-6.5.1" />
-        <option name="gradleJvm" value="14" />
-        <option name="modules">
-          <set>
-            <option value="$PROJECT_DIR$" />
-          </set>
-        </option>
-        <option name="useQualifiedModuleNames" value="true" />
-      </GradleProjectSettings>
-    </option>
-  </component>
-</project>

+ 0 - 20
.idea/jarRepositories.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="RemoteRepositoriesConfiguration">
-    <remote-repository>
-      <option name="id" value="central" />
-      <option name="name" value="Maven Central repository" />
-      <option name="url" value="https://repo1.maven.org/maven2" />
-    </remote-repository>
-    <remote-repository>
-      <option name="id" value="jboss.community" />
-      <option name="name" value="JBoss Community repository" />
-      <option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
-    </remote-repository>
-    <remote-repository>
-      <option name="id" value="MavenRepo" />
-      <option name="name" value="MavenRepo" />
-      <option name="url" value="https://repo.maven.apache.org/maven2/" />
-    </remote-repository>
-  </component>
-</project>

+ 0 - 7
.idea/misc.xml

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="ExternalStorageConfigurationManager" enabled="true" />
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
-    <output url="file://$PROJECT_DIR$/out" />
-  </component>
-</project>

+ 0 - 6
.idea/vcs.xml

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="VcsDirectoryMappings">
-    <mapping directory="$PROJECT_DIR$" vcs="Git" />
-  </component>
-</project>

BIN
build/classes/java/main/mdd/client/Connectable$1.class


BIN
build/classes/java/main/mdd/client/Connectable.class


BIN
build/classes/java/main/mdd/client/ConnectableType.class


BIN
build/classes/java/main/mdd/client/Connection.class


BIN
build/classes/java/main/mdd/client/FXMLDocumentController.class


BIN
build/classes/java/main/mdd/client/GUIEventHandler.class


BIN
build/classes/java/main/mdd/client/HelloWorldServer.class


BIN
build/classes/java/main/mdd/client/IGUIEventClient.class


BIN
build/classes/java/main/mdd/client/Input.class


BIN
build/classes/java/main/mdd/client/Main.class


BIN
build/classes/java/main/mdd/client/Module.class


BIN
build/classes/java/main/mdd/client/Output.class


BIN
build/classes/java/main/mdd/client/Processor.class


BIN
build/classes/java/main/mdd/client/WorkBench.class


BIN
build/classes/java/test/SampleTest.class


+ 0 - 96
build/reports/tests/test/classes/SampleTest.html

@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-<meta http-equiv="x-ua-compatible" content="IE=edge"/>
-<title>Test results - Class SampleTest</title>
-<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
-<link href="../css/style.css" rel="stylesheet" type="text/css"/>
-<script src="../js/report.js" type="text/javascript"></script>
-</head>
-<body>
-<div id="content">
-<h1>Class SampleTest</h1>
-<div class="breadcrumbs">
-<a href="../index.html">all</a> &gt; 
-<a href="../packages/default-package.html">default-package</a> &gt; SampleTest</div>
-<div id="summary">
-<table>
-<tr>
-<td>
-<div class="summaryGroup">
-<table>
-<tr>
-<td>
-<div class="infoBox" id="tests">
-<div class="counter">1</div>
-<p>tests</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="failures">
-<div class="counter">0</div>
-<p>failures</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="ignored">
-<div class="counter">0</div>
-<p>ignored</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="duration">
-<div class="counter">0.001s</div>
-<p>duration</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-</td>
-<td>
-<div class="infoBox success" id="successRate">
-<div class="percent">100%</div>
-<p>successful</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-<div id="tabs">
-<ul class="tabLinks">
-<li>
-<a href="#tab0">Tests</a>
-</li>
-</ul>
-<div id="tab0" class="tab">
-<h2>Tests</h2>
-<table>
-<thead>
-<tr>
-<th>Test</th>
-<th>Duration</th>
-<th>Result</th>
-</tr>
-</thead>
-<tr>
-<td class="success">test</td>
-<td class="success">0.001s</td>
-<td class="success">passed</td>
-</tr>
-</table>
-</div>
-</div>
-<div id="footer">
-<p>
-<div>
-<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
-<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
-</label>
-</div>Generated by 
-<a href="http://www.gradle.org">Gradle 6.5.1</a> at 08.07.2020, 13:10:42</p>
-</div>
-</div>
-</body>
-</html>

+ 0 - 179
build/reports/tests/test/css/base-style.css

@@ -1,179 +0,0 @@
-
-body {
-    margin: 0;
-    padding: 0;
-    font-family: sans-serif;
-    font-size: 12pt;
-}
-
-body, a, a:visited {
-    color: #303030;
-}
-
-#content {
-    padding-left: 50px;
-    padding-right: 50px;
-    padding-top: 30px;
-    padding-bottom: 30px;
-}
-
-#content h1 {
-    font-size: 160%;
-    margin-bottom: 10px;
-}
-
-#footer {
-    margin-top: 100px;
-    font-size: 80%;
-    white-space: nowrap;
-}
-
-#footer, #footer a {
-    color: #a0a0a0;
-}
-
-#line-wrapping-toggle {
-    vertical-align: middle;
-}
-
-#label-for-line-wrapping-toggle {
-    vertical-align: middle;
-}
-
-ul {
-    margin-left: 0;
-}
-
-h1, h2, h3 {
-    white-space: nowrap;
-}
-
-h2 {
-    font-size: 120%;
-}
-
-ul.tabLinks {
-    padding-left: 0;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    overflow: auto;
-    min-width: 800px;
-    width: auto !important;
-    width: 800px;
-}
-
-ul.tabLinks li {
-    float: left;
-    height: 100%;
-    list-style: none;
-    padding-left: 10px;
-    padding-right: 10px;
-    padding-top: 5px;
-    padding-bottom: 5px;
-    margin-bottom: 0;
-    -moz-border-radius: 7px;
-    border-radius: 7px;
-    margin-right: 25px;
-    border: solid 1px #d4d4d4;
-    background-color: #f0f0f0;
-}
-
-ul.tabLinks li:hover {
-    background-color: #fafafa;
-}
-
-ul.tabLinks li.selected {
-    background-color: #c5f0f5;
-    border-color: #c5f0f5;
-}
-
-ul.tabLinks a {
-    font-size: 120%;
-    display: block;
-    outline: none;
-    text-decoration: none;
-    margin: 0;
-    padding: 0;
-}
-
-ul.tabLinks li h2 {
-    margin: 0;
-    padding: 0;
-}
-
-div.tab {
-}
-
-div.selected {
-    display: block;
-}
-
-div.deselected {
-    display: none;
-}
-
-div.tab table {
-    min-width: 350px;
-    width: auto !important;
-    width: 350px;
-    border-collapse: collapse;
-}
-
-div.tab th, div.tab table {
-    border-bottom: solid #d0d0d0 1px;
-}
-
-div.tab th {
-    text-align: left;
-    white-space: nowrap;
-    padding-left: 6em;
-}
-
-div.tab th:first-child {
-    padding-left: 0;
-}
-
-div.tab td {
-    white-space: nowrap;
-    padding-left: 6em;
-    padding-top: 5px;
-    padding-bottom: 5px;
-}
-
-div.tab td:first-child {
-    padding-left: 0;
-}
-
-div.tab td.numeric, div.tab th.numeric {
-    text-align: right;
-}
-
-span.code {
-    display: inline-block;
-    margin-top: 0em;
-    margin-bottom: 1em;
-}
-
-span.code pre {
-    font-size: 11pt;
-    padding-top: 10px;
-    padding-bottom: 10px;
-    padding-left: 10px;
-    padding-right: 10px;
-    margin: 0;
-    background-color: #f7f7f7;
-    border: solid 1px #d0d0d0;
-    min-width: 700px;
-    width: auto !important;
-    width: 700px;
-}
-
-span.wrapped pre {
-    word-wrap: break-word;
-    white-space: pre-wrap;
-    word-break: break-all;
-}
-
-label.hidden {
-    display: none;
-}

+ 0 - 84
build/reports/tests/test/css/style.css

@@ -1,84 +0,0 @@
-
-#summary {
-    margin-top: 30px;
-    margin-bottom: 40px;
-}
-
-#summary table {
-    border-collapse: collapse;
-}
-
-#summary td {
-    vertical-align: top;
-}
-
-.breadcrumbs, .breadcrumbs a {
-    color: #606060;
-}
-
-.infoBox {
-    width: 110px;
-    padding-top: 15px;
-    padding-bottom: 15px;
-    text-align: center;
-}
-
-.infoBox p {
-    margin: 0;
-}
-
-.counter, .percent {
-    font-size: 120%;
-    font-weight: bold;
-    margin-bottom: 8px;
-}
-
-#duration {
-    width: 125px;
-}
-
-#successRate, .summaryGroup {
-    border: solid 2px #d0d0d0;
-    -moz-border-radius: 10px;
-    border-radius: 10px;
-}
-
-#successRate {
-    width: 140px;
-    margin-left: 35px;
-}
-
-#successRate .percent {
-    font-size: 180%;
-}
-
-.success, .success a {
-    color: #008000;
-}
-
-div.success, #successRate.success {
-    background-color: #bbd9bb;
-    border-color: #008000;
-}
-
-.failures, .failures a {
-    color: #b60808;
-}
-
-.skipped, .skipped a {
-    color: #c09853;
-}
-
-div.failures, #successRate.failures {
-    background-color: #ecdada;
-    border-color: #b60808;
-}
-
-ul.linkList {
-    padding-left: 0;
-}
-
-ul.linkList li {
-    list-style: none;
-    margin-bottom: 5px;
-}

+ 0 - 133
build/reports/tests/test/index.html

@@ -1,133 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-<meta http-equiv="x-ua-compatible" content="IE=edge"/>
-<title>Test results - Test Summary</title>
-<link href="css/base-style.css" rel="stylesheet" type="text/css"/>
-<link href="css/style.css" rel="stylesheet" type="text/css"/>
-<script src="js/report.js" type="text/javascript"></script>
-</head>
-<body>
-<div id="content">
-<h1>Test Summary</h1>
-<div id="summary">
-<table>
-<tr>
-<td>
-<div class="summaryGroup">
-<table>
-<tr>
-<td>
-<div class="infoBox" id="tests">
-<div class="counter">1</div>
-<p>tests</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="failures">
-<div class="counter">0</div>
-<p>failures</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="ignored">
-<div class="counter">0</div>
-<p>ignored</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="duration">
-<div class="counter">0.001s</div>
-<p>duration</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-</td>
-<td>
-<div class="infoBox success" id="successRate">
-<div class="percent">100%</div>
-<p>successful</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-<div id="tabs">
-<ul class="tabLinks">
-<li>
-<a href="#tab0">Packages</a>
-</li>
-<li>
-<a href="#tab1">Classes</a>
-</li>
-</ul>
-<div id="tab0" class="tab">
-<h2>Packages</h2>
-<table>
-<thead>
-<tr>
-<th>Package</th>
-<th>Tests</th>
-<th>Failures</th>
-<th>Ignored</th>
-<th>Duration</th>
-<th>Success rate</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td class="success">
-<a href="packages/default-package.html">default-package</a>
-</td>
-<td>1</td>
-<td>0</td>
-<td>0</td>
-<td>0.001s</td>
-<td class="success">100%</td>
-</tr>
-</tbody>
-</table>
-</div>
-<div id="tab1" class="tab">
-<h2>Classes</h2>
-<table>
-<thead>
-<tr>
-<th>Class</th>
-<th>Tests</th>
-<th>Failures</th>
-<th>Ignored</th>
-<th>Duration</th>
-<th>Success rate</th>
-</tr>
-</thead>
-<tbody>
-<tr>
-<td class="success">
-<a href="classes/SampleTest.html">SampleTest</a>
-</td>
-<td>1</td>
-<td>0</td>
-<td>0</td>
-<td>0.001s</td>
-<td class="success">100%</td>
-</tr>
-</tbody>
-</table>
-</div>
-</div>
-<div id="footer">
-<p>
-<div>
-<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
-<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
-</label>
-</div>Generated by 
-<a href="http://www.gradle.org">Gradle 6.5.1</a> at 08.07.2020, 13:10:42</p>
-</div>
-</div>
-</body>
-</html>

+ 0 - 194
build/reports/tests/test/js/report.js

@@ -1,194 +0,0 @@
-(function (window, document) {
-    "use strict";
-
-    var tabs = {};
-
-    function changeElementClass(element, classValue) {
-        if (element.getAttribute("className")) {
-            element.setAttribute("className", classValue);
-        } else {
-            element.setAttribute("class", classValue);
-        }
-    }
-
-    function getClassAttribute(element) {
-        if (element.getAttribute("className")) {
-            return element.getAttribute("className");
-        } else {
-            return element.getAttribute("class");
-        }
-    }
-
-    function addClass(element, classValue) {
-        changeElementClass(element, getClassAttribute(element) + " " + classValue);
-    }
-
-    function removeClass(element, classValue) {
-        changeElementClass(element, getClassAttribute(element).replace(classValue, ""));
-    }
-
-    function initTabs() {
-        var container = document.getElementById("tabs");
-
-        tabs.tabs = findTabs(container);
-        tabs.titles = findTitles(tabs.tabs);
-        tabs.headers = findHeaders(container);
-        tabs.select = select;
-        tabs.deselectAll = deselectAll;
-        tabs.select(0);
-
-        return true;
-    }
-
-    function getCheckBox() {
-        return document.getElementById("line-wrapping-toggle");
-    }
-
-    function getLabelForCheckBox() {
-        return document.getElementById("label-for-line-wrapping-toggle");
-    }
-
-    function findCodeBlocks() {
-        var spans = document.getElementById("tabs").getElementsByTagName("span");
-        var codeBlocks = [];
-        for (var i = 0; i < spans.length; ++i) {
-            if (spans[i].className.indexOf("code") >= 0) {
-                codeBlocks.push(spans[i]);
-            }
-        }
-        return codeBlocks;
-    }
-
-    function forAllCodeBlocks(operation) {
-        var codeBlocks = findCodeBlocks();
-
-        for (var i = 0; i < codeBlocks.length; ++i) {
-            operation(codeBlocks[i], "wrapped");
-        }
-    }
-
-    function toggleLineWrapping() {
-        var checkBox = getCheckBox();
-
-        if (checkBox.checked) {
-            forAllCodeBlocks(addClass);
-        } else {
-            forAllCodeBlocks(removeClass);
-        }
-    }
-
-    function initControls() {
-        if (findCodeBlocks().length > 0) {
-            var checkBox = getCheckBox();
-            var label = getLabelForCheckBox();
-
-            checkBox.onclick = toggleLineWrapping;
-            checkBox.checked = false;
-
-            removeClass(label, "hidden");
-         }
-    }
-
-    function switchTab() {
-        var id = this.id.substr(1);
-
-        for (var i = 0; i < tabs.tabs.length; i++) {
-            if (tabs.tabs[i].id === id) {
-                tabs.select(i);
-                break;
-            }
-        }
-
-        return false;
-    }
-
-    function select(i) {
-        this.deselectAll();
-
-        changeElementClass(this.tabs[i], "tab selected");
-        changeElementClass(this.headers[i], "selected");
-
-        while (this.headers[i].firstChild) {
-            this.headers[i].removeChild(this.headers[i].firstChild);
-        }
-
-        var h2 = document.createElement("H2");
-
-        h2.appendChild(document.createTextNode(this.titles[i]));
-        this.headers[i].appendChild(h2);
-    }
-
-    function deselectAll() {
-        for (var i = 0; i < this.tabs.length; i++) {
-            changeElementClass(this.tabs[i], "tab deselected");
-            changeElementClass(this.headers[i], "deselected");
-
-            while (this.headers[i].firstChild) {
-                this.headers[i].removeChild(this.headers[i].firstChild);
-            }
-
-            var a = document.createElement("A");
-
-            a.setAttribute("id", "ltab" + i);
-            a.setAttribute("href", "#tab" + i);
-            a.onclick = switchTab;
-            a.appendChild(document.createTextNode(this.titles[i]));
-
-            this.headers[i].appendChild(a);
-        }
-    }
-
-    function findTabs(container) {
-        return findChildElements(container, "DIV", "tab");
-    }
-
-    function findHeaders(container) {
-        var owner = findChildElements(container, "UL", "tabLinks");
-        return findChildElements(owner[0], "LI", null);
-    }
-
-    function findTitles(tabs) {
-        var titles = [];
-
-        for (var i = 0; i < tabs.length; i++) {
-            var tab = tabs[i];
-            var header = findChildElements(tab, "H2", null)[0];
-
-            header.parentNode.removeChild(header);
-
-            if (header.innerText) {
-                titles.push(header.innerText);
-            } else {
-                titles.push(header.textContent);
-            }
-        }
-
-        return titles;
-    }
-
-    function findChildElements(container, name, targetClass) {
-        var elements = [];
-        var children = container.childNodes;
-
-        for (var i = 0; i < children.length; i++) {
-            var child = children.item(i);
-
-            if (child.nodeType === 1 && child.nodeName === name) {
-                if (targetClass && child.className.indexOf(targetClass) < 0) {
-                    continue;
-                }
-
-                elements.push(child);
-            }
-        }
-
-        return elements;
-    }
-
-    // Entry point.
-
-    window.onload = function() {
-        initTabs();
-        initControls();
-    };
-} (window, window.document));

+ 0 - 103
build/reports/tests/test/packages/default-package.html

@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
-<meta http-equiv="x-ua-compatible" content="IE=edge"/>
-<title>Test results - Default package</title>
-<link href="../css/base-style.css" rel="stylesheet" type="text/css"/>
-<link href="../css/style.css" rel="stylesheet" type="text/css"/>
-<script src="../js/report.js" type="text/javascript"></script>
-</head>
-<body>
-<div id="content">
-<h1>Default package</h1>
-<div class="breadcrumbs">
-<a href="../index.html">all</a> &gt; default-package</div>
-<div id="summary">
-<table>
-<tr>
-<td>
-<div class="summaryGroup">
-<table>
-<tr>
-<td>
-<div class="infoBox" id="tests">
-<div class="counter">1</div>
-<p>tests</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="failures">
-<div class="counter">0</div>
-<p>failures</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="ignored">
-<div class="counter">0</div>
-<p>ignored</p>
-</div>
-</td>
-<td>
-<div class="infoBox" id="duration">
-<div class="counter">0.001s</div>
-<p>duration</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-</td>
-<td>
-<div class="infoBox success" id="successRate">
-<div class="percent">100%</div>
-<p>successful</p>
-</div>
-</td>
-</tr>
-</table>
-</div>
-<div id="tabs">
-<ul class="tabLinks">
-<li>
-<a href="#tab0">Classes</a>
-</li>
-</ul>
-<div id="tab0" class="tab">
-<h2>Classes</h2>
-<table>
-<thread>
-<tr>
-<th>Class</th>
-<th>Tests</th>
-<th>Failures</th>
-<th>Ignored</th>
-<th>Duration</th>
-<th>Success rate</th>
-</tr>
-</thread>
-<tr>
-<td class="success">
-<a href="../classes/SampleTest.html">SampleTest</a>
-</td>
-<td>1</td>
-<td>0</td>
-<td>0</td>
-<td>0.001s</td>
-<td class="success">100%</td>
-</tr>
-</table>
-</div>
-</div>
-<div id="footer">
-<p>
-<div>
-<label class="hidden" id="label-for-line-wrapping-toggle" for="line-wrapping-toggle">Wrap lines
-<input id="line-wrapping-toggle" type="checkbox" autocomplete="off"/>
-</label>
-</div>Generated by 
-<a href="http://www.gradle.org">Gradle 6.5.1</a> at 08.07.2020, 13:10:42</p>
-</div>
-</div>
-</body>
-</html>

+ 0 - 70
build/resources/main/mdd/client/dark-theme.css

@@ -1,70 +0,0 @@
-.root {
-    -fx-accent: #1e74c6;
-    -fx-focus-color: -fx-accent;
-    -fx-base: #373e43;
-    -fx-control-inner-background: derive(-fx-base, 35%);
-    -fx-control-inner-background-alt: -fx-control-inner-background ;
-}
-
-.label{
-    -fx-text-fill: lightgray;
-}
-
-.text-field {
-    -fx-prompt-text-fill: gray;
-}
-
-.titulo{
-    -fx-font-weight: bold;
-    -fx-font-size: 18px;
-}
-
-.button{
-    -fx-focus-traversable: false;
-}
-
-.button:hover{
-    -fx-text-fill: white;
-}
-
-.separator *.line {
-    -fx-background-color: #3C3C3C;
-    -fx-border-style: solid;
-    -fx-border-width: 1px;
-}
-
-.scroll-bar{
-    -fx-background-color: derive(-fx-base,45%)
-}
-
-.button:default {
-    -fx-base: -fx-accent ;
-}
-
-.table-view{
-    /*-fx-background-color: derive(-fx-base, 10%);*/
-    -fx-selection-bar-non-focused: derive(-fx-base, 50%);
-}
-
-.table-view .column-header .label{
-    -fx-alignment: CENTER_LEFT;
-    -fx-font-weight: none;
-}
-
-.list-cell:even,
-.list-cell:odd,
-.table-row-cell:even,
-.table-row-cell:odd{
-    -fx-control-inner-background: derive(-fx-base, 15%);
-}
-
-.list-cell:empty,
-.table-row-cell:empty {
-    -fx-background-color: transparent;
-}
-
-.list-cell,
-.table-row-cell{
-    -fx-border-color: transparent;
-    -fx-table-cell-border-color:transparent;
-}

+ 0 - 62
build/resources/main/mdd/client/main.fxml

@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<?import javafx.scene.control.*?>
-<?import javafx.scene.layout.*?>
-
-<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mdd.client.FXMLDocumentController">
-   <children>
-       <MenuBar>
-           <Menu fx:id="mMain" text="Main">
-               <MenuItem text="Exit" />
-           </Menu>
-
-           <Menu fx:id="mAbout" text="About">
-           </Menu>
-       </MenuBar>
-      <SplitPane fx:id="sPane" dividerPositions="0.2, 0.8" prefHeight="${sPane.parent.height}" prefWidth="600.0">
-        <items>
-            <Accordion>
-              <panes>
-                <TitledPane animated="false" text="untitled 1">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-                <TitledPane animated="false" text="untitled 2">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-                <TitledPane animated="false" text="untitled 3">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-              </panes>
-            </Accordion>
-            <TabPane fx:id="tabPane" prefHeight="238.0" prefWidth="400.0" tabClosingPolicy="UNAVAILABLE">
-
-            </TabPane>
-            <Accordion>
-              <panes>
-                <TitledPane animated="false" text="untitled 1">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-                <TitledPane animated="false" text="untitled 2">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-                <TitledPane animated="false" text="untitled 3">
-                  <content>
-                    <AnchorPane minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="100.0" />
-                  </content>
-                </TitledPane>
-              </panes>
-            </Accordion>
-        </items>
-      </SplitPane>
-   </children>
-</VBox>

+ 0 - 7
build/test-results/test/TEST-SampleTest.xml

@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<testsuite name="SampleTest" tests="1" skipped="0" failures="0" errors="0" timestamp="2020-07-08T11:10:42" hostname="DESKTOP-4P32VSF" time="0.001">
-  <properties/>
-  <testcase name="test" classname="SampleTest" time="0.001"/>
-  <system-out><![CDATA[]]></system-out>
-  <system-err><![CDATA[]]></system-err>
-</testsuite>

+ 0 - 0
build/test-results/test/binary/output.bin


BIN
build/test-results/test/binary/output.bin.idx


BIN
build/test-results/test/binary/results.bin


+ 0 - 27
build/tmp/compileJava/source-classes-mapping.txt

@@ -1,27 +0,0 @@
-mdd/client/ConnectableType.java
- mdd.client.ConnectableType
-mdd/client/HelloWorldServer.java
- mdd.client.HelloWorldServer
-mdd/client/Main.java
- mdd.client.Main
-mdd/client/Processor.java
- mdd.client.Processor
-mdd/client/GUIEventHandler.java
- mdd.client.GUIEventHandler
-mdd/client/IGUIEventClient.java
- mdd.client.IGUIEventClient
-mdd/client/Connection.java
- mdd.client.Connection
-mdd/client/Connectable.java
- mdd.client.Connectable
- mdd.client.Connectable$1
-mdd/client/Input.java
- mdd.client.Input
-mdd/client/Module.java
- mdd.client.Module
-mdd/client/Output.java
- mdd.client.Output
-mdd/client/WorkBench.java
- mdd.client.WorkBench
-mdd/client/FXMLDocumentController.java
- mdd.client.FXMLDocumentController

+ 0 - 2
build/tmp/compileTestJava/source-classes-mapping.txt

@@ -1,2 +0,0 @@
-SampleTest.java
- SampleTest

+ 3 - 0
src/main/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: mdd.client.Main
+

+ 3 - 0
src/main/java/META-INF/MANIFEST.MF

@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: mdd.client.Main
+

+ 36 - 33
src/main/java/mdd/client/Connectable.java

@@ -4,7 +4,9 @@ import javafx.beans.property.DoubleProperty;
 import javafx.beans.property.SimpleDoubleProperty;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
+import javafx.event.Event;
 import javafx.event.EventHandler;
+import javafx.geometry.Point2D;
 import javafx.scene.Group;
 import javafx.scene.control.TextField;
 import javafx.scene.input.*;
@@ -18,14 +20,12 @@ import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
 
-import javax.xml.stream.EventFilter;
-
 public class Connectable extends Group implements IGUIEventClient ,ChangeListener<Number>{
-    private GUIEventHandler _eventHandler = new GUIEventHandler();
+    private GUIEventHandler _eventHandler;
     private Circle _border;
     private Circle _circle;
-    private boolean _connected = false;
-    private boolean _optimizable = false;
+    public boolean connected = false;
+    public boolean optimizable = false;
     private Module _parent;
     private ConnectableType _type;
 
@@ -35,6 +35,8 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
 
 
     public Connectable(Module parent, ConnectableType type, String id){
+        _eventHandler = GUIEventHandler.getEventHandler();
+        _eventHandler.addEventListener(this);
         _parent = parent;
         _type = type;
         ID = id;
@@ -62,18 +64,14 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
         _circle = new Circle(0,0,5);
         _circle.setFill(Color.WHITE);
 
-        _circle.setOnMouseClicked(new EventHandler<MouseEvent>()
-        {
-            @Override
-            public void handle(MouseEvent e) {
-                if(e.getButton() == MouseButton.SECONDARY) {
-                    if (!_connected){
-                        _optimizable = !_optimizable;
-                        updateColor();
-                    }
+        _circle.setOnMouseClicked(e -> {
+            if (e.getButton() == MouseButton.SECONDARY) {
+                if (!connected) {
+                    optimizable = !optimizable;
+                    updateColor();
                 }
-
             }
+
         });
 
         getChildren().addAll(_border, _circle);
@@ -85,9 +83,12 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
             content.putString(json.toString());
             System.out.println("[Connectable]: started drag with id = " + json.toString());
             db.setContent(content);
-            //e.consume();
+            _eventHandler.publishEvent("DRAG_LINE", json);
+            e.consume();
         });
 
+        _circle.addEventHandler(MouseEvent.MOUSE_DRAGGED, Event::consume);
+
         _circle.addEventHandler(DragEvent.DRAG_OVER, e -> {
             Dragboard db = e.getDragboard();
             if (db.hasString()) {
@@ -121,12 +122,22 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
             //e.setDropCompleted(success);
             //e.consume();
         });
+
+        _circle.addEventFilter(MouseEvent.MOUSE_PRESSED, e -> {
+            if(e.getButton() == MouseButton.PRIMARY) {
+                _eventHandler.publishEvent("MOUSE_PRESSED", generateJSON());
+            }
+            if(e.getButton() == MouseButton.SECONDARY) {
+
+            }
+            //e.consume();
+        });
     }
 
     private void updateColor(){
-        if (_connected){
+        if (connected){
             _circle.setFill(Color.YELLOW);
-        } else if (_optimizable) {
+        } else if (optimizable) {
             _circle.setFill(Color.GREEN);
         } else {
             _circle.setFill(Color.WHITE);
@@ -143,17 +154,15 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
             json.put("type", "ANYTHING");
         }
 
-        JSONArray listID = new JSONArray();
-        listID.add(ID);
-        listID.add(_parent.ID);
-        json.put("ID", listID);
+        json.put("ID", ID);
+        json.put("parent", _parent.ID);
 
         return json;
     }
 
     public void setConnected(boolean state){
-        if (state != _connected){
-            _connected = state;
+        if (state != connected){
+            connected = state;
             updateColor();
         }
     }
@@ -171,18 +180,12 @@ public class Connectable extends Group implements IGUIEventClient ,ChangeListene
     }
 
     @Override
-    public GUIEventHandler getGUIEventHandler() {
-        return _eventHandler;
-    }
+    public void processGUIEvent(String event, JSONObject args) {
 
-    @Override
-    public void setGUIEventHandler(GUIEventHandler eventHandler) {
-        _eventHandler = eventHandler;
-        _eventHandler.addEventListener(this);
     }
 
     @Override
-    public void processGUIEvent(String event, JSONObject args) {
-
+    public void close() throws Exception {
+        _eventHandler.removeEventListener(this);
     }
 }

+ 19 - 14
src/main/java/mdd/client/Connection.java

@@ -5,14 +5,20 @@ import org.json.simple.JSONObject;
 
 
 public class Connection extends Line implements IGUIEventClient {
-    private GUIEventHandler _eventHandler = new GUIEventHandler();
-    private Input _in;
-    private Output _out;
+    private GUIEventHandler _eventHandler;
+    public Input in;
+    public Output out;
+
+    public Connection(){
+        super();
+    }
 
     public Connection(Input in, Output out){
         super(0,0,100,100);
-        _in = in;
-        _out = out;
+        _eventHandler = GUIEventHandler.getEventHandler();
+        _eventHandler.addEventListener(this);
+        this.in = in;
+        this.out = out;
         System.out.println("Connection: "+ in.x.toString());
         this.startXProperty().bind(in.x);
         this.startYProperty().bind(in.y);
@@ -22,20 +28,19 @@ public class Connection extends Line implements IGUIEventClient {
 
         in.setConnected(true);
         out.setConnected(true);
+        JSONObject json = new JSONObject();
+        json.put("con", this.toString());
+        json.put("in", in.toString());
+        json.put("out", in.toString());
+        _eventHandler.publishEvent("CONNECTED", json);
     }
 
     @Override
-    public GUIEventHandler getGUIEventHandler() {
-        return _eventHandler;
-    }
-
-    @Override
-    public void setGUIEventHandler(GUIEventHandler eventHandler) {
-        _eventHandler = eventHandler;
+    public void processGUIEvent(String event, JSONObject args) {
     }
 
     @Override
-    public void processGUIEvent(String event, JSONObject args) {
-
+    public void close() throws Exception {
+        _eventHandler.removeEventListener(this);
     }
 }

+ 2 - 12
src/main/java/mdd/client/FXMLDocumentController.java

@@ -14,24 +14,14 @@ import java.util.ResourceBundle;
 
 public class FXMLDocumentController implements Initializable {
     @FXML
-    private TabPane tabPane;
+    private Workshop workshop;
     @FXML
     private SplitPane sPane;
 
     @Override
     public void initialize(URL location, ResourceBundle resources) {
         System.out.println("Loading...");
-        WorkBench bench = new WorkBench();
-        //bench.setContent();
-        /*pane.setMinHeight(0.0f);
-        pane.setMinWidth(0.0f);
-        pane.setPrefHeight(180.0f);
-        pane.setPrefWidth(200.0f);//*/
-                // minHeight="0.0" minWidth="0.0" prefHeight="180.0" prefWidth="200.0"
-
-        tabPane.getTabs().add(bench);
-
-        //tabPane.getTabs().get(0).setContent(new Rectangle(200,200, Color.LIGHTSTEELBLUE));
+        workshop.setTabClosingPolicy(TabPane.TabClosingPolicy.ALL_TABS);
     }
 
     //@FXML private TabPane tabPane;

+ 9 - 2
src/main/java/mdd/client/GUIEventHandler.java

@@ -6,7 +6,9 @@ import org.json.simple.JSONObject;
 import java.util.Vector;
 
 public class GUIEventHandler {
+    private static GUIEventHandler _handler = new GUIEventHandler();
     private Vector<IGUIEventClient> _clients = new Vector<IGUIEventClient>();
+
     public GUIEventHandler(){
 
     }
@@ -20,9 +22,14 @@ public class GUIEventHandler {
     }
 
     public void publishEvent(String event, JSONObject args){
-        for (IGUIEventClient client : _clients) {
-            client.processGUIEvent(event, args);
+        for (int i = 0; i < _clients.size(); ++i) {
+            _clients.elementAt(i).processGUIEvent(event, args);
+            //System.out.println(i+1 + " | " + _clients.size());
         }
     };
+
+    public static GUIEventHandler getEventHandler(){
+        return _handler;
+    }
 }
 

+ 70 - 0
src/main/java/mdd/client/GUIMain.java

@@ -0,0 +1,70 @@
+package mdd.client;
+
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.scene.input.KeyCode;
+import javafx.stage.Stage;
+import javafx.scene.input.KeyEvent;
+import org.json.simple.JSONObject;
+
+
+import java.io.IOException;
+
+public class GUIMain extends Application implements IGUIEventClient{
+    private GUIEventHandler _eventHandler;
+
+    public static void main(String[] args) {
+        launch(args);
+    }
+
+    @Override
+    public void start(Stage primaryStage){
+        _eventHandler = GUIEventHandler.getEventHandler();
+
+        Parent root = null;
+        try {
+            root = FXMLLoader.load(getClass().getResource("main.fxml"));
+        } catch (IOException e) {
+           throw new RuntimeException(e);
+        }
+
+        root.setFocusTraversable(true);
+
+        root.setOnKeyPressed(e -> {
+            System.out.println("[Application]: "+e.getText());
+            JSONObject json = new JSONObject();
+            KeyCode code = e.getCode();
+            if (e.getCode() == KeyCode.ENTER){
+                json.put("key", "ENTER");
+            }else{
+                //json.put("key", e.getCharacter().toLowerCase());
+            }
+
+            _eventHandler.publishEvent("KeyTyped", json);
+            /*if (isSelected) {
+                JSONObject json = new JSONObject();
+                json.put("id", ID);
+                _eventHandler.publishEvent("OPEN_PROCESSOR", json);
+            }*/
+        });
+
+        Scene scene = new Scene(root);
+        scene.getStylesheets().add(String.valueOf(getClass().getResource("dark-theme.css")));
+        primaryStage.setFullScreen(true);
+        primaryStage.setMaximized(true);
+        primaryStage.setScene(scene);
+        primaryStage.show();
+    }
+
+    @Override
+    public void processGUIEvent(String event, JSONObject args) {
+
+    }
+
+    @Override
+    public void close() throws Exception {
+
+    }
+}

+ 7 - 8
src/main/java/mdd/client/HelloWorldServer.java

@@ -10,21 +10,20 @@ public class HelloWorldServer
     {
         try (ZContext context = new ZContext()) {
             // Socket to talk to clients
-            ZMQ.Socket socket = context.createSocket(SocketType.REP);
-            socket.bind("tcp://*:5555");
+            ZMQ.Socket socket = context.createSocket(SocketType.REQ);
+            socket.connect("tcp://localhost:5555");
+
+            for (int request = 0; request < 10; request++) {
+
+                String response = "Hello, world!";
+                socket.send(response.getBytes(ZMQ.CHARSET), 0);
 
-            while (!Thread.currentThread().isInterrupted()) {
-                // Block until a message is received
                 byte[] reply = socket.recv(0);
 
                 // Print the message
                 System.out.println(
                         "Received: [" + new String(reply, ZMQ.CHARSET) + "]"
                 );
-
-                // Send a response
-                String response = "Hello, world!";
-                socket.send(response.getBytes(ZMQ.CHARSET), 0);
             }
         }
     }

+ 1 - 3
src/main/java/mdd/client/IGUIEventClient.java

@@ -2,8 +2,6 @@ package mdd.client;
 
 import org.json.simple.JSONObject;
 
-public interface IGUIEventClient {
-    GUIEventHandler getGUIEventHandler();
-    void setGUIEventHandler(GUIEventHandler eventHandler);
+public interface IGUIEventClient extends AutoCloseable {
     void processGUIEvent(String event, JSONObject args);
 }

+ 2 - 39
src/main/java/mdd/client/Main.java

@@ -1,44 +1,7 @@
 package mdd.client;
 
-import javafx.application.Application;
-import javafx.fxml.FXML;
-import javafx.fxml.FXMLLoader;
-import javafx.scene.Parent;
-import javafx.scene.Scene;
-import javafx.scene.control.Tab;
-import javafx.scene.control.TabPane;
-import javafx.scene.paint.Color;
-import javafx.scene.shape.Rectangle;
-import javafx.stage.Stage;
-import org.zeromq.SocketType;
-import org.zeromq.ZContext;
-import org.zeromq.ZMQ;
-import zmq.socket.Sockets;
-
-import java.io.IOException;
-
-public class Main extends Application {
-
-
-
+public class Main {
     public static void main(String[] args) {
-        launch(args);
-    }
-
-    @Override
-    public void start(Stage primaryStage){
-        Parent root = null;
-        try {
-            root = FXMLLoader.load(getClass().getResource("main.fxml"));
-        } catch (IOException e) {
-           throw new RuntimeException(e);
-        }
-
-        Scene scene = new Scene(root);
-        scene.getStylesheets().add(String.valueOf(getClass().getResource("dark-theme.css")));
-        primaryStage.setFullScreen(true);
-        primaryStage.setMaximized(true);
-        primaryStage.setScene(scene);
-        primaryStage.show();
+        GUIMain.main(args);
     }
 }

+ 41 - 42
src/main/java/mdd/client/Module.java

@@ -21,15 +21,24 @@ import java.util.Vector;
 public class Module extends Group implements IGUIEventClient{
     private boolean _dragged = false;
     private Point2D _pos = new Point2D(0.0f,0.0f);
-    private GUIEventHandler _eventHandler = new GUIEventHandler();
+    protected GUIEventHandler _eventHandler;
 
     public String ID = "";
+    public Vector<String> Prefix;
     public HBox hlayout = new HBox();
     public VBox inputs = new VBox();
     public VBox outputs = new VBox();
     public boolean isSelected = false;
 
-    public Module(String id){
+    public static Module DefaultModule(){
+        return new Module(new Vector<String>(), "", Color.DARKBLUE);
+    }
+
+    public Module(Vector<String> prefix, String id, Color color){
+        setFocusTraversable(true);
+        _eventHandler = GUIEventHandler.getEventHandler();
+        _eventHandler.addEventListener(this);
+        Prefix = prefix;
         ID = id;
         Rectangle titlebar;
         Rectangle background;
@@ -52,13 +61,13 @@ public class Module extends Group implements IGUIEventClient{
         hlayout.setTranslateX(-7);
         hlayout.setTranslateY(30);
 
-        //System.out.println("[Module]: pressed: "+ hbox.getPrefWidth());
+        // System.out.println("[Module]: pressed: "+ hbox.getPrefWidth());
 
-        //JSONObject parameters
+        // JSONObject parameters
         titlebar = new Rectangle(0.0f, 0.0f, 150-20, 20.0f);
         titlebar.setArcWidth(10.0f);
         titlebar.setArcHeight(10.0f);
-        titlebar.setFill(Color.ROYALBLUE);
+        titlebar.setFill(color);
         background = new Rectangle(0.0f, 0.0f, 150-20, 150 + 40);
         background.setArcWidth(10.0f);
         background.setArcHeight(10.0f);
@@ -74,28 +83,27 @@ public class Module extends Group implements IGUIEventClient{
 
 
 
-        addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
-            System.out.println("[Module]: press event filter detected!");
+        addEventFilter(MouseEvent.MOUSE_PRESSED, e -> {
             if(e.getButton() == MouseButton.PRIMARY) {
                 isSelected = true;
                 System.out.println("[Module]: select: " + ID);
-                JSONObject json = new JSONObject();
-                json.put("id", id);
-                _eventHandler.publishEvent("MOUSE_PRESSED", json);
+                _eventHandler.publishEvent("MOUSE_PRESSED", getJSONIdentifier());
                 _pos = new Point2D(e.getSceneX(), e.getSceneY());
             }
             if(e.getButton() == MouseButton.SECONDARY) {
 
             }
-            e.consume();
+            //e.consume();
         });
 
         addEventHandler(MouseEvent.MOUSE_DRAGGED, e -> {
-            //System.out.println("[Module]: dragg event detected!");
+            // System.out.println("[Module]: dragg event detected!");
             if(e.getButton() == MouseButton.PRIMARY) {
-                setTranslateX(getTranslateX()+(e.getSceneX()-_pos.getX()));
-                setTranslateY(getTranslateY()+(e.getSceneY()-_pos.getY()));
-                _pos = new Point2D( e.getSceneX(),  e.getSceneY());
+                if (isSelected){
+                    setTranslateX(getTranslateX()+(e.getSceneX()-_pos.getX()));
+                    setTranslateY(getTranslateY()+(e.getSceneY()-_pos.getY()));
+                    _pos = new Point2D( e.getSceneX(),  e.getSceneY());
+                }
             }
             if(e.getButton() == MouseButton.SECONDARY) {
 
@@ -104,12 +112,10 @@ public class Module extends Group implements IGUIEventClient{
     }
 
     public void addInput(Input in){
-        in.setGUIEventHandler(_eventHandler);
         inputs.getChildren().add(in);
     }
 
     public void addOutput(Output out){
-        out.setGUIEventHandler(_eventHandler);
         outputs.getChildren().add(out);
     }
 
@@ -124,7 +130,7 @@ public class Module extends Group implements IGUIEventClient{
 
         }
         System.out.println("[Module]: getInput: WRONG ID!");
-        return new Input(this,"");
+        return null;
     }
 
     public Output getOutput(String id){
@@ -138,40 +144,28 @@ public class Module extends Group implements IGUIEventClient{
 
         }
         System.out.println("[Module]: getOutput: WRONG ID!");
-        return new Output(this,"");
+        return null;
     }
 
-    public GUIEventHandler getGUIEventHandler(){
-        return _eventHandler;
+    public JSONObject getJSONIdentifier(){
+        JSONObject json = new JSONObject();
+        json.put("prefix", Prefix);
+        json.put("id", ID);
+        return json;
     }
 
-    public void setGUIEventHandler(GUIEventHandler eventHandler){
-        _eventHandler = eventHandler;
-        for (Node node : inputs.getChildren()){
-            if(node instanceof Input){
-                Input in = (Input) node;
-                in.setGUIEventHandler(_eventHandler);
-            }
-
-        }
-
-        for (Node node : outputs.getChildren()){
-            if(node instanceof Output){
-                Output out = (Output) node;
-                out.setGUIEventHandler(_eventHandler);
-            }
-
-        }
-        _eventHandler.addEventListener(this);
+    public Vector<String> getAsPrefix(){
+        Vector<String> ret = (Vector<String>)Prefix.clone();
+        ret.add(ID);
+        return ret;
     }
 
     @Override
     public void processGUIEvent(String event, JSONObject args) {
         if (event == "MOUSE_PRESSED"){
-            JSONObject json = new JSONObject();
-            json.put("id", ID);
 
-            if (!args.equals(json)){
+
+            if (!args.equals(getJSONIdentifier())){
                 if (isSelected){
                     System.out.println("[Module]: deselect: " + ID);
                 }
@@ -179,4 +173,9 @@ public class Module extends Group implements IGUIEventClient{
             }
         }
     }
+
+    @Override
+    public void close() throws Exception {
+        _eventHandler.removeEventListener(this);
+    }
 }

+ 118 - 39
src/main/java/mdd/client/Processor.java

@@ -1,35 +1,68 @@
 package mdd.client;
 
 import javafx.event.EventHandler;
+import javafx.geometry.Point2D;
 import javafx.scene.Group;
 import javafx.scene.Node;
 import javafx.scene.input.*;
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Line;
 import org.json.simple.JSONArray;
 import org.json.simple.JSONObject;
 import org.json.simple.parser.JSONParser;
 import org.json.simple.parser.ParseException;
 
+import java.util.Vector;
+
 public class Processor extends Module{
     private Group modules = new Group();
     private Group connections = new Group();
     public Group all = new Group(connections, modules);
-    public Module selected = new Module("-1");
-    private GUIEventHandler _eventHandler = new GUIEventHandler();
-
-    public Processor(String id) {
-        super( id);
-        //setFocusTraversable(true);
-        setOnKeyPressed(e -> {
-            System.out.println("[Processor]: pressed:");
-            System.out.println("[Processor]: pressed: " + e.getText());
-            if (isSelected) {
-                JSONObject json = new JSONObject();
-                json.put("id", ID);
-                _eventHandler.publishEvent("OPEN_PROCESSOR", json);
+
+
+    private boolean detected_drag = false;
+    private boolean draw_temp_connection = false;
+    public Connection temp_connection = new Connection();
+    private Connectable connectable;
+
+    public Processor(Vector<String> prefix, String id) {
+        super(prefix, id, Color.DARKVIOLET);
+
+        modules.addEventHandler(MouseEvent.DRAG_DETECTED, e -> {
+            // System.out.println("[Module]: dragg event detected!");
+            if(e.getButton() == MouseButton.PRIMARY) {
+                detected_drag = true;
+            }
+            if(e.getButton() == MouseButton.SECONDARY) {
+
             }
         });
 
+        all.addEventHandler(MouseEvent.MOUSE_DRAGGED, e -> {
+            // System.out.println("[Module]: dragg event detected!");
+            if(e.getButton() == MouseButton.PRIMARY) {
+                if (draw_temp_connection){
+                    System.out.println("[Processor] draw Line!");
+                    temp_connection.setEndX(e.getSceneX());
+                    temp_connection.setEndY(e.getSceneY());
+                }
+            }
+            if(e.getButton() == MouseButton.SECONDARY) {
+
+            }
+        });
+
+        all.addEventHandler(DragEvent.DRAG_DROPPED, e -> {
+            //connections.getChildren().remove(temp_connection);
+            System.out.println("[Processor] all");
+            detected_drag = false;
+        });
+
         modules.addEventHandler(DragEvent.DRAG_DROPPED, e -> {
+            //connections.getChildren().remove(temp_connection);
+            System.out.println("[Processor]");
+            detected_drag = false;
+
             Dragboard db = e.getDragboard();
             boolean success = false;
             if (db.hasString()) {
@@ -53,27 +86,32 @@ public class Processor extends Module{
                         if (json.containsKey("type")) {
                             String type = json.get("type").toString();
                             if (type.equals("INPUT")) {
-                                System.out.println("[WorkBench] Dropped found type = " + "INPUT");
+                                System.out.println("[Processor] Dropped found type = " + "INPUT");
                                 foundInput = true;
-                                JSONArray idList = (JSONArray) json.get("ID");
-                                in = getModule(idList.get(1).toString()).getInput(idList.get(0).toString());
+                                in = getModule(json.get("parent").toString()).getInput(json.get("ID").toString());
                             } else if (type.equals("OUTPUT")) {
-                                System.out.println("[WorkBench] Dropped found type = " + "OUTPUT");
+                                System.out.println("[Processor] Dropped found type = " + "OUTPUT");
                                 foundOutput = true;
-                                JSONArray idList = (JSONArray) json.get("ID");
-                                out = getModule(idList.get(1).toString()).getOutput(idList.get(0).toString());
+                                out = getModule(json.get("parent").toString()).getOutput(json.get("ID").toString());
                             }
                         }
                     }
                     if (foundInput && foundOutput){
-                        System.out.println("[WorkBench] Dropped: success!");
+                        System.out.println("[Processor] Dropped: success!");
+                        if(in.connected){
+                            for (int i = 0; i < connections.getChildren().size(); ++i){
+                                if (((Connection)connections.getChildren().get(i)).in.equals(in)){
+                                    connections.getChildren().remove(i);
+                                }
+                            }
+                        }
                         connections.getChildren().add(new Connection(in, out));
                         success = true;
                     }
 
                 }
 
-                System.out.println("[WorkBench] Dropped: " + db.getString());
+                System.out.println("[Processor] Dropped: " + db.getString());
 
             }
             e.setDropCompleted(success);
@@ -90,36 +128,77 @@ public class Processor extends Module{
                 }
             }
         }
-        return new  Module("");
+        return null;
     }
 
-    public void setGUIEventHandler(GUIEventHandler eventHandler){
-        _eventHandler = eventHandler;
-        for (Node node : inputs.getChildren()){
-            if(node instanceof Input){
-                Input in = (Input) node;
-                in.setGUIEventHandler(_eventHandler);
-            }
-
+    public Module getModule(Vector<String> id_path){
+        id_path.remove(0);
+        if (id_path.size() == 1){
+            return getModule(id_path.firstElement());
         }
+        else {
+            Processor new_processor = (Processor)getModule(id_path.firstElement());
+            return new_processor.getModule(id_path);
+        }
+    }
 
-        for (Node node : outputs.getChildren()){
-            if(node instanceof Output){
-                Output out = (Output) node;
-                out.setGUIEventHandler(_eventHandler);
-            }
-
+    public Processor getProcessor(Vector<String> id_path){
+        id_path.remove(0);
+        Processor new_processor = (Processor)getModule(id_path.firstElement());
+        if (id_path.size() == 1){
+            return new_processor;
+        }else {
+            return new_processor.getProcessor(id_path);
         }
-        _eventHandler.addEventListener(this);
     }
 
     public void addModule(Module module){
-        module.setGUIEventHandler(getGUIEventHandler());
         modules.getChildren().add(module);
     }
 
     public void addConnection(Connection connection){
-        connection.setGUIEventHandler(getGUIEventHandler());
         connections.getChildren().add(connection);
     }
+
+    @Override
+    public void processGUIEvent(String event, JSONObject args) {
+        super.processGUIEvent(event, args);
+        if (isSelected){
+            if (event.equals("KeyTyped")){
+                String key = args.get("key").toString();
+                if (key.equals("ENTER")){
+                    JSONObject json = new JSONObject();
+                    json.put("path", getAsPrefix());
+                    _eventHandler.publishEvent("OPEN_PROCESSOR", json);
+                    System.out.println("[Processor]: published");
+                }
+            }
+        }
+        if (detected_drag){
+            if (event.equals("DRAG_LINE")){
+                draw_temp_connection = true;
+
+                JSONObject json = args;
+                if (json.containsKey("type")) {
+                    String type = json.get("type").toString();
+                    if (type.equals("INPUT")) {
+                        System.out.println("[Processor] Line from type = " + "INPUT");
+                        connectable = getModule(json.get("parent").toString()).getInput(json.get("ID").toString());
+                    } else if (type.equals("OUTPUT")) {
+                        System.out.println("[Processor] Line from type = " + "OUTPUT");
+                        connectable = getModule(json.get("parent").toString()).getOutput(json.get("ID").toString());
+                    }
+                    if (connectable == null){
+                        System.out.println("[Processor]: Couldn't find Connectable!");
+                    }
+                }
+                temp_connection= new Connection();
+                temp_connection.startXProperty().bind(connectable.x);
+                temp_connection.startYProperty().bind(connectable.y);
+                temp_connection.setEndX(connectable.x.getValue()+100);
+                temp_connection.setEndY(connectable.y.getValue()+100);
+                //connections.getChildren().add(temp_connection);
+            }
+        }
+    }
 }

+ 12 - 43
src/main/java/mdd/client/WorkBench.java

@@ -3,66 +3,35 @@ package mdd.client;
 import javafx.geometry.Point2D;
 import javafx.scene.control.ScrollPane;
 import javafx.scene.control.Tab;
-import javafx.scene.input.*;
-import org.json.simple.JSONArray;
+import javafx.scene.input.MouseButton;
+import javafx.scene.input.MouseEvent;
 import org.json.simple.JSONObject;
-import org.json.simple.parser.JSONParser;
-import org.json.simple.parser.ParseException;
-
-import java.util.Vector;
 
 public class WorkBench extends Tab implements IGUIEventClient{
     private ScrollPane _scrollPane;
     private Processor _processor;
     private Point2D _pos = new Point2D(0.0f,0.0f);
-    private GUIEventHandler _eventHandler = new GUIEventHandler();
-
-
-    public WorkBench(){
-        super();
-        _processor = new Processor("");
-        init();
-    }
+    private GUIEventHandler _eventHandler;
 
     public WorkBench(Processor processor){
-        super();
-        _processor = processor;
-        init();
-        //getTabPane()
-    }
+        super(processor.getAsPrefix().toString());
 
-    private void init(){
-        loadExample();
-        setId(_processor.ID);
+        _eventHandler = GUIEventHandler.getEventHandler();
+        _eventHandler.addEventListener(this);
+        _processor = processor;
+        setId(_processor.getAsPrefix().toString());
         _scrollPane = new ScrollPane(_processor.all);
         setContent(_scrollPane);
-
-        //getTabPane()
-    }
-
-    private void loadExample(){
-        _processor.addModule(new Module("1"));
-        _processor.addModule(new Module("2"));
-        _processor.addModule(new Processor("3"));
-
-        _processor.addConnection(new Connection(_processor.getModule("1").getInput("1"), _processor.getModule("3").getOutput("1")));
+        //setContent(_processor.all);
     }
 
     @Override
-    public GUIEventHandler getGUIEventHandler() {
-        return _eventHandler;
-    }
+    public void processGUIEvent(String event, JSONObject args) {
 
-    @Override
-    public void setGUIEventHandler(GUIEventHandler eventHandler) {
-        _eventHandler = eventHandler;
-        _processor.setGUIEventHandler(_eventHandler);
     }
 
     @Override
-    public void processGUIEvent(String event, JSONObject args) {
-        if (event == "OPEN_PROCESSOR"){
-            getTabPane().getTabs().add(new WorkBench((Processor) _processor.getModule(args.get("id").toString())));
-        }
+    public void close() throws Exception {
+        _eventHandler.removeEventListener(this);
     }
 }

+ 87 - 0
src/main/java/mdd/client/Workshop.java

@@ -0,0 +1,87 @@
+package mdd.client;
+
+import javafx.collections.ObservableList;
+import javafx.scene.control.Tab;
+import javafx.scene.control.TabPane;
+import javafx.scene.input.MouseButton;
+import javafx.scene.input.MouseEvent;
+import javafx.scene.paint.Color;
+import org.json.simple.JSONObject;
+
+import java.util.Vector;
+
+
+public class Workshop extends TabPane implements IGUIEventClient {
+    private GUIEventHandler _eventHandler;
+    private Processor _main_processor;
+
+    public Workshop(){
+        super();
+        _eventHandler = GUIEventHandler.getEventHandler();
+        _eventHandler.addEventListener(this);
+        loadExample();
+        showMainProcessor();
+    }
+
+    private void loadExample(){
+        _main_processor = new Processor(new Vector<String>(),"0");
+        _main_processor.addModule(new Module(_main_processor.getAsPrefix(), "1", Color.DODGERBLUE));
+        _main_processor.addModule(new Module(_main_processor.getAsPrefix(),"2", Color.DARKRED));
+
+        Processor processor3 = new Processor(_main_processor.getAsPrefix(),"3");
+
+        Processor processor4 = new Processor(processor3.getAsPrefix(),"4");
+        processor4.addModule(new Module(processor4.getAsPrefix(),"5", Color.DODGERBLUE));
+        processor4.addModule(new Module(processor4.getAsPrefix(),"6", Color.DARKRED));
+        processor4.addModule(new Module(processor4.getAsPrefix(),"7", Color.DODGERBLUE));
+        processor4.addConnection(new Connection(processor4.getModule("5").getInput("1"), processor4.getModule("6").getOutput("1")));
+        processor4.addConnection(new Connection(processor4.getModule("7").getInput("3"), processor4.getModule("5").getOutput("2")));
+
+        processor3.addModule(processor4);
+
+        _main_processor.addModule(processor3);
+
+        _main_processor.addConnection(new Connection(_main_processor.getModule("1").getInput("1"), _main_processor.getModule("3").getOutput("1")));
+    }
+
+    public void showMainProcessor(){
+        showProcessor(_main_processor);
+    }
+
+    private void showProcessor(Processor processor){
+        int existingID = -1;
+        for (int i = 0; i < getTabs().size(); ++i){
+            if (getTabs().get(i).getId().equals(processor.getAsPrefix().toString())){
+                existingID = i;
+            }
+        }
+        if (existingID == -1) {
+            WorkBench bench = new WorkBench(processor);
+            getTabs().add(bench);
+            getSelectionModel().select(bench);
+        }else{
+            getSelectionModel().select(getTabs().get(existingID));
+        }
+    }
+
+
+    @Override
+    public void close() throws Exception {
+        _eventHandler.removeEventListener(this);
+    }
+
+    @Override
+    public void processGUIEvent(String event, JSONObject args) {
+
+        if (event == "OPEN_PROCESSOR"){
+            System.out.println("[Workshop]: OPEN_PROCESSOR with path = " +args.get("path").toString());
+            Processor processor = _main_processor.getProcessor((Vector<String>)args.get("path"));
+            if (processor != null){
+                showProcessor(processor);
+            }else{
+                System.out.println("[Workshop]: Something went wrong!");
+            }
+
+        }
+    }
+}

+ 3 - 2
src/main/resources/mdd/client/main.fxml

@@ -3,6 +3,7 @@
 <?import javafx.scene.control.*?>
 <?import javafx.scene.layout.*?>
 
+<?import mdd.client.Workshop?>
 <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/10.0.2-internal" xmlns:fx="http://javafx.com/fxml/1" fx:controller="mdd.client.FXMLDocumentController">
    <children>
        <MenuBar>
@@ -34,9 +35,9 @@
                 </TitledPane>
               </panes>
             </Accordion>
-            <TabPane fx:id="tabPane" prefHeight="238.0" prefWidth="400.0" tabClosingPolicy="UNAVAILABLE">
+            <Workshop fx:id="workshop" prefHeight="238.0" prefWidth="400.0" tabClosingPolicy="UNAVAILABLE">
 
-            </TabPane>
+            </Workshop>
             <Accordion>
               <panes>
                 <TitledPane animated="false" text="untitled 1">