2012-10-12 20 views
1

目前我正在开发一个使用qooxdoo库的RIA应用程序。QooxDoo新手:需要关于零件加载器的帮助

当我使用qooxdoo的零件加载程序时出现错误。

这是我的application.js

/* ************************************************************************ 
#asset(crmv2/*) 
************************************************************************ */ 
qx.Class.define("crmv2.Application", 
{ 
members :{ 
main : function(){ 
    // Call super class 
    this.base(arguments); 

    // Enable logging in debug variant 
    if (qx.core.Environment.get("qx.debug")) 
    { 
    // support native logging capabilities, e.g. Firebug for Firefox 
    qx.log.appender.Native; 
    // support additional cross-browser console. Press F7 to toggle visibility 
    qx.log.appender.Console; 
    } 

    /* 
    ------------------------------------------------------------------------- 
    Below is your actual application code... 
    ------------------------------------------------------------------------- 
    */ 


    /* 
    ------------------------------------------------------------------------- 
    USE AN EXISTING NODE TO ADD WIDGETS INTO THE PAGE LAYOUT FLOW 
    ------------------------------------------------------------------------- 
    */ 

    // Hint: the second and the third parameter control if the dimensions 
    // of the element should be respected or not. 
    var htmlElement = document.getElementById("isle"); 
    var inlineIsle = new qx.ui.root.Inline(htmlElement, true, true); 

    // use VBox layout instead of basic 
    inlineIsle.setLayout(new qx.ui.layout.VBox); 

    // new container 
    var container = new qx.ui.container.Composite(new qx.ui.layout.HBox); 

    // Create a button 
    var button1 = new qx.ui.form.Button("First Button", "crmv2/test.png"); 
    button1.setAllowStretchY(false); 
    container.add(button1); 
    container.setPadding(10); 

    // spacer 
    var spacer = new qx.ui.core.Spacer(); 
    container.add(spacer, { flex: 1 }); 

    // create a date chooser component 
    var dateChooser = new qx.ui.control.DateChooser; 
    container.add(dateChooser); 

    // add container to the inline root 
    inlineIsle.add(container); 

    // Add an event listener 
    button1.addListener("execute", function(e) { 
    qx.io.PartLoader.require(
     ["testpart"], 
     function() 
     { 

      this.__MainWindow = new crmv2.MainWindow(); 
      //this.getRoot().add(this.__MainWindow); 


     // open the window 
     this.__MainWindow.center(); 
     this.__MainWindow.open(); 
     }, 
     this); 
    var main = new crmv2.MainWindow(); 
    main.open(); 
    }); 


    /* 
    ------------------------------------------------------------------------- 
    ADD WIDGETS WITH ABSOLUTE POSITIONING 
    ------------------------------------------------------------------------- 
    */ 

    // Create a button 
    var button2 = new qx.ui.form.Button("absolutely positioned"); 

    // Add button to document at fixed coordinates 
    this.getRoot().add(button2, {left: 500, top: 310}); 

    // Add an event listener 
    button2.addListener("execute", function(e) { 
    alert("I'm an absolutely positioned button!\n" + 
      "I overlay existing content."); 
    }); 


} 
} 
}); 

MainWindow.js

qx.Class.define("crmv2.MainWindow", 
{ 
extend : qx.ui.window.Window, 
construct : function() 
{ 
    this.base(arguments, "crmv2"); 
} 
}); 

confi.json

{ 
    "name" : "crmv2", 
"include" : 
[{ 
"path" : "${QOOXDOO_PATH}/tool/data/config/application.json" 
} 
], 
"export" : 
[ 
"api", 
"api-data", 
"build", 
"clean", 
"distclean", 
"fix", 
"info", 
"inspector", 
"lint", 
"migration", 
"pretty", 
"profiling", 
"source", 
"source-all", 
"source-hybrid", 
"simulation-build", 
"simulation-run", 
"test", 
"test-source", 
"translation" 
], 
"default-job" : "source-hybrid", 
"let" :{ 
"APPLICATION" : "crmv2", 
"QOOXDOO_PATH" : "../../..", 
"QXTHEME"  : "crmv2.theme.Theme", 
"API_EXCLUDE" : ["qx.test.*", "${APPLICATION}.theme.*", "${APPLICATION}.test.*", "${APPLICATION}.simulation.*"], 
"LOCALES"  : [ "en" ], 
"CACHE"  : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache", 
"ROOT"   : "." 
}, 
// You only need to edit the remainder of this file, if you want to customize 
// specific jobs, or add own job definitions. 
"jobs" : 
{ 
"source": 
{ 
    "packages" : 
    { 
    "parts" : 
    { 
     "boot"  : 
     { 
     "include" : [ "${QXTHEME}", "crmv2.Application" ] 
     }, 
     "testpart" : 
     { 
     "include" : [ "crmv2.MainWindow" ] 
     } 
    } 
    } 
} 

// Uncomment the following entry to add a contrib or library to your 
// project; make sure to adapt the path to the Manifest.json; if you are 
// using a contrib: library, it will be downloaded into the path specified 
// by the 'cache/downloads' config key 
/* 
"libraries" : 
{ 
    "library" : 
    [ 
    { 
     "manifest" : "contrib://SkeletonApplication/trunk/Manifest.json" 
    } 
    ] 
} 
*/ 

// If you want to tweak a job setting, see the following sample where 
// the "format" feature of the "build-script" job is overridden. 
// To see a list of available jobs, invoke 'generate.py x'. 
/* 
,"build-script" : 
{ 
    "compile-options" : 
    { 
    "code" : 
    { 
     "format" : false 
    } 
    } 
} 
*/ 
} 
} 

我得到这个错误IN FIRBUG CONSOLE:

类型错误:份[i]是未定义
份[I] .load(的onLoad,本);

任何人都可以告诉我什么是错的?

在此先感谢。

+0

任何一个?????????? –

回答

3

您为“源”作业定义了部件 - 您在加载应用程序之前是否运行过generate.py source ?!

一旦开始运行generate.py build,不要忘记在config.json的“构建”作业中复制零件定义。

+0

谢谢你thomash。运行generate.py源后,我得到了 ** qx.Theme是undefined ** –

+0

发现修复:http://stackoverflow.com/questions/2372585/qx-class-is-undefined-when-loading-a-qooxdoo-应用在源模式 –