Changeset 7717 for trunk/api

Show
Ignore:
Timestamp:
03/20/07 16:00:51 (22 months ago)
Author:
owen
Message:

Showing instance variables more often

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/api/ApiRef.js

    r6898 r7717  
    6767dojo.provide("api.ApiRef"); 
    6868 
    69 dojo.require("api.ProfileHelper"); 
     69dojo.require("dojo.profile.ProfileHelper"); 
    7070dojo.require("dojo.debug.console"); 
    7171 
     
    994994                        output.push(this.outputObjectProperties(item, type, extra.variables, "Variables")); 
    995995                } 
    996  
    997996                var constructor = (item.constructor && item.constructor.data ? item.constructor.data[0] : null); 
    998997                 
     
    10041003 
    10051004                        // TODO: merge with "this_variables" ??? 
    1006                         output.push(this.outputProtoVariables(item, type, constructor.protovariables)); 
     1005                        if (constructor.parameters) { 
     1006                                output.push(this.outputProtoVariables(item, type, constructor.parameters)); 
     1007                        } else if (constructor.prototype_variables) { 
     1008                                output.push(this.outputProtoVariables(item, type, constructor.prototype_variables)); 
     1009                        } 
    10071010 
    10081011                        // output the constructor itself  (NOTE: we explicitly show the constructor as not expanded) 
     
    13051308                output.push("<tr><td class=paramHeader>Type</td><td class=paramHeader>Name</td><td class=paramHeader>Description</td></tr>"); 
    13061309 
    1307                 if (filteredList == null) { 
    1308                         for (var name in params) { 
    1309                                 output.push(this._outputParameter(params[name], name)); 
    1310                         } 
     1310                if (params.length) { 
     1311                        if (filteredList == null) { 
     1312                                for (var i = 0; i < params.length; i++) { 
     1313                                        output.push(this._outputParameter(null, params[i])); 
     1314                                } 
     1315                        } else { 
     1316                                for (var i = 0; i < filteredList.length; i++) { 
     1317                                        var name = filteredList[i]; 
     1318                                        output.push(this._outputParameter(null, name)); 
     1319                                } 
     1320                        }                
    13111321                } else { 
    1312                         for (var i = 0; i < filteredList.length; i++) { 
    1313                                 var name = filteredList[i]; 
    1314                                 output.push(this._outputParameter(params[name], name)); 
     1322                        if (filteredList == null) { 
     1323                                for (var name in params) { 
     1324                                        output.push(this._outputParameter(params[name], name)); 
     1325                                } 
     1326                        } else { 
     1327                                for (var i = 0; i < filteredList.length; i++) { 
     1328                                        var name = filteredList[i]; 
     1329                                        output.push(this._outputParameter(params[name], name)); 
     1330                                } 
    13151331                        } 
    13161332                } 
     
    13331349                output.push("<tr>"); 
    13341350                 
    1335                 var type = param.type; 
    1336                 if (type) { 
    1337                         var questionChar = type.indexOf("?"); 
    1338                         if (questionChar > 0) { 
    1339                                 isOptional = true; 
    1340                                 type = type.substring(0, questionChar); 
    1341                         } 
    1342                         output.push("<td class='paramType'>", this.outputItemLink(type), "</td>"); 
     1351                if (param) { 
     1352                        var type = param.type; 
     1353                        if (type) { 
     1354                                var questionChar = type.indexOf("?"); 
     1355                                if (questionChar > 0) { 
     1356                                        isOptional = true; 
     1357                                        type = type.substring(0, questionChar); 
     1358                                } 
     1359                                output.push("<td class='paramType'>", this.outputItemLink(type), "</td>"); 
     1360                        } else { 
     1361                                output.push("<td class='paramType'>&nbsp;</td>"); 
     1362                        } 
     1363         
     1364                        output.push("<td class='paramName'>",name,"</td>"); 
     1365         
     1366                        var description = param.description; 
     1367                        if (description == null) description = "&nbsp;"; 
     1368                        if (isOptional) description = "<span class=paramOptional>(optional)</span> " + description; 
     1369                        if (isPrivate) description = "<span class=paramPrivate>(private)</span> " + description; 
     1370                        output.push("<td class='paramDescription'>", description, "</td>"); 
    13431371                } else { 
    1344                         output.push("<td class='paramType'>&nbsp;</td>"); 
    1345                 } 
    1346  
    1347                 output.push("<td class='paramName'>",name,"</td>"); 
    1348  
    1349                 var description = param.description; 
    1350                 if (description == null) description = "&nbsp;"; 
    1351                 if (isOptional) description = "<span class=paramOptional>(optional)</span> " + description; 
    1352                 if (isPrivate) description = "<span class=paramPrivate>(private)</span> " + description; 
    1353                 output.push("<td class='paramDescription'>", description, "</td>"); 
     1372                        output.push("<td class=paramType>&nbsp;</td>"); 
     1373                        output.push("<td class=paramName>",name,"</td>"); 
     1374                        output.push("<td class=paramDescription>&nbsp;</td>"); 
     1375                } 
    13541376 
    13551377                output.push("</tr>"); 
     
    13621384                // summary: output the protoytpe variables for an item 
    13631385                if (protoVars == null) return ""; 
    1364                  
    13651386                var output = []; 
    13661387                // split the vars into props and event handlers 
     
    13681389                var handlerList = this.filterParams(protoVars, function(name) {return name.indexOf("on") == 0}); 
    13691390                // if both are present, write them in a table next to each other 
     1391 
    13701392                var bothPresent = (propList != null && handlerList != null); 
    13711393                if (bothPresent) output.push("<table class='classParamTable'><tr><td class='classParamTableCell'>"); 
     
    14591481         
    14601482        filterParams : function (params, filter) { 
     1483                if (!params) return null; 
    14611484                // summary: filter an object, returning only items for which the filter function returns true 
    14621485                var output = []; 
    1463                 for (var name in params) { 
    1464                         if (filter(name) == true) output.push(name); 
     1486                if (params.length) { 
     1487                        for (var i = 0; i < params.length; i++) { 
     1488                                if (filter(params[i]) == true) output.push(params[i]); 
     1489                        } 
     1490                } else { 
     1491                        for (var name in params) { 
     1492                                if (filter(name) == true) output.push(name); 
     1493                        } 
    14651494                } 
    14661495                if (output.length == 0) return null;