You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/11/06 04:40:37 UTC
svn commit: r471632 - in /incubator/xap/trunk:
WebContent/examples/widgets/combobox.html
WebContent/examples/widgets/index.html
WebContent/examples/widgets/listbox.html src/xap/Xap.js src/xap/util/Debug.js
Author: mturyn
Date: Sun Nov 5 20:40:36 2006
New Revision: 471632
URL: http://svn.apache.org/viewvc?view=rev&rev=471632
Log:
Made debugging work with the new start-up mechanism. Look at the listbox and combobox examples for illustrations
of how to load all files or specified files, respectively---you must specify an object, "debug_config", with either
debug_config = { _debugAll: true } ;
or
debug_config = { _debugList:[file_0,file_1,...,file_N] } ;//quoted strings, 1 per file
before xapcore.js is loaded.
Added listbox reference to the index file.
Modified:
incubator/xap/trunk/WebContent/examples/widgets/combobox.html
incubator/xap/trunk/WebContent/examples/widgets/index.html
incubator/xap/trunk/WebContent/examples/widgets/listbox.html
incubator/xap/trunk/src/xap/Xap.js
incubator/xap/trunk/src/xap/util/Debug.js
Modified: incubator/xap/trunk/WebContent/examples/widgets/combobox.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/combobox.html?view=diff&rev=471632&r1=471631&r2=471632
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/combobox.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/combobox.html Sun Nov 5 20:40:36 2006
@@ -12,14 +12,29 @@
</style>
<!-- Keep dojo from trying to scan this whole page for dojoType'd tags: -->
- <script type="text/javascript">
+ <script language="JavaScript" type="text/javascript">
djConfig = {
parseWidgets: false
};
- </script>
+
+ // Debug classes chosen
+ debug_config = {
+ _debugList:[
+ "xap.widgets.dojo.ListBox",
+ "xap.bridges.xap.XapComboBoxBridge",
+ "xap.bridges.xap.ListBoxBridge",
+ "xap.bridges.dojo.DojoWidgetBridge"
+ ] } ;
+ </script>
<script language="JavaScript" type="text/javascript" src="../../xapcore.js"></script>
<script language="JavaScript" type="text/javascript" src="AttributeTester.js"></script>
+
+ <script language="JavaScript">
+ <!-- must do this before we load the actual application: -->
+ xap.util.Debug.loadDebuggables() ;
+ </script>
+
</head>
<body onload="Xap.createEmbeddedApplications();">
Modified: incubator/xap/trunk/WebContent/examples/widgets/index.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/index.html?view=diff&rev=471632&r1=471631&r2=471632
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/index.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/index.html Sun Nov 5 20:40:36 2006
@@ -7,6 +7,7 @@
<li><a href="checkBox.html"><checkBox></a></li>
<li><a href="radioButton.html"><radioButton></a></li>
<li><a href="combobox.html"><comboBox></a></li>
+<li><a href="listbox.html"><listbox></a></li>
<li><a href="textField.html"><textField></a></li>
<li><a href="textArea.html"><textArea></a></li>
<li><a href="passwordField.html"><passwordField></a></li>
Modified: incubator/xap/trunk/WebContent/examples/widgets/listbox.html
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/listbox.html?view=diff&rev=471632&r1=471631&r2=471632
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/listbox.html (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/listbox.html Sun Nov 5 20:40:36 2006
@@ -15,7 +15,7 @@
};
// Debug all classes used:
debug_config = { _debugAll: true } ;
- // Debug classes chosen
+ // Debug only selected classes:
/* debug_config = {
_debugList:[
"xap.widgets.dojo.ListBox",
@@ -30,6 +30,7 @@
<script language="JavaScript" type="text/javascript" src="AttributeTester.js"></script>
<script language="JavaScript">
+ <!-- must do this before we load the actual application: -->
xap.util.Debug.loadDebuggables();
</script>
Modified: incubator/xap/trunk/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/Xap.js?view=diff&rev=471632&r1=471631&r2=471632
==============================================================================
--- incubator/xap/trunk/src/xap/Xap.js (original)
+++ incubator/xap/trunk/src/xap/Xap.js Sun Nov 5 20:40:36 2006
@@ -43,6 +43,7 @@
xap.html.HtmlConnector.scanPage();
xap.html.HtmlConnector.createEmbeddedApplications();
+
//return the xap applications
return window.xapApplications;
}
@@ -93,7 +94,9 @@
*
*/
Xap.require = function(){
-
+ if( !xap || !xap.util || ! xap.util.Debug ){
+ dojo.require("xap.util.Debug") ;
+ }
// Modules will have to go through Dojo:
var toLoad = arguments[0] ;
var notModule = (toLoad.search(Xap.anyAsteriskRegexp)==-1) ;
@@ -108,13 +111,16 @@
// do we need to reload this file?
//---is it in the "debuggables" list?--are we reloading everything?
var needToDebugLoad = notModule &&
- (Xap._debugAll ||
- (Xap._debugLoad && Xap._debuggables[toLoad]));
+ (xap.util.Debug._debugAll ||
+ (xap.util.Debug._debugLoad //
+ && xap.util.Debug._debuggables[toLoad] //this is one to load
+ )
+ );
try {
dojo.require.apply(dojo,arguments) ;
if(needToDebugLoad){
- Xap.addDebuggables([toLoad]) ;
+ xap.util.Debug.addDebuggables([toLoad]) ;
Xap.ourLoadedClasses[toLoad] = true ;
}
} catch (ee) {
@@ -168,4 +174,3 @@
subclassConstructor.s_log = xap.util.LogFactory.getLog( subclassName ) ;
}
-
Modified: incubator/xap/trunk/src/xap/util/Debug.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/Debug.js?view=diff&rev=471632&r1=471631&r2=471632
==============================================================================
--- incubator/xap/trunk/src/xap/util/Debug.js (original)
+++ incubator/xap/trunk/src/xap/util/Debug.js Sun Nov 5 20:40:36 2006
@@ -27,7 +27,7 @@
Xap.require("xap.util.Utils");
-xap.util.Debug._sourceRootDir = "../../";
+xap.util.Debug._sourceRootDir = "../../" ;
/**
* Keep track of the source root directory for the debuggable files.
@@ -39,24 +39,27 @@
/**
* Add the array of debuggable files to the current list.
*/
-xap.util.Debug.addDebuggables = function(debuggables){
+xap.util.Debug.addDebuggables = function(dbs){
if( !xap.util.Debug._debuggables ){
xap.util.Debug._debuggables = new Object() ;
}
- for (var ii=0; ii<arguments.length; ++ii ){
- xap.util.Debug._debuggables[arguments[ii]] = true ;
+ for (var ii=0; ii<dbs.length; ++ii ){
+ xap.util.Debug._debuggables[dbs[ii]] = true ;
}
}
/**
* Load the list of debuggable file from the server.
*/
-xap.util.Debug.loadDebuggables = function(pathHolderObj){
- if(!pathHolderObj){
+xap.util.Debug.loadDebuggables = function(){
+//If there are args, the first should be a list of
+// classes to load; if there are no arguments, use
+// the default list of files:
+ if(arguments.length ==0 && xap.util.Debug._debuggables){
xap.util.Debug.loadDebuggables(xap.util.Debug._debuggables) ;
return;
}else{
- for (var nom in pathHolderObj){
+ for (var nom in arguments[0]){
xap.util.Debug._loadDebuggable(nom) ;
}
}
@@ -77,5 +80,36 @@
xap.util.Debug._sourceRootDir +="/" ;
}
path = xap.util.Debug._sourceRootDir +"src/"+path +".js" ;
+ Xap.logString += ";"+ path;
xap.util.Utils.importFile(path) ;
+}
+
+
+/**
+ * For debugging on a file-by-file basis:
+**/
+xap.util.Debug.setDebug = function(tf){
+ xap.util.Debug._debugLoad = tf ;
+}
+
+
+
+/**
+ * For debugging all files loaded through Xap.require():
+**/
+xap.util.Debug.setDebugAll = function(tf){
+ xap.util.Debug._debugAll = true ;
+}
+
+
+if( debug_config ){
+ for(var key in debug_config ){
+ xap.util.Debug[key] = debug_config[key] ;
+ }
+ // Easiest to load list of debuggables with
+ // an array, easiest to keep and use as a Set (object keys)
+ if( xap.util.Debug._debugList ){
+ xap.util.Debug._debugLoad = true ;
+ xap.util.Debug.addDebuggables(xap.util.Debug._debugList) ;
+ }
}