se-model-module.js 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. YUI.add('se-model-module', function (Y) {
  2. var ID = 'id',
  3. AST = 'ast',
  4. SYM = 'sym',
  5. CODE = 'code',
  6. NAME = 'name',
  7. TEXT = 'text';
  8. Y.namespace('SE.Models').Module = Y.Base.create('moduleModelSE', Y.Model, [], {
  9. getId: function () {
  10. return this.get(ID);
  11. },
  12. setId: function (id) {
  13. return this.set(ID, id);
  14. },
  15. getName: function () {
  16. return this.get(NAME);
  17. },
  18. setName: function (name) {
  19. return this.set(NAME, name);
  20. },
  21. getAst: function () {
  22. return this.get(AST);
  23. },
  24. setAst: function (ast) {
  25. return this.set(AST, ast);
  26. },
  27. getSym: function () {
  28. return this.get(SYM);
  29. },
  30. setSym: function (sym) {
  31. return this.set(SYM, sym);
  32. },
  33. getCode: function () {
  34. return this.get(CODE)
  35. },
  36. setCode: function (code) {
  37. return this.set(CODE, code);
  38. },
  39. getText: function () {
  40. return this.get(TEXT);
  41. },
  42. setText: function (text) {
  43. return this.set(TEXT, text);
  44. },
  45. isReady: function () {
  46. return !Y.Lang.isNull(this.get(CODE));
  47. }
  48. }, {
  49. ATTRS: {
  50. ast: {
  51. value: null
  52. },
  53. sym: {
  54. value: null
  55. },
  56. code: {
  57. value: null
  58. },
  59. name: {
  60. value: 'noname',
  61. validator: Y.Lang.isString
  62. },
  63. text: {
  64. value: 'MODULE noname; END noname.',
  65. validator: Y.Lang.isString
  66. }
  67. }
  68. });
  69. }, '1.0', {
  70. requires: [
  71. 'model'
  72. ]
  73. });