Stat.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. //MWF.xDesktop.requireApp("process.Xform", "widget.View", null, false);
  3. MWF.xApplication.process.Xform.Stat = MWF.APPStat = new Class({
  4. Extends: MWF.APP$Module,
  5. options: {
  6. "moduleEvents": ["loadData"]
  7. },
  8. _loadUserInterface: function(){
  9. this.node.empty();
  10. },
  11. _afterLoaded: function(){
  12. this.node.setStyle("min-height", "100px");
  13. this.loadStat();
  14. },
  15. active: function(){
  16. if (this.stat) this.stat.loadStatData();
  17. },
  18. loadStat: function(){
  19. var viewJson = {
  20. "application": this.json.queryStat.appName,
  21. "statName": this.json.queryStat.name,
  22. "isChart": (this.json.isChart!="no"),
  23. "isLegend": (this.json.isLegend!="no"),
  24. "isTable": (this.json.isTable!="no")
  25. };
  26. MWF.xDesktop.requireApp("query.Query", "Statistician", function(){
  27. this.stat = new MWF.xApplication.query.Query.Statistician(this.form.app, this.node, viewJson, {
  28. "resizeNode": (this.node.getStyle("height").toString().toLowerCase()!=="auto" && this.node.getStyle("height").toInt()>0),
  29. "onLoaded": function(){
  30. this.fireEvent("postLoad");
  31. }.bind(this)
  32. });
  33. }.bind(this));
  34. },
  35. getData: function(){
  36. if (!this.stat) return null;
  37. if (!this.stat.stat) return null;
  38. return this.stat.stat.data;
  39. }
  40. });