/Frameworks/AppKit/rhino.platform/_CPCibCustomResource.j

http://github.com/polymar/polish · Unknown · 69 lines · 69 code · 0 blank · 0 comment · 0 complexity · 6fdbb27cf80f4dfd3d4ef210116db83e MD5 · raw file

  1. I;21;Foundation/CPObject.jI;21;Foundation/CPString.jc;2848;
  2. var _1="_CPCibCustomResourceClassNameKey",_2="_CPCibCustomResourceResourceNameKey",_3="_CPCibCustomResourcePropertiesKey";
  3. var _4=objj_allocateClassPair(CPObject,"_CPCibCustomResource"),_5=_4.isa;
  4. class_addIvars(_4,[new objj_ivar("_className"),new objj_ivar("_resourceName"),new objj_ivar("_properties")]);
  5. objj_registerClassPair(_4);
  6. objj_addClassForBundle(_4,objj_getBundleWithPath(OBJJ_CURRENT_BUNDLE.path));
  7. class_addMethods(_4,[new objj_method(sel_getUid("initWithClassName:resourceName:properties:"),function(_6,_7,_8,_9,_a){
  8. with(_6){
  9. _6=objj_msgSendSuper({receiver:_6,super_class:objj_getClass("CPObject")},"init");
  10. if(_6){
  11. _className=_8;
  12. _resourceName=_9;
  13. _properties=_a;
  14. }
  15. return _6;
  16. }
  17. }),new objj_method(sel_getUid("initWithCoder:"),function(_b,_c,_d){
  18. with(_b){
  19. _b=objj_msgSendSuper({receiver:_b,super_class:objj_getClass("CPObject")},"init");
  20. if(_b){
  21. _className=objj_msgSend(_d,"decodeObjectForKey:",_1);
  22. _resourceName=objj_msgSend(_d,"decodeObjectForKey:",_2);
  23. _properties=objj_msgSend(_d,"decodeObjectForKey:",_3);
  24. }
  25. return _b;
  26. }
  27. }),new objj_method(sel_getUid("encodeWithCoder:"),function(_e,_f,_10){
  28. with(_e){
  29. objj_msgSend(_10,"encodeObject:forKey:",_className,_1);
  30. objj_msgSend(_10,"encodeObject:forKey:",_resourceName,_2);
  31. objj_msgSend(_10,"encodeObject:forKey:",_properties,_3);
  32. }
  33. }),new objj_method(sel_getUid("awakeAfterUsingCoder:"),function(_11,_12,_13){
  34. with(_11){
  35. if(objj_msgSend(_13,"respondsToSelector:",sel_getUid("bundle"))&&(!objj_msgSend(_13,"respondsToSelector:",sel_getUid("awakenCustomResources"))||objj_msgSend(_13,"awakenCustomResources"))){
  36. if(_className==="CPImage"){
  37. return objj_msgSend(objj_msgSend(CPImage,"alloc"),"initWithContentsOfFile:size:",objj_msgSend(objj_msgSend(_13,"bundle"),"pathForResource:",_resourceName),objj_msgSend(_properties,"objectForKey:","size"));
  38. }
  39. }
  40. return _11;
  41. }
  42. })]);
  43. class_addMethods(_5,[new objj_method(sel_getUid("imageResourceWithName:size:"),function(_14,_15,_16,_17){
  44. with(_14){
  45. return objj_msgSend(objj_msgSend(_14,"alloc"),"initWithClassName:resourceName:properties:","CPImage",_16,objj_msgSend(CPDictionary,"dictionaryWithObject:forKey:",_17,"size"));
  46. }
  47. })]);
  48. var _4=objj_getClass("_CPCibCustomResource");
  49. if(!_4){
  50. objj_exception_throw(new objj_exception(OBJJClassNotFoundException,"*** Could not find definition for class \"_CPCibCustomResource\""));
  51. }
  52. var _5=_4.isa;
  53. class_addMethods(_4,[new objj_method(sel_getUid("filename"),function(_18,_19){
  54. with(_18){
  55. return objj_msgSend(objj_msgSend(CPBundle,"mainBundle"),"pathForResource:",_resourceName);
  56. }
  57. }),new objj_method(sel_getUid("size"),function(_1a,_1b){
  58. with(_1a){
  59. return objj_msgSend(_properties,"objectForKey:","size");
  60. }
  61. }),new objj_method(sel_getUid("isThreePartImage"),function(_1c,_1d){
  62. with(_1c){
  63. return NO;
  64. }
  65. }),new objj_method(sel_getUid("isNinePartImage"),function(_1e,_1f){
  66. with(_1e){
  67. return NO;
  68. }
  69. })]);