aboutsummaryrefslogtreecommitdiffstats
path: root/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common
diff options
context:
space:
mode:
Diffstat (limited to 'dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common')
-rw-r--r--dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Common.js622
-rw-r--r--dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Logger.js191
-rw-r--r--dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Options.js193
3 files changed, 506 insertions, 500 deletions
diff --git a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Common.js b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Common.js
index 7337367dca..1c6bd69dc2 100644
--- a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Common.js
+++ b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Common.js
@@ -18,339 +18,347 @@
* Common operations.
*/
export default class Common {
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Retrieve and start a simple timer. Retrieve elapsed time by calling #ms().
+ * @returns {*}
+ */
+ static timer() {
+ const start = new Date().getTime();
+ return {
+ ms() {
+ return new Date().getTime() - start;
+ }
+ };
+ }
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Retrieve and start a simple timer. Retrieve elapsed time by calling #ms().
- * @returns {*}
- */
- static timer() {
- const start = new Date().getTime();
- return {
- ms() {
- return (new Date().getTime() - start);
- },
- };
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Get datatype, stripping '[object Boolean]' to just 'Boolean'.
- * @param o JS object.
- * @return String like String, Number, Date, Null, Undefined, stuff like that.
- */
- static getType(o) {
- const str = Object.prototype.toString.call(o);
- const prefix = '[object ';
- if (str.substr(str, prefix.length) === prefix) {
- return str.substr(prefix.length, str.length - (prefix.length + 1));
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get datatype, stripping '[object Boolean]' to just 'Boolean'.
+ * @param o JS object.
+ * @return String like String, Number, Date, Null, Undefined, stuff like that.
+ */
+ static getType(o) {
+ const str = Object.prototype.toString.call(o);
+ const prefix = '[object ';
+ if (str.substr(str, prefix.length) === prefix) {
+ return str.substr(prefix.length, str.length - (prefix.length + 1));
+ }
+ return str;
}
- return str;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert that an argument was provided.
- * @param value to be checked.
- * @param message message on assertion failure.
- * @return value.
- */
- static assertNotNull(value, message = 'Unexpected null value') {
- if (!value) {
- throw new Error(message);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert that an argument was provided.
+ * @param value to be checked.
+ * @param message message on assertion failure.
+ * @return value.
+ */
+ static assertNotNull(value, message = 'Unexpected null value') {
+ if (!value) {
+ throw new Error(message);
+ }
+ return value;
}
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert argument type.
- * @param value to be checked.
- * @param expected expected type string, e,g. Number from [object Number].
- * @return value.
- */
- static assertType(value, expected) {
- const type = this.getType(value);
- if (type !== expected) {
- throw new Error(`Expected type ${expected}, got ${type}`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert argument type.
+ * @param value to be checked.
+ * @param expected expected type string, e,g. Number from [object Number].
+ * @return value.
+ */
+ static assertType(value, expected) {
+ const type = this.getType(value);
+ if (type !== expected) {
+ throw new Error(`Expected type ${expected}, got ${type}`);
+ }
+ return value;
}
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert argument type.
- * @param value to be checked.
- * @param unexpected unexpected type string, e,g. Number from [object Number].
- * @return value.
- */
- static assertNotType(value, unexpected) {
- const type = this.getType(value);
- if (type === unexpected) {
- throw new Error(`Forbidden type "${unexpected}"`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert argument type.
+ * @param value to be checked.
+ * @param unexpected unexpected type string, e,g. Number from [object Number].
+ * @return value.
+ */
+ static assertNotType(value, unexpected) {
+ const type = this.getType(value);
+ if (type === unexpected) {
+ throw new Error(`Forbidden type "${unexpected}"`);
+ }
+ return value;
}
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert argument is a simple JSON object, and specifically not (something like an) ES6 class.
- * @param value to be checked.
- * @return value.
- */
- static assertPlainObject(value) {
- Common.assertType(value, 'Object');
- // TODO
- /*
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert argument is a simple JSON object, and specifically not (something like an) ES6 class.
+ * @param value to be checked.
+ * @return value.
+ */
+ static assertPlainObject(value) {
+ Common.assertType(value, 'Object');
+ // TODO
+ /*
if (!($.isPlainObject(value))) {
throw new Error(`Expected plain object: ${value}`);
}
*/
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert argument type.
- * @param value to be checked.
- * @param c expected class.
- * @return value.
- */
- static assertInstanceOf(value, c) {
- Common.assertNotNull(value);
- if (!(value instanceof c)) {
- throw new Error(`Expected instanceof ${c}: ${value}`);
- }
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert that a string matches a regex.
- * @param value value to be tested.
- * @param re pattern to be applied.
- * @return value.
- */
- static assertMatches(value, re) {
- this.assertType(value, 'String');
- this.assertType(re, 'RegExp');
- if (!re.test(value)) {
- throw new Error(`Value ${value} doesn't match pattern ${re}`);
+ return value;
}
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Assert the value of a boolean.
- *
- * @param bool to be checked.
- * @param message optional message on assertion failure.
- * @return value.
- */
- static assertThat(bool, message) {
- if (!bool) {
- throw new Error(message || `Unexpected: ${bool}`);
- }
- return bool;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Verify that a value, generally a function arg, is a DOM element.
- * @param value to be checked.
- * @return value.
- */
- static assertHTMLElement(value) {
- if (!Common.isHTMLElement(value)) {
- throw new Error(`Expected HTMLElement: ${value}`);
- }
- return value;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Check whether a value, generally a function arg, is an HTML DOM element.
- * @param o to be checked.
- * @return true if DOM element.
- */
- static isHTMLElement(o) {
- if (typeof HTMLElement === 'object') {
- return o instanceof HTMLElement;
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert argument type.
+ * @param value to be checked.
+ * @param c expected class.
+ * @return value.
+ */
+ static assertInstanceOf(value, c) {
+ Common.assertNotNull(value);
+ if (!(value instanceof c)) {
+ throw new Error(`Expected instanceof ${c}: ${value}`);
+ }
+ return value;
}
- return o && typeof o === 'object' && o !== null
- && o.nodeType === 1 && typeof o.nodeName === 'string';
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Check if a string is non-empty.
- * @param s string to be checked.
- * @returns false if non-blank string, true otherwise.
- */
- static isBlank(s) {
- if (Common.getType(s) === 'String') {
- return (s.trim().length === 0);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert that a string matches a regex.
+ * @param value value to be tested.
+ * @param re pattern to be applied.
+ * @return value.
+ */
+ static assertMatches(value, re) {
+ this.assertType(value, 'String');
+ this.assertType(re, 'RegExp');
+ if (!re.test(value)) {
+ throw new Error(`Value ${value} doesn't match pattern ${re}`);
+ }
+ return value;
}
- return true;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Detect dates that are numbers, milli/seconds since epoch..
- *
- * @param n candidate number.
- * @returns {boolean}
- */
- static isNumber(n) {
- return !isNaN(parseFloat(n)) && isFinite(n);
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Parse the text output from a template to a DOM element.
- * @param txt input text.
- * @returns {Element}
- */
- static txt2dom(txt) {
- return new DOMParser().parseFromString(txt, 'image/svg+xml').documentElement;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Recursively convert a DOM element to an SVG (namespaced) element. Otherwise
- * you get HTML elements that *happen* to have SVG names, but which aren't actually SVG.
- *
- * @param node DOM node to be converted.
- * @param svg to be updated.
- * @returns {*} for chaining.
- */
- static dom2svg(node, svg) {
-
- Common.assertNotType(node, 'String');
-
- if (node.childNodes && node.childNodes.length > 0) {
-
- for (const c of node.childNodes) {
- switch (c.nodeType) {
- case document.TEXT_NODE:
- svg.text(c.nodeValue);
- break;
- default:
- break;
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Assert the value of a boolean.
+ *
+ * @param bool to be checked.
+ * @param message optional message on assertion failure.
+ * @return value.
+ */
+ static assertThat(bool, message) {
+ if (!bool) {
+ throw new Error(message || `Unexpected: ${bool}`);
}
- }
-
- for (const c of node.childNodes) {
- switch (c.nodeType) {
- case document.ELEMENT_NODE:
- Common.dom2svg(c, svg.append(`svg:${c.nodeName.toLowerCase()}`));
- break;
- default:
- break;
+ return bool;
+ }
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Verify that a value, generally a function arg, is a DOM element.
+ * @param value to be checked.
+ * @return value.
+ */
+ static assertHTMLElement(value) {
+ if (!Common.isHTMLElement(value)) {
+ throw new Error(`Expected HTMLElement: ${value}`);
}
- }
+ return value;
}
- if (node.hasAttributes()) {
- for (let i = 0; i < node.attributes.length; i++) {
- const a = node.attributes.item(i);
- svg.attr(a.name, a.value);
- }
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check whether a value, generally a function arg, is an HTML DOM element.
+ * @param o to be checked.
+ * @return true if DOM element.
+ */
+ static isHTMLElement(o) {
+ /* eslint-disable no-undef */
+ if (typeof HTMLElement === 'object') {
+ return o instanceof HTMLElement;
+ }
+ /* eslint-enable no-undef */
+ return (
+ o &&
+ typeof o === 'object' &&
+ o !== null &&
+ o.nodeType === 1 &&
+ typeof o.nodeName === 'string'
+ );
}
- return svg;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Get the lines to be shown in the label.
- *
- * @param labelText original label text.
- * @param wordWrapAt chars at which to break words.
- * @param lineWrapAt chars at which to wrap.
- * @param maximumLines lines at which to truncate.
- * @returns {Array}
- */
- static tokenize(labelText = '', wordWrapAt, lineWrapAt, maximumLines) {
-
- let l = labelText;
-
- // Hyphenate and break long words.
-
- const regex = new RegExp(`(\\w{${wordWrapAt - 1}})(?=\\w)`, 'g');
- l = l.replace(regex, '$1- ');
-
- const labelTokens = l.split(/\s+/);
- const lines = [];
- let label = '';
- for (const labelToken of labelTokens) {
- if (label.length > 0) {
- const length = label.length + labelToken.length + 1;
- if (length > lineWrapAt) {
- lines.push(label.trim());
- label = labelToken;
- continue;
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Check if a string is non-empty.
+ * @param s string to be checked.
+ * @returns false if non-blank string, true otherwise.
+ */
+ static isBlank(s) {
+ if (Common.getType(s) === 'String') {
+ return s.trim().length === 0;
}
- }
- label = `${label} ${labelToken}`;
+ return true;
}
- if (label) {
- lines.push(label.trim());
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Detect dates that are numbers, milli/seconds since epoch..
+ *
+ * @param n candidate number.
+ * @returns {boolean}
+ */
+ static isNumber(n) {
+ return !isNaN(parseFloat(n)) && isFinite(n);
}
- const truncated = lines.slice(0, maximumLines);
- if (truncated.length < lines.length) {
- let finalLine = truncated[maximumLines - 1];
- if (finalLine.length > (lineWrapAt - 4)) {
- finalLine = finalLine.substring(0, lineWrapAt - 4);
- }
- finalLine = `${finalLine} ...`;
- truncated[maximumLines - 1] = finalLine;
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Parse the text output from a template to a DOM element.
+ * @param txt input text.
+ * @returns {Element}
+ */
+ static txt2dom(txt) {
+ /* eslint-disable no-undef */
+ return new DOMParser().parseFromString(txt, 'image/svg+xml')
+ .documentElement;
+ /* eslint-enable no-undef */
}
- return truncated;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Brutally sanitize an input string. We have no syntax rules, and hence no specific
- * rules to apply, but we have very few unconstrained fields, so we can implement a
- * crude default and devolve the rest to options.
- * @param value value to be sanitized.
- * @param options control options including validation rules.
- * @param type validation type.
- * @returns {*} sanitized string.
- * @private
- */
- static sanitizeText(value, options, type) {
- const rules = Common.assertNotNull(options.validation[type]);
- let v = value || rules.defaultValue || '';
- if (rules.replace) {
- v = v.replace(rules.replace, '');
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Recursively convert a DOM element to an SVG (namespaced) element. Otherwise
+ * you get HTML elements that *happen* to have SVG names, but which aren't actually SVG.
+ *
+ * @param node DOM node to be converted.
+ * @param svg to be updated.
+ * @returns {*} for chaining.
+ */
+ static dom2svg(node, svg) {
+ Common.assertNotType(node, 'String');
+
+ if (node.childNodes && node.childNodes.length > 0) {
+ for (const c of node.childNodes) {
+ switch (c.nodeType) {
+ case document.TEXT_NODE:
+ svg.text(c.nodeValue);
+ break;
+ default:
+ break;
+ }
+ }
+
+ for (const c of node.childNodes) {
+ switch (c.nodeType) {
+ case document.ELEMENT_NODE:
+ Common.dom2svg(
+ c,
+ svg.append(`svg:${c.nodeName.toLowerCase()}`)
+ );
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (node.hasAttributes()) {
+ for (let i = 0; i < node.attributes.length; i++) {
+ const a = node.attributes.item(i);
+ svg.attr(a.name, a.value);
+ }
+ }
+
+ return svg;
}
- if (v.length > rules.maxLength) {
- v = `${v.substring(0, rules.maxLength)}...`;
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get the lines to be shown in the label.
+ *
+ * @param labelText original label text.
+ * @param wordWrapAt chars at which to break words.
+ * @param lineWrapAt chars at which to wrap.
+ * @param maximumLines lines at which to truncate.
+ * @returns {Array}
+ */
+ static tokenize(labelText = '', wordWrapAt, lineWrapAt, maximumLines) {
+ let l = labelText;
+
+ // Hyphenate and break long words.
+
+ const regex = new RegExp(`(\\w{${wordWrapAt - 1}})(?=\\w)`, 'g');
+ l = l.replace(regex, '$1- ');
+
+ const labelTokens = l.split(/\s+/);
+ const lines = [];
+ let label = '';
+ for (const labelToken of labelTokens) {
+ if (label.length > 0) {
+ const length = label.length + labelToken.length + 1;
+ if (length > lineWrapAt) {
+ lines.push(label.trim());
+ label = labelToken;
+ continue;
+ }
+ }
+ label = `${label} ${labelToken}`;
+ }
+
+ if (label) {
+ lines.push(label.trim());
+ }
+
+ const truncated = lines.slice(0, maximumLines);
+ if (truncated.length < lines.length) {
+ let finalLine = truncated[maximumLines - 1];
+ if (finalLine.length > lineWrapAt - 4) {
+ finalLine = finalLine.substring(0, lineWrapAt - 4);
+ }
+ finalLine = `${finalLine} ...`;
+ truncated[maximumLines - 1] = finalLine;
+ }
+
+ return truncated;
}
- return v;
- }
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Brutally sanitize an input string. We have no syntax rules, and hence no specific
+ * rules to apply, but we have very few unconstrained fields, so we can implement a
+ * crude default and devolve the rest to options.
+ * @param value value to be sanitized.
+ * @param options control options including validation rules.
+ * @param type validation type.
+ * @returns {*} sanitized string.
+ * @private
+ */
+ static sanitizeText(value, options, type) {
+ const rules = Common.assertNotNull(options.validation[type]);
+ let v = value || rules.defaultValue || '';
+ if (rules.replace) {
+ v = v.replace(rules.replace, '');
+ }
+ if (v.length > rules.maxLength) {
+ v = `${v.substring(0, rules.maxLength)}...`;
+ }
+ return v;
+ }
}
diff --git a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Logger.js b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Logger.js
index 187f49bb08..8b6ae67ca7 100644
--- a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Logger.js
+++ b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Logger.js
@@ -23,108 +23,107 @@ import Common from './Common';
* disable them for production.
*/
export default class Logger {
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * No-op call so that we can leave imports in place,
+ * even when there's no debugging.
+ */
+ static noop() {
+ // Nothing.
+ }
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Set debug level.
+ * @param level threshold.
+ */
+ static setLevel(level) {
+ this.level = Logger.OFF;
+ if (Common.getType(level) === 'Number') {
+ this.level = level;
+ } else {
+ this.level = Logger[level];
+ }
+ }
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Get debug level.
+ * @returns {number|*}
+ */
+ static getLevel() {
+ return this.level;
+ }
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * No-op call so that we can leave imports in place,
- * even when there's no debugging.
- */
- static noop() {
- // Nothing.
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Set debug level.
- * @param level threshold.
- */
- static setLevel(level) {
- this.level = Logger.OFF;
- if (Common.getType(level) === 'Number') {
- this.level = level;
- } else {
- this.level = Logger[level];
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Write DEBUG-level log.
+ * @param msg message or tokens.
+ */
+ static debug(...msg) {
+ if (this.level >= Logger.DEBUG) {
+ const out = this.serialize(msg);
+ console.info(`ASDCS [DEBUG] ${out}`);
+ }
}
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Get debug level.
- * @returns {number|*}
- */
- static getLevel() {
- return this.level;
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Write DEBUG-level log.
- * @param msg message or tokens.
- */
- static debug(...msg) {
- if (this.level >= Logger.DEBUG) {
- const out = this.serialize(msg);
- console.info(`ASDCS [DEBUG] ${out}`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Write INFO-level log.
+ * @param msg message or tokens.
+ */
+ static info(...msg) {
+ if (this.level >= Logger.INFO) {
+ const out = this.serialize(msg);
+ console.info(`ASDCS [INFO] ${out}`);
+ }
}
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Write INFO-level log.
- * @param msg message or tokens.
- */
- static info(...msg) {
- if (this.level >= Logger.INFO) {
- const out = this.serialize(msg);
- console.info(`ASDCS [INFO] ${out}`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Write debug.
+ * @param msg message or tokens.
+ */
+ static warn(msg) {
+ if (this.level >= Logger.WARN) {
+ const out = this.serialize(msg);
+ console.warn(`ASDCS [WARN] ${out}`);
+ }
}
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Write debug.
- * @param msg message or tokens.
- */
- static warn(msg) {
- if (this.level >= Logger.WARN) {
- const out = this.serialize(msg);
- console.warn(`ASDCS [WARN] ${out}`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Write error.
+ * @param msg message or tokens.
+ */
+ static error(...msg) {
+ if (this.level >= Logger.ERROR) {
+ const out = this.serialize(msg);
+ console.error(`ASDCS [ERROR] ${out}`);
+ }
}
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Write error.
- * @param msg message or tokens.
- */
- static error(...msg) {
- if (this.level >= Logger.ERROR) {
- const out = this.serialize(msg);
- console.error(`ASDCS [ERROR] ${out}`);
+
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /**
+ * Serialize msg.
+ * @param msg message or tokens.
+ * @returns {string}
+ */
+ static serialize(...msg) {
+ let out = '';
+ msg.forEach(token => {
+ out = `${out}${token}`;
+ });
+ return out;
}
- }
-
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Serialize msg.
- * @param msg message or tokens.
- * @returns {string}
- */
- static serialize(...msg) {
- let out = '';
- msg.forEach((token) => {
- out = `${out}${token}`;
- });
- return out;
- }
}
// /////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Options.js b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Options.js
index 15897d7ee3..b054cb26e7 100644
--- a/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Options.js
+++ b/dox-sequence-diagram-ui/src/main/webapp/lib/ecomp/asdc/sequencer/common/Options.js
@@ -23,26 +23,25 @@ import Logger from './Logger';
* and the result -- runtime options -- are available by calling #getOptions().
*/
export default class Options {
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
- // ///////////////////////////////////////////////////////////////////////////////////////////////
+ /**
+ * Construct options, applying defaults.
+ * @param options optional override options.
+ */
+ constructor(options = {}) {
+ this.options = _merge({}, Options.DEFAULTS, options);
+ }
- /**
- * Construct options, applying defaults.
- * @param options optional override options.
- */
- constructor(options = {}) {
- this.options = _merge({}, Options.DEFAULTS, options);
- }
+ // ///////////////////////////////////////////////////////////////////////////////////////////////
- // ///////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * Unwrap options.
- * @returns {*}
- */
- unwrap() {
- return this.options;
- }
+ /**
+ * Unwrap options.
+ * @returns {*}
+ */
+ unwrap() {
+ return this.options;
+ }
}
// /////////////////////////////////////////////////////////////////////////////////////////////////
@@ -51,86 +50,86 @@ export default class Options {
* Default options, overridden by anything of the same name.
*/
Options.DEFAULTS = {
- log: {
- level: Logger.WARN,
- },
- demo: false,
- useHtmlSelect: true,
- diagram: {
- svg: {
- x: 0,
- y: 0,
- width: 1600,
- height: 1200,
- margin: 50,
- floodColor: '#009fdb',
- scale: {
- height: true,
- width: true,
- minimum: 0.25,
- },
- },
- title: {
- height: 0,
- },
- metadata: false,
- lifelines: {
- header: {
- height: 225,
- width: 350,
- wrapWords: 14,
- wrapLines: 18,
- maxLines: 5,
- },
- occurrences: {
- marginTop: 50,
- marginBottom: 75,
- foreshortening: 5,
- width: 50,
- },
- spacing: {
- horizontal: 400,
- vertical: 400,
- },
- },
- messages: {
- label: {
- wrapWords: 14,
- wrapLines: 18,
- maxLines: 4,
- },
- },
- fragments: {
- leftMargin: 150,
- topMargin: 200,
- widthMargin: 300,
- heightMargin: 350,
- label: {
- wrapWords: 50,
- wrapLines: 50,
- maxLines: 2,
- },
- },
- },
- validation: {
- lifeline: {
- maxLength: 100,
- defaultValue: '',
- replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g,
- },
- message: {
- maxLength: 100,
- defaultValue: '',
- replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g,
- },
- notes: {
- maxLength: 255,
- defaultValue: '',
+ log: {
+ level: Logger.WARN
},
- guard: {
- maxLength: 80,
- defaultValue: '',
- replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g,
+ demo: false,
+ useHtmlSelect: true,
+ diagram: {
+ svg: {
+ x: 0,
+ y: 0,
+ width: 1600,
+ height: 1200,
+ margin: 50,
+ floodColor: '#009fdb',
+ scale: {
+ height: true,
+ width: true,
+ minimum: 0.25
+ }
+ },
+ title: {
+ height: 0
+ },
+ metadata: false,
+ lifelines: {
+ header: {
+ height: 225,
+ width: 350,
+ wrapWords: 14,
+ wrapLines: 18,
+ maxLines: 5
+ },
+ occurrences: {
+ marginTop: 50,
+ marginBottom: 75,
+ foreshortening: 5,
+ width: 50
+ },
+ spacing: {
+ horizontal: 400,
+ vertical: 400
+ }
+ },
+ messages: {
+ label: {
+ wrapWords: 14,
+ wrapLines: 18,
+ maxLines: 4
+ }
+ },
+ fragments: {
+ leftMargin: 150,
+ topMargin: 200,
+ widthMargin: 300,
+ heightMargin: 350,
+ label: {
+ wrapWords: 50,
+ wrapLines: 50,
+ maxLines: 2
+ }
+ }
},
- },
+ validation: {
+ lifeline: {
+ maxLength: 100,
+ defaultValue: '',
+ replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g
+ },
+ message: {
+ maxLength: 100,
+ defaultValue: '',
+ replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g
+ },
+ notes: {
+ maxLength: 255,
+ defaultValue: ''
+ },
+ guard: {
+ maxLength: 80,
+ defaultValue: '',
+ replace: /[^\-\.\+ &%#@\?\(\)\[\]<>\w\d]/g
+ }
+ }
};