UNPKG

jsoneditor4code

Version:

JSON Editor for UML Diagrams developed with Javascript Code Templates based on JSON Editor of Jeremy Dorn

139 lines (117 loc) 5.89 kB
//################################################################# //# Javascript Class: Generator4JSON() //# SuperClass: Editor4JSON //# Class Filename: generator4json.js //# //# Author of Class: Engelbert Niehaus //# email: niehaus@uni-landau.de //# created 22.12.2017 //# last modifications 2017/12/22 11:20:10 //# GNU Public License V3 - OpenSource //# //# created with JavaScript Class Creator JSCC //# https://niebert.github.io/JavascriptClassGenerator //################################################################# //--------------------------------------------------------------------- //---Store File in Subdirectory /js and import this Class in HTML-File with // SCRIPT-Tag: LANGUAGE="JavaScript" SRC="js/generator4json.js" //--------------------------------------------------------------------- //---Constructor of Class Generator4JSON() // Call the constructor for creating an instance of class Generator4JSON // by the following command in HTML-file that imports this class // var vMyInstance = new Generator4JSON(); //--------------------------------------------------------------------- //----Attributes------------------------------------------------------- //--------------------------------------------------------------------- // If you want to access the attributes of Generator4JSON, use // the attribute name with a leading "this." in the definition of method of Generator4JSON, e.g. // this.aName = "Hello World"; //--------------------------------------------------------------------- //----Methods---------------------------------------------------------- //--------------------------------------------------------------------- // (1) If you want to assign definitions of methods for single instance of the class 'Generator4JSON' // they are defined with // this.my_method = function (pPar1,pPar2) // this approach allows to overwrite the method definition of single instances dynamically. //--------------------------------------------------------------------- // (2) A prototype definition of methods for 'Generator4JSON' will be set by // use the method's name and extend it with 'Generator4JSON'. // Generator4JSON.prototype.my_method = function (pPar1,pPar2) // This approach consumes less memory for instances. //--------------------------------------------------------------------- //-------------------------------------- //---Super Class------------------------ // Inheritance: 'Generator4JSON' inherits from 'JSONEditor' Generator4JSON.prototype = new JSONEditor(); // Constructor for instances of Generator4JSON has to updated. // Otherwise constructor of Editor4JSON is called Generator4JSON.prototype.constructor=Generator4JSON; // see http://phrogz.net/js/classes/OOPinJS2.html for explanation //-------------------------------------- function Generator4JSON () { //--------------------------------------------------------------------- //---Attributes of Class "Generator4JSON()" //--------------------------------------------------------------------- //--------------------------------------------------------------------- //---Methods of Class "Generator4JSON()" //--------------------------------------------------------------------- //----PUBLIC Method: Generator4JSON.setTemplate(pBase:String,pLoop:String)----- // setTemplate(pBase,pLoop) // Comment for setTemplate //----PUBLIC Method: Generator4JSON.compile(pArray:Array):String----- // compile(pArray) Return: String // Comment for compile } //------------------------------------------------------------------------- //---END Constructor of Class "Generator4JSON()" //------------------------------------------------------------------------- // //################################################################# //# PUBLIC Method: setTemplate() //# used in Class: Generator4JSON //# Parameter: //# pBase:String //# pLoop:String //# Comment: //# Comment for setTemplate //# //# created with JSCC 2017/03/05 18:13:28 //# last modifications 2017/12/22 11:20:10 //################################################################# Generator4JSON.prototype.setTemplate = function (pBase,pLoop) { //----Debugging------------------------------------------ // console.log("js/generator4json.js - Call: setTemplate(pBase:String,pLoop:String)"); // alert("js/generator4json.js - Call: setTemplate(pBase:String,pLoop:String)"); //----Create Object/Instance of Generator4JSON---- // var vMyInstance = new Generator4JSON(); // vMyInstance.setTemplate(pBase,pLoop); //------------------------------------------------------- //----------- INSERT YOUR CODE HERE --------------- }; //----End of Method setTemplate Definition //################################################################# //# PUBLIC Method: compileArray() //# used in Class: Generator4JSON //# Parameter: //# pArray:Array //# Comment: //# Comment for compileArray //# Return: String //# created with JSCC 2017/03/05 18:13:28 //# last modifications 2017/12/22 11:20:10 //################################################################# Generator4JSON.prototype.compileArray = function (pArray) { //----Debugging------------------------------------------ // console.log("js/generator4json.js - Call: compileArray(pArray:Array):String"); // alert("js/generator4json.js - Call: compile(pArray:Array):String"); //----Create Object/Instance of Generator4JSON---- // var vMyInstance = new Generator4JSON(); // vMyInstance.compileArray(pArray); //------------------------------------------------------- //----------- INSERT YOUR CODE HERE --------------- }; //----End of Method compile Definition //------------------------------------------- //---End Definition of Class----------------- // JS Class: Generator4JSON //-------------------------------------------