You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2011/10/14 13:12:24 UTC

svn commit: r1183303 - in /myfaces/core/branches/2.0.x/api/src: assembler/jsfscripts-uncompressed-compiler.xml assembler/jsfscripts-uncompressed-full-compiler.xml main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js

Author: werpu
Date: Fri Oct 14 11:12:23 2011
New Revision: 1183303

URL: http://svn.apache.org/viewvc?rev=1183303&view=rev
Log:
https://issues.apache.org/jira/browse/MYFACES-3357
forgot to some files



Added:
    myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js
Modified:
    myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-compiler.xml
    myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-full-compiler.xml

Modified: myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-compiler.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-compiler.xml?rev=1183303&r1=1183302&r2=1183303&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-compiler.xml (original)
+++ myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-compiler.xml Fri Oct 14 11:12:23 2011
@@ -17,26 +17,7 @@
 -->    
 <assembler>
     <scripts>
-        <!--
-            Assembly for our javascripts
-            if you want to include them manually use:
 
-            
-            <script type="text/javascript" src="./myfaces/_impl/core/_Runtime.js"></script>
-            <script type = "text/javascript" src = "myfaces/_impl/_util/_Lang.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/_util/_ListenerQueue.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/_util/_Dom.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/_util/_HtmlStripper.js"></script>
-
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_Exception.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_AjaxUtils.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_AjaxRequestQueue.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_AjaxRequest.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_AjaxResponse.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/xhrCore/_xhrCoreAdapter.js"></script>
-            <script type = "text/javascript" src = "./myfaces/_impl/core/jsf_impl.js"></script>
-            <script type = "text/javascript" src = "./myfaces/api/jsf.js"></script>
-        -->
         <script>
             <fileName>jsf-uncompressed.js</fileName>
             <includes>

Modified: myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-full-compiler.xml
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-full-compiler.xml?rev=1183303&r1=1183302&r2=1183303&view=diff
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-full-compiler.xml (original)
+++ myfaces/core/branches/2.0.x/api/src/assembler/jsfscripts-uncompressed-full-compiler.xml Fri Oct 14 11:12:23 2011
@@ -57,7 +57,7 @@
                 <include>**/_impl/i18n/Messages_zh_TW.js</include>
 
                 <include>**/_impl/_util/_Lang.js</include>
-                <include>**/_impl/_util/_ExtLang.js</include>
+                <include>**/_impl/_util/_Logging.js</include>
                 <include>**/_impl/_util/_Queue.js</include>
                 <include>**/_impl/_util/_ListenerQueue.js</include>
                 <include>**/_impl/_util/_Dom.js</include>
@@ -82,6 +82,9 @@
                 <include>**/_impl/xhrCore/_AjaxResponse.js</include>
                 <include>**/_impl/xhrCore/_Transports.js</include>
                 <include>**/_impl/core/Impl.js</include>
+                <!-- optimization helper -->
+                <include>**/_impl/core/_EndImpl.js</include>
+                <!-- api -->
                 <include>**/api/jsf.js</include>
             </includes>
         </script>

Added: myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js?rev=1183303&view=auto
==============================================================================
--- myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js (added)
+++ myfaces/core/branches/2.0.x/api/src/main/javascript/META-INF/resources/myfaces/_impl/_util/_Logging.js Fri Oct 14 11:12:23 2011
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * debugging replacement for lang which adds logging functionality
+ * which is not yet present in the core
+ * this is a full replacement class for myfaces._impl._util._Lang
+ * and replaces the object entirely with
+ * a delegated implementation which adds the new methods to Lang
+ *
+ * We use this class to move some debugging related
+ * lang functions out of the core, which never will
+ * be utilized directly in the core
+ * but will be used externally by extension frameworks
+ * and by unit tests
+ */
+/** @namespace myfaces._impl._util._Logging */
+_MF_SINGLTN("myfaces._impl._util._Logging",Object, {
+
+    /**
+     * we use a map switch instread of a log level
+     * slightly slower but more flexible
+     */
+    _ERR: "error",
+    _INF: "info",
+    _DEB: "debug",
+    _LOG: "log",
+    _WRN: "warn",
+
+    _Lang: myfaces._impl._util._Lang,
+
+    constructor_: function() {
+
+        //due to the delegation pattern we do not have access to the browser
+        this._browser = myfaces._impl.core._Runtime.browser;
+
+        this.logLevels = {};
+        this.logLevels[this._ERR] = true;
+        this.logLevels[this._INF] = true;
+        this.logLevels[this._DEB] = true;
+        this.logLevels[this._LOG] = true;
+        this.logLevels[this._WRN] = true;
+
+        //printing of a stack trace if possible
+        this.stackTraceLevels = {};
+        this.stackTraceLevels[this._ERR] = true;
+        this.stackTraceLevels[this._INF] = false;
+        this.stackTraceLevels[this._DEB] = false;
+        this.stackTraceLevels[this._LOG] = false;
+        this.stackTraceLevels[this._WRN] = false;
+    },
+
+    /**
+     * Simple simple logging only triggering at
+     * firebug compatible logging consoles
+     *
+     * note: ;; means the code will be stripped
+     * from the production code by the build system
+     */
+    _log: function(logType /*+arguments*/, args) {
+
+        var argsString = this._Lang.objToArray(arguments[1]).join("|");
+        var c = window.console;
+        
+
+        if (c && c[logType]) {
+            c[logType](argsString);
+            if(this.stackTraceLevels[logType] && c.trace) {
+                c.trace();
+            }
+        }
+        var logHolder = document.getElementById("myfaces.logging");
+
+        if (logHolder) {
+            var elem = document.createElement("div");
+            var b = this._browser;
+            if (!b.isIE || b.isIE > 7) {
+                //w3 compliant class setting
+                elem.setAttribute("class", "consoleLog " + logType);
+            } else {
+                //ie quirks compliant class setting
+                elem.className ="consoleLog " + logType;
+            }
+            logHolder.appendChild(elem);
+            var argsArr = this._Lang.objToArray(arguments[1]);
+            var argsStr = [];
+
+            for(var cnt = 0; cnt < argsArr.length; cnt++) {
+                argsStr.push("<div class='args args_"+cnt+"'>");
+                argsStr.push(argsArr[cnt]);
+                argsStr.push("</div>");
+            }
+            elem.innerHTML = "<div class='args argsinfo'>"+logType.toUpperCase() + "</div>" + argsStr.join("");
+            logHolder.scrollTop = logHolder.scrollHeight;
+        }
+    },
+
+    logError: function(/*varargs*/) {
+        if (!this.logLevels[this._ERR]) return;
+        this._log(this._ERR, arguments);
+    }
+    ,
+    logWarn: function(/*varargs*/) {
+        if (!this.logLevels[this._WRN]) return;
+        this._log(this._WRN, arguments);
+    }
+    ,
+    logInfo: function(/*varargs*/) {
+        if (!this.logLevels[this._INF]) return;
+        this._log(this._INF, arguments);
+    }
+    ,
+    logDebug: function(/*varargs*/) {
+        //Level 1 == debug
+        if (!this.logLevels[this._DEB]) return;
+        this._log(this._DEB, arguments);
+    }
+    ,
+    logTrace: function(/*varargs*/) {
+        if (!this.logLevels[this._LOG]) return;
+        this._log("log", arguments);
+    }
+
+});
+