sproutcore 1.4.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (1650) hide show
  1. data/DISTRIBUTION.yml +20 -0
  2. data/Gemfile +3 -0
  3. data/History.txt +54 -0
  4. data/README.txt +104 -0
  5. data/Rakefile +446 -0
  6. data/Todo.txt +1 -0
  7. data/VERSION.yml +7 -0
  8. data/bin/sc-build +18 -0
  9. data/bin/sc-build-number +18 -0
  10. data/bin/sc-docs +19 -0
  11. data/bin/sc-gen +18 -0
  12. data/bin/sc-init +18 -0
  13. data/bin/sc-manifest +18 -0
  14. data/bin/sc-server +18 -0
  15. data/bin/sproutcore +18 -0
  16. data/design/Technical Notes.graffle/QuickLook/Preview.pdf +0 -0
  17. data/design/Technical Notes.graffle/QuickLook/Thumbnail.tiff +0 -0
  18. data/design/Technical Notes.graffle/data.plist +5534 -0
  19. data/design/Technical Notes.graffle/image8.png +0 -0
  20. data/lib/Buildfile +140 -0
  21. data/lib/buildtasks/build.rake +103 -0
  22. data/lib/buildtasks/entry.rake +68 -0
  23. data/lib/buildtasks/manifest.rake +615 -0
  24. data/lib/buildtasks/render.rake +21 -0
  25. data/lib/buildtasks/target.rake +65 -0
  26. data/lib/doc_templates/jsdoc/allclasses.tmpl +17 -0
  27. data/lib/doc_templates/jsdoc/allfiles.tmpl +56 -0
  28. data/lib/doc_templates/jsdoc/class.tmpl +487 -0
  29. data/lib/doc_templates/jsdoc/index.tmpl +38 -0
  30. data/lib/doc_templates/jsdoc/publish.js +170 -0
  31. data/lib/doc_templates/jsdoc/static/default.css +162 -0
  32. data/lib/doc_templates/jsdoc/static/header.html +2 -0
  33. data/lib/doc_templates/jsdoc/static/index.html +19 -0
  34. data/lib/doc_templates/jsdoc/symbol.tmpl +35 -0
  35. data/lib/doc_templates/sproutcore/allclasses.tmpl +0 -0
  36. data/lib/doc_templates/sproutcore/allfiles.tmpl +56 -0
  37. data/lib/doc_templates/sproutcore/class.tmpl +674 -0
  38. data/lib/doc_templates/sproutcore/classes-json.tmpl +55 -0
  39. data/lib/doc_templates/sproutcore/index.tmpl +48 -0
  40. data/lib/doc_templates/sproutcore/publish.js +346 -0
  41. data/lib/doc_templates/sproutcore/static/default.css +258 -0
  42. data/lib/doc_templates/sproutcore/static/header.html +2 -0
  43. data/lib/doc_templates/sproutcore/static/index.html +19 -0
  44. data/lib/doc_templates/sproutcore/symbol.tmpl +35 -0
  45. data/lib/frameworks/sproutcore/Buildfile +101 -0
  46. data/lib/frameworks/sproutcore/CHANGELOG.md +170 -0
  47. data/lib/frameworks/sproutcore/HISTORY +697 -0
  48. data/lib/frameworks/sproutcore/README.md +68 -0
  49. data/lib/frameworks/sproutcore/apps/docs/core.js +27 -0
  50. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Preview.pdf +0 -0
  51. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/QuickLook/Thumbnail.tiff +0 -0
  52. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/data.plist +14378 -0
  53. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image10.png +0 -0
  54. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image11.png +0 -0
  55. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image13.png +0 -0
  56. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image14.png +0 -0
  57. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image8.png +0 -0
  58. data/lib/frameworks/sproutcore/apps/docs/design/Doc Viewer.graffle/image9.tiff +0 -0
  59. data/lib/frameworks/sproutcore/apps/docs/english.lproj/loading.rhtml +9 -0
  60. data/lib/frameworks/sproutcore/apps/docs/english.lproj/main_page.js +22 -0
  61. data/lib/frameworks/sproutcore/apps/docs/english.lproj/strings.js +15 -0
  62. data/lib/frameworks/sproutcore/apps/docs/main.js +30 -0
  63. data/lib/frameworks/sproutcore/apps/greenhouse/README +25 -0
  64. data/lib/frameworks/sproutcore/apps/greenhouse/TODO +72 -0
  65. data/lib/frameworks/sproutcore/apps/greenhouse/beautify.js +1058 -0
  66. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/design.js +20 -0
  67. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/file.js +75 -0
  68. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/files.js +40 -0
  69. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/layout.js +53 -0
  70. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +201 -0
  71. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/page.js +18 -0
  72. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/property.js +19 -0
  73. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/property_editor.js +17 -0
  74. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/target.js +20 -0
  75. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/targets.js +43 -0
  76. data/lib/frameworks/sproutcore/apps/greenhouse/controllers/view_configs.js +100 -0
  77. data/lib/frameworks/sproutcore/apps/greenhouse/core.js +67 -0
  78. data/lib/frameworks/sproutcore/apps/greenhouse/core_file.js +124 -0
  79. data/lib/frameworks/sproutcore/apps/greenhouse/data_source.js +250 -0
  80. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/app_page.js +377 -0
  81. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/app-selector.css +111 -0
  82. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/button.css +310 -0
  83. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/dock.css +85 -0
  84. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/general.css +52 -0
  85. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +120 -0
  86. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/menu.css +52 -0
  87. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/modal.css +40 -0
  88. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/picker.css +188 -0
  89. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/search.css +60 -0
  90. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/tabbed.css +68 -0
  91. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/text-field.css +67 -0
  92. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +302 -0
  93. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.eot +0 -0
  94. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.otf +0 -0
  95. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500.woff +0 -0
  96. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.eot +0 -0
  97. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.otf +0 -0
  98. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/fonts/museosans_500_italic.woff +0 -0
  99. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/app-selector/choose-app.png +0 -0
  100. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/app-selector/list-item-sel.png +0 -0
  101. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-l.png +0 -0
  102. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-m.png +0 -0
  103. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/active-r.png +0 -0
  104. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-l.png +0 -0
  105. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-m.png +0 -0
  106. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule-xl/regular-r.png +0 -0
  107. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/active-l.png +0 -0
  108. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/active-r.png +0 -0
  109. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/disabled-l.png +0 -0
  110. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/disabled-r.png +0 -0
  111. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/regular-l.png +0 -0
  112. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/regular-r.png +0 -0
  113. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-active-l.png +0 -0
  114. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-active-r.png +0 -0
  115. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-l.png +0 -0
  116. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-r.png +0 -0
  117. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-l.png +0 -0
  118. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/capsule/sel-r.png +0 -0
  119. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-l.png +0 -0
  120. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-m.png +0 -0
  121. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/active-r.png +0 -0
  122. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-active-l.png +0 -0
  123. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-active-r.png +0 -0
  124. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-l.png +0 -0
  125. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-r.png +0 -0
  126. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-l.png +0 -0
  127. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-r.png +0 -0
  128. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-l.png +0 -0
  129. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/cap-sel-r.png +0 -0
  130. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-l.png +0 -0
  131. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-m.png +0 -0
  132. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/disabled-r.png +0 -0
  133. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-l.png +0 -0
  134. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-m.png +0 -0
  135. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/regular-r.png +0 -0
  136. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-l.png +0 -0
  137. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-m.png +0 -0
  138. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-active-r.png +0 -0
  139. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-l.png +0 -0
  140. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-m.png +0 -0
  141. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-disabled-r.png +0 -0
  142. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-l.png +0 -0
  143. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-m.png +0 -0
  144. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/dark/sel-r.png +0 -0
  145. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/active-m.png +0 -0
  146. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/disabled-m.png +0 -0
  147. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/regular-m.png +0 -0
  148. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-active-m.png +0 -0
  149. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-disabled-m.png +0 -0
  150. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/shared/sel-m.png +0 -0
  151. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/active-l.png +0 -0
  152. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/active-r.png +0 -0
  153. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/disabled-l.png +0 -0
  154. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/disabled-r.png +0 -0
  155. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/regular-l.png +0 -0
  156. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/regular-r.png +0 -0
  157. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-active-l.png +0 -0
  158. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-active-r.png +0 -0
  159. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-disabled-l.png +0 -0
  160. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-disabled-r.png +0 -0
  161. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-l.png +0 -0
  162. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/buttons/square/sel-r.png +0 -0
  163. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/actions-active.png +0 -0
  164. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/actions.png +0 -0
  165. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/inspector-active.png +0 -0
  166. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/inspector.png +0 -0
  167. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/library-active.png +0 -0
  168. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/library.png +0 -0
  169. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/projects-active.png +0 -0
  170. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/projects.png +0 -0
  171. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/run-active.png +0 -0
  172. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/run.png +0 -0
  173. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/save-active.png +0 -0
  174. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/icons/save.png +0 -0
  175. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/logos/greenhouse-l.png +0 -0
  176. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/logos/greenhouse-s.png +0 -0
  177. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/logos/sproutcore.png +0 -0
  178. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/main-bg.png +0 -0
  179. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom-left.png +0 -0
  180. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom-right.png +0 -0
  181. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/bottom.png +0 -0
  182. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/close-active.png +0 -0
  183. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/close.png +0 -0
  184. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/left.png +0 -0
  185. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-bottom.png +0 -0
  186. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-left.png +0 -0
  187. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-right.png +0 -0
  188. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/pointer-top.png +0 -0
  189. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/right.png +0 -0
  190. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/search-active.png +0 -0
  191. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/search.png +0 -0
  192. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/top-left.png +0 -0
  193. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/top-right.png +0 -0
  194. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/picker/top.png +0 -0
  195. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/toolbar-bg.png +0 -0
  196. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/inspectors.js +365 -0
  197. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/loading.rhtml +9 -0
  198. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/main_page.js +95 -0
  199. data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/strings.js +87 -0
  200. data/lib/frameworks/sproutcore/apps/greenhouse/fixtures/file.js +35 -0
  201. data/lib/frameworks/sproutcore/apps/greenhouse/main.js +28 -0
  202. data/lib/frameworks/sproutcore/apps/greenhouse/mixins/drop_down.js +97 -0
  203. data/lib/frameworks/sproutcore/apps/greenhouse/models/design.js +22 -0
  204. data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +92 -0
  205. data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +51 -0
  206. data/lib/frameworks/sproutcore/apps/greenhouse/models/target.js +82 -0
  207. data/lib/frameworks/sproutcore/apps/greenhouse/models/view_config.js +49 -0
  208. data/lib/frameworks/sproutcore/apps/greenhouse/resources/test_page.js +37 -0
  209. data/lib/frameworks/sproutcore/apps/greenhouse/states/inspector.js +144 -0
  210. data/lib/frameworks/sproutcore/apps/greenhouse/states/library.js +133 -0
  211. data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +224 -0
  212. data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +291 -0
  213. data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +197 -0
  214. data/lib/frameworks/sproutcore/apps/greenhouse/tests/controllers/design.js +15 -0
  215. data/lib/frameworks/sproutcore/apps/greenhouse/tests/controllers/designs.js +15 -0
  216. data/lib/frameworks/sproutcore/apps/greenhouse/tests/controllers/file.js +15 -0
  217. data/lib/frameworks/sproutcore/apps/greenhouse/tests/controllers/files.js +15 -0
  218. data/lib/frameworks/sproutcore/apps/greenhouse/tests/models/file.js +15 -0
  219. data/lib/frameworks/sproutcore/apps/greenhouse/tests/models/view_config.js +15 -0
  220. data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +15 -0
  221. data/lib/frameworks/sproutcore/apps/greenhouse/views/anchor.js +277 -0
  222. data/lib/frameworks/sproutcore/apps/greenhouse/views/application_list_item.js +19 -0
  223. data/lib/frameworks/sproutcore/apps/greenhouse/views/event_blocker.js +32 -0
  224. data/lib/frameworks/sproutcore/apps/greenhouse/views/label_designer.js +16 -0
  225. data/lib/frameworks/sproutcore/apps/greenhouse/views/list_item.js +42 -0
  226. data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +39 -0
  227. data/lib/frameworks/sproutcore/apps/greenhouse/views/simple_button.js +157 -0
  228. data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +56 -0
  229. data/lib/frameworks/sproutcore/apps/greenhouse/views/web.js +44 -0
  230. data/lib/frameworks/sproutcore/apps/tests/controllers/detail.js +25 -0
  231. data/lib/frameworks/sproutcore/apps/tests/controllers/source.js +29 -0
  232. data/lib/frameworks/sproutcore/apps/tests/controllers/target.js +26 -0
  233. data/lib/frameworks/sproutcore/apps/tests/controllers/targets.js +86 -0
  234. data/lib/frameworks/sproutcore/apps/tests/controllers/tests.js +33 -0
  235. data/lib/frameworks/sproutcore/apps/tests/core.js +133 -0
  236. data/lib/frameworks/sproutcore/apps/tests/english.lproj/loading.rhtml +9 -0
  237. data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +48 -0
  238. data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +233 -0
  239. data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +26 -0
  240. data/lib/frameworks/sproutcore/apps/tests/main.js +27 -0
  241. data/lib/frameworks/sproutcore/apps/tests/states/no_targets.js +26 -0
  242. data/lib/frameworks/sproutcore/apps/tests/states/ready.js +56 -0
  243. data/lib/frameworks/sproutcore/apps/tests/states/ready_detail.js +41 -0
  244. data/lib/frameworks/sproutcore/apps/tests/states/ready_empty.js +48 -0
  245. data/lib/frameworks/sproutcore/apps/tests/states/ready_list.js +41 -0
  246. data/lib/frameworks/sproutcore/apps/tests/states/ready_loading.js +44 -0
  247. data/lib/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +31 -0
  248. data/lib/frameworks/sproutcore/apps/tests/states/start.js +39 -0
  249. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/detail.js +15 -0
  250. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/source.js +15 -0
  251. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/target.js +15 -0
  252. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/targets.js +15 -0
  253. data/lib/frameworks/sproutcore/apps/tests/tests/controllers/tests.js +15 -0
  254. data/lib/frameworks/sproutcore/apps/tests/tests/models/target.js +15 -0
  255. data/lib/frameworks/sproutcore/apps/tests/tests/models/test.js +15 -0
  256. data/lib/frameworks/sproutcore/apps/tests/tests/views/offset_checkbox.js +15 -0
  257. data/lib/frameworks/sproutcore/apps/tests/views/offset_checkbox.js +26 -0
  258. data/lib/frameworks/sproutcore/apps/welcome/controllers/targets.js +49 -0
  259. data/lib/frameworks/sproutcore/apps/welcome/core.js +30 -0
  260. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/loading.rhtml +10 -0
  261. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +7 -0
  262. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +77 -0
  263. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/strings.js +15 -0
  264. data/lib/frameworks/sproutcore/apps/welcome/main.js +19 -0
  265. data/lib/frameworks/sproutcore/apps/welcome/tests/controllers/targets.js +15 -0
  266. data/lib/frameworks/sproutcore/design/CollectionView State Charts.graffle +4848 -0
  267. data/lib/frameworks/sproutcore/design/Design Charts.graffle +16845 -0
  268. data/lib/frameworks/sproutcore/design/Record State Table.numbers +0 -0
  269. data/lib/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Preview.pdf +0 -0
  270. data/lib/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/QuickLook/Thumbnail.tiff +0 -0
  271. data/lib/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/data.plist +19588 -0
  272. data/lib/frameworks/sproutcore/design/SproutCore Datastore Design.graffle/image8.png +0 -0
  273. data/lib/frameworks/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Preview.pdf +0 -0
  274. data/lib/frameworks/sproutcore/design/SproutCore Design Template.graffle/QuickLook/Thumbnail.tiff +0 -0
  275. data/lib/frameworks/sproutcore/design/SproutCore Design Template.graffle/data.plist +1452 -0
  276. data/lib/frameworks/sproutcore/design/SproutCore Design Template.graffle/image8.png +0 -0
  277. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/QuickLook/Preview.pdf +0 -0
  278. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/QuickLook/Thumbnail.tiff +0 -0
  279. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/data.plist +24187 -0
  280. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image10.png +0 -0
  281. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image11.png +0 -0
  282. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image13.png +0 -0
  283. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image15.png +0 -0
  284. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image16.png +0 -0
  285. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image17.png +0 -0
  286. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image18.png +0 -0
  287. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image19.png +0 -0
  288. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image22.tiff +0 -0
  289. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image23.png +0 -0
  290. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image24.png +0 -0
  291. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image25.png +0 -0
  292. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image30.png +0 -0
  293. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image31.png +0 -0
  294. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image8.png +0 -0
  295. data/lib/frameworks/sproutcore/design/TestRunner Design.graffle/image9.png +0 -0
  296. data/lib/frameworks/sproutcore/design/greenhouse-statechart.graffle +9025 -0
  297. data/lib/frameworks/sproutcore/design/greenhouse-statechart.pdf +0 -0
  298. data/lib/frameworks/sproutcore/design/iphone-webapp-loading.psd +0 -0
  299. data/lib/frameworks/sproutcore/frameworks/animation/Buildfile +3 -0
  300. data/lib/frameworks/sproutcore/frameworks/animation/LICENSE +25 -0
  301. data/lib/frameworks/sproutcore/frameworks/animation/README.md +79 -0
  302. data/lib/frameworks/sproutcore/frameworks/animation/core.js +1192 -0
  303. data/lib/frameworks/sproutcore/frameworks/animation/tests/core.js +147 -0
  304. data/lib/frameworks/sproutcore/frameworks/bootstrap/README +9 -0
  305. data/lib/frameworks/sproutcore/frameworks/bootstrap/core.js +7 -0
  306. data/lib/frameworks/sproutcore/frameworks/bootstrap/setup_body_class_names.js +10 -0
  307. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +29 -0
  308. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/loader.js +49 -0
  309. data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +20 -0
  310. data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +99 -0
  311. data/lib/frameworks/sproutcore/frameworks/core_tools/english.lproj/strings.js +15 -0
  312. data/lib/frameworks/sproutcore/frameworks/core_tools/fixtures/target.js +87 -0
  313. data/lib/frameworks/sproutcore/frameworks/core_tools/fixtures/test.js +44 -0
  314. data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +108 -0
  315. data/lib/frameworks/sproutcore/frameworks/core_tools/models/test.js +48 -0
  316. data/lib/frameworks/sproutcore/frameworks/datastore/core.js +8 -0
  317. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +180 -0
  318. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +340 -0
  319. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +393 -0
  320. data/lib/frameworks/sproutcore/frameworks/datastore/debug/json.js +71 -0
  321. data/lib/frameworks/sproutcore/frameworks/datastore/debug/standard_setup.js +96 -0
  322. data/lib/frameworks/sproutcore/frameworks/datastore/fixtures/author_fixtures.js +2503 -0
  323. data/lib/frameworks/sproutcore/frameworks/datastore/fixtures/sample.js +17 -0
  324. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +122 -0
  325. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +105 -0
  326. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +81 -0
  327. data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +100 -0
  328. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +153 -0
  329. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +1201 -0
  330. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +494 -0
  331. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +159 -0
  332. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +242 -0
  333. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +415 -0
  334. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +588 -0
  335. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +1600 -0
  336. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +651 -0
  337. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +2666 -0
  338. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +117 -0
  339. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/contact_model.js +131 -0
  340. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +119 -0
  341. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/mail_model.js +91 -0
  342. data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/test_runner_model.js +56 -0
  343. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/datetime_recordattribute.js +73 -0
  344. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/many_attribute.js +423 -0
  345. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +235 -0
  346. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +337 -0
  347. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +421 -0
  348. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +304 -0
  349. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/parentless.js +134 -0
  350. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +55 -0
  351. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/destroy.js +92 -0
  352. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/error_methods.js +56 -0
  353. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +273 -0
  354. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/readAttribute.js +53 -0
  355. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/refresh.js +48 -0
  356. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/storeDidChangeProperties.js +170 -0
  357. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/unknownProperty.js +66 -0
  358. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/writeAttribute.js +112 -0
  359. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +252 -0
  360. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +284 -0
  361. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/many_array/core_methods.js +204 -0
  362. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/chain.js +180 -0
  363. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChanges.js +171 -0
  364. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +154 -0
  365. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/core_methods.js +70 -0
  366. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/dataHashDidChange.js +113 -0
  367. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/discardChanges.js +99 -0
  368. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readDataHash.js +180 -0
  369. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/readEditableDataHash.js +126 -0
  370. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/removeDataHash.js +163 -0
  371. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/writeDataHash.js +166 -0
  372. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +219 -0
  373. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/compare.js +144 -0
  374. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/contains.js +131 -0
  375. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/containsRecordTypes.js +81 -0
  376. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/copy.js +30 -0
  377. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation.js +197 -0
  378. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/evaluation_of_records.js +92 -0
  379. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/expandedRecordTypes.js +64 -0
  380. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/parse.js +216 -0
  381. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/queryWithScope.js +57 -0
  382. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/record_type_is.js +43 -0
  383. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_comparisons.js +66 -0
  384. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/registered_query_extensions.js +67 -0
  385. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +177 -0
  386. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/error_methods.js +50 -0
  387. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +177 -0
  388. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/cancelRecord.js +54 -0
  389. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +133 -0
  390. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitRecord.js +211 -0
  391. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/core_methods.js +156 -0
  392. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +72 -0
  393. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataHashDidChange.js +157 -0
  394. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/dataSourceCallbacks.js +278 -0
  395. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +106 -0
  396. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/error_methods.js +62 -0
  397. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/find.js +530 -0
  398. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/init.js +23 -0
  399. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +61 -0
  400. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/readDataHash.js +74 -0
  401. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/readEditableDataHash.js +74 -0
  402. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/recordDidChange.js +73 -0
  403. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/removeDataHash.js +144 -0
  404. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/retrieveRecord.js +184 -0
  405. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/writeDataHash.js +125 -0
  406. data/lib/frameworks/sproutcore/frameworks/datejs/core.js +865 -0
  407. data/lib/frameworks/sproutcore/frameworks/datejs/english.lproj/en-US.js +186 -0
  408. data/lib/frameworks/sproutcore/frameworks/datejs/extras.js +332 -0
  409. data/lib/frameworks/sproutcore/frameworks/datejs/license.js +25 -0
  410. data/lib/frameworks/sproutcore/frameworks/datejs/parser.js +1116 -0
  411. data/lib/frameworks/sproutcore/frameworks/datejs/spanish.lproj/es-CO.js +186 -0
  412. data/lib/frameworks/sproutcore/frameworks/datejs/sugarpak.js +475 -0
  413. data/lib/frameworks/sproutcore/frameworks/datejs/time.js +269 -0
  414. data/lib/frameworks/sproutcore/frameworks/datejs/validators/datejs.js +34 -0
  415. data/lib/frameworks/sproutcore/frameworks/debug/core.js +114 -0
  416. data/lib/frameworks/sproutcore/frameworks/debug/invoke_once_last_debugging.js +265 -0
  417. data/lib/frameworks/sproutcore/frameworks/designer/coders/design.js +20 -0
  418. data/lib/frameworks/sproutcore/frameworks/designer/coders/localization.js +19 -0
  419. data/lib/frameworks/sproutcore/frameworks/designer/coders/object.js +347 -0
  420. data/lib/frameworks/sproutcore/frameworks/designer/controllers/controllers.js +16 -0
  421. data/lib/frameworks/sproutcore/frameworks/designer/controllers/design.js +37 -0
  422. data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +134 -0
  423. data/lib/frameworks/sproutcore/frameworks/designer/controllers/page_design.js +170 -0
  424. data/lib/frameworks/sproutcore/frameworks/designer/controllers/page_files.js +22 -0
  425. data/lib/frameworks/sproutcore/frameworks/designer/core.js +26 -0
  426. data/lib/frameworks/sproutcore/frameworks/designer/css/css_rule.js +22 -0
  427. data/lib/frameworks/sproutcore/frameworks/designer/css/css_style.js +29 -0
  428. data/lib/frameworks/sproutcore/frameworks/designer/css/css_style_sheet.js +201 -0
  429. data/lib/frameworks/sproutcore/frameworks/designer/designers/button.js +21 -0
  430. data/lib/frameworks/sproutcore/frameworks/designer/designers/label.js +16 -0
  431. data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +296 -0
  432. data/lib/frameworks/sproutcore/frameworks/designer/designers/tab.js +18 -0
  433. data/lib/frameworks/sproutcore/frameworks/designer/designers/text_field.js +15 -0
  434. data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +1259 -0
  435. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/css/designer.css +96 -0
  436. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/design_page.js +55 -0
  437. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/high_light.css +10 -0
  438. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/controller.png +0 -0
  439. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/dock-bg.png +0 -0
  440. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/dock-item-bg.png +0 -0
  441. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/dock-item-divider.png +0 -0
  442. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/dock-item-sel-bg.png +0 -0
  443. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/dock-item-sel-divider.png +0 -0
  444. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/main-bg.png +0 -0
  445. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/page.png +0 -0
  446. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/pane.png +0 -0
  447. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/images/view.png +0 -0
  448. data/lib/frameworks/sproutcore/frameworks/designer/english.lproj/selection_handles.css +58 -0
  449. data/lib/frameworks/sproutcore/frameworks/designer/ext/object.js +26 -0
  450. data/lib/frameworks/sproutcore/frameworks/designer/ext/page.js +86 -0
  451. data/lib/frameworks/sproutcore/frameworks/designer/ext/view.js +54 -0
  452. data/lib/frameworks/sproutcore/frameworks/designer/mixins/button.js +11 -0
  453. data/lib/frameworks/sproutcore/frameworks/designer/mixins/snap_lines.js +221 -0
  454. data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +138 -0
  455. data/lib/frameworks/sproutcore/frameworks/designer/views/drawing.js +219 -0
  456. data/lib/frameworks/sproutcore/frameworks/designer/views/high_light.js +66 -0
  457. data/lib/frameworks/sproutcore/frameworks/designer/views/page_item_view.js +130 -0
  458. data/lib/frameworks/sproutcore/frameworks/designer/views/selection_handles.js +78 -0
  459. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -0
  460. data/lib/frameworks/sproutcore/frameworks/desktop/debug/drag.js +41 -0
  461. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +56 -0
  462. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/a_sample_image.jpg +0 -0
  463. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/apple-logo1.jpeg +0 -0
  464. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/debug/iframe.html +23 -0
  465. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +74 -0
  466. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/drag.css +7 -0
  467. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +943 -0
  468. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/cap.png +0 -0
  469. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/downbutton.png +0 -0
  470. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  471. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/thumb-bottom.png +0 -0
  472. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/thumb-center.png +0 -0
  473. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/thumb-top.png +0 -0
  474. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/track.png +0 -0
  475. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/upbutton.png +0 -0
  476. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +161 -0
  477. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +12 -0
  478. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +109 -0
  479. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/modal.css +9 -0
  480. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +91 -0
  481. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +35 -0
  482. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +33 -0
  483. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +10 -0
  484. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +134 -0
  485. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +19 -0
  486. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +66 -0
  487. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/split.css +0 -0
  488. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/split_divider.css +6 -0
  489. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +14 -0
  490. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/tab.css +7 -0
  491. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/toolbar.css +5 -0
  492. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/touch-scroller.css +196 -0
  493. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/video.css +3 -0
  494. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +71 -0
  495. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +138 -0
  496. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +694 -0
  497. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +22 -0
  498. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +61 -0
  499. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +295 -0
  500. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +253 -0
  501. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +410 -0
  502. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +1115 -0
  503. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +71 -0
  504. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +74 -0
  505. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +180 -0
  506. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +696 -0
  507. data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +849 -0
  508. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +214 -0
  509. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +39 -0
  510. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +81 -0
  511. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +175 -0
  512. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/responder.js +299 -0
  513. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +923 -0
  514. data/lib/frameworks/sproutcore/frameworks/desktop/system/key_bindings.js +40 -0
  515. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +187 -0
  516. data/lib/frameworks/sproutcore/frameworks/desktop/tests/integration/dialog.js +43 -0
  517. data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +96 -0
  518. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/methods.js +10 -0
  519. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +152 -0
  520. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +135 -0
  521. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +223 -0
  522. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/methods.js +10 -0
  523. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +35 -0
  524. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/pane_page.js +41 -0
  525. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +10 -0
  526. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +40 -0
  527. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +10 -0
  528. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +86 -0
  529. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +194 -0
  530. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +212 -0
  531. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/methods.js +10 -0
  532. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +44 -0
  533. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/methods.js +124 -0
  534. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +163 -0
  535. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +142 -0
  536. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +95 -0
  537. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +249 -0
  538. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deleteSelection.js +82 -0
  539. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/deselect.js +215 -0
  540. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/displayProperties.js +31 -0
  541. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +300 -0
  542. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/layerIdFor.js +65 -0
  543. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/length.js +88 -0
  544. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +240 -0
  545. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/nowShowing.js +121 -0
  546. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +177 -0
  547. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/select.js +240 -0
  548. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectNextItem.js +205 -0
  549. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selectPreviousItem.js +211 -0
  550. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selection.js +141 -0
  551. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +182 -0
  552. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +76 -0
  553. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +456 -0
  554. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/methods.js +10 -0
  555. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +64 -0
  556. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +10 -0
  557. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/ui.js +10 -0
  558. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/render.js +92 -0
  559. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowDelegate.js +183 -0
  560. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +133 -0
  561. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowOffsetForContentIndex.js +131 -0
  562. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_alternatingrows.js +130 -0
  563. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +56 -0
  564. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +205 -0
  565. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +127 -0
  566. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +288 -0
  567. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/methods.js +10 -0
  568. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/menu_item/ui.js +46 -0
  569. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/methods.js +128 -0
  570. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/progress/ui.js +287 -0
  571. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/methods.js +119 -0
  572. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/radio/ui.js +232 -0
  573. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/methods.js +143 -0
  574. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +150 -0
  575. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroller.js +90 -0
  576. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +119 -0
  577. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +226 -0
  578. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/methods.js +144 -0
  579. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +216 -0
  580. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/methods.js +132 -0
  581. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +110 -0
  582. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +37 -0
  583. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/methods.js +10 -0
  584. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/source_list/ui.js +10 -0
  585. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +60 -0
  586. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +52 -0
  587. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +231 -0
  588. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +46 -0
  589. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +54 -0
  590. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +88 -0
  591. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/web/methods.js +10 -0
  592. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +110 -0
  593. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/well/ui.js +54 -0
  594. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +619 -0
  595. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +112 -0
  596. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +3073 -0
  597. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +319 -0
  598. data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +77 -0
  599. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +207 -0
  600. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +631 -0
  601. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +836 -0
  602. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +681 -0
  603. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +588 -0
  604. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +298 -0
  605. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +250 -0
  606. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +376 -0
  607. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +204 -0
  608. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1790 -0
  609. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +884 -0
  610. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +678 -0
  611. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +673 -0
  612. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +324 -0
  613. data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +36 -0
  614. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +286 -0
  615. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +47 -0
  616. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +169 -0
  617. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +781 -0
  618. data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +57 -0
  619. data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +110 -0
  620. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +134 -0
  621. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +184 -0
  622. data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +53 -0
  623. data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +49 -0
  624. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +87 -0
  625. data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +85 -0
  626. data/lib/frameworks/sproutcore/frameworks/foundation/TESTING +46 -0
  627. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/array.js +518 -0
  628. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/controller.js +44 -0
  629. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/object.js +342 -0
  630. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +124 -0
  631. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +150 -0
  632. data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +193 -0
  633. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/blank.gif +0 -0
  634. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/bootstrap.rhtml +79 -0
  635. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +40 -0
  636. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/core.css +474 -0
  637. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/debug/control-test-pane.css +9 -0
  638. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-logo.png +0 -0
  639. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-landscape.jpg +0 -0
  640. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-landscape.png +0 -0
  641. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-portrait.jpg +0 -0
  642. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup-portrait.png +0 -0
  643. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/sproutcore-startup.png +0 -0
  644. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/inline_editor.css +12 -0
  645. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +42 -0
  646. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/static_layout.css +5 -0
  647. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/strings.js +15 -0
  648. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +148 -0
  649. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/view.css +57 -0
  650. data/lib/frameworks/sproutcore/frameworks/foundation/ext/object.js +83 -0
  651. data/lib/frameworks/sproutcore/frameworks/foundation/ext/run_loop.js +162 -0
  652. data/lib/frameworks/sproutcore/frameworks/foundation/fixtures/file_exists.json +1 -0
  653. data/lib/frameworks/sproutcore/frameworks/foundation/fixtures/malformed.json +11 -0
  654. data/lib/frameworks/sproutcore/frameworks/foundation/license.js +30 -0
  655. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +360 -0
  656. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +179 -0
  657. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +96 -0
  658. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +377 -0
  659. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/editable.js +152 -0
  660. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +580 -0
  661. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/responder_context.js +269 -0
  662. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/selection_support.js +250 -0
  663. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +77 -0
  664. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/string.js +543 -0
  665. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/tree_item_content.js +160 -0
  666. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/validatable.js +189 -0
  667. data/lib/frameworks/sproutcore/frameworks/foundation/panes/main.js +51 -0
  668. data/lib/frameworks/sproutcore/frameworks/foundation/panes/pane.js +848 -0
  669. data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +907 -0
  670. data/lib/frameworks/sproutcore/frameworks/foundation/protocols/inline_editor_delegate.js +84 -0
  671. data/lib/frameworks/sproutcore/frameworks/foundation/system/application.js +37 -0
  672. data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +514 -0
  673. data/lib/frameworks/sproutcore/frameworks/foundation/system/browser.js +59 -0
  674. data/lib/frameworks/sproutcore/frameworks/foundation/system/builder.js +210 -0
  675. data/lib/frameworks/sproutcore/frameworks/foundation/system/bundle.js +337 -0
  676. data/lib/frameworks/sproutcore/frameworks/foundation/system/core_query.js +2049 -0
  677. data/lib/frameworks/sproutcore/frameworks/foundation/system/cursor.js +131 -0
  678. data/lib/frameworks/sproutcore/frameworks/foundation/system/datetime.js +1129 -0
  679. data/lib/frameworks/sproutcore/frameworks/foundation/system/device.js +143 -0
  680. data/lib/frameworks/sproutcore/frameworks/foundation/system/event.js +894 -0
  681. data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +85 -0
  682. data/lib/frameworks/sproutcore/frameworks/foundation/system/image_cache.js +432 -0
  683. data/lib/frameworks/sproutcore/frameworks/foundation/system/json.js +515 -0
  684. data/lib/frameworks/sproutcore/frameworks/foundation/system/locale.js +293 -0
  685. data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +57 -0
  686. data/lib/frameworks/sproutcore/frameworks/foundation/system/page.js +108 -0
  687. data/lib/frameworks/sproutcore/frameworks/foundation/system/platform.js +297 -0
  688. data/lib/frameworks/sproutcore/frameworks/foundation/system/ready.js +197 -0
  689. data/lib/frameworks/sproutcore/frameworks/foundation/system/render_context.js +988 -0
  690. data/lib/frameworks/sproutcore/frameworks/foundation/system/request.js +599 -0
  691. data/lib/frameworks/sproutcore/frameworks/foundation/system/responder.js +124 -0
  692. data/lib/frameworks/sproutcore/frameworks/foundation/system/response.js +538 -0
  693. data/lib/frameworks/sproutcore/frameworks/foundation/system/root_responder.js +2060 -0
  694. data/lib/frameworks/sproutcore/frameworks/foundation/system/routes.js +420 -0
  695. data/lib/frameworks/sproutcore/frameworks/foundation/system/task_queue.js +150 -0
  696. data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +103 -0
  697. data/lib/frameworks/sproutcore/frameworks/foundation/system/time.js +473 -0
  698. data/lib/frameworks/sproutcore/frameworks/foundation/system/timer.js +551 -0
  699. data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +397 -0
  700. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils.js +710 -0
  701. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +41 -0
  702. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/task.js +17 -0
  703. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/array_case.js +218 -0
  704. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/enum_case.js +206 -0
  705. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/null_case.js +64 -0
  706. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/selection_support.js +318 -0
  707. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/array/single_case.js +136 -0
  708. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/empty_case.js +82 -0
  709. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/multiple_case.js +111 -0
  710. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_case.js +193 -0
  711. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/object/single_enumerable_case.js +265 -0
  712. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/outline_case.js +108 -0
  713. data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/selection_support.js +340 -0
  714. data/lib/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/methods.js +10 -0
  715. data/lib/frameworks/sproutcore/frameworks/foundation/tests/debug/control_test_pane/ui.js +113 -0
  716. data/lib/frameworks/sproutcore/frameworks/foundation/tests/integration/creating_views.js +113 -0
  717. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/content.js +195 -0
  718. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/displayProperties.js +89 -0
  719. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/keyEquivalents.js +57 -0
  720. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/button/ui.js +68 -0
  721. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/content.js +168 -0
  722. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +89 -0
  723. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/api.js +52 -0
  724. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +227 -0
  725. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/responder_context.js +75 -0
  726. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +142 -0
  727. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/string.js +83 -0
  728. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/validatable/ui.js +74 -0
  729. data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/flat_case.js +325 -0
  730. data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/group_case.js +718 -0
  731. data/lib/frameworks/sproutcore/frameworks/foundation/tests/private/tree_item_observer/outline_case.js +484 -0
  732. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/builder.js +42 -0
  733. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_core.js +1334 -0
  734. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_dimensions.js +387 -0
  735. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/jquery_selector.js +405 -0
  736. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/setClass.js +49 -0
  737. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/core_query/within.js +66 -0
  738. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/datetime.js +348 -0
  739. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/json.js +14 -0
  740. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/locale.js +134 -0
  741. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/math.js +39 -0
  742. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/begin.js +47 -0
  743. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/element.js +44 -0
  744. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/end.js +124 -0
  745. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/get.js +51 -0
  746. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_attr.js +50 -0
  747. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_basic.js +28 -0
  748. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_className.js +179 -0
  749. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/helpers_style.js +101 -0
  750. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/init.js +55 -0
  751. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/join.js +28 -0
  752. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/push_text.js +74 -0
  753. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/tag.js +46 -0
  754. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/render_context/update.js +218 -0
  755. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/request.js +223 -0
  756. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeKeyPane.js +124 -0
  757. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMainPane.js +68 -0
  758. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/makeMenuPane.js +48 -0
  759. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/root_responder.js +101 -0
  760. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/root_responder/targetForAction.js +238 -0
  761. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/routes.js +352 -0
  762. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/task_queue.js +43 -0
  763. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invalidate.js +38 -0
  764. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/invokeLater.js +201 -0
  765. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/isPaused.js +71 -0
  766. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/performAction.js +69 -0
  767. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/timer/schedule.js +170 -0
  768. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/user_defaults.js +24 -0
  769. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/normalizeURL.js +18 -0
  770. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/range.js +62 -0
  771. data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/rect.js +99 -0
  772. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/credit_card.js +35 -0
  773. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/date.js +26 -0
  774. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/number.js +47 -0
  775. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/password.js +13 -0
  776. data/lib/frameworks/sproutcore/frameworks/foundation/tests/validators/validator.js +20 -0
  777. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +10 -0
  778. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +115 -0
  779. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +59 -0
  780. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +148 -0
  781. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/main_pane.js +31 -0
  782. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/pane/append_remove.js +124 -0
  783. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/pane/firstResponder.js +148 -0
  784. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/pane/keyPane.js +133 -0
  785. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/pane/layout.js +31 -0
  786. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/pane/sendEvent.js +206 -0
  787. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +87 -0
  788. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +530 -0
  789. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/clippingFrame.js +133 -0
  790. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertFrames.js +246 -0
  791. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/convertLayouts.js +145 -0
  792. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/createChildViews.js +122 -0
  793. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/createLayer.js +97 -0
  794. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/destroyLayer.js +83 -0
  795. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/didAppendToDocument.js +48 -0
  796. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/findLayerInParentLayer.js +50 -0
  797. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/init.js +50 -0
  798. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/insertBefore.js +200 -0
  799. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisible.js +51 -0
  800. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/isVisibleInWindow.js +116 -0
  801. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/layer.js +150 -0
  802. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutChildViews.js +162 -0
  803. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutDidChange.js +127 -0
  804. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/layoutStyle.js +531 -0
  805. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/nextValidKeyView.js +110 -0
  806. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/parentViewDidChange.js +67 -0
  807. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/prepareContext.js +180 -0
  808. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/removeChild.js +189 -0
  809. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/render.js +83 -0
  810. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/replaceChild.js +29 -0
  811. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayer.js +146 -0
  812. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/updateLayerLocation.js +194 -0
  813. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/view/viewDidResize.js +202 -0
  814. data/lib/frameworks/sproutcore/frameworks/foundation/validators/credit_card.js +125 -0
  815. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +52 -0
  816. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +48 -0
  817. data/lib/frameworks/sproutcore/frameworks/foundation/validators/email.js +45 -0
  818. data/lib/frameworks/sproutcore/frameworks/foundation/validators/not_empty.js +33 -0
  819. data/lib/frameworks/sproutcore/frameworks/foundation/validators/number.js +98 -0
  820. data/lib/frameworks/sproutcore/frameworks/foundation/validators/password.js +86 -0
  821. data/lib/frameworks/sproutcore/frameworks/foundation/validators/positive_integer.js +84 -0
  822. data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +326 -0
  823. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +139 -0
  824. data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +320 -0
  825. data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +180 -0
  826. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +339 -0
  827. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +946 -0
  828. data/lib/frameworks/sproutcore/frameworks/foundation/views/view.js +3313 -0
  829. data/lib/frameworks/sproutcore/frameworks/media/resources/controls.png +0 -0
  830. data/lib/frameworks/sproutcore/frameworks/media/resources/playeras3.fla +0 -0
  831. data/lib/frameworks/sproutcore/frameworks/media/resources/video.css +120 -0
  832. data/lib/frameworks/sproutcore/frameworks/media/resources/videoCanvas.swf +0 -0
  833. data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +739 -0
  834. data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +90 -0
  835. data/lib/frameworks/sproutcore/frameworks/media/views/media_slider.js +243 -0
  836. data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +63 -0
  837. data/lib/frameworks/sproutcore/frameworks/media/views/simple_controls.js +55 -0
  838. data/lib/frameworks/sproutcore/frameworks/media/views/video.js +832 -0
  839. data/lib/frameworks/sproutcore/frameworks/mini/license.js +28 -0
  840. data/lib/frameworks/sproutcore/frameworks/runtime/README +12 -0
  841. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1061 -0
  842. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +238 -0
  843. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/indexOf.js +33 -0
  844. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/insertAt.js +121 -0
  845. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/objectAt.js +34 -0
  846. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/popObject.js +50 -0
  847. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/pushObject.js +46 -0
  848. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/rangeObserver.js +371 -0
  849. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeAt.js +100 -0
  850. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/removeObject.js +49 -0
  851. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/replace.js +94 -0
  852. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/shiftObject.js +50 -0
  853. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/unshiftObject.js +47 -0
  854. data/lib/frameworks/sproutcore/frameworks/runtime/license.js +28 -0
  855. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +643 -0
  856. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js +45 -0
  857. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +64 -0
  858. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/delegate_support.js +110 -0
  859. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +1298 -0
  860. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +110 -0
  861. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1347 -0
  862. data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +141 -0
  863. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +173 -0
  864. data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +180 -0
  865. data/lib/frameworks/sproutcore/frameworks/runtime/protocols/observable_protocol.js +40 -0
  866. data/lib/frameworks/sproutcore/frameworks/runtime/protocols/sparse_array_delegate.js +131 -0
  867. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +1000 -0
  868. data/lib/frameworks/sproutcore/frameworks/runtime/system/cookie.js +160 -0
  869. data/lib/frameworks/sproutcore/frameworks/runtime/system/enumerator.js +107 -0
  870. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +157 -0
  871. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +1199 -0
  872. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +452 -0
  873. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +888 -0
  874. data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +271 -0
  875. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +295 -0
  876. data/lib/frameworks/sproutcore/frameworks/runtime/system/selection_set.js +697 -0
  877. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +532 -0
  878. data/lib/frameworks/sproutcore/frameworks/runtime/system/sparse_array.js +379 -0
  879. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/IsEqual.js +60 -0
  880. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/beget.js +23 -0
  881. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/clone.js +84 -0
  882. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/compare.js +44 -0
  883. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/console.js +16 -0
  884. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +182 -0
  885. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/inspect.js +27 -0
  886. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/isArray.js +25 -0
  887. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +39 -0
  888. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/keys.js +20 -0
  889. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +30 -0
  890. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +19 -0
  891. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +37 -0
  892. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +57 -0
  893. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/comparable.js +44 -0
  894. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable.js +622 -0
  895. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +667 -0
  896. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +155 -0
  897. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +79 -0
  898. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +81 -0
  899. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +55 -0
  900. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +395 -0
  901. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/cookie.js +163 -0
  902. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/error.js +53 -0
  903. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +212 -0
  904. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/addEach.js +49 -0
  905. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/clone.js +43 -0
  906. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/contains.js +74 -0
  907. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/create.js +42 -0
  908. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexAfter.js +38 -0
  909. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/indexBefore.js +38 -0
  910. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/intersects.js +74 -0
  911. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/max.js +40 -0
  912. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/min.js +50 -0
  913. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/rangeStartForIndex.js +36 -0
  914. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/remove.js +189 -0
  915. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/removeEach.js +49 -0
  916. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/without.js +89 -0
  917. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +177 -0
  918. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/base.js +195 -0
  919. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +360 -0
  920. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +59 -0
  921. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/destroy.js +75 -0
  922. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/objectPropertyDidChange.js +117 -0
  923. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/rangeDidChange.js +110 -0
  924. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/update.js +65 -0
  925. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +120 -0
  926. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/add.js +92 -0
  927. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/copy.js +17 -0
  928. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/indexSetForSource.js +98 -0
  929. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/isEqual.js +60 -0
  930. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/selection_set/remove.js +111 -0
  931. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +292 -0
  932. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/sparse_array.js +194 -0
  933. data/lib/frameworks/sproutcore/frameworks/statechart/core.js +11 -0
  934. data/lib/frameworks/sproutcore/frameworks/statechart/mixins/statechart.js +336 -0
  935. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +176 -0
  936. data/lib/frameworks/sproutcore/frameworks/statechart/tests/basic.js +90 -0
  937. data/lib/frameworks/sproutcore/frameworks/statechart/tests/history.js +71 -0
  938. data/lib/frameworks/sproutcore/frameworks/statechart/tests/nested.js +59 -0
  939. data/lib/frameworks/sproutcore/frameworks/statechart/tests/transient.js +148 -0
  940. data/lib/frameworks/sproutcore/frameworks/table/mixins/table_delegate.js +41 -0
  941. data/lib/frameworks/sproutcore/frameworks/table/system/table_column.js +125 -0
  942. data/lib/frameworks/sproutcore/frameworks/table/views/table.js +439 -0
  943. data/lib/frameworks/sproutcore/frameworks/table/views/table_cell.js +62 -0
  944. data/lib/frameworks/sproutcore/frameworks/table/views/table_head.js +158 -0
  945. data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +212 -0
  946. data/lib/frameworks/sproutcore/frameworks/table/views/table_row.js +155 -0
  947. data/lib/frameworks/sproutcore/frameworks/testing/core.js +196 -0
  948. data/lib/frameworks/sproutcore/frameworks/testing/english.lproj/additions.css +8 -0
  949. data/lib/frameworks/sproutcore/frameworks/testing/english.lproj/runner.css +128 -0
  950. data/lib/frameworks/sproutcore/frameworks/testing/english.lproj/testsuite.css +136 -0
  951. data/lib/frameworks/sproutcore/frameworks/testing/extras.js +17 -0
  952. data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +3559 -0
  953. data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +827 -0
  954. data/lib/frameworks/sproutcore/frameworks/testing/system/dump.js +205 -0
  955. data/lib/frameworks/sproutcore/frameworks/testing/system/equiv.js +201 -0
  956. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +695 -0
  957. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +209 -0
  958. data/lib/frameworks/sproutcore/frameworks/testing/system/suite.js +228 -0
  959. data/lib/frameworks/sproutcore/frameworks/testing/utils.js +62 -0
  960. data/lib/frameworks/sproutcore/lib/index.rhtml +119 -0
  961. data/lib/frameworks/sproutcore/license.js +30 -0
  962. data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +69 -0
  963. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/button.css +41 -0
  964. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/core.css +8 -0
  965. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/backButton.png +0 -0
  966. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/blueButton.png +0 -0
  967. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/cancel.png +0 -0
  968. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/grayButton.png +0 -0
  969. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/leftButton.png +0 -0
  970. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrow.png +0 -0
  971. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listArrowSel.png +0 -0
  972. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/listGroup.png +0 -0
  973. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/loading.gif +0 -0
  974. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/pinstripes.png +0 -0
  975. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/rightButton.png +0 -0
  976. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/selection.png +0 -0
  977. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/thumb.png +0 -0
  978. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggle.png +0 -0
  979. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toggleOn.png +0 -0
  980. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolButton.png +0 -0
  981. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/toolbar.png +0 -0
  982. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/images/whiteButton.png +0 -0
  983. data/lib/frameworks/sproutcore/themes/iphone_theme/english.lproj/strings.js +15 -0
  984. data/lib/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/Data +0 -0
  985. data/lib/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Preview.jpg +0 -0
  986. data/lib/frameworks/sproutcore/themes/standard_theme/Source/Panel.drawit/QuickLook/Thumbnail.jpg +0 -0
  987. data/lib/frameworks/sproutcore/themes/standard_theme/Source/SproutCore Theme Buttons.psd +0 -0
  988. data/lib/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/Data +0 -0
  989. data/lib/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Preview.jpg +0 -0
  990. data/lib/frameworks/sproutcore/themes/standard_theme/Source/ToolbarView Pattern.drawit/QuickLook/Thumbnail.jpg +0 -0
  991. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/10.png +0 -0
  992. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/100.png +0 -0
  993. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/102.png +0 -0
  994. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/110.png +0 -0
  995. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/120.png +0 -0
  996. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/127.png +0 -0
  997. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/18.png +0 -0
  998. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/19.png +0 -0
  999. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/2.png +0 -0
  1000. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/24.png +0 -0
  1001. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/26.png +0 -0
  1002. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/27.png +0 -0
  1003. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/28.png +0 -0
  1004. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/29.png +0 -0
  1005. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/30.png +0 -0
  1006. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/31.png +0 -0
  1007. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/33.png +0 -0
  1008. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/37.png +0 -0
  1009. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/41.png +0 -0
  1010. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/16/99.png +0 -0
  1011. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/10.png +0 -0
  1012. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/100.png +0 -0
  1013. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/102.png +0 -0
  1014. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/110.png +0 -0
  1015. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/120.png +0 -0
  1016. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/127.png +0 -0
  1017. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/18.png +0 -0
  1018. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/19.png +0 -0
  1019. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/2.png +0 -0
  1020. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/24.png +0 -0
  1021. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/26.png +0 -0
  1022. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/27.png +0 -0
  1023. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/28.png +0 -0
  1024. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/29.png +0 -0
  1025. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/30.png +0 -0
  1026. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/31.png +0 -0
  1027. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/33.png +0 -0
  1028. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/37.png +0 -0
  1029. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/41.png +0 -0
  1030. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/24/99.png +0 -0
  1031. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/10.png +0 -0
  1032. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/100.png +0 -0
  1033. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/102.png +0 -0
  1034. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/110.png +0 -0
  1035. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/120.png +0 -0
  1036. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/127.png +0 -0
  1037. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/18.png +0 -0
  1038. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/19.png +0 -0
  1039. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/2.png +0 -0
  1040. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/24.png +0 -0
  1041. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/26.png +0 -0
  1042. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/27.png +0 -0
  1043. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/28.png +0 -0
  1044. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/29.png +0 -0
  1045. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/30.png +0 -0
  1046. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/31.png +0 -0
  1047. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/33.png +0 -0
  1048. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/37.png +0 -0
  1049. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/41.png +0 -0
  1050. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/32/99.png +0 -0
  1051. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/48/10.png +0 -0
  1052. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/48/18.png +0 -0
  1053. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/48/19.png +0 -0
  1054. data/lib/frameworks/sproutcore/themes/standard_theme/Source/icons/48/2.png +0 -0
  1055. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/Data +0 -0
  1056. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Preview.jpg +0 -0
  1057. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-x.drawit/QuickLook/Thumbnail.jpg +0 -0
  1058. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/Data +0 -0
  1059. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Preview.jpg +0 -0
  1060. data/lib/frameworks/sproutcore/themes/standard_theme/Source/panel-sprite-y.drawit/QuickLook/Thumbnail.jpg +0 -0
  1061. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x-2.psd +0 -0
  1062. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-repeat-x.psd +0 -0
  1063. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-sprite.psd +0 -0
  1064. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sc-theme-ysprite.psd +0 -0
  1065. data/lib/frameworks/sproutcore/themes/standard_theme/Source/shared-icons.psd +0 -0
  1066. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sproutcore-logo.psd +0 -0
  1067. data/lib/frameworks/sproutcore/themes/standard_theme/Source/sticky-note.psd +0 -0
  1068. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/button.css +399 -0
  1069. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/checkbox.css +78 -0
  1070. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/collection.css +135 -0
  1071. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/core.css +76 -0
  1072. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/disclosure.css +57 -0
  1073. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_222222.png +0 -0
  1074. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_454545.png +0 -0
  1075. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_888888.png +0 -0
  1076. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/icons/mini_ffffff.png +0 -0
  1077. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/panels/sprite-x.png +0 -0
  1078. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/panels/sprite-y.png +0 -0
  1079. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-repeat-x.png +0 -0
  1080. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-repeat-y.png +0 -0
  1081. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-scroller-sprite.png +0 -0
  1082. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-repeat-x.png +0 -0
  1083. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-theme-ysprite.png +0 -0
  1084. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/images/sc-toolbar-view.png +0 -0
  1085. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/label.css +11 -0
  1086. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/list_item.css +82 -0
  1087. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/menu.css +20 -0
  1088. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/menu_item_view.css +36 -0
  1089. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/pane.css +18 -0
  1090. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/panel.css +33 -0
  1091. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/picker.css +17 -0
  1092. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/progress.css +27 -0
  1093. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/radio.css +125 -0
  1094. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/scroller.css +159 -0
  1095. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +275 -0
  1096. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/slider.css +94 -0
  1097. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/split_view.css +11 -0
  1098. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/tab.css +14 -0
  1099. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/table.css +14 -0
  1100. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/text_field.css +5 -0
  1101. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/toolbar.css +7 -0
  1102. data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/well.css +36 -0
  1103. data/lib/gen/Buildfile +16 -0
  1104. data/lib/gen/app/Buildfile +36 -0
  1105. data/lib/gen/app/README +1 -0
  1106. data/lib/gen/app/USAGE +13 -0
  1107. data/lib/gen/app/templates/apps/@target_name@/core.js +27 -0
  1108. data/lib/gen/app/templates/apps/@target_name@/main.js +30 -0
  1109. data/lib/gen/app/templates/apps/@target_name@/resources/loading.rhtml +9 -0
  1110. data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +24 -0
  1111. data/lib/gen/controller/Buildfile +18 -0
  1112. data/lib/gen/controller/README +1 -0
  1113. data/lib/gen/controller/USAGE +13 -0
  1114. data/lib/gen/controller/templates/controllers/@filename@.js +18 -0
  1115. data/lib/gen/controller/templates/tests/controllers/@filename@.js +15 -0
  1116. data/lib/gen/data-source/Buildfile +18 -0
  1117. data/lib/gen/data-source/README +1 -0
  1118. data/lib/gen/data-source/USAGE +15 -0
  1119. data/lib/gen/data-source/templates/data_sources/@filename@.js +64 -0
  1120. data/lib/gen/design/Buildfile +23 -0
  1121. data/lib/gen/design/README +1 -0
  1122. data/lib/gen/design/USAGE +10 -0
  1123. data/lib/gen/design/templates/resources/@filename@.js +16 -0
  1124. data/lib/gen/framework/Buildfile +36 -0
  1125. data/lib/gen/framework/README +1 -0
  1126. data/lib/gen/framework/USAGE +13 -0
  1127. data/lib/gen/framework/templates/frameworks/@target_name@/core.js +21 -0
  1128. data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +15 -0
  1129. data/lib/gen/language/Buildfile +26 -0
  1130. data/lib/gen/language/README +1 -0
  1131. data/lib/gen/language/USAGE +13 -0
  1132. data/lib/gen/language/templates/@filename@/strings.js +14 -0
  1133. data/lib/gen/model/Buildfile +16 -0
  1134. data/lib/gen/model/README +1 -0
  1135. data/lib/gen/model/USAGE +15 -0
  1136. data/lib/gen/model/templates/fixtures/@filename@.js +35 -0
  1137. data/lib/gen/model/templates/models/@filename@.js +19 -0
  1138. data/lib/gen/model/templates/tests/models/@filename@.js +15 -0
  1139. data/lib/gen/page/Buildfile +36 -0
  1140. data/lib/gen/page/README +1 -0
  1141. data/lib/gen/page/USAGE +15 -0
  1142. data/lib/gen/page/templates/pages/@target_name@/Buildfile +16 -0
  1143. data/lib/gen/page/templates/pages/@target_name@/core.js +22 -0
  1144. data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +14 -0
  1145. data/lib/gen/page/templates/pages/@target_name@/resources/body.css +1 -0
  1146. data/lib/gen/page/templates/pages/@target_name@/resources/body.rhtml +7 -0
  1147. data/lib/gen/project/Buildfile +45 -0
  1148. data/lib/gen/project/INIT +3 -0
  1149. data/lib/gen/project/README +1 -0
  1150. data/lib/gen/project/USAGE +2 -0
  1151. data/lib/gen/project/templates/@filename@/Buildfile +7 -0
  1152. data/lib/gen/project/templates/@filename@/README +7 -0
  1153. data/lib/gen/responder/Buildfile +18 -0
  1154. data/lib/gen/responder/README +1 -0
  1155. data/lib/gen/responder/USAGE +15 -0
  1156. data/lib/gen/responder/templates/states/@filename@.js +39 -0
  1157. data/lib/gen/test/Buildfile +25 -0
  1158. data/lib/gen/test/README +1 -0
  1159. data/lib/gen/test/USAGE +12 -0
  1160. data/lib/gen/test/templates/tests/@filename@.js +15 -0
  1161. data/lib/gen/theme/Buildfile +36 -0
  1162. data/lib/gen/theme/README +1 -0
  1163. data/lib/gen/theme/USAGE +13 -0
  1164. data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +11 -0
  1165. data/lib/gen/view/Buildfile +18 -0
  1166. data/lib/gen/view/README +1 -0
  1167. data/lib/gen/view/USAGE +13 -0
  1168. data/lib/gen/view/templates/tests/views/@filename@.js +15 -0
  1169. data/lib/gen/view/templates/views/@filename@.js +18 -0
  1170. data/lib/sproutcore.rb +167 -0
  1171. data/lib/sproutcore/builders.rb +13 -0
  1172. data/lib/sproutcore/builders/base.rb +90 -0
  1173. data/lib/sproutcore/builders/bundle.rb +63 -0
  1174. data/lib/sproutcore/builders/combine.rb +60 -0
  1175. data/lib/sproutcore/builders/html.rb +211 -0
  1176. data/lib/sproutcore/builders/javascript.rb +101 -0
  1177. data/lib/sproutcore/builders/less.rb +41 -0
  1178. data/lib/sproutcore/builders/minify.rb +159 -0
  1179. data/lib/sproutcore/builders/sass.rb +65 -0
  1180. data/lib/sproutcore/builders/strings.rb +45 -0
  1181. data/lib/sproutcore/builders/stylesheet.rb +56 -0
  1182. data/lib/sproutcore/builders/test.rb +59 -0
  1183. data/lib/sproutcore/builders/test_index.rb +26 -0
  1184. data/lib/sproutcore/buildfile.rb +490 -0
  1185. data/lib/sproutcore/buildfile/build_task.rb +33 -0
  1186. data/lib/sproutcore/buildfile/buildfile_dsl.rb +169 -0
  1187. data/lib/sproutcore/buildfile/cloneable.rb +34 -0
  1188. data/lib/sproutcore/buildfile/early_time.rb +30 -0
  1189. data/lib/sproutcore/buildfile/invocation_chain.rb +64 -0
  1190. data/lib/sproutcore/buildfile/namespace.rb +33 -0
  1191. data/lib/sproutcore/buildfile/string_ext.rb +202 -0
  1192. data/lib/sproutcore/buildfile/task.rb +333 -0
  1193. data/lib/sproutcore/buildfile/task_arguments.rb +106 -0
  1194. data/lib/sproutcore/buildfile/task_manager.rb +195 -0
  1195. data/lib/sproutcore/deprecated/view_helper.rb +662 -0
  1196. data/lib/sproutcore/helpers.rb +11 -0
  1197. data/lib/sproutcore/helpers/capture_helper.rb +30 -0
  1198. data/lib/sproutcore/helpers/cssmin.rb +202 -0
  1199. data/lib/sproutcore/helpers/dom_id_helper.rb +21 -0
  1200. data/lib/sproutcore/helpers/entry_sorter.rb +128 -0
  1201. data/lib/sproutcore/helpers/html5_manifest.rb +88 -0
  1202. data/lib/sproutcore/helpers/packed_optimizer.rb +102 -0
  1203. data/lib/sproutcore/helpers/static_helper.rb +376 -0
  1204. data/lib/sproutcore/helpers/tag_helper.rb +182 -0
  1205. data/lib/sproutcore/helpers/text_helper.rb +303 -0
  1206. data/lib/sproutcore/models.rb +8 -0
  1207. data/lib/sproutcore/models/generator.rb +493 -0
  1208. data/lib/sproutcore/models/hash_struct.rb +124 -0
  1209. data/lib/sproutcore/models/manifest.rb +385 -0
  1210. data/lib/sproutcore/models/manifest_entry.rb +355 -0
  1211. data/lib/sproutcore/models/project.rb +267 -0
  1212. data/lib/sproutcore/models/target.rb +758 -0
  1213. data/lib/sproutcore/rack.rb +7 -0
  1214. data/lib/sproutcore/rack/builder.rb +344 -0
  1215. data/lib/sproutcore/rack/dev.rb +92 -0
  1216. data/lib/sproutcore/rack/docs.rb +24 -0
  1217. data/lib/sproutcore/rack/filesystem.rb +324 -0
  1218. data/lib/sproutcore/rack/proxy.rb +149 -0
  1219. data/lib/sproutcore/rack/service.rb +153 -0
  1220. data/lib/sproutcore/rack/test_runner.rb +24 -0
  1221. data/lib/sproutcore/render_engines/erubis.rb +55 -0
  1222. data/lib/sproutcore/render_engines/haml.rb +39 -0
  1223. data/lib/sproutcore/tools.rb +360 -0
  1224. data/lib/sproutcore/tools/build.rb +106 -0
  1225. data/lib/sproutcore/tools/build_number.rb +23 -0
  1226. data/lib/sproutcore/tools/docs.rb +53 -0
  1227. data/lib/sproutcore/tools/gen.rb +101 -0
  1228. data/lib/sproutcore/tools/init.rb +40 -0
  1229. data/lib/sproutcore/tools/manifest.rb +85 -0
  1230. data/lib/sproutcore/tools/server.rb +48 -0
  1231. data/lib/sproutcore/vendor/github_gem_lint.rb +22 -0
  1232. data/lib/sproutcore/vendor/jsdoc/README.txt +151 -0
  1233. data/lib/sproutcore/vendor/jsdoc/app/frame.js +33 -0
  1234. data/lib/sproutcore/vendor/jsdoc/app/frame/Chain.js +102 -0
  1235. data/lib/sproutcore/vendor/jsdoc/app/frame/Dumper.js +144 -0
  1236. data/lib/sproutcore/vendor/jsdoc/app/frame/Hash.js +47 -0
  1237. data/lib/sproutcore/vendor/jsdoc/app/frame/Link.js +142 -0
  1238. data/lib/sproutcore/vendor/jsdoc/app/frame/Namespace.js +10 -0
  1239. data/lib/sproutcore/vendor/jsdoc/app/frame/Opt.js +134 -0
  1240. data/lib/sproutcore/vendor/jsdoc/app/frame/Reflection.js +26 -0
  1241. data/lib/sproutcore/vendor/jsdoc/app/frame/String.js +93 -0
  1242. data/lib/sproutcore/vendor/jsdoc/app/frame/Testrun.js +129 -0
  1243. data/lib/sproutcore/vendor/jsdoc/app/handlers/FOODOC.js +26 -0
  1244. data/lib/sproutcore/vendor/jsdoc/app/handlers/XMLDOC.js +26 -0
  1245. data/lib/sproutcore/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +159 -0
  1246. data/lib/sproutcore/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +16 -0
  1247. data/lib/sproutcore/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +292 -0
  1248. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC.js +98 -0
  1249. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/DocComment.js +200 -0
  1250. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/DocTag.js +294 -0
  1251. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +162 -0
  1252. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +100 -0
  1253. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Lang.js +144 -0
  1254. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Parser.js +109 -0
  1255. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +33 -0
  1256. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Symbol.js +681 -0
  1257. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +226 -0
  1258. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/TextStream.js +41 -0
  1259. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Token.js +18 -0
  1260. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +332 -0
  1261. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +133 -0
  1262. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Util.js +32 -0
  1263. data/lib/sproutcore/vendor/jsdoc/app/lib/JSDOC/Walker.js +453 -0
  1264. data/lib/sproutcore/vendor/jsdoc/app/main.js +74 -0
  1265. data/lib/sproutcore/vendor/jsdoc/app/plugins/commentSrcJson.js +19 -0
  1266. data/lib/sproutcore/vendor/jsdoc/app/plugins/frameworkPrototype.js +16 -0
  1267. data/lib/sproutcore/vendor/jsdoc/app/plugins/functionCall.js +10 -0
  1268. data/lib/sproutcore/vendor/jsdoc/app/plugins/publishSrcHilite.js +62 -0
  1269. data/lib/sproutcore/vendor/jsdoc/app/plugins/sproutcoreTags.js +26 -0
  1270. data/lib/sproutcore/vendor/jsdoc/app/plugins/symbolLink.js +9 -0
  1271. data/lib/sproutcore/vendor/jsdoc/app/plugins/tagParamConfig.js +31 -0
  1272. data/lib/sproutcore/vendor/jsdoc/app/plugins/tagSynonyms.js +43 -0
  1273. data/lib/sproutcore/vendor/jsdoc/app/run.js +346 -0
  1274. data/lib/sproutcore/vendor/jsdoc/app/t/TestDoc.js +144 -0
  1275. data/lib/sproutcore/vendor/jsdoc/app/t/runner.js +13 -0
  1276. data/lib/sproutcore/vendor/jsdoc/app/test.js +304 -0
  1277. data/lib/sproutcore/vendor/jsdoc/app/test/addon.js +24 -0
  1278. data/lib/sproutcore/vendor/jsdoc/app/test/anon_inner.js +14 -0
  1279. data/lib/sproutcore/vendor/jsdoc/app/test/augments.js +31 -0
  1280. data/lib/sproutcore/vendor/jsdoc/app/test/augments2.js +26 -0
  1281. data/lib/sproutcore/vendor/jsdoc/app/test/borrows.js +41 -0
  1282. data/lib/sproutcore/vendor/jsdoc/app/test/borrows2.js +23 -0
  1283. data/lib/sproutcore/vendor/jsdoc/app/test/config.js +22 -0
  1284. data/lib/sproutcore/vendor/jsdoc/app/test/constructs.js +18 -0
  1285. data/lib/sproutcore/vendor/jsdoc/app/test/encoding.js +10 -0
  1286. data/lib/sproutcore/vendor/jsdoc/app/test/encoding_other.js +12 -0
  1287. data/lib/sproutcore/vendor/jsdoc/app/test/functions_anon.js +39 -0
  1288. data/lib/sproutcore/vendor/jsdoc/app/test/functions_nested.js +33 -0
  1289. data/lib/sproutcore/vendor/jsdoc/app/test/global.js +13 -0
  1290. data/lib/sproutcore/vendor/jsdoc/app/test/globals.js +25 -0
  1291. data/lib/sproutcore/vendor/jsdoc/app/test/ignore.js +10 -0
  1292. data/lib/sproutcore/vendor/jsdoc/app/test/inner.js +16 -0
  1293. data/lib/sproutcore/vendor/jsdoc/app/test/jsdoc_test.js +477 -0
  1294. data/lib/sproutcore/vendor/jsdoc/app/test/lend.js +33 -0
  1295. data/lib/sproutcore/vendor/jsdoc/app/test/memberof.js +20 -0
  1296. data/lib/sproutcore/vendor/jsdoc/app/test/memberof_constructor.js +15 -0
  1297. data/lib/sproutcore/vendor/jsdoc/app/test/name.js +19 -0
  1298. data/lib/sproutcore/vendor/jsdoc/app/test/namespace_nested.js +23 -0
  1299. data/lib/sproutcore/vendor/jsdoc/app/test/nocode.js +13 -0
  1300. data/lib/sproutcore/vendor/jsdoc/app/test/oblit_anon.js +20 -0
  1301. data/lib/sproutcore/vendor/jsdoc/app/test/overview.js +20 -0
  1302. data/lib/sproutcore/vendor/jsdoc/app/test/param_inline.js +37 -0
  1303. data/lib/sproutcore/vendor/jsdoc/app/test/params_optional.js +8 -0
  1304. data/lib/sproutcore/vendor/jsdoc/app/test/prototype.js +17 -0
  1305. data/lib/sproutcore/vendor/jsdoc/app/test/prototype_nested.js +9 -0
  1306. data/lib/sproutcore/vendor/jsdoc/app/test/prototype_oblit.js +13 -0
  1307. data/lib/sproutcore/vendor/jsdoc/app/test/prototype_oblit_constructor.js +24 -0
  1308. data/lib/sproutcore/vendor/jsdoc/app/test/public.js +10 -0
  1309. data/lib/sproutcore/vendor/jsdoc/app/test/shared.js +42 -0
  1310. data/lib/sproutcore/vendor/jsdoc/app/test/shared2.js +2 -0
  1311. data/lib/sproutcore/vendor/jsdoc/app/test/shortcuts.js +22 -0
  1312. data/lib/sproutcore/vendor/jsdoc/app/test/static_this.js +13 -0
  1313. data/lib/sproutcore/vendor/jsdoc/app/test/synonyms.js +23 -0
  1314. data/lib/sproutcore/vendor/jsdoc/app/test/tosource.js +23 -0
  1315. data/lib/sproutcore/vendor/jsdoc/app/test/variable_redefine.js +14 -0
  1316. data/lib/sproutcore/vendor/jsdoc/changes.txt +47 -0
  1317. data/lib/sproutcore/vendor/jsdoc/conf/sample.conf +31 -0
  1318. data/lib/sproutcore/vendor/jsdoc/java/build.xml +36 -0
  1319. data/lib/sproutcore/vendor/jsdoc/java/build_1.4.xml +36 -0
  1320. data/lib/sproutcore/vendor/jsdoc/java/classes/js.jar +0 -0
  1321. data/lib/sproutcore/vendor/jsdoc/java/src/JsDebugRun.java +21 -0
  1322. data/lib/sproutcore/vendor/jsdoc/java/src/JsRun.java +21 -0
  1323. data/lib/sproutcore/vendor/jsdoc/jsdebug.jar +0 -0
  1324. data/lib/sproutcore/vendor/jsdoc/jsrun.jar +0 -0
  1325. data/lib/sproutcore/vendor/jsdoc/t/TestDoc.js +144 -0
  1326. data/lib/sproutcore/vendor/jsdoc/t/runner.js +13 -0
  1327. data/lib/sproutcore/vendor/jsdoc/test.js +304 -0
  1328. data/lib/sproutcore/vendor/jsdoc/test/addon.js +24 -0
  1329. data/lib/sproutcore/vendor/jsdoc/test/anon_inner.js +14 -0
  1330. data/lib/sproutcore/vendor/jsdoc/test/augments.js +31 -0
  1331. data/lib/sproutcore/vendor/jsdoc/test/augments2.js +26 -0
  1332. data/lib/sproutcore/vendor/jsdoc/test/borrows.js +41 -0
  1333. data/lib/sproutcore/vendor/jsdoc/test/borrows2.js +23 -0
  1334. data/lib/sproutcore/vendor/jsdoc/test/config.js +22 -0
  1335. data/lib/sproutcore/vendor/jsdoc/test/constructs.js +18 -0
  1336. data/lib/sproutcore/vendor/jsdoc/test/encoding.js +10 -0
  1337. data/lib/sproutcore/vendor/jsdoc/test/encoding_other.js +12 -0
  1338. data/lib/sproutcore/vendor/jsdoc/test/functions_anon.js +39 -0
  1339. data/lib/sproutcore/vendor/jsdoc/test/functions_nested.js +33 -0
  1340. data/lib/sproutcore/vendor/jsdoc/test/global.js +13 -0
  1341. data/lib/sproutcore/vendor/jsdoc/test/globals.js +25 -0
  1342. data/lib/sproutcore/vendor/jsdoc/test/ignore.js +10 -0
  1343. data/lib/sproutcore/vendor/jsdoc/test/inner.js +16 -0
  1344. data/lib/sproutcore/vendor/jsdoc/test/jsdoc_test.js +477 -0
  1345. data/lib/sproutcore/vendor/jsdoc/test/lend.js +33 -0
  1346. data/lib/sproutcore/vendor/jsdoc/test/memberof.js +20 -0
  1347. data/lib/sproutcore/vendor/jsdoc/test/memberof_constructor.js +15 -0
  1348. data/lib/sproutcore/vendor/jsdoc/test/name.js +19 -0
  1349. data/lib/sproutcore/vendor/jsdoc/test/namespace_nested.js +23 -0
  1350. data/lib/sproutcore/vendor/jsdoc/test/nocode.js +13 -0
  1351. data/lib/sproutcore/vendor/jsdoc/test/oblit_anon.js +20 -0
  1352. data/lib/sproutcore/vendor/jsdoc/test/overview.js +20 -0
  1353. data/lib/sproutcore/vendor/jsdoc/test/param_inline.js +37 -0
  1354. data/lib/sproutcore/vendor/jsdoc/test/params_optional.js +8 -0
  1355. data/lib/sproutcore/vendor/jsdoc/test/prototype.js +17 -0
  1356. data/lib/sproutcore/vendor/jsdoc/test/prototype_nested.js +9 -0
  1357. data/lib/sproutcore/vendor/jsdoc/test/prototype_oblit.js +13 -0
  1358. data/lib/sproutcore/vendor/jsdoc/test/prototype_oblit_constructor.js +24 -0
  1359. data/lib/sproutcore/vendor/jsdoc/test/public.js +10 -0
  1360. data/lib/sproutcore/vendor/jsdoc/test/shared.js +42 -0
  1361. data/lib/sproutcore/vendor/jsdoc/test/shared2.js +2 -0
  1362. data/lib/sproutcore/vendor/jsdoc/test/shortcuts.js +22 -0
  1363. data/lib/sproutcore/vendor/jsdoc/test/static_this.js +13 -0
  1364. data/lib/sproutcore/vendor/jsdoc/test/synonyms.js +23 -0
  1365. data/lib/sproutcore/vendor/jsdoc/test/tosource.js +23 -0
  1366. data/lib/sproutcore/vendor/jsdoc/test/variable_redefine.js +14 -0
  1367. data/lib/sproutcore/vendor/yui-compressor/SCyuicompressor-2.4.2.jar +0 -0
  1368. data/lib/sproutcore/vendor/yui-compressor/yuicompressor-2.4.2.jar +0 -0
  1369. data/lib/sproutcore/version.rb +11 -0
  1370. data/spec/buildtasks/build/copy_spec.rb +60 -0
  1371. data/spec/buildtasks/build/spec_helper.rb +36 -0
  1372. data/spec/buildtasks/manifest/catalog_spec.rb +48 -0
  1373. data/spec/buildtasks/manifest/hide_buildfiles_spec.rb +126 -0
  1374. data/spec/buildtasks/manifest/localize_spec.rb +97 -0
  1375. data/spec/buildtasks/manifest/prepare_build_tasks/bundle_spec.rb +254 -0
  1376. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +254 -0
  1377. data/spec/buildtasks/manifest/prepare_build_tasks/css_spec.rb +87 -0
  1378. data/spec/buildtasks/manifest/prepare_build_tasks/html_spec.rb +175 -0
  1379. data/spec/buildtasks/manifest/prepare_build_tasks/javascript_spec.rb +65 -0
  1380. data/spec/buildtasks/manifest/prepare_build_tasks/minify_spec.rb +70 -0
  1381. data/spec/buildtasks/manifest/prepare_build_tasks/packed_spec.rb +152 -0
  1382. data/spec/buildtasks/manifest/prepare_build_tasks/sass_spec.rb +98 -0
  1383. data/spec/buildtasks/manifest/prepare_build_tasks/strings_spec.rb +64 -0
  1384. data/spec/buildtasks/manifest/prepare_build_tasks/tests_spec.rb +163 -0
  1385. data/spec/buildtasks/manifest/prepare_spec.rb +43 -0
  1386. data/spec/buildtasks/manifest/spec_helper.rb +35 -0
  1387. data/spec/buildtasks/target_spec.rb +270 -0
  1388. data/spec/fixtures/builder_tests/Buildfile +20 -0
  1389. data/spec/fixtures/builder_tests/apps/bundle_test/bundle.js +1 -0
  1390. data/spec/fixtures/builder_tests/apps/combine_test/a.js +1 -0
  1391. data/spec/fixtures/builder_tests/apps/combine_test/b.js +1 -0
  1392. data/spec/fixtures/builder_tests/apps/combine_test/c.js +1 -0
  1393. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/a.css +1 -0
  1394. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/b.css +1 -0
  1395. data/spec/fixtures/builder_tests/apps/combine_test/english.lproj/c.css +1 -0
  1396. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/bar1_sample.rhtml +2 -0
  1397. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/erb_sample.html.erb +1 -0
  1398. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/icons/image.png +0 -0
  1399. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/image.jpg +0 -0
  1400. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/rhtml_sample.rhtml +1 -0
  1401. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/strings.js +4 -0
  1402. data/spec/fixtures/builder_tests/apps/html_test/english.lproj/style.css +0 -0
  1403. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/french-icons/fr.png +0 -0
  1404. data/spec/fixtures/builder_tests/apps/html_test/french.lproj/strings.js +4 -0
  1405. data/spec/fixtures/builder_tests/apps/html_test/lib/layout_template.rhtml +1 -0
  1406. data/spec/fixtures/builder_tests/apps/html_test/scripts.js +0 -0
  1407. data/spec/fixtures/builder_tests/apps/javascript_test/sc_static.js +15 -0
  1408. data/spec/fixtures/builder_tests/apps/javascript_test/sc_super.js +4 -0
  1409. data/spec/fixtures/builder_tests/apps/javascript_test/strings.js +7 -0
  1410. data/spec/fixtures/builder_tests/apps/less_test/sample.less +4 -0
  1411. data/spec/fixtures/builder_tests/apps/sass_test/sample.sass +4 -0
  1412. data/spec/fixtures/builder_tests/apps/sass_test/sample.scss +4 -0
  1413. data/spec/fixtures/builder_tests/apps/strings_test/lproj/strings.js +8 -0
  1414. data/spec/fixtures/builder_tests/apps/stylesheet_test/build_directives.css +9 -0
  1415. data/spec/fixtures/builder_tests/apps/stylesheet_test/sc_static.css +12 -0
  1416. data/spec/fixtures/builder_tests/apps/test_test/lib/alt_layout.rhtml +1 -0
  1417. data/spec/fixtures/builder_tests/apps/test_test/lib/test_layout.rhtml +3 -0
  1418. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test.js +1 -0
  1419. data/spec/fixtures/builder_tests/apps/test_test/tests/qunit_test2.js +1 -0
  1420. data/spec/fixtures/builder_tests/apps/test_test/tests/rhtml_test.rhtml +4 -0
  1421. data/spec/fixtures/builder_tests/frameworks/debug/core.js +0 -0
  1422. data/spec/fixtures/builder_tests/frameworks/debug/english.lproj/dummy.css +0 -0
  1423. data/spec/fixtures/builder_tests/frameworks/dynamic_req_target_1/dynamic_req_js_1.js +0 -0
  1424. data/spec/fixtures/builder_tests/frameworks/dynamic_req_target_1/english.lproj/dynamic_req_style_1.css +0 -0
  1425. data/spec/fixtures/builder_tests/frameworks/qunit/core.js +0 -0
  1426. data/spec/fixtures/builder_tests/frameworks/qunit/english.lproj/dummy.css +0 -0
  1427. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/req_style_1.css +0 -0
  1428. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/strings.js +4 -0
  1429. data/spec/fixtures/builder_tests/frameworks/req_target_1/english.lproj/test.rhtml +1 -0
  1430. data/spec/fixtures/builder_tests/frameworks/req_target_1/req_js_1.js +0 -0
  1431. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/req_style_2.css +0 -0
  1432. data/spec/fixtures/builder_tests/frameworks/req_target_2/english.lproj/test.rhtml +1 -0
  1433. data/spec/fixtures/builder_tests/frameworks/req_target_2/javascript.js +1 -0
  1434. data/spec/fixtures/builder_tests/frameworks/req_target_2/lib/alt_layout.rhtml +0 -0
  1435. data/spec/fixtures/builder_tests/frameworks/req_target_2/req_js_2.js +0 -0
  1436. data/spec/fixtures/builder_tests/themes/sample_theme/Buildfile +1 -0
  1437. data/spec/fixtures/buildfiles/basic/Buildfile +11 -0
  1438. data/spec/fixtures/buildfiles/basic/task_module.rake +6 -0
  1439. data/spec/fixtures/buildfiles/installed/Buildfile +5 -0
  1440. data/spec/fixtures/buildfiles/installed/Buildfile2 +5 -0
  1441. data/spec/fixtures/buildfiles/project_test/Buildfile +4 -0
  1442. data/spec/fixtures/buildfiles/project_test/not_project/Buildfile +2 -0
  1443. data/spec/fixtures/buildfiles/project_test/not_project/child/PLACEHOLDER +0 -0
  1444. data/spec/fixtures/entry_for_project/Buildfile +1 -0
  1445. data/spec/fixtures/entry_for_project/apps/test_app/entry.txt +0 -0
  1446. data/spec/fixtures/entry_for_project/apps/test_app/frameworks/nested/PLACEHOLDER +0 -0
  1447. data/spec/fixtures/entry_for_project/frameworks/shared/PLACEHOLDER +0 -0
  1448. data/spec/fixtures/entry_for_project/frameworks/unrelated/PLACEHOLDER +0 -0
  1449. data/spec/fixtures/find_targets/custom/Buildfile +8 -0
  1450. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar1/PLACEHOLDER +0 -0
  1451. data/spec/fixtures/find_targets/custom/bars/bar1/bars/bar2/PLACEHOLDER +0 -0
  1452. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo1/PLACEHOLDER +0 -0
  1453. data/spec/fixtures/find_targets/custom/bars/bar1/foos/foo2/PLACEHOLDER +0 -0
  1454. data/spec/fixtures/find_targets/custom/foos/custom_foos/Buildfile +5 -0
  1455. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo1/PLACEHOLDER +0 -0
  1456. data/spec/fixtures/find_targets/custom/foos/custom_foos/custom_foodir/foo2/PLACEHOLDER +0 -0
  1457. data/spec/fixtures/find_targets/custom/foos/custom_foos/foos/not_foo1/PLACEHOLDER +0 -0
  1458. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar1/PLACEHOLDER +0 -0
  1459. data/spec/fixtures/find_targets/custom/foos/foo1/bars/bar2/PLACEHOLDER +0 -0
  1460. data/spec/fixtures/find_targets/nested/Buildfile +8 -0
  1461. data/spec/fixtures/find_targets/nested/apps/app1/Buildfile +1 -0
  1462. data/spec/fixtures/find_targets/nested/apps/app1/apps/nested_app/PLACEHOLDER +0 -0
  1463. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework1/PLACEHOLDER +0 -0
  1464. data/spec/fixtures/find_targets/standard/Apps/app1/frameworks/framework2/PLACEHOLDER +0 -0
  1465. data/spec/fixtures/find_targets/standard/clients/client1/PLACEHOLDER +0 -0
  1466. data/spec/fixtures/find_targets/standard/frameworks/framework1/frameworks/framework1/PLACEHOLDER +0 -0
  1467. data/spec/fixtures/find_targets/standard/frameworks/framework2/PLACEHOLDER +0 -0
  1468. data/spec/fixtures/find_targets/standard/themes/theme1/PLACEHOLDER +0 -0
  1469. data/spec/fixtures/find_targets/standard/themes/theme2/PLACEHOLDER +0 -0
  1470. data/spec/fixtures/languages/apps/caps_long_names/English.lproj/PLACEHOLDER +0 -0
  1471. data/spec/fixtures/languages/apps/caps_long_names/FreNCH.lproj/PLACEHOLDER +0 -0
  1472. data/spec/fixtures/languages/apps/caps_long_names/UnknOWN.lproj/PLACEHOLDER +0 -0
  1473. data/spec/fixtures/languages/apps/long_names/english.lproj/PLACEHOLDER +0 -0
  1474. data/spec/fixtures/languages/apps/long_names/french.lproj/PLACEHOLDER +0 -0
  1475. data/spec/fixtures/languages/apps/long_names/german.lproj/PLACEHOLDER +0 -0
  1476. data/spec/fixtures/languages/apps/long_names/italian.lproj/PLACEHOLDER +0 -0
  1477. data/spec/fixtures/languages/apps/long_names/japanese.lproj/PLACEHOLDER +0 -0
  1478. data/spec/fixtures/languages/apps/long_names/spanish.lproj/PLACEHOLDER +0 -0
  1479. data/spec/fixtures/languages/apps/long_names/unknown.lproj/PLACEHOLDER +0 -0
  1480. data/spec/fixtures/languages/apps/no_names/PLACEHOLDER +0 -0
  1481. data/spec/fixtures/languages/apps/short_names/de.lproj/PLACEHOLDER +0 -0
  1482. data/spec/fixtures/languages/apps/short_names/en-CA.lproj/PLACEHOLDER +0 -0
  1483. data/spec/fixtures/languages/apps/short_names/en-GB.lproj/PLACEHOLDER +0 -0
  1484. data/spec/fixtures/languages/apps/short_names/en-US.lproj/PLACEHOLDER +0 -0
  1485. data/spec/fixtures/languages/apps/short_names/en.lproj/PLACEHOLDER +0 -0
  1486. data/spec/fixtures/languages/apps/short_names/es.lproj/PLACEHOLDER +0 -0
  1487. data/spec/fixtures/languages/apps/short_names/foo.lproj/PLACEHOLDER +0 -0
  1488. data/spec/fixtures/languages/apps/short_names/fr.lproj/PLACEHOLDER +0 -0
  1489. data/spec/fixtures/languages/apps/short_names/it.lproj/PLACEHOLDER +0 -0
  1490. data/spec/fixtures/languages/apps/short_names/ja.lproj/PLACEHOLDER +0 -0
  1491. data/spec/fixtures/ordered_entries/apps/no_requires/1.js +1 -0
  1492. data/spec/fixtures/ordered_entries/apps/no_requires/B.js +1 -0
  1493. data/spec/fixtures/ordered_entries/apps/no_requires/a.js +1 -0
  1494. data/spec/fixtures/ordered_entries/apps/no_requires/a/a.js +1 -0
  1495. data/spec/fixtures/ordered_entries/apps/no_requires/a/b.js +1 -0
  1496. data/spec/fixtures/ordered_entries/apps/no_requires/b/a.js +1 -0
  1497. data/spec/fixtures/ordered_entries/apps/no_requires/c.js +1 -0
  1498. data/spec/fixtures/ordered_entries/apps/no_requires/core.js +1 -0
  1499. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/B.css +0 -0
  1500. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a.css +0 -0
  1501. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/a.css +0 -0
  1502. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/a/b.css +0 -0
  1503. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/b/a.css +0 -0
  1504. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/c.css +0 -0
  1505. data/spec/fixtures/ordered_entries/apps/no_requires/english.lproj/strings.js +1 -0
  1506. data/spec/fixtures/ordered_entries/apps/no_requires/main.js +1 -0
  1507. data/spec/fixtures/ordered_entries/apps/no_requires/resources/main_page.js +1 -0
  1508. data/spec/fixtures/ordered_entries/apps/no_requires/t.js +1 -0
  1509. data/spec/fixtures/ordered_entries/apps/no_requires/utils.js +1 -0
  1510. data/spec/fixtures/ordered_entries/apps/with_requires/a.js +2 -0
  1511. data/spec/fixtures/ordered_entries/apps/with_requires/b.js +3 -0
  1512. data/spec/fixtures/ordered_entries/apps/with_requires/c.js +2 -0
  1513. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/a.css +2 -0
  1514. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/b.css +2 -0
  1515. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/c.css +2 -0
  1516. data/spec/fixtures/ordered_entries/apps/with_requires/english.lproj/d.js +1 -0
  1517. data/spec/fixtures/real_world/Buildfile +12 -0
  1518. data/spec/fixtures/real_world/apps/account/README +1 -0
  1519. data/spec/fixtures/real_world/apps/calendar/README +1 -0
  1520. data/spec/fixtures/real_world/apps/contacts/README_BEFORE_EDITING +1 -0
  1521. data/spec/fixtures/real_world/apps/files/README +1 -0
  1522. data/spec/fixtures/real_world/apps/mail/README +1 -0
  1523. data/spec/fixtures/real_world/apps/mobile_photos/README +1 -0
  1524. data/spec/fixtures/real_world/apps/photos/README +1 -0
  1525. data/spec/fixtures/real_world/apps/uploader/README +1 -0
  1526. data/spec/fixtures/real_world/frameworks/core_files/PLACEHOLDER +0 -0
  1527. data/spec/fixtures/real_world/frameworks/core_photos/PLACEHOLDER +0 -0
  1528. data/spec/fixtures/real_world/frameworks/shared/PLACEHOLDER +0 -0
  1529. data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +26 -0
  1530. data/spec/fixtures/real_world/frameworks/sproutcore/README +1 -0
  1531. data/spec/fixtures/real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER +0 -0
  1532. data/spec/fixtures/real_world/frameworks/sproutcore/apps/test_runner/PLACEHOLDER +0 -0
  1533. data/spec/fixtures/real_world/frameworks/sproutcore/core.js +0 -0
  1534. data/spec/fixtures/real_world/frameworks/sproutcore/debug/debug-resource.html +0 -0
  1535. data/spec/fixtures/real_world/frameworks/sproutcore/debug/sample_debug.js +0 -0
  1536. data/spec/fixtures/real_world/frameworks/sproutcore/demo2.js +0 -0
  1537. data/spec/fixtures/real_world/frameworks/sproutcore/demo3.scss +0 -0
  1538. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/debug/sample_debug-loc.js +0 -0
  1539. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.css +4 -0
  1540. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo.html +1 -0
  1541. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo2.sass +0 -0
  1542. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo3.scss +0 -0
  1543. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/demo4.less +0 -0
  1544. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.haml +0 -0
  1545. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.html.erb +1 -0
  1546. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/file_extension_test.rhtml +0 -0
  1547. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/fixtures/sample_fixtures-loc.js +0 -0
  1548. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/has_require.css +4 -0
  1549. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_require.css +1 -0
  1550. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/no_sc_resource.rhtml +1 -0
  1551. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/protocols/sample-loc.js +0 -0
  1552. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.css +6 -0
  1553. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/sc_resource.rhtml +3 -0
  1554. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/strings.js +1 -0
  1555. data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/tests/sample-loc.js +0 -0
  1556. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample-json-fixture.json +1 -0
  1557. data/spec/fixtures/real_world/frameworks/sproutcore/fixtures/sample_fixtures.js +0 -0
  1558. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/application/PLACEHOLDER +0 -0
  1559. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/costello/core.js +0 -0
  1560. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/data_store/PLACEHOLDER +0 -0
  1561. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/debug/PLACEHOLDER +0 -0
  1562. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/desktop/PLACEHOLDER +0 -0
  1563. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/empty_theme/PLACEHOLDER +0 -0
  1564. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/foundation/PLACEHOLDER +0 -0
  1565. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/mobile/PLACEHOLDER +0 -0
  1566. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/qunit/PLACEHOLDER +0 -0
  1567. data/spec/fixtures/real_world/frameworks/sproutcore/frameworks/uploader/PLACEHOLDER +0 -0
  1568. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/french-resource.js +0 -0
  1569. data/spec/fixtures/real_world/frameworks/sproutcore/french.lproj/strings.js +1 -0
  1570. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/german-resource.js +0 -0
  1571. data/spec/fixtures/real_world/frameworks/sproutcore/german.lproj/strings.js +0 -0
  1572. data/spec/fixtures/real_world/frameworks/sproutcore/has_require.js +4 -0
  1573. data/spec/fixtures/real_world/frameworks/sproutcore/lib/index.html +1 -0
  1574. data/spec/fixtures/real_world/frameworks/sproutcore/no_require.js +1 -0
  1575. data/spec/fixtures/real_world/frameworks/sproutcore/protocols/sample.js +0 -0
  1576. data/spec/fixtures/real_world/frameworks/sproutcore/resources/boo.png +0 -0
  1577. data/spec/fixtures/real_world/frameworks/sproutcore/sc_resource.js +6 -0
  1578. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample1.js +0 -0
  1579. data/spec/fixtures/real_world/frameworks/sproutcore/tests/nested/sample2.js +0 -0
  1580. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.js +0 -0
  1581. data/spec/fixtures/real_world/frameworks/sproutcore/tests/sample.rhtml +1 -0
  1582. data/spec/fixtures/real_world/frameworks/sproutcore/themes/standard_theme/README +0 -0
  1583. data/spec/fixtures/real_world/frameworks/sproutcore/views/view.js +1 -0
  1584. data/spec/fixtures/real_world/generators/sample_custom/Buildfile +0 -0
  1585. data/spec/fixtures/real_world/generators/sample_custom/templates/{filename}.js +1 -0
  1586. data/spec/fixtures/recursive_project/Buildfile +8 -0
  1587. data/spec/fixtures/recursive_project/frameworks/sproutcore/frameworks/costello/PLACEHOLDER +0 -0
  1588. data/spec/lib/builders/bundle_spec.rb +295 -0
  1589. data/spec/lib/builders/combine_spec.rb +67 -0
  1590. data/spec/lib/builders/html_spec.rb +580 -0
  1591. data/spec/lib/builders/javascript_spec.rb +82 -0
  1592. data/spec/lib/builders/less_spec.rb +51 -0
  1593. data/spec/lib/builders/sass_spec.rb +72 -0
  1594. data/spec/lib/builders/spec_helper.rb +30 -0
  1595. data/spec/lib/builders/strings_spec.rb +55 -0
  1596. data/spec/lib/builders/stylesheet_spec.rb +64 -0
  1597. data/spec/lib/builders/test_index_spec.rb +45 -0
  1598. data/spec/lib/builders/test_spec.rb +137 -0
  1599. data/spec/lib/buildfile/config_for_spec.rb +81 -0
  1600. data/spec/lib/buildfile/define_spec.rb +59 -0
  1601. data/spec/lib/buildfile/dup_spec.rb +65 -0
  1602. data/spec/lib/buildfile/invoke_spec.rb +135 -0
  1603. data/spec/lib/buildfile/load_spec.rb +51 -0
  1604. data/spec/lib/buildfile/task/dup_spec.rb +55 -0
  1605. data/spec/lib/buildfile/task_defined_spec.rb +17 -0
  1606. data/spec/lib/buildfile_commands/build_task_spec.rb +19 -0
  1607. data/spec/lib/buildfile_commands/config_spec.rb +97 -0
  1608. data/spec/lib/buildfile_commands/import_spec.rb +17 -0
  1609. data/spec/lib/buildfile_commands/namespace_spec.rb +18 -0
  1610. data/spec/lib/buildfile_commands/proxies_spec.rb +38 -0
  1611. data/spec/lib/buildfile_commands/replace_task_spec.rb +29 -0
  1612. data/spec/lib/buildfile_commands/task_spec.rb +36 -0
  1613. data/spec/lib/helpers/packing_optimizer/optimize_spec.rb +26 -0
  1614. data/spec/lib/models/hash_struct/deep_clone_spec.rb +27 -0
  1615. data/spec/lib/models/hash_struct/has_options_spec.rb +32 -0
  1616. data/spec/lib/models/hash_struct/hash_spec.rb +29 -0
  1617. data/spec/lib/models/hash_struct/merge_spec.rb +19 -0
  1618. data/spec/lib/models/hash_struct/method_missing.rb +41 -0
  1619. data/spec/lib/models/manifest/add_entry_spec.rb +36 -0
  1620. data/spec/lib/models/manifest/add_transform_spec.rb +93 -0
  1621. data/spec/lib/models/manifest/build_spec.rb +78 -0
  1622. data/spec/lib/models/manifest/entry_for_spec.rb +94 -0
  1623. data/spec/lib/models/manifest/find_entry.rb +109 -0
  1624. data/spec/lib/models/manifest/prepare_spec.rb +62 -0
  1625. data/spec/lib/models/manifest_entry/cacheable_url_spec.rb +31 -0
  1626. data/spec/lib/models/manifest_entry/hyperdomain_prefix.rb +34 -0
  1627. data/spec/lib/models/manifest_entry/prepare_spec.rb +54 -0
  1628. data/spec/lib/models/project/add_target_spec.rb +44 -0
  1629. data/spec/lib/models/project/buildfile_spec.rb +35 -0
  1630. data/spec/lib/models/project/find_targets_for_spec.rb +78 -0
  1631. data/spec/lib/models/project/load_nearest_project_spec.rb +23 -0
  1632. data/spec/lib/models/project/target_for_spec.rb +33 -0
  1633. data/spec/lib/models/project/targets_spec.rb +62 -0
  1634. data/spec/lib/models/target/compute_build_number_spec.rb +126 -0
  1635. data/spec/lib/models/target/config_spec.rb +30 -0
  1636. data/spec/lib/models/target/expand_required_targets_spec.rb +48 -0
  1637. data/spec/lib/models/target/installed_languages_spec.rb +47 -0
  1638. data/spec/lib/models/target/lproj_for_spec.rb +38 -0
  1639. data/spec/lib/models/target/manifest_for_spec.rb +42 -0
  1640. data/spec/lib/models/target/parent_target_spec.rb +21 -0
  1641. data/spec/lib/models/target/prepare_spec.rb +53 -0
  1642. data/spec/lib/models/target/required_targets_spec.rb +129 -0
  1643. data/spec/lib/models/target/target_for_spec.rb +56 -0
  1644. data/spec/lib/tools/build_number_spec.rb +35 -0
  1645. data/spec/lib/tools/gen_spec.rb +209 -0
  1646. data/spec/lib/tools/tools_spec.rb +96 -0
  1647. data/spec/spec.opts +4 -0
  1648. data/spec/spec_helper.rb +138 -0
  1649. data/sproutcore.gemspec +51 -0
  1650. metadata +1897 -0
