/pyjs/tests/test007.js

http://pyjamas.googlecode.com/ · JavaScript · 47 lines · 47 code · 0 blank · 0 comment · 0 complexity · c6cc72b97d56c4b8ac68543c596ae333 MD5 · raw file

  1. __ui_UIObject.prototype.__class__ = "ui_UIObject";
  2. function ui_UIObject() {
  3. return new __ui_UIObject();
  4. }
  5. function __ui_UIObject() {
  6. }
  7. __ui_UIObject.prototype.getElement = function() {
  8. return this.element;
  9. };
  10. __ui_UIObject.prototype.setElement = function(element) {
  11. this.element = element;
  12. };
  13. __ui_UIObject.prototype.setStyleName = function(style) {
  14. DOM_setAttribute(this.element, "className", style);
  15. };
  16. pyjs_extend(__ui_Widget, __ui_UIObject);
  17. __ui_Widget.prototype.__class__ = "ui_Widget";
  18. function ui_Widget() {
  19. return new __ui_Widget();
  20. }
  21. function __ui_Widget() {
  22. __ui_UIObject.call(this);
  23. }
  24. __ui_Widget.prototype.setParent = function(parent) {
  25. this.parent = parent;
  26. };
  27. pyjs_extend(__ui_Panel, __ui_Widget);
  28. __ui_Panel.prototype.__class__ = "ui_Panel";
  29. function ui_Panel() {
  30. return new __ui_Panel();
  31. }
  32. function __ui_Panel() {
  33. __ui_Widget.call(this);
  34. }
  35. pyjs_extend(__ui_ComplexPanel, __ui_Panel);
  36. __ui_ComplexPanel.prototype.__class__ = "ui_ComplexPanel";
  37. function ui_ComplexPanel() {
  38. return new __ui_ComplexPanel();
  39. }
  40. function __ui_ComplexPanel() {
  41. this.children = new pyjslib_List([]);
  42. }
  43. __ui_ComplexPanel.prototype.add = function(widget) {
  44. this.children.append(widget);
  45. widget.setParent(this);
  46. return true;
  47. };