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/09/04 12:21:18 UTC

[myfaces-tobago] branch master updated: optimize: using default parameter

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


The following commit(s) were added to refs/heads/master by this push:
     new 0780290  optimize: using default parameter
0780290 is described below

commit 07802906510f583902be493a4f7fe966eae7ef45
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Sep 4 14:21:08 2019 +0200

    optimize: using default parameter
    
    issue: TOBAGO-1633: TS refactoring
---
 .../src/main/npm/ts/tobago-command.ts                     | 15 ++++++---------
 .../tobago-theme-standard/src/main/npm/ts/tobago-tab.ts   |  2 +-
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
index d54e0bd..eb1110a 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-command.ts
@@ -38,7 +38,8 @@ export class CommandMap {
 
     if (change.execute || change.render) {
       jsf.ajax.request(
-          element.getAttribute("name"),
+          element,
+          // element.getAttribute("name"),
           event,
           {
             "javax.faces.behavior.event": "change",
@@ -76,7 +77,7 @@ export class CommandMap {
     if (!command.omit) {
       const popup = command.popup;
       if (popup && popup.command === "close" && popup.immediate) {
-        Popup.close(this);
+        Popup.close(element);
       } else {
         const action = command.action ? command.action : element.id;
         if (command.execute || command.render) {
@@ -93,7 +94,7 @@ export class CommandMap {
           Command.submitAction(this, action, command);
         }
         if (popup && popup.command === "close") {
-          Popup.close(this);
+          Popup.close(element);
         }
       }
     }
@@ -141,7 +142,7 @@ export class Command {
   static isSubmit: boolean = false;
 
   confirmation: string;
-  collapse: boolean;
+  collapse: boolean; // XXX is boolean okay??? Should this be not an element or a structure?
   omit: boolean;
   popup; // todo: type
   action: string;
@@ -243,11 +244,7 @@ export class Command {
     }
   }
 
-  static init = function (element: HTMLElement) {
-    Command.initialize(element, false);
-  };
-
-  static initialize = function (element: HTMLElement, force: boolean) {
+  static init = function (element: HTMLElement, force: boolean = false) {
 
     for (const commandElement of DomUtils.selfOrQuerySelectorAll(element, "[data-tobago-commands]")) {
 
diff --git a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
index 9b7a905..e9f2ed4 100644
--- a/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
+++ b/tobago-theme/tobago-theme-standard/src/main/npm/ts/tobago-tab.ts
@@ -47,7 +47,7 @@ class TabGroup extends HTMLElement {
       }
     }
 
-    Command.initialize(tabGroup, true);
+    Command.init(tabGroup, true);
   }
 
   get tabs(): NodeListOf<Tab> {