Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrikfolkerts authored Sep 20, 2019
1 parent 300926e commit a05e67f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ EXECUTE

Change into the directory of SESViewEl and execute
- npm install

All necessary packages are installed.

Then SESViewEl can be started with
Expand Down
59 changes: 57 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
-->

<div style="display:inline-block;" id="globals"></div>
<input name="Show/Hide Node Attributes" id="showhidenodeattrib" type="button" size="20" value="Show/Hide Node Attributes" onclick="showNodeSpecAttrib();">
<div style="display:inline-block;" id="nodeSpecificAttributes"></div>
</body>

<script>
Expand All @@ -37,6 +39,10 @@
//start the server
server();

//set global variables
var show_allAttribString = "";
var nodesSpecAttribShown = false;

//--------------------------------------------------------------------

//presentation with d3
Expand Down Expand Up @@ -68,7 +74,8 @@
//presentation of the globals
function presGlob(sesvars, semcons) {
var show_globals = [];
show_globals.push('<table border=0>');
show_globals.push('<table style="display: inline-block"; border=1>');
//show_globals.push('<table style="float: left"; border=1>');
show_globals.push('<thead>');
show_globals.push('<tr><th align=left bgcolor=#AAAAAA>SES variables</th><th align=left bgcolor=#AAAAAA>semantic conditions</th></tr>');
show_globals.push('</thead>');
Expand All @@ -77,8 +84,53 @@
show_globals.push('</tbody>');
show_globals.push('</table>');

var show_globalsString = "";
for (var i=0; i<show_globals.length; i++) {
show_globalsString = show_globalsString + show_globals[i];
}

var globEl = document.getElementById("globals");
globEl.innerHTML = show_globals;
globEl.innerHTML = show_globalsString;
}

//presentation of the node specific attributes
function presNodeSpecAttr(nodeSpecificAttributes) {
var show_allAttrib = [];
for (var i=0; i<nodeSpecificAttributes.length; i++) {
var show_attrib = [];
show_attrib.push('<table style="display: inline-block"; border=1>');
//show_attrib.push('<table style="float: left"; border=1>');
show_attrib.push('<thead>');
show_attrib.push('<tr><th align=left bgcolor=#EEEEEE>Nodename</th><th align=left bgcolor=#EEEEEE>Attributes</th></tr>');
show_attrib.push('</thead>');
show_attrib.push('<tbody>');
show_attrib.push('<tr><td bgcolor=#EEEEEE>' + nodeSpecificAttributes[i][0] + '</td><td bgcolor=#EEEEEE>' + nodeSpecificAttributes[i][1] +'</td></tr>');
show_attrib.push('</tbody>');
show_attrib.push('</table>');

show_allAttrib.push(show_attrib);
}

show_allAttribArray = [];
for (var i=0; i<show_allAttrib.length; i++) {
show_allAttribArray = show_allAttribArray.concat(show_allAttrib[i]);
}

for (var i=0; i<show_allAttribArray.length; i++) {
show_allAttribString = show_allAttribString + show_allAttribArray[i];
}
}

function showNodeSpecAttrib() {
if (!nodesSpecAttribShown) {
var nsaEl = document.getElementById("nodeSpecificAttributes");
nsaEl.innerHTML = show_allAttribString;
nodesSpecAttribShown = true;
} else {
var nsaEl = document.getElementById("nodeSpecificAttributes");
nsaEl.innerHTML = "";
nodesSpecAttribShown = false;
}
}

//--------------------------------------------------------------------
Expand All @@ -105,10 +157,13 @@
var treeDat = retval[0];
var sesvars = retval[1];
var semcons = retval[2];
var nodeSpecificAttributes = retval[3];
//execute script for presentation
presenter.createPicture(treeDat);
//execute function for presentation of the globals
presGlob(sesvars, semcons);
//execute function for presentation of the node specific attributes
presNodeSpecAttr(nodeSpecificAttributes);
});

// Remove the client from the list when it leaves
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "SESViewEl",
"name": "sesviewel",
"version": "1.0.0",
"description": "Developed with Node.js and electron as UI in Visual Studio Code.",
"main": "main.js",
Expand Down
28 changes: 23 additions & 5 deletions xml_converter.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ exports.treeData = function getTheTree(xmlString) {
var dom = dom.getElementsByTagName('node')[0];
//console.log(dom)

var nodeSpecificAttributes = [];

//if the XML string is available, execute the function treebuildRecursive(...), otherwise load a pseudo tree -> root node is inserted here
if (dom != undefined){
//get attributes of first node
Expand All @@ -52,7 +54,11 @@ exports.treeData = function getTheTree(xmlString) {
infotext = getAttributeInfotext(childnodes[j], infotext);
}
}
return infotext.replace(/&quot;/g, '\"');
var returntext = infotext.replace(/&quot;/g, '\"');
if (returntext != "") {
nodeSpecificAttributes.push([childnodes[0].parentNode.attributes[1].value, returntext]); //[name, atttributes]
}
return returntext;
}

function getInfotextAspect(childnodes) {
Expand All @@ -66,7 +72,11 @@ exports.treeData = function getTheTree(xmlString) {
infotext = getCouplingInfotext(childnodes[j], infotext);
}
}
return infotext.replace(/&quot;/g, '\"');
var returntext = infotext.replace(/&quot;/g, '\"');
if (returntext != "") {
nodeSpecificAttributes.push([childnodes[0].parentNode.attributes[1].value, returntext]); //[name, atttributes]
}
return returntext;
}

function getInfotextSpecialization(childnodes) {
Expand All @@ -76,7 +86,11 @@ exports.treeData = function getTheTree(xmlString) {
infotext = getSpecializationruleInfotext(childnodes[j], infotext);
}
}
return infotext.replace(/&quot;/g, '\"');
var returntext = infotext.replace(/&quot;/g, '\"');
if (returntext != "") {
nodeSpecificAttributes.push([childnodes[0].parentNode.attributes[1].value, returntext]); //[name, atttributes]
}
return returntext;
}

function getInfotextMultiAspect(childnodes) {
Expand All @@ -92,7 +106,11 @@ exports.treeData = function getTheTree(xmlString) {
infotext = getNumrepInfotext(childnodes[j], infotext);
}
}
return infotext.replace(/&quot;/g, '\"');
var returntext = infotext.replace(/&quot;/g, '\"');
if (returntext != "") {
nodeSpecificAttributes.push([childnodes[0].parentNode.attributes[1].value, returntext]); //[name, atttributes]
}
return returntext;
}

function getAttributeInfotext(childnode, infotext) {
Expand Down Expand Up @@ -229,5 +247,5 @@ exports.treeData = function getTheTree(xmlString) {
//}
return children;
}
return [jtree, sesvars, semcons];
return [jtree, sesvars, semcons, nodeSpecificAttributes];
}

0 comments on commit a05e67f

Please sign in to comment.