You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2019/06/13 12:37:55 UTC
[myfaces-tobago] 01/02: TOBAGO-1633: TS refactoring: logging and
cleanup
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit c4dd7ef18fa4be2c2996b28a44b4cd2a2d97c2ca
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Thu Jun 13 10:31:53 2019 +0200
TOBAGO-1633: TS refactoring: logging and cleanup
---
.../src/main/npm/ts/tobago-core.ts | 24 +++-------------------
.../src/main/npm/ts/tobago-in.ts | 4 ++--
.../src/main/npm/ts/tobago-jsf.ts | 2 +-
.../src/main/npm/ts/tobago-split-layout.ts | 2 +-
.../src/main/npm/ts/tobago-utils.ts | 1 +
5 files changed, 8 insertions(+), 25 deletions(-)
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 @@ export class Tobago4 {
// -------- 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 @@ export class Tobago4 {
*/
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 @@ class RegExpTest {
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 @@ class Jsf {
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 @@ class SplitLayout {
}
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 @@ export class DomUtils {
}
return <HTMLElement>pages.item(0);
}
+ console.warn("Found no tobago page!");
return null;
}