/Frameworks/Debug/AppKit/rhino.platform/CPCibLoading.j

http://github.com/jfahrenkrug/MapKit-HelloWorld · Unknown · 46 lines · 45 code · 1 blank · 0 comment · 0 complexity · 45774e38ca4a754d4f1f3ecaf415344f MD5 · raw file

  1. I;21;Foundation/CPBundle.jI;25;Foundation/CPDictionary.jI;21;Foundation/CPString.jc;2555;
  2. var CPCibOwner = "CPCibOwner";
  3. var LoadInfoForCib = {};
  4. {
  5. var the_class = objj_getClass("CPObject")
  6. if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPObject\""));
  7. var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("awakeFromCib"), function $CPObject__awakeFromCib(self, _cmd)
  8. { with(self)
  9. {
  10. }
  11. })]);
  12. }
  13. {
  14. var the_class = objj_getClass("CPBundle")
  15. if(!the_class) objj_exception_throw(new objj_exception(OBJJClassNotFoundException, "*** Could not find definition for class \"CPBundle\""));
  16. var meta_class = the_class.isa;class_addMethods(the_class, [new objj_method(sel_getUid("loadCibFile:externalNameTable:loadDelegate:"), function $CPBundle__loadCibFile_externalNameTable_loadDelegate_(self, _cmd, aFileName, aNameTable, aDelegate)
  17. { with(self)
  18. {
  19. var cib = objj_msgSend(objj_msgSend(CPCib, "alloc"), "initWithCibNamed:bundle:loadDelegate:", aFileName, self, objj_msgSend(self, "class"));
  20. LoadInfoForCib[objj_msgSend(cib, "hash")] = { loadDelegate:aDelegate, externalNameTable:aNameTable };
  21. }
  22. })]);
  23. class_addMethods(meta_class, [new objj_method(sel_getUid("loadCibFile:externalNameTable:loadDelegate:"), function $CPBundle__loadCibFile_externalNameTable_loadDelegate_(self, _cmd, anAbsolutePath, aNameTable, aDelegate)
  24. { with(self)
  25. {
  26. var cib = objj_msgSend(objj_msgSend(CPCib, "alloc"), "initWithContentsOfURL:loadDelegate:", anAbsolutePath, self);
  27. LoadInfoForCib[objj_msgSend(cib, "hash")] = { loadDelegate:aDelegate, externalNameTable:aNameTable };
  28. }
  29. }), new objj_method(sel_getUid("loadCibNamed:owner:loadDelegate:"), function $CPBundle__loadCibNamed_owner_loadDelegate_(self, _cmd, aName, anOwner, aDelegate)
  30. { with(self)
  31. {
  32. var bundle = anOwner ? objj_msgSend(CPBundle, "bundleForClass:", objj_msgSend(anOwner, "class")) : objj_msgSend(CPBundle, "mainBundle"),
  33. path = objj_msgSend(bundle, "pathForResource:", aName);
  34. objj_msgSend(self, "loadCibFile:externalNameTable:loadDelegate:", path, objj_msgSend(CPDictionary, "dictionaryWithObject:forKey:", anOwner, CPCibOwner), aDelegate);
  35. }
  36. }), new objj_method(sel_getUid("cibDidFinishLoading:"), function $CPBundle__cibDidFinishLoading_(self, _cmd, aCib)
  37. { with(self)
  38. {
  39. var loadInfo = LoadInfoForCib[objj_msgSend(aCib, "hash")];
  40. delete LoadInfoForCib[objj_msgSend(aCib, "hash")];
  41. objj_msgSend(aCib, "instantiateCibWithExternalNameTable:", loadInfo.externalNameTable);
  42. objj_msgSend(loadInfo.loadDelegate, "cibDidFinishLoading:", aCib);
  43. }
  44. })]);
  45. }