TOBAGO-1633: TS refactoring: logging and cleanup
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-core.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-core.ts
index 19ecaec..eabca9f 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-core.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-core.ts
@@ -38,16 +38,12 @@
// -------- Constants -------------------------------------------------------
/**
- * Component separator constant
- * @const
- * @type {string}
+ * JSF's component separator constant
*/
static readonly COMPONENT_SEP = ':';
/**
- * Tobago's subComponent separator constant
- * @const
- * @type {string}
+ * Tobago's sub-coponent separator constant
*/
static readonly SUB_COMPONENT_SEP = '::';
@@ -59,32 +55,18 @@
*/
static form = null;
- static htmlIdIndex = 0;
-
- static createHtmlId = function () {
- var id = '__tbg_id_' + Tobago4.htmlIdIndex++;
- console.debug('created id = ' + id);
- return id;
- };
-
- static jsObjects = [];
-
static isSubmit = false;
static initMarker = false;
// -------- Functions -------------------------------------------------------
- static findPage = function () {
- return jQuery(".tobago-page");
- };
-
/**
* Find a sub-element of the page. Like the form with id e.g. page::form
* @param suffix
*/
static findSubElementOfPage = function (suffix) {
- return jQuery(DomUtils.escapeClientId(Tobago4.findPage().attr("id") + Tobago4.SUB_COMPONENT_SEP + suffix));
+ return jQuery(DomUtils.escapeClientId(DomUtils.page().id + Tobago4.SUB_COMPONENT_SEP + suffix));
};
/**
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-in.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-in.ts
index 1dc3281..75f75ff 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-in.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-in.ts
@@ -30,13 +30,13 @@
this.element = element;
this.regexp = new RegExp(this.element.dataset["regexp"]);
- console.info("constructor: " + element.id);
+ console.debug("constructor: '%s'", element.id);
this.element.addEventListener("change", this.checkValue.bind(this));
};
checkValue(event: TextEvent) {
- console.info("changed: check if " + this.regexp + " is okay!");
+ console.debug("changed: check if '%s' is okay!", this.regexp.toString());
if (!this.regexp.test(this.element.value)) {
this.element.classList.add("border-danger");
} else {
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
index b61feba..71c6a61 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-jsf.ts
@@ -58,7 +58,7 @@
jsf.ajax.addOnEvent(function (event) {
console.timeEnd("[tobago-jsf] jsf-ajax");
console.time("[tobago-jsf] jsf-ajax");
- console.log("[tobago-jsf] JSF event status: " + event.status);
+ console.debug("[tobago-jsf] JSF event status: '%s'", event.status);
if (event.status === "success") {
event.responseXML.querySelectorAll("update").forEach(function (update: Element) {
const result = /<!\[CDATA\[(.*)]]>/gm.exec(update.innerHTML);
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
index 158162e..8d00105 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-split-layout.ts
@@ -60,7 +60,7 @@
}
previousArea.style.flexGrow = "inherit";
previousArea.style.flexBasis = "auto";
- console.info("initial = " + (this.horizontal ? previousArea.style.width : previousArea.style.height));
+ console.debug("initial width/height = '%s'", (this.horizontal ? previousArea.style.width : previousArea.style.height));
};
move(event: MouseEvent): void {
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
index 6b3bd58..cfd5d26 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-utils.ts
@@ -25,6 +25,7 @@
}
return <HTMLElement>pages.item(0);
}
+ console.warn("Found no tobago page!");
return null;
}