/Frameworks/AppKit/rhino.platform/CPOutlineView.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 56 lines · 56 code · 0 blank · 0 comment · 0 complexity · 415bed904d3da7bf67c66736b1dafeb4 MD5 · raw file

  1. i;13;CPTableView.jc;2698;
  2. var _1=objj_allocateClassPair(CPTableView,"CPOutlineView"),_2=_1.isa;
  3. class_addIvars(_1,[new objj_ivar("_outlineDataSource"),new objj_ivar("_itemsByRow")]);
  4. objj_registerClassPair(_1);
  5. objj_addClassForBundle(_1,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  6. class_addMethods(_1,[new objj_method(sel_getUid("initWithFrame:"),function(_3,_4,_5){
  7. with(_3){
  8. _3=objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPTableView")},"initWithFrame:",_5);
  9. if(_3){
  10. objj_msgSendSuper({receiver:_3,super_class:objj_getClass("CPTableView")},"setDataSource:",_3);
  11. _itemsByRow=objj_msgSend(objj_msgSend(CPArray,"alloc"),"init");
  12. }
  13. return _3;
  14. }
  15. }),new objj_method(sel_getUid("setDataSource:"),function(_6,_7,_8){
  16. with(_6){
  17. if(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("outlineView:child:ofItem"))){
  18. objj_msgSend(CPException,"raise:reason:",CPInternalInconsistencyException,"Data source must implement 'outlineView:child:ofItem'");
  19. }
  20. if(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("outlineView:isItemExpandable"))){
  21. objj_msgSend(CPException,"raise:reason:",CPInternalInconsistencyException,"Data source must implement 'outlineView:isItemExpandable'");
  22. }
  23. if(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("outlineView:numberOfChildrenOfItem"))){
  24. objj_msgSend(CPException,"raise:reason:",CPInternalInconsistencyException,"Data source must implement 'outlineView:numberOfChildrenOfItem'");
  25. }
  26. if(!objj_msgSend(_8,"respondsToSelector:",sel_getUid("outlineView:objectValueForTableColumn:byItem"))){
  27. objj_msgSend(CPException,"raise:reason:",CPInternalInconsistencyException,"Data source must implement 'outlineView:objectValueForTableColumn:byItem'");
  28. }
  29. _outlineDataSource=_8;
  30. objj_msgSend(_6,"reloadData");
  31. }
  32. }),new objj_method(sel_getUid("reloadData"),function(_9,_a){
  33. with(_9){
  34. _numberOfVisibleItems=objj_msgSend(_outlineDataSource,"outlineView:numberOfChildrenOfItem:",_9,nil);
  35. _numberOfRows=_numberOfVisibleItems;
  36. var i=0;
  37. for(;i<_numberOfVisibleItems;++i){
  38. _itemsByRow[i]=objj_msgSend(_outlineDataSource,"outlineView:child:ofItem:",_9,i,nil);
  39. }
  40. objj_msgSend(_9,"loadTableCellsInRect:",objj_msgSend(_9,"bounds"));
  41. }
  42. })]);
  43. var _1=objj_getClass("CPOutlineView");
  44. if(!_1){
  45. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"CPOutlineView\""));
  46. }
  47. var _2=_1.isa;
  48. class_addMethods(_1,[new objj_method(sel_getUid("numberOfRowsInTableView:"),function(_c,_d,_e){
  49. with(_c){
  50. return _numberOfVisibleItems;
  51. }
  52. }),new objj_method(sel_getUid("tableView:objectValueForTableColumn:row:"),function(_f,_10,_11,_12,_13){
  53. with(_f){
  54. return objj_msgSend(_outlineDataSource,"outlineView:objectValueForTableColumn:byItem:",_f,_12,_itemsByRow[_13]);
  55. }
  56. })]);