@@ -0,0 +1,2666 @@
1
+ // ==========================================================================
2
+ // Project: SproutCore - JavaScript Application Framework
3
+ // Copyright: ©2006-2010 Sprout Systems, Inc. and contributors.
4
+ // Portions ©2008-2010 Apple Inc. All rights reserved.
5
+ // License: Licensed under MIT license (see license.js)
6
+ // ==========================================================================
7
+
8
+ sc_require('models/record');
9
+
10
+ /**
11
+ @class
12
+
13
+
14
+ The Store is where you can find all of your dataHashes. Stores can be
15
+ chained for editing purposes and committed back one chain level at a time
16
+ all the way back to a persistent data source.
17
+
18
+ Every application you create should generally have its own store objects.
19
+ Once you create the store, you will rarely need to work with the store
20
+ directly except to retrieve records and collections.
21
+
22
+ Internally, the store will keep track of changes to your json data hashes
23
+ and manage syncing those changes with your data source. A data source may
24
+ be a server, local storage, or any other persistent code.
25
+
26
+ @extends SC.Object
27
+ @since SproutCore 1.0
28
+ */
29
+ SC.Store = SC.Object.extend( /** @scope SC.Store.prototype */ {
30
+
31
+ /**
32
+ An (optional) name of the store, which can be useful during debugging,
33
+ especially if you have multiple nested stores.
34
+
35
+ @property {String}
36
+ */
37
+ name: null,
38
+
39
+ /**
40
+ An array of all the chained stores that current rely on the receiver
41
+ store.
42
+
43
+ @property {Array}
44
+ */
45
+ nestedStores: null,
46
+
47
+ /**
48
+ The data source is the persistent storage that will provide data to the
49
+ store and save changes. You normally will set your data source when you
50
+ first create your store in your application.
51
+
52
+ @property {SC.DataSource}
53
+ */
54
+ dataSource: null,
55
+
56
+ /**
57
+ This type of store is not nested.
58
+
59
+ @property {Boolean}
60
+ */
61
+ isNested: NO,
62
+
63
+ /**
64
+ This type of store is not nested.
65
+
66
+ @property {Boolean}
67
+ */
68
+ commitRecordsAutomatically: NO,
69
+
70
+ // ..........................................................
71
+ // DATA SOURCE SUPPORT
72
+ //
73
+
74
+ /**
75
+ Convenience method. Sets the current data source to the passed property.
76
+ This will also set the store property on the dataSource to the receiver.
77
+
78
+ If you are using this from the core.js method of your app, you may need to
79
+ just pass a string naming your data source class. If this is the case,
80
+ then your data source will be instantiated the first time it is requested.
81
+
82
+ @param {SC.DataSource|String} dataSource the data source
83
+ @returns {SC.Store} receiver
84
+ */
85
+ from: function(dataSource) {
86
+ this.set('dataSource', dataSource);
87
+ return this ;
88
+ },
89
+
90
+ // lazily convert data source to real object
91
+ _getDataSource: function() {
92
+ var ret = this.get('dataSource');
93
+ if (typeof ret === SC.T_STRING) {
94
+ ret = SC.objectForPropertyPath(ret);
95
+ if (ret) ret = ret.create();
96
+ if (ret) this.set('dataSource', ret);
97
+ }
98
+ return ret;
99
+ },
100
+
101
+ /**
102
+ Convenience method. Creates a CascadeDataSource with the passed
103
+ data source arguments and sets the CascadeDataSource as the data source
104
+ for the receiver.
105
+
106
+ @param {SC.DataSource...} dataSource one or more data source arguments
107
+ @returns {SC.Store} reciever
108
+ */
109
+ cascade: function(dataSource) {
110
+ var dataSources = SC.A(arguments) ;
111
+ dataSource = SC.CascadeDataSource.create({
112
+ dataSources: dataSources
113
+ });
114
+ return this.from(dataSource);
115
+ },
116
+
117
+ // ..........................................................
118
+ // STORE CHAINING
119
+ //
120
+
121
+ /**
122
+ Returns a new nested store instance that can be used to buffer changes
123
+ until you are ready to commit them. When you are ready to commit your
124
+ changes, call commitChanges() or destroyChanges() and then destroy() when
125
+ you are finished with the chained store altogether.
126
+
127
+ {{{
128
+ store = MyApp.store.chain();
129
+ .. edit edit edit
130
+ store.commitChanges().destroy();
131
+ }}}
132
+
133
+ @param {Hash} attrs optional attributes to set on new store
134
+ @param {Class} newStoreClass optional the class of the newly-created nested store (defaults to SC.NestedStore)
135
+ @returns {SC.NestedStore} new nested store chained to receiver
136
+ */
137
+ chain: function(attrs, newStoreClass) {
138
+ if (!attrs) attrs = {};
139
+ attrs.parentStore = this;
140
+
141
+ if (newStoreClass) {
142
+ // Ensure the passed-in class is a type of nested store.
143
+ if (SC.typeOf(newStoreClass) !== 'class') throw new Error("%@ is not a valid class".fmt(newStoreClass));
144
+ if (!SC.kindOf(newStoreClass, SC.NestedStore)) throw new Error("%@ is not a type of SC.NestedStore".fmt(newStoreClass));
145
+ }
146
+ else {
147
+ newStoreClass = SC.NestedStore;
148
+ }
149
+
150
+ var ret = newStoreClass.create(attrs),
151
+ nested = this.nestedStores;
152
+
153
+ if (!nested) nested = this.nestedStores = [];
154
+ nested.push(ret);
155
+ return ret ;
156
+ },
157
+
158
+ /** @private
159
+
160
+ Called by a nested store just before it is destroyed so that the parent
161
+ can remove the store from its list of nested stores.
162
+
163
+ @returns {SC.Store} receiver
164
+ */
165
+ willDestroyNestedStore: function(nestedStore) {
166
+ if (this.nestedStores) {
167
+ this.nestedStores.removeObject(nestedStore);
168
+ }
169
+ return this ;
170
+ },
171
+
172
+ /**
173
+ Used to determine if a nested store belongs directly or indirectly to the
174
+ receiver.
175
+
176
+ @param {SC.Store} store store instance
177
+ @returns {Boolean} YES if belongs
178
+ */
179
+ hasNestedStore: function(store) {
180
+ while(store && (store !== this)) store = store.get('parentStore');
181
+ return store === this ;
182
+ },
183
+
184
+ // ..........................................................
185
+ // SHARED DATA STRUCTURES
186
+ //
187
+
188
+ /** @private
189
+ JSON data hashes indexed by store key.
190
+
191
+ *IMPORTANT: Property is not observable*
192
+
193
+ Shared by a store and its child stores until you make edits to it.
194
+
195
+ @property {Hash}
196
+ */
197
+ dataHashes: null,
198
+
199
+ /** @private
200
+ The current status of a data hash indexed by store key.
201
+
202
+ *IMPORTANT: Property is not observable*
203
+
204
+ Shared by a store and its child stores until you make edits to it.
205
+
206
+ @property {Hash}
207
+ */
208
+ statuses: null,
209
+
210
+ /** @private
211
+ This array contains the revisions for the attributes indexed by the
212
+ storeKey.
213
+
214
+ *IMPORTANT: Property is not observable*
215
+
216
+ Revisions are used to keep track of when an attribute hash has been
217
+ changed. A store shares the revisions data with its parent until it
218
+ starts to make changes to it.
219
+
220
+ @property {Hash}
221
+ */
222
+ revisions: null,
223
+
224
+ /**
225
+ Array indicates whether a data hash is possibly in use by an external
226
+ record for editing. If a data hash is editable then it may be modified
227
+ at any time and therefore chained stores may need to clone the
228
+ attributes before keeping a copy of them.
229
+
230
+ Note that this is kept as an array because it will be stored as a dense
231
+ array on some browsers, making it faster.
232
+
233
+ @property {Array}
234
+ */
235
+ editables: null,
236
+
237
+ /**
238
+ A set of storeKeys that need to be committed back to the data source. If
239
+ you call commitRecords() without passing any other parameters, the keys
240
+ in this set will be committed instead.
241
+
242
+ @property {SC.Set}
243
+ */
244
+ changelog: null,
245
+
246
+ /**
247
+ A set of SC.RecordArray that have been returned from findAll with an
248
+ SC.Query. These will all be notified with _notifyRecordArraysWithQuery()
249
+ whenever the store changes.
250
+
251
+ @property {Array}
252
+ */
253
+ recordArraysWithQuery: null,
254
+
255
+ /**
256
+ An array of SC.Error objects associated with individual records in the
257
+ store (indexed by store keys).
258
+
259
+ Errors passed form the data source in the call to dataSourceDidError() are
260
+ stored here.
261
+
262
+ @property {Array}
263
+ */
264
+ recordErrors: null,
265
+
266
+ /**
267
+ A hash of SC.Error objects associated with queries (indexed by the GUID
268
+ of the query).
269
+
270
+ Errors passed from the data source in the call to dataSourceDidErrorQuery()
271
+ are stored here.
272
+
273
+ @property {Hash}
274
+ */
275
+ queryErrors: null,
276
+
277
+ // ..........................................................
278
+ // CORE ATTRIBUTE API
279
+ //
280
+ // The methods in this layer work on data hashes in the store. They do not
281
+ // perform any changes that can impact records. Usually you will not need
282
+ // to use these methods.
283
+
284
+ /**
285
+ Returns the current edit status of a storekey. May be one of EDITABLE or
286
+ LOCKED. Used mostly for unit testing.
287
+
288
+ @param {Number} storeKey the store key
289
+ @returns {Number} edit status
290
+ */
291
+ storeKeyEditState: function(storeKey) {
292
+ var editables = this.editables, locks = this.locks;
293
+ return (editables && editables[storeKey]) ? SC.Store.EDITABLE : SC.Store.LOCKED ;
294
+ },
295
+
296
+ /**
297
+ Returns the data hash for the given storeKey. This will also 'lock'
298
+ the hash so that further edits to the parent store will no
299
+ longer be reflected in this store until you reset.
300
+
301
+ @param {Number} storeKey key to retrieve
302
+ @returns {Hash} data hash or null
303
+ */
304
+ readDataHash: function(storeKey) {
305
+ return this.dataHashes[storeKey];
306
+ },
307
+
308
+ /**
309
+ Returns the data hash for the storeKey, cloned so that you can edit
310
+ the contents of the attributes if you like. This will do the extra work
311
+ to make sure that you only clone the attributes one time.
312
+
313
+ If you use this method to modify data hash, be sure to call
314
+ dataHashDidChange() when you make edits to record the change.
315
+
316
+ @param {Number} storeKey the store key to retrieve
317
+ @returns {Hash} the attributes hash
318
+ */
319
+ readEditableDataHash: function(storeKey) {
320
+ // read the value - if there is no hash just return; nothing to do
321
+ var ret = this.dataHashes[storeKey];
322
+ if (!ret) return ret ; // nothing to do.
323
+
324
+ // clone data hash if not editable
325
+ var editables = this.editables;
326
+ if (!editables) editables = this.editables = [];
327
+ if (!editables[storeKey]) {
328
+ editables[storeKey] = 1 ; // use number to store as dense array
329
+ ret = this.dataHashes[storeKey] = SC.clone(ret);
330
+ }
331
+ return ret;
332
+ },
333
+
334
+ /**
335
+ Reads a property from the hash - cloning it if needed so you can modify
336
+ it independently of any parent store. This method is really only well
337
+ tested for use with toMany relationships. Although it is public you
338
+ generally should not call it directly.
339
+
340
+ @param {Number} storeKey storeKey of data hash
341
+ @param {String} propertyName property to read
342
+ @returns {Object} editable property value
343
+ */
344
+ readEditableProperty: function(storeKey, propertyName) {
345
+ var hash = this.readEditableDataHash(storeKey),
346
+ editables = this.editables[storeKey], // get editable info...
347
+ ret = hash[propertyName];
348
+
349
+ // editables must be made into a hash so that we can keep track of which
350
+ // properties have already been made editable
351
+ if (editables === 1) editables = this.editables[storeKey] = {};
352
+
353
+ // clone if needed
354
+ if (!editables[propertyName]) {
355
+ ret = hash[propertyName];
356
+ if (ret && ret.isCopyable) ret = hash[propertyName] = ret.copy();
357
+ editables[propertyName] = YES ;
358
+ }
359
+
360
+ return ret ;
361
+ },
362
+
363
+ /**
364
+ Replaces the data hash for the storeKey. This will lock the data hash and
365
+ mark them as cloned. This will also call dataHashDidChange() for you.
366
+
367
+ Note that the hash you set here must be a different object from the
368
+ original data hash. Once you make a change here, you must also call
369
+ dataHashDidChange() to register the changes.
370
+
371
+ If the data hash does not yet exist in the store, this method will add it.
372
+ Pass the optional status to edit the status as well.
373
+
374
+ @param {Number} storeKey the store key to write
375
+ @param {Hash} hash the new hash
376
+ @param {String} status the new hash status
377
+ @returns {SC.Store} receiver
378
+ */
379
+ writeDataHash: function(storeKey, hash, status) {
380
+
381
+ // update dataHashes and optionally status.
382
+ if (hash) this.dataHashes[storeKey] = hash;
383
+ if (status) this.statuses[storeKey] = status ;
384
+
385
+ // also note that this hash is now editable
386
+ var editables = this.editables;
387
+ if (!editables) editables = this.editables = [];
388
+ editables[storeKey] = 1 ; // use number for dense array support
389
+
390
+ return this ;
391
+ },
392
+
393
+ /**
394
+ Removes the data hash from the store. This does not imply a deletion of
395
+ the record. You could be simply unloading the record. Eitherway,
396
+ removing the dataHash will be synced back to the parent store but not to
397
+ the server.
398
+
399
+ Note that you can optionally pass a new status to go along with this. If
400
+ you do not pass a status, it will change the status to SC.RECORD_EMPTY
401
+ (assuming you just unloaded the record). If you are deleting the record
402
+ you may set it to SC.Record.DESTROYED_CLEAN.
403
+
404
+ Be sure to also call dataHashDidChange() to register this change.
405
+
406
+ @param {Number} storeKey
407
+ @param {String} status optional new status
408
+ @returns {SC.Store} reciever
409
+ */
410
+ removeDataHash: function(storeKey, status) {
411
+ var rev ;
412
+
413
+ // don't use delete -- that will allow parent dataHash to come through
414
+ this.dataHashes[storeKey] = null;
415
+ this.statuses[storeKey] = status || SC.Record.EMPTY;
416
+ rev = this.revisions[storeKey] = this.revisions[storeKey]; // copy ref
417
+
418
+ // hash is gone and therefore no longer editable
419
+ var editables = this.editables;
420
+ if (editables) editables[storeKey] = 0 ;
421
+
422
+ return this ;
423
+ },
424
+
425
+ /**
426
+ Reads the current status for a storeKey. This will also lock the data
427
+ hash. If no status is found, returns SC.RECORD_EMPTY.
428
+
429
+ @param {Number} storeKey the store key
430
+ @returns {Number} status
431
+ */
432
+ readStatus: function(storeKey) {
433
+ // use readDataHash to handle optimistic locking. this could be inlined
434
+ // but for now this minimized copy-and-paste code.
435
+ this.readDataHash(storeKey);
436
+ return this.statuses[storeKey] || SC.Record.EMPTY;
437
+ },
438
+
439
+ /**
440
+ Reads the current status for the storeKey without actually locking the
441
+ record. Usually you won't need to use this method. It is mostly used
442
+ internally.
443
+
444
+ @param {Number} storeKey the store key
445
+ @returns {Number} status
446
+ */
447
+ peekStatus: function(storeKey) {
448
+ return this.statuses[storeKey] || SC.Record.EMPTY;
449
+ },
450
+
451
+ /**
452
+ Writes the current status for a storeKey. If the new status is
453
+ SC.Record.ERROR, you may also pass an optional error object. Otherwise
454
+ this param is ignored.
455
+
456
+ @param {Number} storeKey the store key
457
+ @param {String} newStatus the new status
458
+ @param {SC.Error} error optional error object
459
+ @returns {SC.Store} receiver
460
+ */
461
+ writeStatus: function(storeKey, newStatus) {
462
+ // use writeDataHash for now to handle optimistic lock. maximize code
463
+ // reuse.
464
+ return this.writeDataHash(storeKey, null, newStatus);
465
+ },
466
+
467
+ /**
468
+ Call this method whenever you modify some editable data hash to register
469
+ with the Store that the attribute values have actually changed. This will
470
+ do the book-keeping necessary to track the change across stores including
471
+ managing locks.
472
+
473
+ @param {Number|Array} storeKeys one or more store keys that changed
474
+ @param {Number} rev optional new revision number. normally leave null
475
+ @param {Boolean} statusOnly (optional) YES if only status changed
476
+ @param {String} key that changed (optional)
477
+ @returns {SC.Store} receiver
478
+ */
479
+ dataHashDidChange: function(storeKeys, rev, statusOnly, key) {
480
+
481
+ // update the revision for storeKey. Use generateStoreKey() because that
482
+ // gaurantees a universally (to this store hierarchy anyway) unique
483
+ // key value.
484
+ if (!rev) rev = SC.Store.generateStoreKey();
485
+ var isArray, len, idx, storeKey;
486
+
487
+ isArray = SC.typeOf(storeKeys) === SC.T_ARRAY;
488
+ if (isArray) {
489
+ len = storeKeys.length;
490
+ } else {
491
+ len = 1;
492
+ storeKey = storeKeys;
493
+ }
494
+
495
+ for(idx=0;idx<len;idx++) {
496
+ if (isArray) storeKey = storeKeys[idx];
497
+ this.revisions[storeKey] = rev;
498
+ this._notifyRecordPropertyChange(storeKey, statusOnly, key);
499
+ }
500
+
501
+ return this ;
502
+ },
503
+
504
+ /** @private
505
+ Will push all changes to a the recordPropertyChanges property
506
+ and execute flush() once at the end of the runloop.
507
+ */
508
+ _notifyRecordPropertyChange: function(storeKey, statusOnly, key) {
509
+
510
+ var records = this.records,
511
+ nestedStores = this.get('nestedStores'),
512
+ K = SC.Store,
513
+ rec, editState, len, idx, store, status, keys;
514
+
515
+ // pass along to nested stores
516
+ len = nestedStores ? nestedStores.length : 0 ;
517
+ for(idx=0;idx<len;idx++) {
518
+ store = nestedStores[idx];
519
+ status = store.peekStatus(storeKey); // important: peek avoids read-lock
520
+ editState = store.storeKeyEditState(storeKey);
521
+
522
+ // when store needs to propagate out changes in the parent store
523
+ // to nested stores
524
+ if (editState === K.INHERITED) {
525
+ store._notifyRecordPropertyChange(storeKey, statusOnly, key);
526
+
527
+ } else if (status & SC.Record.BUSY) {
528
+ // make sure nested store does not have any changes before resetting
529
+ if(store.get('hasChanges')) throw K.CHAIN_CONFLICT_ERROR;
530
+ store.reset();
531
+ }
532
+ }
533
+
534
+ // store info in changes hash and schedule notification if needed.
535
+ var changes = this.recordPropertyChanges;
536
+ if (!changes) {
537
+ changes = this.recordPropertyChanges =
538
+ { storeKeys: SC.CoreSet.create(),
539
+ records: SC.CoreSet.create(),
540
+ hasDataChanges: SC.CoreSet.create(),
541
+ propertyForStoreKeys: {} };
542
+ }
543
+
544
+ changes.storeKeys.add(storeKey);
545
+
546
+ if (records && (rec=records[storeKey])) {
547
+ changes.records.push(storeKey);
548
+
549
+ // If there are changes other than just the status we need to record
550
+ // that information so we do the right thing during the next flush.
551
+ // Note that if we're called multiple times before flush and one call
552
+ // has statusOnly=true and another has statusOnly=false, the flush will
553
+ // (correctly) operate in statusOnly=false mode.
554
+ if (!statusOnly) changes.hasDataChanges.push(storeKey);
555
+
556
+ // If this is a key specific change, make sure that only those
557
+ // properties/keys are notified. However, if a previous invocation of
558
+ // _notifyRecordPropertyChange specified that all keys have changed, we
559
+ // need to respect that.
560
+ if (key) {
561
+ if (!(keys = changes.propertyForStoreKeys[storeKey])) {
562
+ keys = changes.propertyForStoreKeys[storeKey] = SC.CoreSet.create();
563
+ }
564
+
565
+ // If it's '*' instead of a set, then that means there was a previous
566
+ // invocation that said all keys have changed.
567
+ if (keys !== '*') {
568
+ keys.add(key);
569
+ }
570
+ }
571
+ else {
572
+ // Mark that all properties have changed.
573
+ changes.propertyForStoreKeys[storeKey] = '*';
574
+ }
575
+ }
576
+
577
+ this.invokeOnce(this.flush);
578
+ return this;
579
+ },
580
+
581
+ /**
582
+ Delivers any pending changes to materialized records. Normally this
583
+ happens once, automatically, at the end of the RunLoop. If you have
584
+ updated some records and need to update records immediately, however,
585
+ you may call this manually.
586
+
587
+ @returns {SC.Store} receiver
588
+ */
589
+ flush: function() {
590
+ if (!this.recordPropertyChanges) return this;
591
+
592
+ var changes = this.recordPropertyChanges,
593
+ storeKeys = changes.storeKeys,
594
+ hasDataChanges = changes.hasDataChanges,
595
+ records = changes.records,
596
+ propertyForStoreKeys = changes.propertyForStoreKeys,
597
+ recordTypes = SC.CoreSet.create(),
598
+ rec, recordType, statusOnly, idx, len, storeKey, keys;
599
+
600
+ storeKeys.forEach(function(storeKey) {
601
+ if (records.contains(storeKey)) {
602
+ statusOnly = hasDataChanges.contains(storeKey) ? NO : YES;
603
+ rec = this.records[storeKey];
604
+ keys = propertyForStoreKeys ? propertyForStoreKeys[storeKey] : null;
605
+
606
+ // Are we invalidating all keys? If so, don't pass any to
607
+ // storeDidChangeProperties.
608
+ if (keys === '*') keys = null;
609
+
610
+ // remove it so we don't trigger this twice
611
+ records.remove(storeKey);
612
+
613
+ if (rec) rec.storeDidChangeProperties(statusOnly, keys);
614
+ }
615
+
616
+ recordType = SC.Store.recordTypeFor(storeKey);
617
+ recordTypes.add(recordType);
618
+
619
+ }, this);
620
+
621
+ if (storeKeys.get('length') > 0) this._notifyRecordArrays(storeKeys, recordTypes);
622
+
623
+ storeKeys.clear();
624
+ hasDataChanges.clear();
625
+ records.clear();
626
+ // Provide full reference to overwrite
627
+ this.recordPropertyChanges.propertyForStoreKeys = {};
628
+
629
+ return this;
630
+ },
631
+
632
+ /**
633
+ Resets the store content. This will clear all internal data for all
634
+ records, resetting them to an EMPTY state. You generally do not want
635
+ to call this method yourself, though you may override it.
636
+
637
+ @returns {SC.Store} receiver
638
+ */
639
+ reset: function() {
640
+
641
+ // create a new empty data store
642
+ this.dataHashes = {} ;
643
+ this.revisions = {} ;
644
+ this.statuses = {} ;
645
+
646
+ // also reset temporary objects and errors
647
+ this.chainedChanges = this.locks = this.editables = null;
648
+ this.changelog = null ;
649
+ this.recordErrors = null;
650
+ this.queryErrors = null;
651
+
652
+ var records = this.records, storeKey;
653
+ if (records) {
654
+ for(storeKey in records) {
655
+ if (!records.hasOwnProperty(storeKey)) continue ;
656
+ this._notifyRecordPropertyChange(parseInt(storeKey, 10), NO);
657
+ }
658
+ }
659
+
660
+ this.set('hasChanges', NO);
661
+ },
662
+
663
+ /** @private
664
+ Called by a nested store on a parent store to commit any changes from the
665
+ store. This will copy any changed dataHashes as well as any persistant
666
+ change logs.
667
+
668
+ If the parentStore detects a conflict with the optimistic locking, it will
669
+ raise an exception before it makes any changes. If you pass the
670
+ force flag then this detection phase will be skipped and the changes will
671
+ be applied even if another resource has modified the store in the mean
672
+ time.
673
+
674
+ @param {SC.Store} nestedStore the child store
675
+ @param {SC.Set} changes the set of changed store keys
676
+ @param {Boolean} force
677
+ @returns {SC.Store} receiver
678
+ */
679
+ commitChangesFromNestedStore: function(nestedStore, changes, force) {
680
+ // first, check for optimistic locking problems
681
+ if (!force) this._verifyLockRevisions(changes, nestedStore.locks);
682
+
683
+ // OK, no locking issues. So let's just copy them changes.
684
+ // get local reference to values.
685
+ var len = changes.length, i, storeKey, myDataHashes, myStatuses,
686
+ myEditables, myRevisions, chDataHashes, chStatuses, chRevisions;
687
+
688
+ myRevisions = this.revisions ;
689
+ myDataHashes = this.dataHashes;
690
+ myStatuses = this.statuses;
691
+ myEditables = this.editables ;
692
+
693
+ // setup some arrays if needed
694
+ if (!myEditables) myEditables = this.editables = [] ;
695
+
696
+ chDataHashes = nestedStore.dataHashes;
697
+ chRevisions = nestedStore.revisions ;
698
+ chStatuses = nestedStore.statuses;
699
+
700
+ for(i=0;i<len;i++) {
701
+ storeKey = changes[i];
702
+
703
+ // now copy changes
704
+ myDataHashes[storeKey] = chDataHashes[storeKey];
705
+ myStatuses[storeKey] = chStatuses[storeKey];
706
+ myRevisions[storeKey] = chRevisions[storeKey];
707
+
708
+ myEditables[storeKey] = 0 ; // always make dataHash no longer editable
709
+
710
+ this._notifyRecordPropertyChange(storeKey, NO);
711
+ }
712
+
713
+ // add any records to the changelog for commit handling
714
+ var myChangelog = this.changelog, chChangelog = nestedStore.changelog;
715
+ if (chChangelog) {
716
+ if (!myChangelog) myChangelog = this.changelog = SC.CoreSet.create();
717
+ myChangelog.addEach(chChangelog);
718
+ }
719
+ this.changelog = myChangelog;
720
+
721
+ // immediately flush changes to notify records - nested stores will flush
722
+ // later on.
723
+ if (!this.get('parentStore')) this.flush();
724
+
725
+ return this ;
726
+ },
727
+
728
+ /** @private
729
+ Verifies that the passed lock revisions match the current revisions
730
+ in the receiver store. If the lock revisions do not match, then the
731
+ store is in a conflict and an exception will be raised.
732
+
733
+ @param {Array} changes set of changes we are trying to apply
734
+ @param {SC.Set} locks the locks to verify
735
+ @returns {SC.Store} receiver
736
+ */
737
+ _verifyLockRevisions: function(changes, locks) {
738
+ var len = changes.length, revs = this.revisions, i, storeKey, lock, rev ;
739
+ if (locks && revs) {
740
+ for(i=0;i<len;i++) {
741
+ storeKey = changes[i];
742
+ lock = locks[storeKey] || 1;
743
+ rev = revs[storeKey] || 1;
744
+
745
+ // if the save revision for the item does not match the current rev
746
+ // the someone has changed the data hash in this store and we have
747
+ // a conflict.
748
+ if (lock < rev) throw SC.Store.CHAIN_CONFLICT_ERROR;
749
+ }
750
+ }
751
+ return this ;
752
+ },
753
+
754
+ // ..........................................................
755
+ // HIGH-LEVEL RECORD API
756
+ //
757
+
758
+ /**
759
+ Finds a single record instance with the specified recordType and id or an
760
+ array of records matching some query conditions.
761
+
762
+ h2. Finding a Single Record
763
+
764
+ If you pass a single recordType and id, this method will return an actual
765
+ record instance. If the record has not been loaded into the store yet,
766
+ this method will ask the data source to retrieve it. If no data source
767
+ indicates that it can retrieve the record, then this method will return
768
+ null.
769
+
770
+ Note that if the record needs to be retrieved from the server, then the
771
+ record instance returned from this method will not have any data yet.
772
+ Instead it will have a status of SC.Record.READY_LOADING. You can monitor
773
+ the status property to be notified when the record data is available for
774
+ you to use it.
775
+
776
+ h2. Find a Collection of Records
777
+
778
+ If you pass only a record type or a query object, you can instead find
779
+ all records matching a specified set of conditions. When you call find()
780
+ in this way, it will create a query if needed and pass it to the data
781
+ source to fetch the results.
782
+
783
+ If this is the first time you have fetched the query, then the store will
784
+ automatically ask the data source to fetch any records related to it as
785
+ well. Otherwise you can refresh the query results at anytime by calling
786
+ refresh() on the returned RecordArray.
787
+
788
+ You can detect whether a RecordArray is fetching from the server by
789
+ checking its status.
790
+
791
+ h2. Examples
792
+
793
+ Finding a single record:
794
+
795
+ {{{
796
+ MyApp.store.find(MyApp.Contact, "23"); // returns MyApp.Contact
797
+ }}}
798
+
799
+ Finding all records of a particular type:
800
+
801
+ {{{
802
+ MyApp.store.find(MyApp.Contact); // returns SC.RecordArray of contacts
803
+ }}}
804
+
805
+ Finding all contacts with first name John:
806
+
807
+ {{{
808
+ var query = SC.Query.local(MyApp.Contact, "firstName = %@", "John");
809
+ MyApp.store.find(query); // returns SC.RecordArray of contacts
810
+ }}}
811
+
812
+ Finding all contacts using a remote query:
813
+
814
+ {{{
815
+ var query = SC.Query.remote(MyApp.Contact);
816
+ MyApp.store.find(query); // returns SC.RecordArray filled by server
817
+ }}}
818
+
819
+ @param {SC.Record|String} recordType the expected record type
820
+ @param {String} id the id to load
821
+ @returns {SC.Record} record instance or null
822
+ */
823
+ find: function(recordType, id) {
824
+
825
+ // if recordType is passed as string, find object
826
+ if (SC.typeOf(recordType)===SC.T_STRING) {
827
+ recordType = SC.objectForPropertyPath(recordType);
828
+ }
829
+
830
+ // handle passing a query...
831
+ if ((arguments.length === 1) && !(recordType && recordType.get && recordType.get('isRecord'))) {
832
+ if (!recordType) throw new Error("SC.Store#find() must pass recordType or query");
833
+ if (!recordType.isQuery) {
834
+ recordType = SC.Query.local(recordType);
835
+ }
836
+ return this._findQuery(recordType, YES, YES);
837
+
838
+ // handle finding a single record
839
+ } else {
840
+ return this._findRecord(recordType, id);
841
+ }
842
+ },
843
+
844
+ /** @private
845
+ DEPRECATED used find() instead.
846
+
847
+ This method will accept a record type or query and return a record array
848
+ matching the results. This method was commonly used prior to SproutCore
849
+ 1.0. It has been deprecated in favor of a single find() method instead.
850
+
851
+ For compatibility, this method will continue to work in SproutCore 1.0 but
852
+ it will raise a warning. It will be removed in a future version of
853
+ SproutCore.
854
+ */
855
+ findAll: function(recordType, conditions, params) {
856
+ console.warn("SC.Store#findAll() will be removed in a future version of SproutCore. Use SC.Store#find() instead");
857
+
858
+
859
+ if (!recordType || !recordType.isQuery) {
860
+ recordType = SC.Query.local(recordType, conditions, params);
861
+ }
862
+
863
+ return this._findQuery(recordType, YES, YES);
864
+ },
865
+
866
+
867
+ _findQuery: function(query, createIfNeeded, refreshIfNew) {
868
+
869
+ // lookup the local RecordArray for this query.
870
+ var cache = this._scst_recordArraysByQuery,
871
+ key = SC.guidFor(query),
872
+ ret, ra ;
873
+ if (!cache) cache = this._scst_recordArraysByQuery = {};
874
+ ret = cache[key];
875
+
876
+ // if a RecordArray was not found, then create one and also add it to the
877
+ // list of record arrays to update.
878
+ if (!ret && createIfNeeded) {
879
+ cache[key] = ret = SC.RecordArray.create({ store: this, query: query });
880
+
881
+ ra = this.get('recordArrays');
882
+ if (!ra) this.set('recordArrays', ra = SC.Set.create());
883
+ ra.add(ret);
884
+
885
+ if (refreshIfNew) this.refreshQuery(query);
886
+ }
887
+
888
+ this.flush();
889
+ return ret ;
890
+ },
891
+
892
+ _findRecord: function(recordType, id) {
893
+
894
+ var storeKey ;
895
+
896
+ // if a record instance is passed, simply use the storeKey. This allows
897
+ // you to pass a record from a chained store to get the same record in the
898
+ // current store.
899
+ if (recordType && recordType.get && recordType.get('isRecord')) {
900
+ storeKey = recordType.get('storeKey');
901
+
902
+ // otherwise, lookup the storeKey for the passed id. look in subclasses
903
+ // as well.
904
+ } else storeKey = id ? recordType.storeKeyFor(id) : null;
905
+
906
+ if (storeKey && (this.readStatus(storeKey) === SC.Record.EMPTY)) {
907
+ storeKey = this.retrieveRecord(recordType, id);
908
+ }
909
+
910
+ // now we have the storeKey, materialize the record and return it.
911
+ return storeKey ? this.materializeRecord(storeKey) : null ;
912
+ },
913
+
914
+ // ..........................................................
915
+ // RECORD ARRAY OPERATIONS
916
+ //
917
+
918
+ /**
919
+ Called by the record array just before it is destroyed. This will
920
+ de-register it from receiving future notifications.
921
+
922
+ You should never call this method yourself. Instead call destroy() on the
923
+ RecordArray directly.
924
+
925
+ @param {SC.RecordArray} recordArray the record array
926
+ @returns {SC.Store} receiver
927
+ */
928
+ recordArrayWillDestroy: function(recordArray) {
929
+ var cache = this._scst_recordArraysByQuery,
930
+ set = this.get('recordArrays');
931
+
932
+ if (cache) delete cache[SC.guidFor(recordArray.get('query'))];
933
+ if (set) set.remove(recordArray);
934
+ return this ;
935
+ },
936
+
937
+ /**
938
+ Called by the record array whenever it needs the data source to refresh
939
+ its contents. Nested stores will actually just pass this along to the
940
+ parent store. The parent store will call fetch() on the data source.
941
+
942
+ You should never call this method yourself. Instead call refresh() on the
943
+ RecordArray directly.
944
+
945
+ @param {SC.Query} query the record array query to refresh
946
+ @returns {SC.Store} receiver
947
+ */
948
+ refreshQuery: function(query) {
949
+ if (!query) throw new Error("refreshQuery() requires a query");
950
+
951
+ var cache = this._scst_recordArraysByQuery,
952
+ recArray = cache ? cache[SC.guidFor(query)] : null,
953
+ source = this._getDataSource();
954
+
955
+ if (source && source.fetch) {
956
+ if (recArray) recArray.storeWillFetchQuery(query);
957
+ source.fetch.call(source, this, query);
958
+ }
959
+
960
+ return this ;
961
+ },
962
+
963
+ /** @private
964
+ Will ask all record arrays that have been returned from findAll
965
+ with an SC.Query to check their arrays with the new storeKeys
966
+
967
+ @param {SC.IndexSet} storeKeys set of storeKeys that changed
968
+ @param {SC.Set} recordTypes
969
+ @returns {SC.Store} receiver
970
+ */
971
+ _notifyRecordArrays: function(storeKeys, recordTypes) {
972
+ var recordArrays = this.get('recordArrays');
973
+ if (!recordArrays) return this;
974
+
975
+ recordArrays.forEach(function(recArray) {
976
+ if (recArray) recArray.storeDidChangeStoreKeys(storeKeys, recordTypes);
977
+ }, this);
978
+
979
+ return this ;
980
+ },
981
+
982
+
983
+ // ..........................................................
984
+ // LOW-LEVEL HELPERS
985
+ //
986
+
987
+ /**
988
+ Array of all records currently in the store with the specified
989
+ type. This method only reflects the actual records loaded into memory and
990
+ therefore is not usually needed at runtime. However you will often use
991
+ this method for testing.
992
+
993
+ @param {SC.Record} recordType the record type
994
+ @returns {SC.Array} array instance - usually SC.RecordArray
995
+ */
996
+ recordsFor: function(recordType) {
997
+ var storeKeys = [],
998
+ storeKeysById = recordType.storeKeysById(),
999
+ id, storeKey, ret;
1000
+
1001
+ // collect all non-empty store keys
1002
+ for(id in storeKeysById) {
1003
+ storeKey = storeKeysById[id]; // get the storeKey
1004
+ if (this.readStatus(storeKey) !== SC.RECORD_EMPTY) {
1005
+ storeKeys.push(storeKey);
1006
+ }
1007
+ }
1008
+
1009
+ if (storeKeys.length>0) {
1010
+ ret = SC.RecordArray.create({ store: this, storeKeys: storeKeys });
1011
+ } else ret = storeKeys; // empty array
1012
+ return ret ;
1013
+ },
1014
+
1015
+ _TMP_REC_ATTRS: {},
1016
+
1017
+ /**
1018
+ Given a storeKey, return a materialized record. You will not usually
1019
+ call this method yourself. Instead it will used by other methods when
1020
+ you find records by id or perform other searches.
1021
+
1022
+ If a recordType has been mapped to the storeKey, then a record instance
1023
+ will be returned even if the data hash has not been requested yet.
1024
+
1025
+ Each Store instance returns unique record instances for each storeKey.
1026
+
1027
+ @param {Number} storeKey The storeKey for the dataHash.
1028
+ @returns {SC.Record} Returns a record instance.
1029
+ */
1030
+ materializeRecord: function(storeKey) {
1031
+ var records = this.records, ret, recordType, attrs;
1032
+
1033
+ // look up in cached records
1034
+ if (!records) records = this.records = {}; // load cached records
1035
+ ret = records[storeKey];
1036
+ if (ret) return ret;
1037
+
1038
+ // not found -- OK, create one then.
1039
+ recordType = SC.Store.recordTypeFor(storeKey);
1040
+ if (!recordType) return null; // not recordType registered, nothing to do
1041
+
1042
+ attrs = this._TMP_REC_ATTRS ;
1043
+ attrs.storeKey = storeKey ;
1044
+ attrs.store = this ;
1045
+ ret = records[storeKey] = recordType.create(attrs);
1046
+
1047
+ return ret ;
1048
+ },
1049
+
1050
+ // ..........................................................
1051
+ // CORE RECORDS API
1052
+ //
1053
+ // The methods in this section can be used to manipulate records without
1054
+ // actually creating record instances.
1055
+
1056
+ /**
1057
+ Creates a new record instance with the passed recordType and dataHash.
1058
+ You can also optionally specify an id or else it will be pulled from the
1059
+ data hash.
1060
+
1061
+ Note that the record will not yet be saved back to the server. To save
1062
+ a record to the server, call commitChanges() on the store.
1063
+
1064
+ @param {SC.Record} recordType the record class to use on creation
1065
+ @param {Hash} dataHash the JSON attributes to assign to the hash.
1066
+ @param {String} id (optional) id to assign to record
1067
+
1068
+ @returns {SC.Record} Returns the created record
1069
+ */
1070
+ createRecord: function(recordType, dataHash, id) {
1071
+ var primaryKey, storeKey, status, K = SC.Record, changelog, defaultVal,
1072
+ ret;
1073
+
1074
+ // First, try to get an id. If no id is passed, look it up in the
1075
+ // dataHash.
1076
+ if (!id && (primaryKey = recordType.prototype.primaryKey)) {
1077
+ id = dataHash[primaryKey];
1078
+ // if still no id, check if there is a defaultValue function for
1079
+ // the primaryKey attribute and assign that
1080
+ defaultVal = recordType.prototype[primaryKey] ? recordType.prototype[primaryKey].defaultValue : null;
1081
+ if(!id && SC.typeOf(defaultVal)===SC.T_FUNCTION) {
1082
+ id = dataHash[primaryKey] = defaultVal();
1083
+ }
1084
+ }
1085
+
1086
+ // Next get the storeKey - base on id if available
1087
+ storeKey = id ? recordType.storeKeyFor(id) : SC.Store.generateStoreKey();
1088
+
1089
+ // now, check the state and do the right thing.
1090
+ status = this.readStatus(storeKey);
1091
+
1092
+ // check state
1093
+ // any busy or ready state or destroyed dirty state is not allowed
1094
+ if ((status & K.BUSY) ||
1095
+ (status & K.READY) ||
1096
+ (status == K.DESTROYED_DIRTY)) {
1097
+ throw id ? K.RECORD_EXISTS_ERROR : K.BAD_STATE_ERROR;
1098
+
1099
+ // allow error or destroyed state only with id
1100
+ } else if (!id && (status==SC.DESTROYED_CLEAN || status==SC.ERROR)) {
1101
+ throw K.BAD_STATE_ERROR;
1102
+ }
1103
+
1104
+ // add dataHash and setup initial status -- also save recordType
1105
+ this.writeDataHash(storeKey, (dataHash ? dataHash : {}), K.READY_NEW);
1106
+
1107
+ SC.Store.replaceRecordTypeFor(storeKey, recordType);
1108
+ this.dataHashDidChange(storeKey);
1109
+
1110
+ // Record is now in a committable state -- add storeKey to changelog
1111
+ changelog = this.changelog;
1112
+ if (!changelog) changelog = SC.Set.create();
1113
+ changelog.add(storeKey);
1114
+ this.changelog = changelog;
1115
+
1116
+ // if commit records is enabled
1117
+ if(this.get('commitRecordsAutomatically')){
1118
+ this.invokeLast(this.commitRecords);
1119
+ }
1120
+
1121
+ // Finally return materialized record, after we propagate the status to
1122
+ // any aggregrate records.
1123
+ ret = this.materializeRecord(storeKey);
1124
+ if (ret) ret.propagateToAggregates();
1125
+ return ret;
1126
+ },
1127
+
1128
+ /**
1129
+ Creates an array of new records. You must pass an array of dataHashes
1130
+ plus a recordType and, optionally, an array of ids. This will create an
1131
+ array of record instances with the same record type.
1132
+
1133
+ If you need to instead create a bunch of records with different data types
1134
+ you can instead pass an array of recordTypes, one for each data hash.
1135
+
1136
+ @param {SC.Record|Array} recordTypes class or array of classes
1137
+ @param {Array} dataHashes array of data hashes
1138
+ @param {Array} ids (optional) ids to assign to records
1139
+ @returns {Array} array of materialized record instances.
1140
+ */
1141
+ createRecords: function(recordTypes, dataHashes, ids) {
1142
+ var ret = [], recordType, id, isArray, len = dataHashes.length, idx ;
1143
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1144
+ if (!isArray) recordType = recordTypes;
1145
+ for(idx=0;idx<len;idx++) {
1146
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1147
+ id = ids ? ids[idx] : undefined ;
1148
+ ret.push(this.createRecord(recordType, dataHashes[idx], id));
1149
+ }
1150
+ return ret ;
1151
+ },
1152
+
1153
+
1154
+ /**
1155
+ Unloads a record, removing the data hash from the store. If you try to
1156
+ unload a record that is already destroyed then this method will have no effect.
1157
+ If you unload a record that does not exist or an error then an exception
1158
+ will be raised.
1159
+
1160
+ @param {SC.Record} recordType the recordType
1161
+ @param {String} id the record id
1162
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1163
+ @returns {SC.Store} receiver
1164
+ */
1165
+ unloadRecord: function(recordType, id, storeKey, newStatus) {
1166
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1167
+ var status = this.readStatus(storeKey), K = SC.Record;
1168
+ newStatus = newStatus || K.EMPTY;
1169
+ // handle status - ignore if destroying or destroyed
1170
+ if ((status === K.BUSY_DESTROYING) || (status & K.DESTROYED)) {
1171
+ return this; // nothing to do
1172
+
1173
+ // error out if empty
1174
+ } else if (status & K.BUSY) {
1175
+ throw K.BUSY_ERROR ;
1176
+
1177
+ // otherwise, destroy in dirty state
1178
+ } else status = newStatus ;
1179
+
1180
+ // remove the data hash, set new status
1181
+ this.removeDataHash(storeKey, status);
1182
+ this.dataHashDidChange(storeKey);
1183
+
1184
+ return this ;
1185
+ },
1186
+
1187
+ /**
1188
+ Unloads a group of records. If you have a set of record ids, unloading
1189
+ them this way can be faster than retrieving each record and unloading
1190
+ it individually.
1191
+
1192
+ You can pass either a single recordType or an array of recordTypes. If
1193
+ you pass a single recordType, then the record type will be used for each
1194
+ record. If you pass an array, then each id must have a matching record
1195
+ type in the array.
1196
+
1197
+ You can optionally pass an array of storeKeys instead of the recordType
1198
+ and ids. In this case the first two parameters will be ignored. This
1199
+ is usually only used by low-level internal methods. You will not usually
1200
+ unload records this way.
1201
+
1202
+ @param {SC.Record|Array} recordTypes class or array of classes
1203
+ @param {Array} ids ids to unload
1204
+ @param {Array} storeKeys (optional) store keys to unload
1205
+ @returns {SC.Store} receiver
1206
+ */
1207
+ unloadRecords: function(recordTypes, ids, storeKeys, newStatus) {
1208
+ var len, isArray, idx, id, recordType, storeKey;
1209
+ if(storeKeys===undefined){
1210
+ len = ids.length;
1211
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1212
+ if (!isArray) recordType = recordTypes;
1213
+ for(idx=0;idx<len;idx++) {
1214
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1215
+ id = ids ? ids[idx] : undefined ;
1216
+ this.unloadRecord(recordType, id, undefined, newStatus);
1217
+ }
1218
+ }else{
1219
+ len = storeKeys.length;
1220
+ for(idx=0;idx<len;idx++) {
1221
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1222
+ this.unloadRecord(undefined, undefined, storeKey, newStatus);
1223
+ }
1224
+ }
1225
+ return this ;
1226
+ },
1227
+
1228
+ /**
1229
+ Destroys a record, removing the data hash from the store and adding the
1230
+ record to the destroyed changelog. If you try to destroy a record that is
1231
+ already destroyed then this method will have no effect. If you destroy a
1232
+ record that does not exist or an error then an exception will be raised.
1233
+
1234
+ @param {SC.Record} recordType the recordType
1235
+ @param {String} id the record id
1236
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1237
+ @returns {SC.Store} receiver
1238
+ */
1239
+ destroyRecord: function(recordType, id, storeKey) {
1240
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1241
+ var status = this.readStatus(storeKey), changelog, K = SC.Record;
1242
+
1243
+ // handle status - ignore if destroying or destroyed
1244
+ if ((status === K.BUSY_DESTROYING) || (status & K.DESTROYED)) {
1245
+ return this; // nothing to do
1246
+
1247
+ // error out if empty
1248
+ } else if (status == K.EMPTY) {
1249
+ throw K.NOT_FOUND_ERROR ;
1250
+
1251
+ // error out if busy
1252
+ } else if (status & K.BUSY) {
1253
+ throw K.BUSY_ERROR ;
1254
+
1255
+ // if new status, destroy but leave in clean state
1256
+ } else if (status == K.READY_NEW) {
1257
+ status = K.DESTROYED_CLEAN ;
1258
+
1259
+ // otherwise, destroy in dirty state
1260
+ } else status = K.DESTROYED_DIRTY ;
1261
+
1262
+ // remove the data hash, set new status
1263
+ this.writeStatus(storeKey, status);
1264
+ this.dataHashDidChange(storeKey);
1265
+
1266
+ // add/remove change log
1267
+ changelog = this.changelog;
1268
+ if (!changelog) changelog = this.changelog = SC.Set.create();
1269
+
1270
+ ((status & K.DIRTY) ? changelog.add(storeKey) : changelog.remove(storeKey));
1271
+ this.changelog=changelog;
1272
+
1273
+ // if commit records is enabled
1274
+ if(this.get('commitRecordsAutomatically')){
1275
+ this.invokeLast(this.commitRecords);
1276
+ }
1277
+
1278
+ return this ;
1279
+ },
1280
+
1281
+ /**
1282
+ Destroys a group of records. If you have a set of record ids, destroying
1283
+ them this way can be faster than retrieving each record and destroying
1284
+ it individually.
1285
+
1286
+ You can pass either a single recordType or an array of recordTypes. If
1287
+ you pass a single recordType, then the record type will be used for each
1288
+ record. If you pass an array, then each id must have a matching record
1289
+ type in the array.
1290
+
1291
+ You can optionally pass an array of storeKeys instead of the recordType
1292
+ and ids. In this case the first two parameters will be ignored. This
1293
+ is usually only used by low-level internal methods. You will not usually
1294
+ destroy records this way.
1295
+
1296
+ @param {SC.Record|Array} recordTypes class or array of classes
1297
+ @param {Array} ids ids to destroy
1298
+ @param {Array} storeKeys (optional) store keys to destroy
1299
+ @returns {SC.Store} receiver
1300
+ */
1301
+ destroyRecords: function(recordTypes, ids, storeKeys) {
1302
+ var len, isArray, idx, id, recordType, storeKey;
1303
+ if(storeKeys===undefined){
1304
+ len = ids.length;
1305
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1306
+ if (!isArray) recordType = recordTypes;
1307
+ for(idx=0;idx<len;idx++) {
1308
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1309
+ id = ids ? ids[idx] : undefined ;
1310
+ this.destroyRecord(recordType, id, undefined);
1311
+ }
1312
+ }else{
1313
+ len = storeKeys.length;
1314
+ for(idx=0;idx<len;idx++) {
1315
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1316
+ this.destroyRecord(undefined, undefined, storeKey);
1317
+ }
1318
+ }
1319
+ return this ;
1320
+ },
1321
+
1322
+ /**
1323
+ Notes that the data for the given record id has changed. The record will
1324
+ be committed to the server the next time you commit the root store. Only
1325
+ call this method on a record in a READY state of some type.
1326
+
1327
+ @param {SC.Record} recordType the recordType
1328
+ @param {String} id the record id
1329
+ @param {Number} storeKey (optional) if passed, ignores recordType and id
1330
+ @param {String} key that changed (optional)
1331
+ @param {Boolean} if the change is to statusOnly (optional)
1332
+ @returns {SC.Store} receiver
1333
+ */
1334
+ recordDidChange: function(recordType, id, storeKey, key, statusOnly) {
1335
+ if (storeKey === undefined) storeKey = recordType.storeKeyFor(id);
1336
+ var status = this.readStatus(storeKey), changelog, K = SC.Record;
1337
+
1338
+ // BUSY_LOADING, BUSY_CREATING, BUSY_COMMITTING, BUSY_REFRESH_CLEAN
1339
+ // BUSY_REFRESH_DIRTY, BUSY_DESTROYING
1340
+ if (status & K.BUSY) {
1341
+ throw K.BUSY_ERROR ;
1342
+
1343
+ // if record is not in ready state, then it is not found.
1344
+ // ERROR, EMPTY, DESTROYED_CLEAN, DESTROYED_DIRTY
1345
+ } else if (!(status & K.READY)) {
1346
+ throw K.NOT_FOUND_ERROR ;
1347
+
1348
+ // otherwise, make new status READY_DIRTY unless new.
1349
+ // K.READY_CLEAN, K.READY_DIRTY, ignore K.READY_NEW
1350
+ } else {
1351
+ if (status != K.READY_NEW) this.writeStatus(storeKey, K.READY_DIRTY);
1352
+ }
1353
+
1354
+ // record data hash change
1355
+ this.dataHashDidChange(storeKey, null, statusOnly, key);
1356
+
1357
+ // record in changelog
1358
+ changelog = this.changelog ;
1359
+ if (!changelog) changelog = this.changelog = SC.Set.create() ;
1360
+ changelog.add(storeKey);
1361
+ this.changelog = changelog;
1362
+
1363
+ // if commit records is enabled
1364
+ if(this.get('commitRecordsAutomatically')){
1365
+ this.invokeLast(this.commitRecords);
1366
+ }
1367
+
1368
+ return this ;
1369
+ },
1370
+
1371
+ /**
1372
+ Mark a group of records as dirty. The records will be committed to the
1373
+ server the next time you commit changes on the root store. If you have a
1374
+ set of record ids, marking them dirty this way can be faster than
1375
+ retrieving each record and destroying it individually.
1376
+
1377
+ You can pass either a single recordType or an array of recordTypes. If
1378
+ you pass a single recordType, then the record type will be used for each
1379
+ record. If you pass an array, then each id must have a matching record
1380
+ type in the array.
1381
+
1382
+ You can optionally pass an array of storeKeys instead of the recordType
1383
+ and ids. In this case the first two parameters will be ignored. This
1384
+ is usually only used by low-level internal methods.
1385
+
1386
+ @param {SC.Record|Array} recordTypes class or array of classes
1387
+ @param {Array} ids ids to destroy
1388
+ @param {Array} storeKeys (optional) store keys to destroy
1389
+ @returns {SC.Store} receiver
1390
+ */
1391
+ recordsDidChange: function(recordTypes, ids, storeKeys) {
1392
+ var len, isArray, idx, id, recordType, storeKey;
1393
+ if(storeKeys===undefined){
1394
+ len = ids.length;
1395
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY;
1396
+ if (!isArray) recordType = recordTypes;
1397
+ for(idx=0;idx<len;idx++) {
1398
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1399
+ id = ids ? ids[idx] : undefined ;
1400
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1401
+ this.recordDidChange(recordType, id, storeKey);
1402
+ }
1403
+ }else{
1404
+ len = storeKeys.length;
1405
+ for(idx=0;idx<len;idx++) {
1406
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1407
+ this.recordDidChange(undefined, undefined, storeKey);
1408
+ }
1409
+ }
1410
+ return this ;
1411
+ },
1412
+
1413
+ /**
1414
+ Retrieves a set of records from the server. If the records has
1415
+ already been loaded in the store, then this method will simply return.
1416
+ Otherwise if your store has a dataSource, this will call the
1417
+ dataSource to retrieve the record. Generally you will not need to
1418
+ call this method yourself. Instead you can just use find().
1419
+
1420
+ This will not actually create a record instance but it will initiate a
1421
+ load of the record from the server. You can subsequently get a record
1422
+ instance itself using materializeRecord()
1423
+
1424
+ @param {SC.Record|Array} recordTypes class or array of classes
1425
+ @param {Array} ids ids to retrieve
1426
+ @param {Array} storeKeys (optional) store keys to retrieve
1427
+ @param {Boolean} isRefresh
1428
+ @returns {Array} storeKeys to be retrieved
1429
+ */
1430
+ retrieveRecords: function(recordTypes, ids, storeKeys, isRefresh) {
1431
+
1432
+ var source = this._getDataSource(),
1433
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1434
+ len = (!storeKeys) ? ids.length : storeKeys.length,
1435
+ ret = [],
1436
+ rev = SC.Store.generateStoreKey(),
1437
+ K = SC.Record,
1438
+ recordType, idx, storeKey, status, ok;
1439
+
1440
+ if (!isArray) recordType = recordTypes;
1441
+
1442
+ // if no storeKeys were passed, map recordTypes + ids
1443
+ for(idx=0;idx<len;idx++) {
1444
+
1445
+ // collect store key
1446
+ if (storeKeys) {
1447
+ storeKey = storeKeys[idx];
1448
+ } else {
1449
+ if (isArray) recordType = recordTypes[idx];
1450
+ storeKey = recordType.storeKeyFor(ids[idx]);
1451
+ }
1452
+
1453
+ // collect status and process
1454
+ status = this.readStatus(storeKey);
1455
+
1456
+ // K.EMPTY, K.ERROR, K.DESTROYED_CLEAN - initial retrieval
1457
+ if ((status == K.EMPTY) || (status == K.ERROR) || (status == K.DESTROYED_CLEAN)) {
1458
+ this.writeStatus(storeKey, K.BUSY_LOADING);
1459
+ this.dataHashDidChange(storeKey, rev, YES);
1460
+ ret.push(storeKey);
1461
+
1462
+ // otherwise, ignore record unless isRefresh is YES.
1463
+ } else if (isRefresh) {
1464
+ // K.READY_CLEAN, K.READY_DIRTY, ignore K.READY_NEW
1465
+ if (status & K.READY) {
1466
+ this.writeStatus(storeKey, K.BUSY_REFRESH | (status & 0x03)) ;
1467
+ this.dataHashDidChange(storeKey, rev, YES);
1468
+ ret.push(storeKey);
1469
+
1470
+ // K.BUSY_DESTROYING, K.BUSY_COMMITTING, K.BUSY_CREATING
1471
+ } else if ((status == K.BUSY_DESTROYING) || (status == K.BUSY_CREATING) || (status == K.BUSY_COMMITTING)) {
1472
+ throw K.BUSY_ERROR ;
1473
+
1474
+ // K.DESTROY_DIRTY, bad state...
1475
+ } else if (status == K.DESTROYED_DIRTY) {
1476
+ throw K.BAD_STATE_ERROR ;
1477
+
1478
+ // ignore K.BUSY_LOADING, K.BUSY_REFRESH_CLEAN, K.BUSY_REFRESH_DIRTY
1479
+ }
1480
+ }
1481
+ }
1482
+
1483
+ // now retrieve storekeys from dataSource. if there is no dataSource,
1484
+ // then act as if we couldn't retrieve.
1485
+ ok = NO;
1486
+ if (source) ok = source.retrieveRecords.call(source, this, ret, ids);
1487
+
1488
+ // if the data source could not retrieve or if there is no source, then
1489
+ // simulate the data source calling dataSourceDidError on those we are
1490
+ // loading for the first time or dataSourceDidComplete on refreshes.
1491
+ if (!ok) {
1492
+ len = ret.length;
1493
+ rev = SC.Store.generateStoreKey();
1494
+ for(idx=0;idx<len;idx++) {
1495
+ storeKey = ret[idx];
1496
+ status = this.readStatus(storeKey);
1497
+ if (status === K.BUSY_LOADING) {
1498
+ this.writeStatus(storeKey, K.ERROR);
1499
+ this.dataHashDidChange(storeKey, rev, YES);
1500
+
1501
+ } else if (status & K.BUSY_REFRESH) {
1502
+ this.writeStatus(storeKey, K.READY | (status & 0x03));
1503
+ this.dataHashDidChange(storeKey, rev, YES);
1504
+ }
1505
+ }
1506
+ ret.length = 0 ; // truncate to indicate that none could refresh
1507
+ }
1508
+ return ret ;
1509
+ },
1510
+
1511
+ _TMP_RETRIEVE_ARRAY: [],
1512
+
1513
+ /**
1514
+ Retrieves a record from the server. If the record has already been loaded
1515
+ in the store, then this method will simply return. Otherwise if your
1516
+ store has a dataSource, this will call the dataSource to retrieve the
1517
+ record. Generally you will not need to call this method yourself.
1518
+ Instead you can just use find().
1519
+
1520
+ This will not actually create a record instance but it will initiate a
1521
+ load of the record from the server. You can subsequently get a record
1522
+ instance itself using materializeRecord()
1523
+
1524
+ @param {SC.Record} recordType class
1525
+ @param {String} id id to retrieve
1526
+ @param {Number} storeKey (optional) store key
1527
+ @param {Boolean} isRefresh
1528
+ @returns {Number} storeKey that was retrieved
1529
+ */
1530
+ retrieveRecord: function(recordType, id, storeKey, isRefresh) {
1531
+ var array = this._TMP_RETRIEVE_ARRAY,
1532
+ ret;
1533
+
1534
+ if (storeKey) {
1535
+ array[0] = storeKey;
1536
+ storeKey = array;
1537
+ id = null ;
1538
+ } else {
1539
+ array[0] = id;
1540
+ id = array;
1541
+ }
1542
+
1543
+ ret = this.retrieveRecords(recordType, id, storeKey, isRefresh);
1544
+ array.length = 0 ;
1545
+ return ret[0];
1546
+ },
1547
+
1548
+ /**
1549
+ Refreshes a record from the server. If the record has already been loaded
1550
+ in the store, then this method will request a refresh from the dataSource.
1551
+ Otherwise it will attempt to retrieve the record.
1552
+
1553
+ @param {String} id to id of the record to load
1554
+ @param {SC.Record} recordType the expected record type
1555
+ @param {Number} storeKey (optional) optional store key
1556
+ @returns {Boolean} YES if the retrieval was a success.
1557
+ */
1558
+ refreshRecord: function(recordType, id, storeKey) {
1559
+ return !!this.retrieveRecord(recordType, id, storeKey, YES);
1560
+ },
1561
+
1562
+ /**
1563
+ Refreshes a set of records from the server. If the records has already been loaded
1564
+ in the store, then this method will request a refresh from the dataSource.
1565
+ Otherwise it will attempt to retrieve them.
1566
+
1567
+ @param {SC.Record|Array} recordTypes class or array of classes
1568
+ @param {Array} ids ids to destroy
1569
+ @param {Array} storeKeys (optional) store keys to destroy
1570
+ @returns {Boolean} YES if the retrieval was a success.
1571
+ */
1572
+ refreshRecords: function(recordTypes, ids, storeKeys) {
1573
+ var ret = this.retrieveRecords(recordTypes, ids, storeKeys, YES);
1574
+ return ret && ret.length>0;
1575
+ },
1576
+
1577
+ /**
1578
+ Commits the passed store keys or ids. If no storeKeys are given
1579
+ it will commit any records in the changelog.
1580
+
1581
+ Based on the current state of the record, this will ask the data
1582
+ source to perform the appropriate actions
1583
+ on the store keys.
1584
+
1585
+ @param {Array} recordTypes the expected record types (SC.Record)
1586
+ @param {Array} ids to commit
1587
+ @param {SC.Set} storeKeys to commit
1588
+ @param {Hash} params optional additional parameters to pass along to the
1589
+ data source
1590
+
1591
+ @returns {Boolean} if the action was succesful.
1592
+ */
1593
+ commitRecords: function(recordTypes, ids, storeKeys, params) {
1594
+
1595
+ var source = this._getDataSource(),
1596
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1597
+ retCreate= [], retUpdate= [], retDestroy = [],
1598
+ rev = SC.Store.generateStoreKey(),
1599
+ K = SC.Record,
1600
+ recordType, idx, storeKey, status, key, ret, len ;
1601
+
1602
+ // If no params are passed, look up storeKeys in the changelog property.
1603
+ // Remove any committed records from changelog property.
1604
+
1605
+ if(!recordTypes && !ids && !storeKeys){
1606
+ storeKeys = this.changelog;
1607
+ }
1608
+
1609
+ len = storeKeys ? storeKeys.get('length') : (ids ? ids.get('length') : 0);
1610
+
1611
+ for(idx=0;idx<len;idx++) {
1612
+
1613
+ // collect store key
1614
+ if (storeKeys) {
1615
+ storeKey = storeKeys[idx];
1616
+ } else {
1617
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1618
+ else recordType = recordTypes;
1619
+ storeKey = recordType.storeKeyFor(ids[idx]);
1620
+ }
1621
+
1622
+ // collect status and process
1623
+ status = this.readStatus(storeKey);
1624
+
1625
+ if ((status == K.EMPTY) || (status == K.ERROR)) {
1626
+ throw K.NOT_FOUND_ERROR ;
1627
+ }
1628
+ else {
1629
+ if(status==K.READY_NEW) {
1630
+ this.writeStatus(storeKey, K.BUSY_CREATING);
1631
+ this.dataHashDidChange(storeKey, rev, YES);
1632
+ retCreate.push(storeKey);
1633
+ } else if (status==K.READY_DIRTY) {
1634
+ this.writeStatus(storeKey, K.BUSY_COMMITTING);
1635
+ this.dataHashDidChange(storeKey, rev, YES);
1636
+ retUpdate.push(storeKey);
1637
+ } else if (status==K.DESTROYED_DIRTY) {
1638
+ this.writeStatus(storeKey, K.BUSY_DESTROYING);
1639
+ this.dataHashDidChange(storeKey, rev, YES);
1640
+ retDestroy.push(storeKey);
1641
+ } else if (status==K.DESTROYED_CLEAN) {
1642
+ this.dataHashDidChange(storeKey, rev, YES);
1643
+ }
1644
+ // ignore K.READY_CLEAN, K.BUSY_LOADING, K.BUSY_CREATING, K.BUSY_COMMITTING,
1645
+ // K.BUSY_REFRESH_CLEAN, K_BUSY_REFRESH_DIRTY, KBUSY_DESTROYING
1646
+ }
1647
+ }
1648
+
1649
+ // now commit storekeys to dataSource
1650
+ if (source && (len>0 || params)) {
1651
+ ret = source.commitRecords.call(source, this, retCreate, retUpdate, retDestroy, params);
1652
+ }
1653
+
1654
+ //remove all commited changes from changelog
1655
+ if (ret && !recordTypes && !ids) {
1656
+ if (storeKeys === this.changelog) {
1657
+ this.changelog = null;
1658
+ }
1659
+ else {
1660
+ this.changelog.removeEach(storeKeys);
1661
+ }
1662
+ }
1663
+ return ret ;
1664
+ },
1665
+
1666
+ /**
1667
+ Commits the passed store key or id. Based on the current state of the
1668
+ record, this will ask the data source to perform the appropriate action
1669
+ on the store key.
1670
+
1671
+ You have to pass either the id or the storeKey otherwise it will return
1672
+ NO.
1673
+
1674
+ @param {SC.Record} recordType the expected record type
1675
+ @param {String} id the id of the record to commit
1676
+ @param {Number} storeKey the storeKey of the record to commit
1677
+ @param {Hash} params optional additonal params that will passed down
1678
+ to the data source
1679
+ @returns {Boolean} if the action was successful.
1680
+ */
1681
+ commitRecord: function(recordType, id, storeKey, params) {
1682
+ var array = this._TMP_RETRIEVE_ARRAY,
1683
+ ret ;
1684
+ if (id === undefined && storeKey === undefined ) return NO;
1685
+ if (storeKey !== undefined) {
1686
+ array[0] = storeKey;
1687
+ storeKey = array;
1688
+ id = null ;
1689
+ } else {
1690
+ array[0] = id;
1691
+ id = array;
1692
+ }
1693
+
1694
+ ret = this.commitRecords(recordType, id, storeKey, params);
1695
+ array.length = 0 ;
1696
+ return ret;
1697
+ },
1698
+
1699
+ /**
1700
+ Cancels an inflight request for the passed records. Depending on the
1701
+ server implementation, this could cancel an entire request, causing
1702
+ other records to also transition their current state.
1703
+
1704
+ @param {SC.Record|Array} recordTypes class or array of classes
1705
+ @param {Array} ids ids to destroy
1706
+ @param {Array} storeKeys (optional) store keys to destroy
1707
+ @returns {SC.Store} the store.
1708
+ */
1709
+ cancelRecords: function(recordTypes, ids, storeKeys) {
1710
+ var source = this._getDataSource(),
1711
+ isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1712
+ K = SC.Record,
1713
+ ret = [],
1714
+ status, len, idx, id, recordType, storeKey;
1715
+
1716
+ len = (storeKeys === undefined) ? ids.length : storeKeys.length;
1717
+ for(idx=0;idx<len;idx++) {
1718
+ if (isArray) recordType = recordTypes[idx] || SC.Record;
1719
+ else recordType = recordTypes || SC.Record;
1720
+
1721
+ id = ids ? ids[idx] : undefined ;
1722
+
1723
+ if(storeKeys===undefined){
1724
+ storeKey = recordType.storeKeyFor(id);
1725
+ }else{
1726
+ storeKey = storeKeys ? storeKeys[idx] : undefined ;
1727
+ }
1728
+ if(storeKey) {
1729
+ status = this.readStatus(storeKey);
1730
+
1731
+ if ((status == K.EMPTY) || (status == K.ERROR)) {
1732
+ throw K.NOT_FOUND_ERROR ;
1733
+ }
1734
+ ret.push(storeKey);
1735
+ }
1736
+ }
1737
+
1738
+ if (source) source.cancel.call(source, this, ret);
1739
+
1740
+ return this ;
1741
+ },
1742
+
1743
+ /**
1744
+ Cancels an inflight request for the passed record. Depending on the
1745
+ server implementation, this could cancel an entire request, causing
1746
+ other records to also transition their current state.
1747
+
1748
+ @param {SC.Record|Array} recordTypes class or array of classes
1749
+ @param {Array} ids ids to destroy
1750
+ @param {Array} storeKeys (optional) store keys to destroy
1751
+ @returns {SC.Store} the store.
1752
+ */
1753
+ cancelRecord: function(recordType, id, storeKey) {
1754
+ var array = this._TMP_RETRIEVE_ARRAY,
1755
+ ret ;
1756
+
1757
+ if (storeKey !== undefined) {
1758
+ array[0] = storeKey;
1759
+ storeKey = array;
1760
+ id = null ;
1761
+ } else {
1762
+ array[0] = id;
1763
+ id = array;
1764
+ }
1765
+
1766
+ ret = this.cancelRecords(recordType, id, storeKey);
1767
+ array.length = 0 ;
1768
+ return this;
1769
+ },
1770
+
1771
+ /**
1772
+ Convenience method can be called by the store or other parts of your
1773
+ application to load a record into the store. This method will take a
1774
+ recordType and a data hashes and either add or update the
1775
+ record in the store.
1776
+
1777
+ The loaded records will be in an SC.Record.READY_CLEAN state, indicating
1778
+ they were loaded from the data source and do not need to be committed
1779
+ back before changing.
1780
+
1781
+ This method will check the state of the storeKey and call either
1782
+ pushRetrieve() or dataSourceDidComplete(). The standard state constraints
1783
+ for these methods apply here.
1784
+
1785
+ The return value will be the storeKey used for the push. This is often
1786
+ convenient to pass into loadQuery(), if you are fetching a remote query.
1787
+
1788
+ If you are upgrading from a pre SproutCore 1.0 application, this method
1789
+ is the closest to the old updateRecord().
1790
+
1791
+ @param {SC.Record} recordType the record type
1792
+ @param {Array} dataHash to update
1793
+ @param {Array} id optional. if not passed lookup on the hash
1794
+ @returns {String} store keys assigned to these id
1795
+ */
1796
+ loadRecord: function(recordType, dataHash, id) {
1797
+ var K = SC.Record,
1798
+ ret, primaryKey, storeKey;
1799
+
1800
+ // save lookup info
1801
+ recordType = recordType || SC.Record;
1802
+ primaryKey = recordType.prototype.primaryKey;
1803
+
1804
+
1805
+ // push each record
1806
+ id = id || dataHash[primaryKey];
1807
+ ret = storeKey = recordType.storeKeyFor(id); // needed to cache
1808
+
1809
+ if (this.readStatus(storeKey) & K.BUSY) {
1810
+ this.dataSourceDidComplete(storeKey, dataHash, id);
1811
+ } else this.pushRetrieve(recordType, id, dataHash, storeKey);
1812
+
1813
+ // return storeKey
1814
+ return ret ;
1815
+ },
1816
+
1817
+ /**
1818
+ Convenience method can be called by the store or other parts of your
1819
+ application to load records into the store. This method will take a
1820
+ recordType and an array of data hashes and either add or update the
1821
+ record in the store.
1822
+
1823
+ The loaded records will be in an SC.Record.READY_CLEAN state, indicating
1824
+ they were loaded from the data source and do not need to be committed
1825
+ back before changing.
1826
+
1827
+ This method will check the state of each storeKey and call either
1828
+ pushRetrieve() or dataSourceDidComplete(). The standard state constraints
1829
+ for these methods apply here.
1830
+
1831
+ The return value will be the storeKeys used for each push. This is often
1832
+ convenient to pass into loadQuery(), if you are fetching a remote query.
1833
+
1834
+ If you are upgrading from a pre SproutCore 1.0 application, this method
1835
+ is the closest to the old updateRecords().
1836
+
1837
+ @param {SC.Record} recordTypes the record type or array of record types
1838
+ @param {Array} dataHashes array of data hashes to update
1839
+ @param {Array} ids optional array of ids. if not passed lookup on hashes
1840
+ @returns {Array} store keys assigned to these ids
1841
+ */
1842
+ loadRecords: function(recordTypes, dataHashes, ids) {
1843
+ var isArray = SC.typeOf(recordTypes) === SC.T_ARRAY,
1844
+ len = dataHashes.get('length'),
1845
+ ret = [],
1846
+ K = SC.Record,
1847
+ recordType, id, primaryKey, idx, dataHash, storeKey;
1848
+
1849
+ // save lookup info
1850
+ if (!isArray) {
1851
+ recordType = recordTypes || SC.Record;
1852
+ primaryKey = recordType.prototype.primaryKey ;
1853
+ }
1854
+
1855
+ // push each record
1856
+ for(idx=0;idx<len;idx++) {
1857
+ dataHash = dataHashes.objectAt(idx);
1858
+ if (isArray) {
1859
+ recordType = recordTypes.objectAt(idx) || SC.Record;
1860
+ primaryKey = recordType.prototype.primaryKey ;
1861
+ }
1862
+ id = (ids) ? ids.objectAt(idx) : dataHash[primaryKey];
1863
+ ret[idx] = this.loadRecord(recordType, dataHash, id);
1864
+
1865
+ }
1866
+
1867
+ // return storeKeys
1868
+ return ret ;
1869
+ },
1870
+
1871
+ /**
1872
+ Returns the SC.Error object associated with a specific record.
1873
+
1874
+ @param {Number} storeKey The store key of the record.
1875
+
1876
+ @returns {SC.Error} SC.Error or undefined if no error associated with the record.
1877
+ */
1878
+ readError: function(storeKey) {
1879
+ var errors = this.recordErrors ;
1880
+ return errors ? errors[storeKey] : undefined ;
1881
+ },
1882
+
1883
+ /**
1884
+ Returns the SC.Error object associated with a specific query.
1885
+
1886
+ @param {SC.Query} query The SC.Query with which the error is associated.
1887
+
1888
+ @returns {SC.Error} SC.Error or undefined if no error associated with the query.
1889
+ */
1890
+ readQueryError: function(query) {
1891
+ var errors = this.queryErrors ;
1892
+ return errors ? errors[SC.guidFor(query)] : undefined ;
1893
+ },
1894
+
1895
+ // ..........................................................
1896
+ // DATA SOURCE CALLBACKS
1897
+ //
1898
+ // Mathods called by the data source on the store
1899
+
1900
+ /**
1901
+ Called by a dataSource when it cancels an inflight operation on a
1902
+ record. This will transition the record back to it non-inflight state.
1903
+
1904
+ @param {Number} storeKey record store key to cancel
1905
+ @returns {SC.Store} reciever
1906
+ */
1907
+ dataSourceDidCancel: function(storeKey) {
1908
+ var status = this.readStatus(storeKey),
1909
+ K = SC.Record;
1910
+
1911
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
1912
+ // DESTROYED_DIRTY
1913
+ if (!(status & K.BUSY)) {
1914
+ throw K.BAD_STATE_ERROR; // should never be called in this state
1915
+
1916
+ }
1917
+
1918
+ // otherwise, determine proper state transition
1919
+ switch(status) {
1920
+ case K.BUSY_LOADING:
1921
+ status = K.EMPTY;
1922
+ break ;
1923
+
1924
+ case K.BUSY_CREATING:
1925
+ status = K.READY_NEW;
1926
+ break;
1927
+
1928
+ case K.BUSY_COMMITTING:
1929
+ status = K.READY_DIRTY ;
1930
+ break;
1931
+
1932
+ case K.BUSY_REFRESH_CLEAN:
1933
+ status = K.READY_CLEAN;
1934
+ break;
1935
+
1936
+ case K.BUSY_REFRESH_DIRTY:
1937
+ status = K.READY_DIRTY ;
1938
+ break ;
1939
+
1940
+ case K.BUSY_DESTROYING:
1941
+ status = K.DESTROYED_DIRTY ;
1942
+ break;
1943
+
1944
+ default:
1945
+ throw K.BAD_STATE_ERROR ;
1946
+ }
1947
+ this.writeStatus(storeKey, status) ;
1948
+ this.dataHashDidChange(storeKey, null, YES);
1949
+
1950
+ return this ;
1951
+ },
1952
+
1953
+ /**
1954
+ Called by a data source when it creates or commits a record. Passing an
1955
+ optional id will remap the storeKey to the new record id. This is
1956
+ required when you commit a record that does not have an id yet.
1957
+
1958
+ @param {Number} storeKey record store key to change to READY_CLEAN state
1959
+ @param {Hash} dataHash optional data hash to replace current hash
1960
+ @param {Object} newId optional new id to replace the old one
1961
+ @returns {SC.Store} reciever
1962
+ */
1963
+ dataSourceDidComplete: function(storeKey, dataHash, newId) {
1964
+ var status = this.readStatus(storeKey), K = SC.Record, statusOnly;
1965
+
1966
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
1967
+ // DESTROYED_DIRTY
1968
+ if (!(status & K.BUSY)) {
1969
+ throw K.BAD_STATE_ERROR; // should never be called in this state
1970
+ }
1971
+
1972
+ // otherwise, determine proper state transition
1973
+ if(status===K.BUSY_DESTROYING) {
1974
+ throw K.BAD_STATE_ERROR ;
1975
+ } else status = K.READY_CLEAN ;
1976
+
1977
+ this.writeStatus(storeKey, status) ;
1978
+ if (dataHash) this.writeDataHash(storeKey, dataHash, status) ;
1979
+ if (newId) SC.Store.replaceIdFor(storeKey, newId);
1980
+
1981
+ statusOnly = dataHash || newId ? NO : YES;
1982
+ this.dataHashDidChange(storeKey, null, statusOnly);
1983
+
1984
+ return this ;
1985
+ },
1986
+
1987
+ /**
1988
+ Called by a data source when it has destroyed a record. This will
1989
+ transition the record to the proper state.
1990
+
1991
+ @param {Number} storeKey record store key to cancel
1992
+ @returns {SC.Store} reciever
1993
+ */
1994
+ dataSourceDidDestroy: function(storeKey) {
1995
+ var status = this.readStatus(storeKey), K = SC.Record;
1996
+
1997
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
1998
+ // DESTROYED_DIRTY
1999
+ if (!(status & K.BUSY)) {
2000
+ throw K.BAD_STATE_ERROR; // should never be called in this state
2001
+ }
2002
+ // otherwise, determine proper state transition
2003
+ else{
2004
+ status = K.DESTROYED_CLEAN ;
2005
+ }
2006
+ this.removeDataHash(storeKey, status) ;
2007
+ this.dataHashDidChange(storeKey);
2008
+
2009
+ return this ;
2010
+ },
2011
+
2012
+ /**
2013
+ Converts the passed record into an error object.
2014
+
2015
+ @param {Number} storeKey record store key to error
2016
+ @param {SC.Error} error [optional] an SC.Error instance to associate with storeKey
2017
+ @returns {SC.Store} reciever
2018
+ */
2019
+ dataSourceDidError: function(storeKey, error) {
2020
+ var status = this.readStatus(storeKey), errors = this.recordErrors, K = SC.Record;
2021
+
2022
+ // EMPTY, ERROR, READY_CLEAN, READY_NEW, READY_DIRTY, DESTROYED_CLEAN,
2023
+ // DESTROYED_DIRTY
2024
+ if (!(status & K.BUSY)) throw K.BAD_STATE_ERROR;
2025
+
2026
+ // otherwise, determine proper state transition
2027
+ else status = K.ERROR ;
2028
+
2029
+ // Add the error to the array of record errors (for lookup later on if necessary).
2030
+ if (error && error.isError) {
2031
+ if (!errors) errors = this.recordErrors = [];
2032
+ errors[storeKey] = error;
2033
+ }
2034
+
2035
+ this.writeStatus(storeKey, status) ;
2036
+ this.dataHashDidChange(storeKey, null, YES);
2037
+
2038
+ return this ;
2039
+ },
2040
+
2041
+ // ..........................................................
2042
+ // PUSH CHANGES FROM DATA SOURCE
2043
+ //
2044
+
2045
+ /**
2046
+ Call by the data source whenever you want to push new data out of band
2047
+ into the store.
2048
+
2049
+ @param {Class} recordType the SC.Record subclass
2050
+ @param {Object} id the record id or null
2051
+ @param {Hash} dataHash data hash to load
2052
+ @param {Number} storeKey optional store key.
2053
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2054
+ */
2055
+ pushRetrieve: function(recordType, id, dataHash, storeKey) {
2056
+ var K = SC.Record, status;
2057
+
2058
+ if(storeKey===undefined) storeKey = recordType.storeKeyFor(id);
2059
+ status = this.readStatus(storeKey);
2060
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN) {
2061
+
2062
+ status = K.READY_CLEAN;
2063
+ if(dataHash===undefined) this.writeStatus(storeKey, status) ;
2064
+ else this.writeDataHash(storeKey, dataHash, status) ;
2065
+
2066
+ this.dataHashDidChange(storeKey);
2067
+
2068
+ return storeKey;
2069
+ }
2070
+ //conflicted (ready)
2071
+ return NO;
2072
+ },
2073
+
2074
+ /**
2075
+ Call by the data source whenever you want to push a deletion into the
2076
+ store.
2077
+
2078
+ @param {Class} recordType the SC.Record subclass
2079
+ @param {Object} id the record id or null
2080
+ @param {Number} storeKey optional store key.
2081
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2082
+ */
2083
+ pushDestroy: function(recordType, id, storeKey) {
2084
+ var K = SC.Record, status;
2085
+
2086
+ if(storeKey===undefined){
2087
+ storeKey = recordType.storeKeyFor(id);
2088
+ }
2089
+ status = this.readStatus(storeKey);
2090
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN){
2091
+ status = K.DESTROYED_CLEAN;
2092
+ this.removeDataHash(storeKey, status) ;
2093
+ this.dataHashDidChange(storeKey);
2094
+ return storeKey;
2095
+ }
2096
+ //conflicted (destroy)
2097
+ return NO;
2098
+ },
2099
+
2100
+ /**
2101
+ Call by the data source whenever you want to push an error into the
2102
+ store.
2103
+
2104
+ @param {Class} recordType the SC.Record subclass
2105
+ @param {Object} id the record id or null
2106
+ @param {SC.Error} error [optional] an SC.Error instance to associate with id or storeKey
2107
+ @param {Number} storeKey optional store key.
2108
+ @returns {Number|Boolean} storeKey if push was allowed, NO if not
2109
+ */
2110
+ pushError: function(recordType, id, error, storeKey) {
2111
+ var K = SC.Record, status, errors = this.recordErrors;
2112
+
2113
+ if(storeKey===undefined) storeKey = recordType.storeKeyFor(id);
2114
+ status = this.readStatus(storeKey);
2115
+
2116
+ if(status==K.EMPTY || status==K.ERROR || status==K.READY_CLEAN || status==K.DESTROYED_CLEAN){
2117
+ status = K.ERROR;
2118
+
2119
+ // Add the error to the array of record errors (for lookup later on if necessary).
2120
+ if (error && error.isError) {
2121
+ if (!errors) errors = this.recordErrors = [];
2122
+ errors[storeKey] = error;
2123
+ }
2124
+
2125
+ this.writeStatus(storeKey, status) ;
2126
+ this.dataHashDidChange(storeKey, null, YES);
2127
+ return storeKey;
2128
+ }
2129
+ //conflicted (error)
2130
+ return NO;
2131
+ },
2132
+
2133
+ // ..........................................................
2134
+ // FETCH CALLBACKS
2135
+ //
2136
+
2137
+ // NOTE: although these method works on RecordArray instances right now.
2138
+ // They could be optimized to actually share query results between nested
2139
+ // stores. This is why these methods are implemented here instead of
2140
+ // directly on Query or RecordArray objects.
2141
+
2142
+ /**
2143
+ Sets the passed array of storeKeys as the new data for the query. You
2144
+ can call this at any time for a remote query to update its content. If
2145
+ you want to use incremental loading, then pass a SparseArray object.
2146
+
2147
+ If the query you pass is not a REMOTE query, then this method will raise
2148
+ an exception. This will also implicitly transition the query state to
2149
+ SC.Record.READY.
2150
+
2151
+ If you called loadRecords() before to load the actual content, you can
2152
+ call this method with the return value of that method to actually set the
2153
+ storeKeys on the result.
2154
+
2155
+ @param {SC.Query} query the query you are loading. must be remote.
2156
+ @param {SC.Array} storeKeys array of store keys
2157
+ @returns {SC.Store} receiver
2158
+ */
2159
+ loadQueryResults: function(query, storeKeys) {
2160
+ if (query.get('location') === SC.Query.LOCAL) {
2161
+ throw new Error("Cannot load query results for a local query");
2162
+ }
2163
+
2164
+ var recArray = this._findQuery(query, YES, NO);
2165
+ if (recArray) recArray.set('storeKeys', storeKeys);
2166
+ this.dataSourceDidFetchQuery(query);
2167
+
2168
+ return this ;
2169
+ },
2170
+
2171
+ /**
2172
+ Called by your data source whenever you finish fetching the results of a
2173
+ query. This will put the query into a READY state if it was loading.
2174
+
2175
+ Note that if the query is a REMOTE query, then you must separately load
2176
+ the results into the query using loadQueryResults(). If the query is
2177
+ LOCAL, then the query will update automatically with any new records you
2178
+ added to the store.
2179
+
2180
+ @param {SC.Query} query the query you fetched
2181
+ @returns {SC.Store} receiver
2182
+ */
2183
+ dataSourceDidFetchQuery: function(query) {
2184
+ return this._scstore_dataSourceDidFetchQuery(query, YES);
2185
+ },
2186
+
2187
+ _scstore_dataSourceDidFetchQuery: function(query, createIfNeeded) {
2188
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2189
+ nestedStores = this.get('nestedStores'),
2190
+ loc = nestedStores ? nestedStores.get('length') : 0;
2191
+
2192
+ // fix query if needed
2193
+ if (recArray) recArray.storeDidFetchQuery(query);
2194
+
2195
+ // notify nested stores
2196
+ while(--loc >= 0) {
2197
+ nestedStores[loc]._scstore_dataSourceDidFetchQuery(query, NO);
2198
+ }
2199
+
2200
+ return this ;
2201
+ },
2202
+
2203
+ /**
2204
+ Called by your data source if it cancels fetching the results of a query.
2205
+ This will put any RecordArray's back into its original state (READY or
2206
+ EMPTY).
2207
+
2208
+ @param {SC.Query} query the query you cancelled
2209
+ @returns {SC.Store} receiver
2210
+ */
2211
+ dataSourceDidCancelQuery: function(query) {
2212
+ return this._scstore_dataSourceDidCancelQuery(query, YES);
2213
+ },
2214
+
2215
+ _scstore_dataSourceDidCancelQuery: function(query, createIfNeeded) {
2216
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2217
+ nestedStores = this.get('nestedStores'),
2218
+ loc = nestedStores ? nestedStores.get('length') : 0;
2219
+
2220
+ // fix query if needed
2221
+ if (recArray) recArray.storeDidCancelQuery(query);
2222
+
2223
+ // notify nested stores
2224
+ while(--loc >= 0) {
2225
+ nestedStores[loc]._scstore_dataSourceDidCancelQuery(query, NO);
2226
+ }
2227
+
2228
+ return this ;
2229
+ },
2230
+
2231
+ /**
2232
+ Called by your data source if it encountered an error loading the query.
2233
+ This will put the query into an error state until you try to refresh it
2234
+ again.
2235
+
2236
+ @param {SC.Query} query the query with the error
2237
+ @param {SC.Error} error [optional] an SC.Error instance to associate with query
2238
+ @returns {SC.Store} receiver
2239
+ */
2240
+ dataSourceDidErrorQuery: function(query, error) {
2241
+ var errors = this.queryErrors;
2242
+
2243
+ // Add the error to the array of query errors (for lookup later on if necessary).
2244
+ if (error && error.isError) {
2245
+ if (!errors) errors = this.queryErrors = {};
2246
+ errors[SC.guidFor(query)] = error;
2247
+ }
2248
+
2249
+ return this._scstore_dataSourceDidErrorQuery(query, YES);
2250
+ },
2251
+
2252
+ _scstore_dataSourceDidErrorQuery: function(query, createIfNeeded) {
2253
+ var recArray = this._findQuery(query, createIfNeeded, NO),
2254
+ nestedStores = this.get('nestedStores'),
2255
+ loc = nestedStores ? nestedStores.get('length') : 0;
2256
+
2257
+ // fix query if needed
2258
+ if (recArray) recArray.storeDidErrorQuery(query);
2259
+
2260
+ // notify nested stores
2261
+ while(--loc >= 0) {
2262
+ nestedStores[loc]._scstore_dataSourceDidErrorQuery(query, NO);
2263
+ }
2264
+
2265
+ return this ;
2266
+ },
2267
+
2268
+ // ..........................................................
2269
+ // INTERNAL SUPPORT
2270
+ //
2271
+
2272
+ /** @private */
2273
+ init: function() {
2274
+ sc_super();
2275
+ this.reset();
2276
+ },
2277
+
2278
+
2279
+ toString: function() {
2280
+ // Include the name if the client has specified one.
2281
+ var name = this.get('name');
2282
+ if (!name) {
2283
+ return sc_super();
2284
+ }
2285
+ else {
2286
+ var ret = sc_super();
2287
+ return "%@ (%@)".fmt(name, ret);
2288
+ }
2289
+ },
2290
+
2291
+
2292
+ // ..........................................................
2293
+ // PRIMARY KEY CONVENIENCE METHODS
2294
+ //
2295
+
2296
+ /**
2297
+ Given a storeKey, return the primaryKey.
2298
+
2299
+ @param {Number} storeKey the store key
2300
+ @returns {String} primaryKey value
2301
+ */
2302
+ idFor: function(storeKey) {
2303
+ return SC.Store.idFor(storeKey);
2304
+ },
2305
+
2306
+ /**
2307
+ Given a storeKey, return the recordType.
2308
+
2309
+ @param {Number} storeKey the store key
2310
+ @returns {SC.Record} record instance
2311
+ */
2312
+ recordTypeFor: function(storeKey) {
2313
+ return SC.Store.recordTypeFor(storeKey) ;
2314
+ },
2315
+
2316
+ /**
2317
+ Given a recordType and primaryKey, find the storeKey. If the primaryKey
2318
+ has not been assigned a storeKey yet, it will be added.
2319
+
2320
+ @param {SC.Record} recordType the record type
2321
+ @param {String} primaryKey the primary key
2322
+ @returns {Number} storeKey
2323
+ */
2324
+ storeKeyFor: function(recordType, primaryKey) {
2325
+ return recordType.storeKeyFor(primaryKey);
2326
+ },
2327
+
2328
+ /**
2329
+ Given a primaryKey value for the record, returns the associated
2330
+ storeKey. As opposed to storeKeyFor() however, this method
2331
+ will NOT generate a new storeKey but returned undefined.
2332
+
2333
+ @param {String} id a record id
2334
+ @returns {Number} a storeKey.
2335
+ */
2336
+ storeKeyExists: function(recordType, primaryKey) {
2337
+ return recordType.storeKeyExists(primaryKey);
2338
+ },
2339
+
2340
+ /**
2341
+ Finds all storeKeys of a certain record type in this store
2342
+ and returns an array.
2343
+
2344
+ @param {SC.Record} recordType
2345
+ @returns {Array} set of storeKeys
2346
+ */
2347
+ storeKeysFor: function(recordType) {
2348
+ var ret = [],
2349
+ isEnum = recordType && recordType.isEnumerable,
2350
+ recType, storeKey, isMatch ;
2351
+
2352
+ if (!this.statuses) return ret;
2353
+ for(storeKey in SC.Store.recordTypesByStoreKey) {
2354
+ recType = SC.Store.recordTypesByStoreKey[storeKey];
2355
+
2356
+ // if same record type and this store has it
2357
+ if (isEnum) isMatch = recordType.contains(recType);
2358
+ else isMatch = recType === recordType;
2359
+
2360
+ if(isMatch && this.statuses[storeKey]) ret.push(parseInt(storeKey, 10));
2361
+ }
2362
+
2363
+ return ret;
2364
+ },
2365
+
2366
+ /**
2367
+ Finds all storeKeys in this store
2368
+ and returns an array.
2369
+
2370
+ @returns {Array} set of storeKeys
2371
+ */
2372
+ storeKeys: function() {
2373
+ var ret = [], storeKey;
2374
+ if(!this.statuses) return ret;
2375
+
2376
+ for(storeKey in this.statuses) {
2377
+ // if status is not empty
2378
+ if(this.statuses[storeKey] != SC.Record.EMPTY) {
2379
+ ret.push(parseInt(storeKey, 10));
2380
+ }
2381
+ }
2382
+
2383
+ return ret;
2384
+ },
2385
+
2386
+ /**
2387
+ Returns string representation of a storeKey, with status.
2388
+
2389
+ @param {Number} storeKey
2390
+ @returns {String}
2391
+ */
2392
+ statusString: function(storeKey) {
2393
+ var rec = this.materializeRecord(storeKey);
2394
+ return rec.statusString();
2395
+ }
2396
+
2397
+ }) ;
2398
+
2399
+ SC.Store.mixin({
2400
+
2401
+ /**
2402
+ Standard error raised if you try to commit changes from a nested store
2403
+ and there is a conflict.
2404
+
2405
+ @property {Error}
2406
+ */
2407
+ CHAIN_CONFLICT_ERROR: new Error("Nested Store Conflict"),
2408
+
2409
+ /**
2410
+ Standard error if you try to perform an operation on a nested store
2411
+ without a parent.
2412
+
2413
+ @property {Error}
2414
+ */
2415
+ NO_PARENT_STORE_ERROR: new Error("Parent Store Required"),
2416
+
2417
+ /**
2418
+ Standard error if you try to perform an operation on a nested store that
2419
+ is only supported in root stores.
2420
+
2421
+ @property {Error}
2422
+ */
2423
+ NESTED_STORE_UNSUPPORTED_ERROR: new Error("Unsupported In Nested Store"),
2424
+
2425
+ /**
2426
+ Standard error if you try to retrieve a record in a nested store that is
2427
+ dirty. (This is allowed on the main store, but not in nested stores.)
2428
+
2429
+ @property {Error}
2430
+ */
2431
+ NESTED_STORE_RETRIEVE_DIRTY_ERROR: new Error("Cannot Retrieve Dirty Record in Nested Store"),
2432
+
2433
+ /**
2434
+ Data hash state indicates the data hash is currently editable
2435
+
2436
+ @property {String}
2437
+ */
2438
+ EDITABLE: 'editable',
2439
+
2440
+ /**
2441
+ Data hash state indicates the hash no longer tracks changes from a
2442
+ parent store, but it is not editable.
2443
+
2444
+ @property {String}
2445
+ */
2446
+ LOCKED: 'locked',
2447
+
2448
+ /**
2449
+ Data hash state indicates the hash is tracking changes from the parent
2450
+ store and is not editable.
2451
+
2452
+ @property {String}
2453
+ */
2454
+ INHERITED: 'inherited',
2455
+
2456
+ /** @private
2457
+ This array maps all storeKeys to primary keys. You will not normally
2458
+ access this method directly. Instead use the idFor() and
2459
+ storeKeyFor() methods on SC.Record.
2460
+ */
2461
+ idsByStoreKey: [],
2462
+
2463
+ /** @private
2464
+ Maps all storeKeys to a recordType. Once a storeKey is associated with
2465
+ a primaryKey and recordType that remains constant throughout the lifetime
2466
+ of the application.
2467
+ */
2468
+ recordTypesByStoreKey: {},
2469
+
2470
+ /** @private
2471
+ Maps some storeKeys to query instance. Once a storeKey is associated with
2472
+ a query instance, that remains constant through the lifetime of the
2473
+ application. If a Query is destroyed, it will remove itself from this
2474
+ list.
2475
+
2476
+ Don't access this directly. Use queryFor().
2477
+ */
2478
+ queriesByStoreKey: [],
2479
+
2480
+ /** @private
2481
+ The next store key to allocate. A storeKey must always be greater than 0
2482
+ */
2483
+ nextStoreKey: 1,
2484
+
2485
+ /**
2486
+ Generates a new store key for use.
2487
+
2488
+ @property {Number}
2489
+ */
2490
+ generateStoreKey: function() { return this.nextStoreKey++; },
2491
+
2492
+ /**
2493
+ Given a storeKey returns the primaryKey associated with the key.
2494
+ If not primaryKey is associated with the storeKey, returns null.
2495
+
2496
+ @param {Number} storeKey the store key
2497
+ @returns {String} the primary key or null
2498
+ */
2499
+ idFor: function(storeKey) {
2500
+ return this.idsByStoreKey[storeKey] ;
2501
+ },
2502
+
2503
+ /**
2504
+ Given a storeKey, returns the query object associated with the key. If
2505
+ no query is associated with the storeKey, returns null.
2506
+
2507
+ @param {Number} storeKey the store key
2508
+ @returns {SC.Query} query query object
2509
+ */
2510
+ queryFor: function(storeKey) {
2511
+ return this.queriesByStoreKey[storeKey];
2512
+ },
2513
+
2514
+ /**
2515
+ Given a storeKey returns the SC.Record class associated with the key.
2516
+ If no record type is associated with the store key, returns null.
2517
+
2518
+ The SC.Record class will only be found if you have already called
2519
+ storeKeyFor() on the record.
2520
+
2521
+ @param {Number} storeKey the store key
2522
+ @returns {SC.Record} the record type
2523
+ */
2524
+ recordTypeFor: function(storeKey) {
2525
+ return this.recordTypesByStoreKey[storeKey];
2526
+ },
2527
+
2528
+ /**
2529
+ Swaps the primaryKey mapped to the given storeKey with the new
2530
+ primaryKey. If the storeKey is not currently associated with a record
2531
+ this will raise an exception.
2532
+
2533
+ @param {Number} storeKey the existing store key
2534
+ @param {String} newPrimaryKey the new primary key
2535
+ @returns {SC.Store} receiver
2536
+ */
2537
+ replaceIdFor: function(storeKey, newId) {
2538
+ var oldId = this.idsByStoreKey[storeKey],
2539
+ recordType, storeKeys;
2540
+
2541
+ if (oldId !== newId) { // skip if id isn't changing
2542
+
2543
+ recordType = this.recordTypeFor(storeKey);
2544
+ if (!recordType) {
2545
+ throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(storeKey));
2546
+ }
2547
+
2548
+ // map one direction...
2549
+ this.idsByStoreKey[storeKey] = newId;
2550
+
2551
+ // then the other...
2552
+ storeKeys = recordType.storeKeysById() ;
2553
+ delete storeKeys[oldId];
2554
+ storeKeys[newId] = storeKey;
2555
+ }
2556
+
2557
+ return this ;
2558
+ },
2559
+
2560
+ /**
2561
+ Swaps the recordType recorded for a given storeKey. Normally you should
2562
+ not call this method directly as it can damage the store behavior. This
2563
+ method is used by other store methods to set the recordType for a
2564
+ storeKey.
2565
+
2566
+ @param {Integer} storeKey the store key
2567
+ @param {SC.Record} recordType a record class
2568
+ @returns {SC.Store} reciever
2569
+ */
2570
+ replaceRecordTypeFor: function(storeKey, recordType) {
2571
+ this.recordTypesByStoreKey[storeKey] = recordType;
2572
+ return this ;
2573
+ }
2574
+
2575
+ });
2576
+
2577
+
2578
+ /** @private */
2579
+ SC.Store.prototype.nextStoreIndex = 1;
2580
+
2581
+ // ..........................................................
2582
+ // COMPATIBILITY
2583
+ //
2584
+
2585
+ /** @private
2586
+ global store is used only for deprecated compatibility methods. Don't use
2587
+ this in real code.
2588
+ */
2589
+ SC.Store._getDefaultStore = function() {
2590
+ var store = this._store;
2591
+ if(!store) this._store = store = SC.Store.create();
2592
+ return store;
2593
+ };
2594
+
2595
+ /** @private
2596
+
2597
+ DEPRECATED
2598
+
2599
+ Included for compatibility, loads data hashes with the named recordType.
2600
+ If no recordType is passed, expects to find a recordType property in the
2601
+ data hashes. dataSource and isLoaded params are ignored.
2602
+
2603
+ Calls SC.Store#loadRecords() on the default store. Do not use this method in
2604
+ new code.
2605
+
2606
+ @param {Array} dataHashes data hashes to import
2607
+ @param {Object} dataSource ignored
2608
+ @param {SC.Record} recordType default record type
2609
+ @param {Boolean} isLoaded ignored
2610
+ @returns {Array} SC.Record instances for loaded data hashes
2611
+ */
2612
+ SC.Store.updateRecords = function(dataHashes, dataSource, recordType, isLoaded) {
2613
+
2614
+ console.warn("SC.Store.updateRecords() is deprecated. Use loadRecords() instead");
2615
+
2616
+ var store = this._getDefaultStore(),
2617
+ len = dataHashes.length,
2618
+ idx, ret;
2619
+
2620
+ // if no recordType was passed, build an array of recordTypes from hashes
2621
+ if (!recordType) {
2622
+ recordType = [];
2623
+ for(idx=0;idx<len;idx++) recordType[idx] = dataHashes[idx].recordType;
2624
+ }
2625
+
2626
+ // call new API. Returns storeKeys
2627
+ ret = store.loadRecords(recordType, dataHashes);
2628
+
2629
+ // map to SC.Record instances
2630
+ len = ret.length;
2631
+ for(idx=0;idx<len;idx++) ret[idx] = store.materializeRecord(ret[idx]);
2632
+
2633
+ return ret ;
2634
+ };
2635
+
2636
+ /** @private
2637
+
2638
+ DEPRECATED
2639
+
2640
+ Finds a record with the passed guid on the default store. This is included
2641
+ only for compatibility. You should use the newer find() method defined on
2642
+ SC.Store instead.
2643
+
2644
+ @param {String} guid the guid
2645
+ @param {SC.Record} recordType expected record type
2646
+ @returns {SC.Record} found record
2647
+ */
2648
+ SC.Store.find = function(guid, recordType) {
2649
+ return this._getDefaultStore().find(recordType, guid);
2650
+ };
2651
+
2652
+ /** @private
2653
+
2654
+ DEPRECATED
2655
+
2656
+ Passes through to findAll on default store. This is included only for
2657
+ compatibility. You should use the newer findAll() defined on SC.Store
2658
+ instead.
2659
+
2660
+ @param {Hash} filter search parameters
2661
+ @param {SC.Record} recordType type of record to find
2662
+ @returns {SC.RecordArray} result set
2663
+ */
2664
+ SC.Store.findAll = function(filter, recordType) {
2665
+ return this._getDefaultStore().findAll(filter, recordType);
2666
+ };