1

目前我正在使用 qooxdoo 库开发 RIA 应用程序。

使用 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.");
  });


}
}
});

主窗口.js

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

conf.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
    }
  }
}
*/
}
}

我在 FIRBUG 控制台中遇到了这个错误:

TypeError: parts[i] is undefined
parts[i].load(onLoad, this);

谁能告诉我怎么了?

提前致谢。

4

1 回答 1

3

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

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

于 2012-10-12T09:14:39.840 回答