QooxDoo新手:需要零件装载机的帮助

时间:2012-10-12 01:39:16

标签: qooxdoo

目前我正在使用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.");
  });


}
}
});

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

我在FIRBUG CONSOLE中犯了这个错误:

TypeError:parts [i]未定义
parts [i] .load(onLoad,this);

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

提前致谢。

1 个答案:

答案 0 :(得分:3)

您为“来源”作业定义了部分 - 在加载应用之前是否运行了generate.py source

在运行generate.py build后,不要忘记在config.json中的“build”作业中复制部件定义。