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,3313 @@
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('system/browser');
9
+ sc_require('system/event');
10
+ sc_require('system/cursor');
11
+ sc_require('system/responder') ;
12
+
13
+ sc_require('mixins/string') ;
14
+
15
+ SC.viewKey = SC.guidKey + "_view" ;
16
+
17
+ /** Select a horizontal layout for various views.*/
18
+ SC.LAYOUT_HORIZONTAL = 'sc-layout-horizontal';
19
+
20
+ /** Select a vertical layout for various views.*/
21
+ SC.LAYOUT_VERTICAL = 'sc-layout-vertical';
22
+
23
+ /** @private */
24
+ SC._VIEW_DEFAULT_DIMS = 'marginTop marginLeft'.w();
25
+
26
+ /**
27
+ Layout properties needed to anchor a view to the top.
28
+ */
29
+ SC.ANCHOR_TOP = { top: 0 };
30
+
31
+ /**
32
+ Layout properties needed to anchor a view to the left.
33
+ */
34
+ SC.ANCHOR_LEFT = { left: 0 };
35
+
36
+ /*
37
+ Layout properties to anchor a view to the top left
38
+ */
39
+ SC.ANCHOR_TOP_LEFT = { top: 0, left: 0 };
40
+
41
+ /**
42
+ Layout properties to anchoe view to the bottom.
43
+ */
44
+ SC.ANCHOR_BOTTOM = { bottom: 0 };
45
+
46
+ /**
47
+ Layout properties to anchor a view to the right.
48
+ */
49
+ SC.ANCHOR_RIGHT = { right: 0 } ;
50
+
51
+ /**
52
+ Layout properties to anchor a view to the bottom right.
53
+ */
54
+ SC.ANCHOR_BOTTOM_RIGHT = { bottom: 0, right: 0 };
55
+
56
+ /**
57
+ Layout properties to take up the full width of a parent view.
58
+ */
59
+ SC.FULL_WIDTH = { left: 0, right: 0 };
60
+
61
+ /**
62
+ Layout properties to take up the full height of a parent view.
63
+ */
64
+ SC.FULL_HEIGHT = { top: 0, bottom: 0 };
65
+
66
+ /**
67
+ Layout properties to center. Note that you must also specify a width and
68
+ height for this to work.
69
+ */
70
+ SC.ANCHOR_CENTER = { centerX: 0, centerY: 0 };
71
+
72
+ /**
73
+ Layout property for width, height
74
+ */
75
+
76
+ SC.LAYOUT_AUTO = 'auto';
77
+
78
+ /**
79
+ Default property to disable or enable by default the contextMenu
80
+ */
81
+ SC.CONTEXT_MENU_ENABLED = YES;
82
+
83
+ /**
84
+ Default property to disable or enable if the focus can jump to the address
85
+ bar or not.
86
+ */
87
+ SC.TABBING_ONLY_INSIDE_DOCUMENT = YES;
88
+
89
+ /** @private - custom array used for child views */
90
+ SC.EMPTY_CHILD_VIEWS_ARRAY = [];
91
+ SC.EMPTY_CHILD_VIEWS_ARRAY.needsClone = YES;
92
+
93
+ /**
94
+ @class
95
+
96
+ Base class for managing a view. Views provide two functions:
97
+
98
+ 1. They translate state and events into drawing instructions for the
99
+ web browser and
100
+
101
+ 2. They act as first responders for incoming keyboard, mouse, and
102
+ touch events.
103
+
104
+ h2. View Initialization
105
+
106
+ When a view is setup, there are several methods you can override that
107
+ will be called at different times depending on how your view is created.
108
+ Here is a guide to which method you want to override and when:
109
+
110
+ - *init:* override this method for any general object setup (such as
111
+ observers, starting timers and animations, etc) that you need to happen
112
+ everytime the view is created, regardless of whether or not its layer
113
+ exists yet.
114
+
115
+ - *render:* override this method to generate or update your HTML to reflect
116
+ the current state of your view. This method is called both when your view
117
+ is first created and later anytime it needs to be updated.
118
+
119
+ - *didCreateLayer:* the render() method is used to generate new HTML.
120
+ Override this method to perform any additional setup on the DOM you might
121
+ need to do after creating the view. For example, if you need to listen
122
+ for events.
123
+
124
+ - *willDestroyLayer:* if you implement didCreateLayer() to setup event
125
+ listeners, you should implement this method as well to remove the same
126
+ just before the DOM for your view is destroyed.
127
+
128
+ - *updateLayer:* Normally, when a view needs to update its content, it will
129
+ re-render the view using the render() method. If you would like to
130
+ override this behavior with your own custom updating code, you can
131
+ replace updateLayer() with your own implementation instead.
132
+
133
+ - *didAppendToDocument:* in theory all DOM setup could be done
134
+ in didCreateLayer() as you already have a DOM element instantiated.
135
+ However there is cases where the element has to be first appended to the
136
+ Document because there is either a bug on the browser or you are using
137
+ plugins which objects are not instantiated until you actually append the
138
+ element to the DOM. This will allow you to do things like registering
139
+ DOM events on flash or quicktime objects.
140
+
141
+ @extends SC.Responder
142
+ @extends SC.DelegateSupport
143
+ @since SproutCore 1.0
144
+ */
145
+ SC.View = SC.Responder.extend(SC.DelegateSupport,
146
+ /** @scope SC.View.prototype */ {
147
+
148
+ concatenatedProperties: 'outlets displayProperties layoutProperties classNames renderMixin didCreateLayerMixin willDestroyLayerMixin'.w(),
149
+
150
+ /**
151
+ The current pane.
152
+ @property {SC.Pane}
153
+ */
154
+ pane: function() {
155
+ var view = this ;
156
+ while (view && !view.isPane) view = view.get('parentView') ;
157
+ return view ;
158
+ }.property('parentView').cacheable(),
159
+
160
+ /**
161
+ The page this view was instantiated from. This is set by the page object
162
+ during instantiation.
163
+
164
+ @property {SC.Page}
165
+ */
166
+ page: null,
167
+
168
+ /**
169
+ The current split view this view is embedded in (may be null).
170
+ @property {SC.SplitView}
171
+ */
172
+ splitView: function() {
173
+ var view = this ;
174
+ while (view && !view.isSplitView) view = view.get('parentView') ;
175
+ return view ;
176
+ }.property('parentView').cacheable(),
177
+
178
+ /**
179
+ If the view is currently inserted into the DOM of a parent view, this
180
+ property will point to the parent of the view.
181
+ */
182
+ parentView: null,
183
+
184
+ /**
185
+ Optional background color. Will be applied to the view's element if
186
+ set. This property is intended for one-off views that need a background
187
+ element. If you plan to create many view instances it is probably better
188
+ to use CSS.
189
+
190
+ @property {String}
191
+ */
192
+ backgroundColor: null,
193
+
194
+ /**
195
+ Activates use of brower's static layout. You can apply this mixin and
196
+ still use absolute positioning. To activate static positioning, set this
197
+ property to YES.
198
+
199
+ @property {Boolean}
200
+ */
201
+ useStaticLayout: NO,
202
+
203
+ // ..........................................................
204
+ // IS ENABLED SUPPORT
205
+ //
206
+
207
+ /**
208
+ Set to true when the item is enabled. Note that changing this value
209
+ will also alter the isVisibleInWindow property for this view and any
210
+ child views.
211
+
212
+ Note that if you apply the SC.Control mixin, changing this property will
213
+ also automatically add or remove a 'disabled' CSS class name as well.
214
+
215
+ This property is observable and bindable.
216
+
217
+ @property {Boolean}
218
+ */
219
+ isEnabled: YES,
220
+ isEnabledBindingDefault: SC.Binding.oneWay().bool(),
221
+
222
+ /**
223
+ Computed property returns YES if the view and all of its parent views
224
+ are enabled in the pane. You should use this property when deciding
225
+ whether to respond to an incoming event or not.
226
+
227
+ This property is not observable.
228
+
229
+ @property {Boolean}
230
+ */
231
+ isEnabledInPane: function() {
232
+ var ret = this.get('isEnabled'), pv ;
233
+ if (ret && (pv = this.get('parentView'))) ret = pv.get('isEnabledInPane');
234
+ return ret ;
235
+ }.property('parentView', 'isEnabled'),
236
+
237
+ /** @private
238
+ Observes the isEnabled property and resigns first responder if set to NO.
239
+ This will avoid cases where, for example, a disabled text field retains
240
+ its focus rings.
241
+
242
+ @observes isEnabled
243
+ */
244
+ _sc_view_isEnabledDidChange: function(){
245
+ if(!this.get('isEnabled') && this.get('isFirstResponder')){
246
+ this.resignFirstResponder();
247
+ }
248
+ }.observes('isEnabled'),
249
+
250
+ // ..........................................................
251
+ // IS VISIBLE IN WINDOW SUPPORT
252
+ //
253
+
254
+ /**
255
+ The isVisible property determines if the view is shown in the view
256
+ hierarchy it is a part of. A view can have isVisible == YES and still have
257
+ isVisibleInWindow == NO. This occurs, for instance, when a parent view has
258
+ isVisible == NO. Default is YES.
259
+
260
+ The isVisible property is considered part of the layout and so changing it
261
+ will trigger a layout update.
262
+
263
+ @property {Boolean}
264
+ */
265
+ isVisible: YES,
266
+ isVisibleBindingDefault: SC.Binding.bool(),
267
+
268
+ /**
269
+ YES only if the view and all of its parent views are currently visible
270
+ in the window. This property is used to optimize certain behaviors in
271
+ the view. For example, updates to the view layer are not performed
272
+ if the view until the view becomes visible in the window.
273
+ */
274
+ isVisibleInWindow: NO,
275
+
276
+ /**
277
+ By default we don't disable the context menu. Overriding this property
278
+ can enable/disable the context menu per view.
279
+ */
280
+ isContextMenuEnabled: function() {
281
+ return SC.CONTEXT_MENU_ENABLED;
282
+ }.property(),
283
+
284
+ /**
285
+ Recomputes the isVisibleInWindow property based on the visibility of the
286
+ view and its parent. If the recomputed value differs from the current
287
+ isVisibleInWindow state, this method will also call
288
+ recomputIsVisibleInWindow() on its child views as well. As an optional
289
+ optimization, you can pass the isVisibleInWindow state of the parentView
290
+ if you already know it.
291
+
292
+ You will not generally need to call or override this method yourself. It
293
+ is used by the SC.View hierarchy to relay window visibility changes up
294
+ and down the chain.
295
+
296
+ @property {Boolean} parentViewIsVisible
297
+ @returns {SC.View} receiver
298
+ */
299
+ recomputeIsVisibleInWindow: function(parentViewIsVisible) {
300
+ var previous = this.get('isVisibleInWindow'),
301
+ current = this.get('isVisible'),
302
+ parentView;
303
+
304
+ // isVisibleInWindow = isVisible && parentView.isVisibleInWindow
305
+ // this approach only goes up to the parentView if necessary.
306
+ if (current) {
307
+ // If we weren't passed in 'parentViewIsVisible' (we generally aren't;
308
+ // it's an optimization), then calculate it.
309
+ if (parentViewIsVisible === undefined) {
310
+ parentView = this.get('parentView');
311
+ parentViewIsVisible = parentView ? parentView.get('isVisibleInWindow') : NO;
312
+ }
313
+ current = current && parentViewIsVisible;
314
+ }
315
+
316
+ // If our visibility has changed, then set the new value and notify our
317
+ // child views to update their value.
318
+ if (previous !== current) {
319
+ this.set('isVisibleInWindow', current);
320
+
321
+ var childViews = this.get('childViews'), len = childViews.length, idx;
322
+ for(idx=0;idx<len;idx++) {
323
+ childViews[idx].recomputeIsVisibleInWindow(current);
324
+ }
325
+
326
+ // For historical reasons, we'll also layout the child views if
327
+ // necessary.
328
+ if (current) {
329
+ if (this.get('childViewsNeedLayout')) this.invokeOnce(this.layoutChildViewsIfNeeded);
330
+ }
331
+ else {
332
+ // Also, if we were previously visible and were the first responder,
333
+ // resign it. This more appropriately belongs in a
334
+ // 'isVisibleInWindow' observer or some such helper method because
335
+ // this work is not strictly related to computing the visibility, but
336
+ // view performance is critical, so avoiding the extra observer is
337
+ // worthwhile.
338
+ if (this.get('isFirstResponder')) this.resignFirstResponder();
339
+ }
340
+ }
341
+
342
+ // If we're in this function, then that means one of our ancestor views
343
+ // changed, or changed its 'isVisibleInWindow' value. That means that if
344
+ // we are out of sync with the layer, then we need to update our state
345
+ // now.
346
+ //
347
+ // For example, say we're isVisible=NO, but we have not yet added the
348
+ // 'hidden' class to the layer because of the "don't update the layer if
349
+ // we're not visible in the window" check. If any of our parent views
350
+ // became visible, our layer would incorrectly be shown!
351
+ this.updateLayerIfNeeded(YES);
352
+
353
+ return this;
354
+ },
355
+
356
+
357
+ /** @private
358
+ Whenever the view’s visibility changes, we need to recompute whether it is
359
+ actually visible inside the window (a view is only visible in the window
360
+ if it is marked as visibile and its parent view is as well), in addition
361
+ to updating the layer accordingly.
362
+ */
363
+ _sc_isVisibleDidChange: function() {
364
+ // 'isVisible' is effectively a displayProperty, but we'll call
365
+ // displayDidChange() manually here instead of declaring it as a
366
+ // displayProperty because that avoids having two observers on
367
+ // 'isVisible'. A single observer is:
368
+ // a. More efficient
369
+ // b. More correct, because we can guarantee the order of operations
370
+ this.displayDidChange();
371
+
372
+ this.recomputeIsVisibleInWindow();
373
+ }.observes('isVisible'),
374
+
375
+
376
+
377
+ // ..........................................................
378
+ // CHILD VIEW SUPPORT
379
+ //
380
+
381
+ /**
382
+ Array of child views. You should never edit this array directly unless
383
+ you are implementing createChildViews(). Most of the time, you should
384
+ use the accessor methods such as appendChild(), insertBefore() and
385
+ removeChild().
386
+
387
+ @property {Array}
388
+ */
389
+ childViews: SC.EMPTY_CHILD_VIEWS_ARRAY,
390
+
391
+ /**
392
+ Insert the view into the the receiver's childNodes array.
393
+
394
+ The view will be added to the childNodes array before the beforeView. If
395
+ beforeView is null, then the view will be added to the end of the array.
396
+ This will also add the view's rootElement DOM node to the receivers
397
+ containerElement DOM node as a child.
398
+
399
+ If the specified view already belongs to another parent, it will be
400
+ removed from that view first.
401
+
402
+ @param {SC.View} view
403
+ @param {SC.View} beforeView
404
+ @returns {SC.View} the receiver
405
+ */
406
+ insertBefore: function(view, beforeView) {
407
+ view.beginPropertyChanges(); // limit notifications
408
+
409
+ // remove view from old parent if needed. Also notify views.
410
+ if (view.get('parentView')) view.removeFromParent() ;
411
+ if (this.willAddChild) this.willAddChild(view, beforeView) ;
412
+ if (view.willAddToParent) view.willAddToParent(this, beforeView) ;
413
+
414
+ // set parentView of child
415
+ view.set('parentView', this);
416
+
417
+ // add to childView's array.
418
+ var idx, childViews = this.get('childViews') ;
419
+ if (childViews.needsClone) this.set(childViews = []);
420
+ idx = (beforeView) ? childViews.indexOf(beforeView) : childViews.length;
421
+ if (idx<0) idx = childViews.length ;
422
+ childViews.insertAt(idx, view) ;
423
+
424
+ // The DOM will need some fixing up, note this on the view.
425
+ view.parentViewDidChange() ;
426
+ view.layoutDidChange() ;
427
+ var pane = view.get('pane');
428
+ if(pane && pane.get('isPaneAttached')) {
429
+ view._notifyDidAppendToDocument();
430
+ }
431
+
432
+ // notify views
433
+ if (this.didAddChild) this.didAddChild(view, beforeView) ;
434
+ if (view.didAddToParent) view.didAddToParent(this, beforeView) ;
435
+
436
+ view.endPropertyChanges();
437
+
438
+ return this ;
439
+ },
440
+
441
+ /**
442
+ Removes the child view from the parent view.
443
+
444
+ @param {SC.View} view
445
+ @returns {SC.View} receiver
446
+ */
447
+ removeChild: function(view) {
448
+ if (!view) return this; // nothing to do
449
+ if (view.parentView !== this) {
450
+ throw "%@.removeChild(%@) must belong to parent".fmt(this,view);
451
+ }
452
+ // notify views
453
+ if (view.willRemoveFromParent) view.willRemoveFromParent() ;
454
+ if (this.willRemoveChild) this.willRemoveChild(view) ;
455
+
456
+ // update parent node
457
+ view.set('parentView', null) ;
458
+
459
+ // remove view from childViews array.
460
+ var childViews = this.get('childViews'),
461
+ idx = childViews.indexOf(view) ;
462
+ if (idx>=0) childViews.removeAt(idx);
463
+
464
+ // The DOM will need some fixing up, note this on the view.
465
+ view.parentViewDidChange() ;
466
+
467
+ // notify views
468
+ if (this.didRemoveChild) this.didRemoveChild(view);
469
+ if (view.didRemoveFromParent) view.didRemoveFromParent(this) ;
470
+
471
+ return this ;
472
+ },
473
+
474
+ /**
475
+ Removes all children from the parentView.
476
+
477
+ @returns {SC.View} receiver
478
+ */
479
+ removeAllChildren: function() {
480
+ var childViews = this.get('childViews'), view ;
481
+ while (view = childViews.objectAt(childViews.get('length')-1)) {
482
+ this.removeChild(view) ;
483
+ }
484
+ return this ;
485
+ },
486
+
487
+ /**
488
+ Removes the view from its parentView, if one is found. Otherwise
489
+ does nothing.
490
+
491
+ @returns {SC.View} receiver
492
+ */
493
+ removeFromParent: function() {
494
+ var parent = this.get('parentView') ;
495
+ if (parent) parent.removeChild(this) ;
496
+ return this ;
497
+ },
498
+
499
+ /**
500
+ Replace the oldView with the specified view in the receivers childNodes
501
+ array. This will also replace the DOM node of the oldView with the DOM
502
+ node of the new view in the receivers DOM.
503
+
504
+ If the specified view already belongs to another parent, it will be
505
+ removed from that view first.
506
+
507
+ @param view {SC.View} the view to insert in the DOM
508
+ @param view {SC.View} the view to remove from the DOM.
509
+ @returns {SC.View} the receiver
510
+ */
511
+ replaceChild: function(view, oldView) {
512
+ // suspend notifications
513
+ view.beginPropertyChanges();
514
+ oldView.beginPropertyChanges();
515
+ this.beginPropertyChanges();
516
+
517
+ this.insertBefore(view,oldView).removeChild(oldView) ;
518
+
519
+ // resume notifications
520
+ this.endPropertyChanges();
521
+ oldView.endPropertyChanges();
522
+ view.endPropertyChanges();
523
+
524
+ return this;
525
+ },
526
+
527
+ /**
528
+ Replaces the current array of child views with the new array of child
529
+ views.
530
+
531
+ @param {Array} views views you want to add
532
+ @returns {SC.View} receiver
533
+ */
534
+ replaceAllChildren: function(views) {
535
+ var len = views.get('length'), idx;
536
+
537
+ this.beginPropertyChanges();
538
+ this.destroyLayer().removeAllChildren();
539
+ for(idx=0;idx<len;idx++) this.appendChild(views.objectAt(idx));
540
+ this.replaceLayer();
541
+ this.endPropertyChanges();
542
+
543
+ return this ;
544
+ },
545
+
546
+ /**
547
+ Appends the specified view to the end of the receivers childViews array.
548
+ This is equivalent to calling insertBefore(view, null);
549
+
550
+ @param view {SC.View} the view to insert
551
+ @returns {SC.View} the receiver
552
+ */
553
+ appendChild: function(view) {
554
+ return this.insertBefore(view, null);
555
+ },
556
+
557
+ /**
558
+ This method is called whenever the receiver's parentView has changed.
559
+ The default implementation of this method marks the view's display
560
+ location as dirty so that it will update at the end of the run loop.
561
+
562
+ You will not usually need to override or call this method yourself, though
563
+ if you manually patch the parentView hierarchy for some reason, you should
564
+ call this method to notify the view that it's parentView has changed.
565
+
566
+ @returns {SC.View} receiver
567
+ */
568
+ parentViewDidChange: function() {
569
+ this.recomputeIsVisibleInWindow() ;
570
+
571
+ this.set('layerLocationNeedsUpdate', YES) ;
572
+ this.invokeOnce(this.updateLayerLocationIfNeeded) ;
573
+
574
+ // We also need to iterate down through the view hierarchy and invalidate
575
+ // all our child view's caches for 'pane', since it could have changed.
576
+ //
577
+ // Note: In theory we could try to avoid this invalidation if we
578
+ // do this only in cases where we "know" the 'pane' value might
579
+ // have changed, but those cases are few and far between.
580
+
581
+ this._invalidatePaneCacheForSelfAndAllChildViews();
582
+
583
+ return this ;
584
+ },
585
+
586
+ /** @private
587
+ We want to cache the 'pane' property, but it's impossible for us to
588
+ declare a dependence on all properties that can affect the value. (For
589
+ example, if our grandparent gets attached to a new pane, our pane will
590
+ have changed.) So when there's the potential for the pane changing, we
591
+ need to invalidate the caches for all our child views, and their child
592
+ views, and so on.
593
+ */
594
+ _invalidatePaneCacheForSelfAndAllChildViews: function () {
595
+ var childView, childViews = this.get('childViews'),
596
+ len = childViews.length, idx ;
597
+
598
+ this.notifyPropertyChange('pane');
599
+
600
+ for (idx=0; idx<len; ++idx) {
601
+ childView = childViews[idx];
602
+ if (childView._invalidatePaneCacheForSelfAndAllChildViews) {
603
+ childView._invalidatePaneCacheForSelfAndAllChildViews();
604
+ }
605
+ }
606
+ },
607
+
608
+ // ..........................................................
609
+ // LAYER SUPPORT
610
+ //
611
+
612
+ /**
613
+ Returns the current layer for the view. The layer for a view is only
614
+ generated when the view first becomes visible in the window and even
615
+ then it will not be computed until you request this layer property.
616
+
617
+ If the layer is not actually set on the view itself, then the layer will
618
+ be found by calling this.findLayerInParentLayer().
619
+
620
+ You can also set the layer by calling set on this property.
621
+
622
+ @property {DOMElement} the layer
623
+ */
624
+ layer: function(key, value) {
625
+ if (value !== undefined) {
626
+ this._view_layer = value ;
627
+
628
+ // no layer...attempt to discover it...
629
+ } else {
630
+ value = this._view_layer;
631
+ if (!value) {
632
+ var parent = this.get('parentView');
633
+ if (parent) parent = parent.get('layer');
634
+ if (parent) {
635
+ this._view_layer = value = this.findLayerInParentLayer(parent);
636
+ }
637
+ parent = null ; // avoid memory leak
638
+ }
639
+ }
640
+ return value ;
641
+ }.property('isVisibleInWindow').cacheable(),
642
+
643
+ /**
644
+ Get a CoreQuery object for this view's layer, or pass in a selector string
645
+ to get a CoreQuery object for a DOM node nested within this layer.
646
+
647
+ @param {String} sel a CoreQuery-compatible selector string
648
+ @returns {SC.CoreQuery} the CoreQuery object for the DOM node
649
+ */
650
+ $: function(sel) {
651
+ var ret, layer = this.get('layer') ;
652
+ // note: SC.$([]) returns an empty CoreQuery object. SC.$() would
653
+ // return an object selecting the document.
654
+ ret = !layer ? SC.$([]) : (sel === undefined) ? SC.$(layer) : SC.$(sel, layer) ;
655
+ layer = null ; // avoid memory leak
656
+ return ret ;
657
+ },
658
+
659
+ /**
660
+ Returns the DOM element that should be used to hold child views when they
661
+ are added/remove via DOM manipulation. The default implementation simply
662
+ returns the layer itself. You can override this to return a DOM element
663
+ within the layer.
664
+
665
+ @property {DOMElement} the container layer
666
+ */
667
+ containerLayer: function() {
668
+ return this.get('layer') ;
669
+ }.property('layer').cacheable(),
670
+
671
+ /**
672
+ The ID to use when trying to locate the layer in the DOM. If you do not
673
+ set the layerId explicitly, then the view's GUID will be used instead.
674
+ This ID must be set at the time the view is created.
675
+
676
+ @property {String}
677
+ @readOnly
678
+ */
679
+ layerId: function(key, value) {
680
+ if (value) this._layerId = value;
681
+ if (this._layerId) return this._layerId;
682
+ return SC.guidFor(this) ;
683
+ }.property().cacheable(),
684
+
685
+ _lastLayerId: null,
686
+
687
+ /**
688
+ Handles changes in the layer id.
689
+ */
690
+ layerIdDidChange: function() {
691
+ var layer = this.get("layer"),
692
+ lid = this.get("layerId"),
693
+ lastId = this._lastLayerId;
694
+ if (lid !== lastId) {
695
+ // if we had an earlier one, remove from view hash.
696
+ if (lastId && SC.View.views[lastId] === this) {
697
+ delete SC.View.views[lastId];
698
+ }
699
+
700
+ // set the current one as the new old one
701
+ this._lastLayerId = lid;
702
+
703
+ // and add the new one
704
+ SC.View.views[lid] = this;
705
+
706
+ // and finally, set the actual layer id.
707
+ if (layer) layer.id = lid;
708
+ }
709
+ }.observes("layerId"),
710
+
711
+ /**
712
+ Attempts to discover the layer in the parent layer. The default
713
+ implementation looks for an element with an ID of layerId (or the view's
714
+ guid if layerId is null). You can override this method to provide your
715
+ own form of lookup. For example, if you want to discover your layer using
716
+ a CSS class name instead of an ID.
717
+
718
+ @param {DOMElement} parentLayer the parent's DOM layer
719
+ @returns {DOMElement} the discovered layer
720
+ */
721
+ findLayerInParentLayer: function(parentLayer) {
722
+ var layerId = this.get('layerId'),
723
+ node, i, ilen, childNodes, elem, usedQuerySelector;
724
+
725
+ // first, let's try the fast path...
726
+ elem = document.getElementById(layerId) ;
727
+
728
+ // TODO: use code generation to only really do this check on IE
729
+ if (SC.browser.msie && elem && elem.id !== layerId) elem = null;
730
+
731
+ // if no element was found the fast way, search down the parentLayer for
732
+ // the element. This code should not be invoked very often. Usually a
733
+ // DOM element will be discovered by the first method above.
734
+ // This code uses a BFS algorithm as is expected to find the layer right
735
+ // below the parent.
736
+ if (!elem) {
737
+ elem = parentLayer.firstChild ;
738
+ var q = [];
739
+ q.push(parentLayer);
740
+ while (q.length !==0) {
741
+ node = q.shift();
742
+ if (node.id===layerId) {
743
+ return node;
744
+ }
745
+ childNodes = node.childNodes;
746
+ for (i=0, ilen=childNodes.length; i < ilen; ++i) {
747
+ q.push(childNodes[i]);
748
+ }
749
+ }
750
+ elem = null;
751
+ }
752
+
753
+ return elem;
754
+ },
755
+
756
+ /**
757
+ Returns YES if the receiver is a subview of a given view or if it’s
758
+ identical to that view. Otherwise, it returns NO.
759
+
760
+ @property {SC.View} view
761
+ */
762
+ isDescendantOf: function(view) {
763
+ var parentView = this.get('parentView');
764
+
765
+ if(this===view) return YES;
766
+ else if(parentView) return parentView.isDescendantOf(view);
767
+ else return NO;
768
+ },
769
+
770
+ /**
771
+ This method is invoked whenever a display property changes. It will set
772
+ the layerNeedsUpdate method to YES. If you need to perform additional
773
+ setup whenever the display changes, you can override this method as well.
774
+
775
+ @returns {SC.View} receiver
776
+ */
777
+ displayDidChange: function() {
778
+ this.set('layerNeedsUpdate', YES) ;
779
+ return this;
780
+ },
781
+
782
+ /**
783
+ Setting this property to YES will cause the updateLayerIfNeeded method to
784
+ be invoked at the end of the runloop. You can also force a view to update
785
+ sooner by calling updateLayerIfNeeded() directly. The method will update
786
+ the layer only if this property is YES.
787
+
788
+ @property {Boolean}
789
+ @test in updateLayer
790
+ */
791
+ layerNeedsUpdate: NO,
792
+
793
+ /** @private
794
+ Schedules the updateLayerIfNeeded method to run at the end of the runloop
795
+ if layerNeedsUpdate is set to YES.
796
+ */
797
+ _view_layerNeedsUpdateDidChange: function() {
798
+ if (this.get('layerNeedsUpdate')) {
799
+ this.invokeOnce(this.updateLayerIfNeeded) ;
800
+ }
801
+ }.observes('layerNeedsUpdate'),
802
+
803
+ /**
804
+ Updates the layer only if the view is visible onscreen and if
805
+ layerNeedsUpdate is set to YES. Normally you will not invoke this method
806
+ directly. Instead you set the layerNeedsUpdate property to YES and this
807
+ method will be called once at the end of the runloop.
808
+
809
+ If you need to update view's layer sooner than the end of the runloop, you
810
+ can call this method directly. If your view is not visible in the window
811
+ but you want it to update anyway, then call this method, passing YES for
812
+ the 'skipIsVisibleInWindowCheck' parameter.
813
+
814
+ You should not override this method. Instead override updateLayer() or
815
+ render().
816
+
817
+ @returns {SC.View} receiver
818
+ @test in updateLayer
819
+ */
820
+ updateLayerIfNeeded: function(skipIsVisibleInWindowCheck) {
821
+ var needsUpdate = this.get('layerNeedsUpdate'),
822
+ shouldUpdate = needsUpdate && (skipIsVisibleInWindowCheck || this.get('isVisibleInWindow'));
823
+ if (shouldUpdate) {
824
+ // only update a layer if it already exists
825
+ if (this.get('layer')) {
826
+ this.beginPropertyChanges() ;
827
+ this.set('layerNeedsUpdate', NO) ;
828
+ this.updateLayer() ;
829
+ this.endPropertyChanges() ;
830
+ }
831
+ }
832
+
833
+ return this ;
834
+ },
835
+
836
+ /**
837
+ This is the core method invoked to update a view layer whenever it has
838
+ changed. This method simply creates a render context focused on the
839
+ layer element and then calls your render() method.
840
+
841
+ You will not usually call or override this method directly. Instead you
842
+ should set the layerNeedsUpdate property to YES to cause this method to
843
+ run at the end of the run loop, or you can call updateLayerIfNeeded()
844
+ to force the layer to update immediately.
845
+
846
+ Instead of overriding this method, consider overidding the render() method
847
+ instead, which is called both when creating and updating a layer. If you
848
+ do not want your render() method called when updating a layer, then you
849
+ should override this method instead.
850
+
851
+ @returns {SC.View} receiver
852
+ */
853
+ updateLayer: function() {
854
+ var context = this.renderContext(this.get('layer')) ;
855
+ this.prepareContext(context, NO) ;
856
+ context.update() ;
857
+ if (context._innerHTMLReplaced) {
858
+ var pane = this.get('pane');
859
+ if(pane && pane.get('isPaneAttached')) {
860
+ this._notifyDidAppendToDocument();
861
+ }
862
+ }
863
+
864
+ // If this view uses static layout, then notify that the frame (likely)
865
+ // changed.
866
+ if (this.useStaticLayout) this.viewDidResize();
867
+
868
+ if (this.didUpdateLayer) this.didUpdateLayer(); // call to update DOM
869
+ if(this.designer && this.designer.viewDidUpdateLayer) {
870
+ this.designer.viewDidUpdateLayer(); //let the designer know
871
+ }
872
+ return this ;
873
+ },
874
+
875
+ /**
876
+ Creates a new renderContext with the passed tagName or element. You
877
+ can override this method to provide further customization to the context
878
+ if needed. Normally you will not need to call or override this method.
879
+
880
+ @returns {SC.RenderContext}
881
+ */
882
+ renderContext: function(tagNameOrElement) {
883
+ return SC.RenderContext(tagNameOrElement) ;
884
+ },
885
+
886
+ /**
887
+ Creates the layer by creating a renderContext and invoking the view's
888
+ render() method. This will only create the layer if the layer does not
889
+ already exist.
890
+
891
+ When you create a layer, it is expected that your render() method will
892
+ also render the HTML for all child views as well. This method will
893
+ notify the view along with any of its childViews that its layer has been
894
+ created.
895
+
896
+ @returns {SC.View} receiver
897
+ */
898
+ createLayer: function() {
899
+ if (this.get('layer')) return this ; // nothing to do
900
+
901
+ var context = this.renderContext(this.get('tagName')) ;
902
+
903
+ // now prepare the content like normal.
904
+ this.prepareContext(context, YES) ;
905
+ this.set('layer', context.element()) ;
906
+
907
+ // now notify the view and its child views..
908
+ this._notifyDidCreateLayer() ;
909
+
910
+ return this ;
911
+ },
912
+
913
+ /** @private -
914
+ Invokes the receivers didCreateLayer() method if it exists and then
915
+ invokes the same on all child views.
916
+ */
917
+ _notifyDidCreateLayer: function() {
918
+ if (this.didCreateLayer) this.didCreateLayer() ;
919
+ var mixins = this.didCreateLayerMixin, len, idx,
920
+ childViews = this.get('childViews'),
921
+ childView;
922
+ if (mixins) {
923
+ len = mixins.length ;
924
+ for (idx=0; idx<len; ++idx) mixins[idx].call(this) ;
925
+ }
926
+
927
+ len = childViews.length ;
928
+ for (idx=0; idx<len; ++idx) {
929
+ childView = childViews[idx];
930
+ if (!childView) continue;
931
+
932
+ // A parent view creating a layer might result in the creation of a
933
+ // child view's DOM node being created via a render context without
934
+ // createLayer() being invoked on the child. In such cases, if anyone
935
+ // had requested 'layer' and it was cached as null, we need to
936
+ // invalidate it.
937
+ childView.notifyPropertyChange('layer');
938
+
939
+ childView._notifyDidCreateLayer() ;
940
+ }
941
+ },
942
+
943
+ /**
944
+ Destroys any existing layer along with the layer for any child views as
945
+ well. If the view does not currently have a layer, then this method will
946
+ do nothing.
947
+
948
+ If you implement willDestroyLayer() on your view or if any mixins
949
+ implement willDestroLayerMixin(), then this method will be invoked on your
950
+ view before your layer is destroyed to give you a chance to clean up any
951
+ event handlers, etc.
952
+
953
+ If you write a willDestroyLayer() handler, you can assume that your
954
+ didCreateLayer() handler was called earlier for the same layer.
955
+
956
+ Normally you will not call or override this method yourself, but you may
957
+ want to implement the above callbacks when it is run.
958
+
959
+ @returns {SC.View} receiver
960
+ */
961
+ destroyLayer: function() {
962
+ var layer = this.get('layer') ;
963
+ if (layer) {
964
+ // Now notify the view and its child views. It will also set the
965
+ // layer property to null.
966
+ this._notifyWillDestroyLayer() ;
967
+
968
+ // do final cleanup
969
+ if (layer.parentNode) layer.parentNode.removeChild(layer) ;
970
+ layer = null ;
971
+ }
972
+ return this ;
973
+ },
974
+
975
+ /**
976
+ Destroys and recreates the current layer. This can be more efficient than
977
+ modifying individual child views.
978
+
979
+ @returns {SC.View} receiver
980
+ */
981
+ replaceLayer: function() {
982
+ this.destroyLayer();
983
+ this.set('layerLocationNeedsUpdate', YES) ;
984
+ this.invokeOnce(this.updateLayerLocationIfNeeded) ;
985
+ },
986
+
987
+ /** @private -
988
+ Invokes willDestroyLayer() on view and child views. Then sets layer to
989
+ null for receiver.
990
+ */
991
+ _notifyWillDestroyLayer: function() {
992
+ if (this.willDestroyLayer) this.willDestroyLayer() ;
993
+ var mixins = this.willDestroyLayerMixin, len, idx,
994
+ childViews = this.get('childViews') ;
995
+ if (mixins) {
996
+ len = mixins.length ;
997
+ for (idx=0; idx<len; ++idx) mixins[idx].call(this) ;
998
+ }
999
+
1000
+ len = childViews.length ;
1001
+ for (idx=0; idx<len; ++idx) childViews[idx]._notifyWillDestroyLayer() ;
1002
+
1003
+ this.set('layer', null) ;
1004
+ },
1005
+
1006
+ /**
1007
+ Invoked by createLayer() and updateLayer() to actually render a context.
1008
+ This method calls the render() method on your view along with any
1009
+ renderMixin() methods supplied by mixins you might have added.
1010
+
1011
+ You should not override this method directly. However, you might call
1012
+ this method if you choose to override updateLayer() or createLayer().
1013
+
1014
+ @param {SC.RenderContext} context the render context
1015
+ @param {Boolean} firstTime YES if this is creating a layer
1016
+ @returns {void}
1017
+ */
1018
+ prepareContext: function(context, firstTime) {
1019
+ var mixins, len, idx, layerId, bgcolor, cursor, classNames;
1020
+
1021
+ // do some initial setup only needed at create time.
1022
+ if (firstTime) {
1023
+ // TODO: seems like things will break later if SC.guidFor(this) is used
1024
+
1025
+ layerId = this.layerId ? this.get('layerId') : SC.guidFor(this) ;
1026
+ context.id(layerId).classNames(this.get('classNames'), YES) ;
1027
+ this.renderLayout(context, firstTime) ;
1028
+ }else{
1029
+ context.resetClassNames();
1030
+ context.classNames(this.get('classNames'), YES);
1031
+ }
1032
+
1033
+ // do some standard setup...
1034
+ classNames = [];
1035
+ if (this.get('isTextSelectable')) classNames.push('allow-select') ;
1036
+ if (!this.get('isEnabled')) classNames.push('disabled') ;
1037
+ if (!this.get('isVisible')) classNames.push('hidden') ;
1038
+ if (this.get('isFirstResponder')) classNames.push('focus');
1039
+ if (this.get('useStaticLayout')) classNames.push('sc-static-layout');
1040
+
1041
+ bgcolor = this.get('backgroundColor');
1042
+ if (bgcolor) context.addStyle('backgroundColor', bgcolor);
1043
+
1044
+ // Sets cursor class, if present.
1045
+ cursor = this.get('cursor');
1046
+ if (!cursor && this.get('shouldInheritCursor')) {
1047
+ // If this view has no cursor and should inherit it from the parent,
1048
+ // then it sets its own cursor view. This sets the cursor rather than
1049
+ // simply using the parent's cursor object so that its cursorless
1050
+ // childViews can also inherit it.
1051
+ cursor = this.getPath('parentView.cursor');
1052
+ }
1053
+
1054
+ if (SC.typeOf(cursor) === SC.T_STRING) {
1055
+ cursor = SC.objectForPropertyPath(cursor);
1056
+ }
1057
+
1058
+ if (cursor instanceof SC.Cursor) {
1059
+ classNames.push(cursor.get('className')) ;
1060
+ }
1061
+
1062
+ // Doing a single call to 'addClass' is faster than multiple.
1063
+ context.addClass(classNames);
1064
+
1065
+ this.beginPropertyChanges() ;
1066
+ this.set('layerNeedsUpdate', NO) ;
1067
+ this.render(context, firstTime) ;
1068
+ if (mixins = this.renderMixin) {
1069
+ len = mixins.length;
1070
+ for(idx=0; idx<len; ++idx) mixins[idx].call(this, context, firstTime) ;
1071
+ }
1072
+ this.endPropertyChanges() ;
1073
+ },
1074
+
1075
+ /**
1076
+ Your render method should invoke this method to render any child views,
1077
+ especially if this is the first time the view will be rendered. This will
1078
+ walk down the childView chain, rendering all of the children in a nested
1079
+ way.
1080
+
1081
+ @param {SC.RenderContext} context the context
1082
+ @param {Boolean} firstName true if the layer is being created
1083
+ @returns {SC.RenderContext} the render context
1084
+ @test in render
1085
+ */
1086
+ renderChildViews: function(context, firstTime) {
1087
+ var cv = this.get('childViews'), len = cv.length, idx, view ;
1088
+ for (idx=0; idx<len; ++idx) {
1089
+ view = cv[idx] ;
1090
+ if (!view) continue;
1091
+ context = context.begin(view.get('tagName')) ;
1092
+ view.prepareContext(context, firstTime) ;
1093
+ context = context.end() ;
1094
+ }
1095
+ return context ;
1096
+ },
1097
+
1098
+ /**
1099
+ Invoked whenever your view needs to be rendered, including when the view's
1100
+ layer is first created and any time in the future when it needs to be
1101
+ updated.
1102
+
1103
+ You will normally override this method in your subclassed views to
1104
+ provide whatever drawing functionality you will need in order to
1105
+ render your content.
1106
+
1107
+ You can use the passed firstTime property to determine whether or not
1108
+ you need to completely re-render the view or only update the surrounding
1109
+ HTML.
1110
+
1111
+ The default implementation of this method simply calls renderChildViews()
1112
+ if this is the first time you are rendering, or null otherwise.
1113
+
1114
+ @param {SC.RenderContext} context the render context
1115
+ @param {Boolean} firstTime YES if this is creating a layer
1116
+ @returns {void}
1117
+ */
1118
+ render: function(context, firstTime) {
1119
+ if (firstTime) this.renderChildViews(context, firstTime) ;
1120
+ },
1121
+
1122
+
1123
+ /** @private -
1124
+ Invokes the receivers didAppendLayerToDocument() method if it exists and
1125
+ then invokes the same on all child views.
1126
+ */
1127
+
1128
+ _notifyDidAppendToDocument: function() {
1129
+ if (this.didAppendToDocument) this.didAppendToDocument();
1130
+
1131
+ var i=0, child, childLen, children = this.get('childViews');
1132
+ for(i=0, childLen=children.length; i<childLen; i++) {
1133
+ child = children[i];
1134
+ if(child._notifyDidAppendToDocument){
1135
+ child._notifyDidAppendToDocument();
1136
+ }
1137
+ }
1138
+ },
1139
+
1140
+ childViewsObserver: function(){
1141
+ var childViews = this.get('childViews'), i, iLen, child;
1142
+ for(i=0, iLen = childViews.length; i<iLen; i++){
1143
+ child = childViews[i];
1144
+ if(child._notifyDidAppendToDocument){
1145
+ child._notifyDidAppendToDocument();
1146
+ }
1147
+ }
1148
+ }.observes('childViews'),
1149
+
1150
+ // ..........................................................
1151
+ // STANDARD RENDER PROPERTIES
1152
+ //
1153
+
1154
+ /**
1155
+ Tag name for the view's outer element. The tag name is only used when
1156
+ a layer is first created. If you change the tagName for an element, you
1157
+ must destroy and recreate the view layer.
1158
+
1159
+ @property {String}
1160
+ */
1161
+ tagName: 'div',
1162
+
1163
+ /**
1164
+ Standard CSS class names to apply to the view's outer element. This
1165
+ property automatically inherits any class names defined by the view's
1166
+ superclasses as well.
1167
+
1168
+ @property {Array}
1169
+ */
1170
+ classNames: ['sc-view'],
1171
+
1172
+ /**
1173
+ Tool tip property that will be set to the title attribute on the HTML
1174
+ rendered element.
1175
+
1176
+ @property {String}
1177
+ */
1178
+ toolTip: null,
1179
+
1180
+ /**
1181
+ Determines if the user can select text within the view. Normally this is
1182
+ set to NO to disable text selection. You should set this to YES if you
1183
+ are creating a view that includes editable text. Otherwise, settings this
1184
+ to YES will probably make your controls harder to use and it is not
1185
+ recommended.
1186
+
1187
+ @property {Boolean}
1188
+ @readOnly
1189
+ */
1190
+ isTextSelectable: NO,
1191
+
1192
+ /**
1193
+ You can set this array to include any properties that should immediately
1194
+ invalidate the display. The display will be automatically invalidated
1195
+ when one of these properties change.
1196
+
1197
+ Implementation note: 'isVisible' is also effectively a display property,
1198
+ but it is not declared as such because the same effect is implemented
1199
+ inside _sc_isVisibleDidChange(). This avoids having two observers on
1200
+ 'isVisible', which is:
1201
+ a. More efficient
1202
+ b. More correct, because we can guarantee the order of operations
1203
+
1204
+ @property {Array}
1205
+ @readOnly
1206
+ */
1207
+ displayProperties: ['isFirstResponder'],
1208
+
1209
+ /**
1210
+ You can set this to an SC.Cursor instance; its class name will
1211
+ automatically be added to the layer's classNames, allowing you
1212
+ to efficiently change the cursor for a large group of views with
1213
+ just one change to the SC.Cursor object. The cursor property
1214
+ is only used when the layer is created, so if you need to change
1215
+ it to a different cursor object, you will have to destroy and
1216
+ recreate the view layer. (In this case you might investigate
1217
+ setting cursors using CSS directly instead of SC.Cursor.)
1218
+
1219
+ @property {SC.Cursor String}
1220
+ */
1221
+ cursor: null,
1222
+
1223
+ /**
1224
+ A child view without a cursor of its own inherits its parent's cursor by
1225
+ default. Set this to NO to prevent this behavior.
1226
+
1227
+ @property {Boolean}
1228
+ */
1229
+ shouldInheritCursor: YES,
1230
+
1231
+ // ..........................................................
1232
+ // LAYER LOCATION
1233
+ //
1234
+
1235
+ /**
1236
+ Set to YES when the view's layer location is dirty. You can call
1237
+ updateLayerLocationIfNeeded() to clear this flag if it is set.
1238
+
1239
+ @property {Boolean}
1240
+ */
1241
+ layerLocationNeedsUpdate: NO,
1242
+
1243
+ /**
1244
+ Calls updateLayerLocation(), but only if the view's layer location
1245
+ currently needs to be updated. This method is called automatically at
1246
+ the end of a run loop if you have called parentViewDidChange() at some
1247
+ point.
1248
+
1249
+ @property {Boolean} force This property is ignored.
1250
+ @returns {SC.View} receiver
1251
+ @test in updateLayerLocation
1252
+ */
1253
+ updateLayerLocationIfNeeded: function(force) {
1254
+ if (this.get('layerLocationNeedsUpdate')) {
1255
+ this.updateLayerLocation() ;
1256
+ }
1257
+ return this ;
1258
+ },
1259
+
1260
+ /**
1261
+ This method is called when a view changes its location in the view
1262
+ hierarchy. This method will update the underlying DOM-location of the
1263
+ layer so that it reflects the new location.
1264
+
1265
+ @returns {SC.View} receiver
1266
+ */
1267
+ updateLayerLocation: function() {
1268
+ // collect some useful value
1269
+ // if there is no node for some reason, just exit
1270
+ var node = this.get('layer'),
1271
+ parentView = this.get('parentView'),
1272
+ parentNode = parentView ? parentView.get('containerLayer') : null ;
1273
+
1274
+ // remove node from current parentNode if the node does not match the new
1275
+ // parent node.
1276
+ if (node && node.parentNode && node.parentNode !== parentNode) {
1277
+ node.parentNode.removeChild(node);
1278
+ }
1279
+
1280
+ // CASE 1: no new parentView. just remove from parent (above).
1281
+ if (!parentView) {
1282
+ if (node && node.parentNode) node.parentNode.removeChild(node);
1283
+
1284
+ // CASE 2: parentView has no layer, view has layer. destroy layer
1285
+ // CASE 3: parentView has no layer, view has no layer, nothing to do
1286
+ } else if (!parentNode) {
1287
+ if (node) {
1288
+ if (node.parentNode) node.parentNode.removeChild(node);
1289
+ this.destroyLayer();
1290
+ }
1291
+
1292
+ // CASE 4: parentView has layer, view has no layer. create layer & add
1293
+ // CASE 5: parentView has layer, view has layer. move layer
1294
+ } else {
1295
+ if (!node) {
1296
+ this.createLayer() ;
1297
+ node = this.get('layer') ;
1298
+ if (!node) return; // can't do anything without a node.
1299
+ }
1300
+
1301
+ var siblings = parentView.get('childViews'),
1302
+ nextView = siblings.objectAt(siblings.indexOf(this)+1),
1303
+ nextNode = (nextView) ? nextView.get('layer') : null ;
1304
+
1305
+ // before we add to parent node, make sure that the nextNode exists...
1306
+ if (nextView && (!nextNode || nextNode.parentNode!==parentNode)) {
1307
+ nextView.updateLayerLocationIfNeeded() ;
1308
+ nextNode = nextView.get('layer') ;
1309
+ }
1310
+
1311
+ // add to parentNode if needed.
1312
+ if ((node.parentNode!==parentNode) || (node.nextSibling!==nextNode)) {
1313
+ parentNode.insertBefore(node, nextNode) ;
1314
+ }
1315
+ }
1316
+
1317
+ parentNode = parentView = node = nextNode = null ; // avoid memory leaks
1318
+
1319
+ this.set('layerLocationNeedsUpdate', NO) ;
1320
+
1321
+ return this ;
1322
+ },
1323
+
1324
+ // .......................................................
1325
+ // SC.RESPONDER SUPPORT
1326
+ //
1327
+
1328
+ /** @property
1329
+ The nextResponder is usually the parentView.
1330
+ */
1331
+ nextResponder: function() {
1332
+ return this.get('parentView') ;
1333
+ }.property('parentView').cacheable(),
1334
+
1335
+
1336
+ /** @property
1337
+ Set to YES if your view is willing to accept first responder status. This
1338
+ is used when calculcating key responder loop.
1339
+ */
1340
+ acceptsFirstResponder: NO,
1341
+
1342
+ // ..........................................................
1343
+ // KEY RESPONDER
1344
+ //
1345
+
1346
+ /** @property
1347
+ YES if the view is currently first responder and the pane the view belongs
1348
+ to is also key pane. While this property is set, you should expect to
1349
+ receive keyboard events.
1350
+ */
1351
+ isKeyResponder: NO,
1352
+
1353
+ /**
1354
+ This method is invoked just before you lost the key responder status.
1355
+ The passed view is the view that is about to gain keyResponder status.
1356
+ This gives you a chance to do any early setup. Remember that you can
1357
+ gain/lose key responder status either because another view in the same
1358
+ pane is becoming first responder or because another pane is about to
1359
+ become key.
1360
+
1361
+ @param {SC.Responder} responder
1362
+ */
1363
+ willLoseKeyResponderTo: function(responder) {},
1364
+
1365
+ /**
1366
+ This method is invoked just before you become the key responder. The
1367
+ passed view is the view that is about to lose keyResponder status. You
1368
+ can use this to do any setup before the view changes.
1369
+ Remember that you can gain/lose key responder status either because
1370
+ another view in the same pane is becoming first responder or because
1371
+ another pane is about to become key.
1372
+
1373
+ @param {SC.Responder} responder
1374
+ */
1375
+ willBecomeKeyResponderFrom: function(responder) {},
1376
+
1377
+ /**
1378
+ Invokved just after the responder loses key responder status.
1379
+ */
1380
+ didLoseKeyResponderTo: function(responder) {},
1381
+
1382
+ /**
1383
+ Invoked just after the responder gains key responder status.
1384
+ */
1385
+ didBecomeKeyResponderFrom: function(responder) {},
1386
+
1387
+ /**
1388
+ This method will process a key input event, attempting to convert it to
1389
+ an appropriate action method and sending it up the responder chain. The
1390
+ event is converted using the SC.KEY_BINDINGS hash, which maps key events
1391
+ into method names. If no key binding is found, then the key event will
1392
+ be passed along using an insertText() method.
1393
+
1394
+ @param {SC.Event} event
1395
+ @returns {Object} object that handled event, if any
1396
+ */
1397
+ interpretKeyEvents: function(event) {
1398
+ var codes = event.commandCodes(), cmd = codes[0], chr = codes[1], ret;
1399
+
1400
+ if (!cmd && !chr) return null ; //nothing to do.
1401
+
1402
+ // if this is a command key, try to do something about it.
1403
+ if (cmd) {
1404
+ var methodName = SC.MODIFIED_KEY_BINDINGS[cmd] || SC.BASE_KEY_BINDINGS[cmd.match(/[^_]+$/)[0]];
1405
+ if (methodName) {
1406
+ var target = this, pane = this.get('pane'), handler = null;
1407
+ while(target && !(handler = target.tryToPerform(methodName, event))){
1408
+ target = (target===pane)? null: target.get('nextResponder') ;
1409
+ }
1410
+ return handler ;
1411
+ }
1412
+ }
1413
+
1414
+ if (chr && this.respondsTo('insertText')) {
1415
+ // if we haven't returned yet and there is plain text, then do an insert
1416
+ // of the text. Since this is not an action, do not send it up the
1417
+ // responder chain.
1418
+ ret = this.insertText(chr, event);
1419
+ return ret ? (ret===YES ? this : ret) : null ; // map YES|NO => this|nil
1420
+ }
1421
+
1422
+ return null ; //nothing to do.
1423
+ },
1424
+
1425
+ /**
1426
+ This method is invoked by interpretKeyEvents() when you receive a key
1427
+ event matching some plain text. You can use this to actually insert the
1428
+ text into your application, if needed.
1429
+
1430
+ @param {SC.Event} event
1431
+ @returns {Object} receiver or object that handled event
1432
+ */
1433
+ insertText: function(chr) {
1434
+ return NO ;
1435
+ },
1436
+
1437
+ /**
1438
+ Recursively travels down the view hierarchy looking for a view that
1439
+ implements the key equivalent (returning to YES to indicate it handled
1440
+ the event). You can override this method to handle specific key
1441
+ equivalents yourself.
1442
+
1443
+ The keystring is a string description of the key combination pressed.
1444
+ The evt is the event itself. If you handle the equivalent, return YES.
1445
+ Otherwise, you should just return sc_super.
1446
+
1447
+ @param {String} keystring
1448
+ @param {SC.Event} evt
1449
+ @returns {Boolean}
1450
+ */
1451
+ performKeyEquivalent: function(keystring, evt) {
1452
+ var ret = NO,
1453
+ childViews = this.get('childViews'),
1454
+ len = childViews.length,
1455
+ idx = -1 ;
1456
+ while (!ret && (++idx < len)) {
1457
+ ret = childViews[idx].performKeyEquivalent(keystring, evt) ;
1458
+ }
1459
+ return ret ;
1460
+ },
1461
+
1462
+ /**
1463
+ Optionally points to the next key view that should gain focus when tabbing
1464
+ through an interface. If this is not set, then the next key view will
1465
+ be set automatically to the next child.
1466
+ */
1467
+ nextKeyView: null,
1468
+
1469
+ /**
1470
+ Computes the next valid key view, possibly returning the receiver or null.
1471
+ This is the next key view that acceptsFirstResponder.
1472
+
1473
+ @property
1474
+ @type SC.View
1475
+ */
1476
+ nextValidKeyView: function() {
1477
+ var seen = [],
1478
+ rootView = this.get('pane'), ret = this.get('nextKeyView');
1479
+
1480
+ if(!ret) ret = rootView._computeNextValidKeyView(this, seen);
1481
+
1482
+ if(SC.TABBING_ONLY_INSIDE_DOCUMENT && !ret) {
1483
+ ret = rootView._computeNextValidKeyView(rootView, seen);
1484
+ }
1485
+
1486
+ return ret ;
1487
+ }.property('nextKeyView'),
1488
+
1489
+ _computeNextValidKeyView: function(currentView, seen) {
1490
+ var ret = this.get('nextKeyView'),
1491
+ children, i, childLen, child;
1492
+ if(this !== currentView && seen.indexOf(currentView)!=-1 &&
1493
+ this.get('acceptsFirstResponder') && this.get('isVisibleInWindow')){
1494
+ return this;
1495
+ }
1496
+ seen.push(this); // avoid cycles
1497
+
1498
+ // find next sibling
1499
+ if (!ret) {
1500
+ children = this.get('childViews');
1501
+ for(i=0, childLen = children.length; i<childLen; i++){
1502
+ child = children[i];
1503
+ if(child.get('isVisibleInWindow') && child.get('isVisible')){
1504
+ ret = child._computeNextValidKeyView(currentView, seen);
1505
+ }
1506
+ if (ret) return ret;
1507
+ }
1508
+ ret = null;
1509
+ }
1510
+ return ret ;
1511
+ },
1512
+
1513
+ /**
1514
+ Optionally points to the previous key view that should gain focus when
1515
+ tabbing through the interface. If this is not set then the previous
1516
+ key view will be set automatically to the previous child.
1517
+ */
1518
+ previousKeyView: null,
1519
+
1520
+ /**
1521
+ Computes the previous valid key view, possibly returning the receiver or
1522
+ null. This is the previous key view that acceptsFirstResponder.
1523
+
1524
+ @property
1525
+ @type SC.View
1526
+ */
1527
+ previousValidKeyView: function() {
1528
+ var seen = [],
1529
+ rootView = this.pane(), ret = this.get('previousKeyView');
1530
+ if(!ret) ret = rootView._computePreviousValidKeyView(this, seen);
1531
+ return ret ;
1532
+ }.property('previousKeyView'),
1533
+
1534
+ _computePreviousValidKeyView: function(currentView, seen) {
1535
+ var ret = this.get('previousKeyView'),
1536
+ children, i, child;
1537
+
1538
+ if(this !== currentView && seen.indexOf(currentView)!=-1 &&
1539
+ this.get('acceptsFirstResponder') && this.get('isVisibleInWindow')){
1540
+ return this;
1541
+ }
1542
+ seen.push(this); // avoid cycles
1543
+
1544
+ // find next sibling
1545
+ if (!ret) {
1546
+ children = this.get('childViews');
1547
+ for(i=children.length-1; 0<=i; i--){
1548
+ child = children[i];
1549
+ if(child.get('isVisibleInWindow') && child.get('isVisible')){
1550
+ ret = child._computePreviousValidKeyView(currentView, seen);
1551
+ }
1552
+ if (ret) return ret;
1553
+ }
1554
+ ret = null;
1555
+ }
1556
+ return ret ;
1557
+ },
1558
+
1559
+ // .......................................................
1560
+ // CORE DISPLAY METHODS
1561
+ //
1562
+
1563
+ /** @private
1564
+ Setup a view, but do not finish waking it up.
1565
+ - configure childViews
1566
+ - generate DOM + plug in outlets/childViews unless rootElement is defined
1567
+ - register the view with the global views hash, which is used for mgmt
1568
+ */
1569
+ init: function() {
1570
+ var parentView, path, root, idx, len, lp, dp ;
1571
+
1572
+ sc_super() ;
1573
+
1574
+ // Register this view for event handling
1575
+ SC.View.views[this.get('layerId')] = this ;
1576
+
1577
+ var childViews = this.get('childViews');
1578
+
1579
+ // setup child views. be sure to clone the child views array first
1580
+ this.childViews = childViews ? childViews.slice() : [] ;
1581
+ this.createChildViews() ; // setup child Views
1582
+
1583
+ // register display property observers ..
1584
+ // TODO: Optimize into class setup
1585
+ dp = this.get('displayProperties') ;
1586
+ idx = dp.length ;
1587
+ while (--idx >= 0) {
1588
+ this.addObserver(dp[idx], this, this.displayDidChange) ;
1589
+ }
1590
+
1591
+ // register for drags
1592
+ if (this.get('isDropTarget')) SC.Drag.addDropTarget(this) ;
1593
+
1594
+ // register scroll views for autoscroll during drags
1595
+ if (this.get('isScrollable')) SC.Drag.addScrollableView(this) ;
1596
+ },
1597
+
1598
+ /**
1599
+ Wakes up the view. The default implementation immediately syncs any
1600
+ bindings, which may cause the view to need its display updated. You
1601
+ can override this method to perform any additional setup. Be sure to
1602
+ call sc_super to setup bindings and to call awake on childViews.
1603
+
1604
+ It is best to awake a view before you add it to the DOM. This way when
1605
+ the DOM is generated, it will have the correct initial values and will
1606
+ not require any additional setup.
1607
+
1608
+ @returns {void}
1609
+ */
1610
+ awake: function() {
1611
+ sc_super();
1612
+ var childViews = this.get('childViews'), len = childViews.length, idx ;
1613
+ for (idx=0; idx<len; ++idx) {
1614
+ if (!childViews[idx]) continue ;
1615
+ childViews[idx].awake() ;
1616
+ }
1617
+ },
1618
+
1619
+ /**
1620
+ You must call this method on a view to destroy the view (and all of its
1621
+ child views). This will remove the view from any parent node, then make
1622
+ sure that the DOM element managed by the view can be released by the
1623
+ memory manager.
1624
+ */
1625
+ destroy: function() {
1626
+ if (this.get('isDestroyed')) return this; // nothing to do
1627
+
1628
+ this._destroy(); // core destroy method
1629
+
1630
+ // remove from parent if found
1631
+ this.removeFromParent() ;
1632
+
1633
+ // unregister for drags
1634
+ if (this.get('isDropTarget')) SC.Drag.removeDropTarget(this) ;
1635
+
1636
+ // unregister for autoscroll during drags
1637
+ if (this.get('isScrollable')) SC.Drag.removeScrollableView(this) ;
1638
+
1639
+ //Do generic destroy. It takes care of mixins and sets isDestroyed to YES.
1640
+ sc_super();
1641
+ return this; // done with cleanup
1642
+ },
1643
+
1644
+ _destroy: function() {
1645
+ if (this.get('isDestroyed')) return this ; // nothing to do
1646
+
1647
+ // destroy the layer -- this will avoid each child view destroying
1648
+ // the layer over and over again...
1649
+ this.destroyLayer() ;
1650
+
1651
+ // first destroy any children.
1652
+ var childViews = this.get('childViews'), len = childViews.length, idx ;
1653
+ if (len) {
1654
+ childViews = childViews.slice() ;
1655
+ for (idx=0; idx<len; ++idx) childViews[idx].destroy() ;
1656
+ }
1657
+
1658
+ // next remove view from global hash
1659
+ delete SC.View.views[this.get('layerId')] ;
1660
+ delete this._CQ ;
1661
+ delete this.page ;
1662
+
1663
+ return this ;
1664
+ },
1665
+
1666
+ /**
1667
+ This method is called when your view is first created to setup any child
1668
+ views that are already defined on your class. If any are found, it will
1669
+ instantiate them for you.
1670
+
1671
+ The default implementation of this method simply steps through your
1672
+ childViews array, which is expects to either be empty or to contain View
1673
+ designs that can be instantiated
1674
+
1675
+ Alternatively, you can implement this method yourself in your own
1676
+ subclasses to look for views defined on specific properties and then build
1677
+ a childViews array yourself.
1678
+
1679
+ Note that when you implement this method yourself, you should never
1680
+ instantiate views directly. Instead, you should use
1681
+ this.createChildView() method instead. This method can be much faster in
1682
+ a production environment than creating views yourself.
1683
+
1684
+ @returns {SC.View} receiver
1685
+ */
1686
+ createChildViews: function() {
1687
+ var childViews = this.get('childViews'),
1688
+ len = childViews.length,
1689
+ idx, key, views, view ;
1690
+
1691
+ this.beginPropertyChanges() ;
1692
+
1693
+ // swap the array
1694
+ for (idx=0; idx<len; ++idx) {
1695
+ if (key = (view = childViews[idx])) {
1696
+
1697
+ // is this is a key name, lookup view class
1698
+ if (typeof key === SC.T_STRING) {
1699
+ view = this[key];
1700
+ } else key = null ;
1701
+
1702
+ if (!view) {
1703
+ console.error ("No view with name "+key+" has been found in "+this.toString());
1704
+ // skip this one.
1705
+ continue;
1706
+ }
1707
+
1708
+ if (view.isClass) {
1709
+ view = this.createChildView(view) ; // instantiate if needed
1710
+ if (key) this[key] = view ; // save on key name if passed
1711
+ }
1712
+ }
1713
+ childViews[idx] = view;
1714
+ }
1715
+
1716
+ this.endPropertyChanges() ;
1717
+ return this ;
1718
+ },
1719
+
1720
+ /**
1721
+ Instantiates a view to be added to the childViews array during view
1722
+ initialization. You generally will not call this method directly unless
1723
+ you are overriding createChildViews(). Note that this method will
1724
+ automatically configure the correct settings on the new view instance to
1725
+ act as a child of the parent.
1726
+
1727
+ @param {Class} viewClass
1728
+ @param {Hash} attrs optional attributes to add
1729
+ @returns {SC.View} new instance
1730
+ @test in createChildViews
1731
+ */
1732
+ createChildView: function(view, attrs) {
1733
+ // attrs should always exist...
1734
+ if (!attrs) attrs = {} ;
1735
+ attrs.owner = attrs.parentView = this ;
1736
+ attrs.isVisibleInWindow = this.get('isVisibleInWindow');
1737
+ if (!attrs.page) attrs.page = this.page ;
1738
+
1739
+ // Now add this to the attributes and create.
1740
+ view = view.create(attrs) ;
1741
+ return view ;
1742
+ },
1743
+
1744
+ // ...........................................
1745
+ // LAYOUT
1746
+ //
1747
+
1748
+ /**
1749
+ The 'frame' property depends on the 'layout' property as well as the
1750
+ parent view’s frame. In order to properly invalidate any cached values,
1751
+ we need to invalidate the cache whenever 'layout' changes. However,
1752
+ observing 'layout' does not guarantee that; the observer might not be run
1753
+ immediately.
1754
+
1755
+ In order to avoid any window of opportunity where the cached frame could
1756
+ be invalid, we need to force layoutDidChange() to always immediately run
1757
+ whenever 'layout' is set.
1758
+ */
1759
+ propertyDidChange: function(key, value, _keepCache) {
1760
+ // If the key is 'layout', we need to call layoutDidChange() immediately
1761
+ // so that if the frame has changed any cached values (for both this view
1762
+ // and any child views) can be appropriately invalidated.
1763
+
1764
+ // To allow layout to be a computed property, we check if any property has
1765
+ // changed and if layout is dependent on the property.
1766
+ // If it is we call layoutDidChange.
1767
+ var layoutChange=false;
1768
+ if(typeof this.layout === "function" && this._kvo_dependents) {
1769
+ var dependents = this._kvo_dependents[key];
1770
+ if(dependents && dependents.indexOf('layout')!=-1) layoutChange = true;
1771
+ }
1772
+ if(key==='layout' || layoutChange) this.layoutDidChange();
1773
+ // Resume notification as usual.
1774
+ sc_super();
1775
+ },
1776
+
1777
+
1778
+ /**
1779
+ This convenience method will take the current layout, apply any changes
1780
+ you pass and set it again. It is more convenient than having to do this
1781
+ yourself sometimes.
1782
+
1783
+ You can pass just a key/value pair or a hash with several pairs. You can
1784
+ also pass a null value to delete a property.
1785
+
1786
+ This method will avoid actually setting the layout if the value you pass
1787
+ does not edit the layout.
1788
+
1789
+ @param {String|Hash} key
1790
+ @param {Object} value
1791
+ @returns {SC.View} receiver
1792
+ */
1793
+ adjust: function(key, value) {
1794
+ var layout = SC.clone(this.get('layout')), didChange = NO, cur ;
1795
+
1796
+ if (key === undefined) return this ; // nothing to do.
1797
+
1798
+ // handle string case
1799
+ if (SC.typeOf(key) === SC.T_STRING) {
1800
+ cur = layout[key] ;
1801
+ if (SC.none(value)) {
1802
+ if (cur !== undefined) didChange = YES ;
1803
+ delete layout[key] ;
1804
+ } else {
1805
+ if (cur !== value) didChange = YES ;
1806
+ layout[key] = value ;
1807
+ }
1808
+
1809
+ // handle hash -- do it this way to avoid creating memory unless needed
1810
+ } else {
1811
+ var hash = key;
1812
+ for(key in hash) {
1813
+ if (!hash.hasOwnProperty(key)) continue;
1814
+ value = hash[key] ;
1815
+ cur = layout[key] ;
1816
+
1817
+ if (value === null) {
1818
+ if (cur !== undefined) didChange = YES ;
1819
+ delete layout[key] ;
1820
+ } else if (value !== undefined) {
1821
+ if (cur !== value) didChange = YES ;
1822
+ layout[key] = value ;
1823
+ }
1824
+ }
1825
+ }
1826
+ // now set adjusted layout
1827
+ if (didChange) this.set('layout', layout) ;
1828
+
1829
+ return this ;
1830
+ },
1831
+
1832
+ /**
1833
+ The layout describes how you want your view to be positions on the
1834
+ screen. You can define the following properties:
1835
+
1836
+ - left: the left edge
1837
+ - top: the top edge
1838
+ - right: the right edge
1839
+ - bottom: the bottom edge
1840
+ - height: the height
1841
+ - width: the width
1842
+ - centerX: an offset from center X
1843
+ - centerY: an offset from center Y
1844
+ - minWidth: a minimum width
1845
+ - minHeight: a minimum height
1846
+ - maxWidth: a maximum width
1847
+ - maxHeight: a maximum height
1848
+
1849
+ Note that you can only use certain combinations to set layout. For
1850
+ example, you may set left/right or left/width, but not left/width/right,
1851
+ since that combination doesn't make sense.
1852
+
1853
+ Likewise, you may set a minWidth/minHeight, or maxWidth/maxHeight, but
1854
+ if you also set the width/height explicitly, then those constraints won't
1855
+ matter as much.
1856
+
1857
+ Layout is designed to maximize reliance on the browser's rendering
1858
+ engine to keep your app up to date.
1859
+
1860
+ @test in layoutStyle
1861
+ */
1862
+ layout: { top: 0, left: 0, bottom: 0, right: 0 },
1863
+
1864
+ /**
1865
+ Converts a frame from the receiver's offset to the target offset. Both
1866
+ the receiver and the target must belong to the same pane. If you pass
1867
+ null, the conversion will be to the pane level.
1868
+
1869
+ Note that the context of a view's frame is the view's parent frame. In
1870
+ other words, if you want to convert the frame of your view to the global
1871
+ frame, then you should do:
1872
+
1873
+ {{{
1874
+ var pv = this.get('parentView'), frame = this.get('frame');
1875
+ var newFrame = pv ? pv.convertFrameToView(frame, null) : frame;
1876
+ }}}
1877
+
1878
+ @param {Rect} frame the source frame
1879
+ @param {SC.View} targetView the target view to convert to
1880
+ @returns {Rect} converted frame
1881
+ @test in converFrames
1882
+ */
1883
+ convertFrameToView: function(frame, targetView) {
1884
+ var myX=0, myY=0, targetX=0, targetY=0, view = this, f ;
1885
+
1886
+ // walk up this side
1887
+ while (view) {
1888
+ f = view.get('frame'); myX += f.x; myY += f.y ;
1889
+ view = view.get('layoutView') ;
1890
+ }
1891
+
1892
+ // walk up other size
1893
+ if (targetView) {
1894
+ view = targetView ;
1895
+ while (view) {
1896
+ f = view.get('frame'); targetX += f.x; targetY += f.y ;
1897
+ view = view.get('layoutView') ;
1898
+ }
1899
+ }
1900
+
1901
+ // now we can figure how to translate the origin.
1902
+ myX = frame.x + myX - targetX ;
1903
+ myY = frame.y + myY - targetY ;
1904
+ return { x: myX, y: myY, width: frame.width, height: frame.height } ;
1905
+ },
1906
+
1907
+ /**
1908
+ Converts a frame offset in the coordinates of another view system to the
1909
+ receiver's view.
1910
+
1911
+ Note that the convext of a view's frame is relative to the view's
1912
+ parentFrame. For example, if you want to convert the frame of view that
1913
+ belongs to another view to the receiver's frame you would do:
1914
+
1915
+ {{{
1916
+ var frame = view.get('frame');
1917
+ var newFrame = this.convertFrameFromView(frame, view.get('parentView'));
1918
+ }}}
1919
+
1920
+ @param {Rect} frame the source frame
1921
+ @param {SC.View} targetView the target view to convert to
1922
+ @returns {Rect} converted frame
1923
+ @test in converFrames
1924
+ */
1925
+ convertFrameFromView: function(frame, targetView) {
1926
+ var myX=0, myY=0, targetX=0, targetY=0, view = this, f ;
1927
+
1928
+ // walk up this side
1929
+ //Note: Intentional assignment of variable f
1930
+ while (view && (f = view.get('frame'))) {
1931
+ myX += f.x; myY += f.y ;
1932
+ view = view.get('parentView') ;
1933
+ }
1934
+
1935
+ // walk up other size
1936
+ if (targetView) {
1937
+ view = targetView ;
1938
+ while(view) {
1939
+ f = view.get('frame'); targetX += f.x; targetY += f.y ;
1940
+ view = view.get('parentView') ;
1941
+ }
1942
+ }
1943
+
1944
+ // now we can figure how to translate the origin.
1945
+ myX = frame.x - myX + targetX ;
1946
+ myY = frame.y - myY + targetY ;
1947
+ return { x: myX, y: myY, width: frame.width, height: frame.height } ;
1948
+ },
1949
+
1950
+ /**
1951
+ Attempt to scroll the view to visible. This will walk up the parent
1952
+ view hierarchy looking looking for a scrollable view. It will then
1953
+ call scrollToVisible() on it.
1954
+
1955
+ Returns YES if an actual scroll took place, no otherwise.
1956
+
1957
+ @returns {Boolean}
1958
+ */
1959
+ scrollToVisible: function() {
1960
+ var pv = this.get('parentView');
1961
+ while(pv && !pv.get('isScrollable')) pv = pv.get('parentView');
1962
+
1963
+ // found view, first make it scroll itself visible then scroll this.
1964
+ if (pv) {
1965
+ pv.scrollToVisible();
1966
+ return pv.scrollToVisible(this);
1967
+ } else return NO ;
1968
+ },
1969
+
1970
+ /**
1971
+ Frame describes the current bounding rect for your view. This is always
1972
+ measured from the top-left corner of the parent view.
1973
+
1974
+ @property {Rect}
1975
+ @test in layoutStyle
1976
+ */
1977
+ frame: function() {
1978
+ return this.computeFrameWithParentFrame(null) ;
1979
+ }.property('useStaticLayout').cacheable(), // We depend on the layout, but layoutDidChange will call viewDidChange to check the frame for us
1980
+
1981
+ /**
1982
+ Computes what the frame of this view would be if the parent were resized
1983
+ to the passed dimensions. You can use this method to project the size of
1984
+ a frame based on the resize behavior of the parent.
1985
+
1986
+ This method is used especially by the scroll view to automatically
1987
+ calculate when scrollviews should be visible.
1988
+
1989
+ Passing null for the parent dimensions will use the actual current
1990
+ parent dimensions. This is the same method used to calculate the current
1991
+ frame when it changes.
1992
+
1993
+ @param {Rect} pdim the projected parent dimensions
1994
+ @returns {Rect} the computed frame
1995
+ */
1996
+ computeFrameWithParentFrame: function(pdim) {
1997
+ var layout = this.get('layout'),
1998
+ f = {} , error, layer, AUTO = SC.LAYOUT_AUTO,
1999
+ stLayout = this.get('useStaticLayout'),
2000
+ pv = this.get('parentView'),
2001
+ dH, dW, //shortHand for parentDimensions
2002
+ borderTop, borderLeft,
2003
+ lR = layout.right,
2004
+ lL = layout.left,
2005
+ lT = layout.top,
2006
+ lB = layout.bottom,
2007
+ lW = layout.width,
2008
+ lH = layout.height,
2009
+ lcX = layout.centerX,
2010
+ lcY = layout.centerY;
2011
+
2012
+ if (lW !== undefined &&
2013
+ lW === SC.LAYOUT_AUTO &&
2014
+ stLayout !== undefined && !stLayout) {
2015
+ error = SC.Error.desc(("%@.layout() cannot use width:auto if "+
2016
+ "staticLayout is disabled").fmt(this), "%@".fmt(this), -1);
2017
+ console.error(error.toString()) ;
2018
+ throw error ;
2019
+ }
2020
+
2021
+ if (lH !== undefined &&
2022
+ lH === SC.LAYOUT_AUTO &&
2023
+ stLayout !== undefined && !stLayout) {
2024
+ error = SC.Error.desc(("%@.layout() cannot use height:auto if "+
2025
+ "staticLayout is disabled").fmt(this),"%@".fmt(this), -1);
2026
+ console.error(error.toString()) ;
2027
+ throw error ;
2028
+ }
2029
+
2030
+ if (stLayout) {
2031
+ // need layer to be able to compute rect
2032
+ if (layer = this.get('layer')) {
2033
+ f = SC.viewportOffset(layer); // x,y
2034
+ if (pv) f = pv.convertFrameFromView(f, null);
2035
+
2036
+ /*
2037
+ TODO Can probably have some better width/height values - CC
2038
+ */
2039
+ f.width = layer.offsetWidth;
2040
+ f.height = layer.offsetHeight;
2041
+ return f;
2042
+ }
2043
+ return null; // can't compute
2044
+ }
2045
+
2046
+
2047
+ if (!pdim) pdim = this.computeParentDimensions(layout) ;
2048
+ dH = pdim.height;
2049
+ dW = pdim.width;
2050
+
2051
+
2052
+ // handle left aligned and left/right
2053
+ if (!SC.none(lL)) {
2054
+ if(SC.isPercentage(lL)){
2055
+ f.x = dW*lL;
2056
+ }else{
2057
+ f.x = lL ;
2058
+ }
2059
+ if (lW !== undefined) {
2060
+ if(lW === AUTO) f.width = AUTO ;
2061
+ else if(SC.isPercentage(lW)) f.width = dW*lW ;
2062
+ else f.width = lW ;
2063
+ } else { // better have lR!
2064
+ f.width = dW - f.x ;
2065
+ if(lR && SC.isPercentage(lR)) f.width = f.width - (lR*dW) ;
2066
+ else f.width = f.width - (lR || 0) ;
2067
+ }
2068
+ // handle right aligned
2069
+ } else if (!SC.none(lR)) {
2070
+ if (SC.none(lW)) {
2071
+ if (SC.isPercentage(lR)) {
2072
+ f.width = dW - (dW*lR) ;
2073
+ }
2074
+ else f.width = dW - lR ;
2075
+ f.x = 0 ;
2076
+ } else {
2077
+ if(lW === AUTO) f.width = AUTO ;
2078
+ else if(SC.isPercentage(lW)) f.width = dW*lW ;
2079
+ else f.width = (lW || 0) ;
2080
+ if (SC.isPercentage(lW)) f.x = dW - (lR*dW) - f.width ;
2081
+ else f.x = dW - lR - f.width ;
2082
+ }
2083
+
2084
+ // handle centered
2085
+ } else if (!SC.none(lcX)) {
2086
+ if(lW === AUTO) f.width = AUTO ;
2087
+ else if (SC.isPercentage(lW)) f.width = lW*dW ;
2088
+ else f.width = (lW || 0) ;
2089
+ if(SC.isPercentage(lcX)) f.x = (dW - f.width)/2 + (lcX*dW) ;
2090
+ else f.x = (dW - f.width)/2 + lcX ;
2091
+ } else {
2092
+ f.x = 0 ; // fallback
2093
+ if (SC.none(lW)) {
2094
+ f.width = dW ;
2095
+ } else {
2096
+ if(lW === AUTO) f.width = AUTO ;
2097
+ if (SC.isPercentage(lW)) f.width = lW*dW ;
2098
+ else f.width = (lW || 0) ;
2099
+ }
2100
+ }
2101
+
2102
+ // handle top aligned and top/bottom
2103
+ if (!SC.none(lT)) {
2104
+ if(SC.isPercentage(lT)) f.y = lT*dH ;
2105
+ else f.y = lT ;
2106
+ if (lH !== undefined) {
2107
+ if(lH === AUTO) f.height = AUTO ;
2108
+ else if(SC.isPercentage(lH)) f.height = lH*dH ;
2109
+ else f.height = lH ;
2110
+ } else { // better have lB!
2111
+ if(lB && SC.isPercentage(lB)) f.height = dH - f.y - (lB*dH) ;
2112
+ else f.height = dH - f.y - (lB || 0) ;
2113
+ }
2114
+
2115
+ // handle bottom aligned
2116
+ } else if (!SC.none(lB)) {
2117
+ if (SC.none(lH)) {
2118
+ if (SC.isPercentage(lB)) f.height = dH - (lB*dH) ;
2119
+ else f.height = dH - lB ;
2120
+ f.y = 0 ;
2121
+ } else {
2122
+ if(lH === AUTO) f.height = AUTO ;
2123
+ if (lH && SC.isPercentage(lH)) f.height = lH*dH ;
2124
+ else f.height = (lH || 0) ;
2125
+ if (SC.isPercentage(lB)) f.y = dH - (lB*dH) - f.height ;
2126
+ else f.y = dH - lB - f.height ;
2127
+ }
2128
+
2129
+ // handle centered
2130
+ } else if (!SC.none(lcY)) {
2131
+ if(lH === AUTO) f.height = AUTO ;
2132
+ if (lH && SC.isPercentage(lH)) f.height = lH*dH ;
2133
+ else f.height = (lH || 0) ;
2134
+ if (SC.isPercentage(lcY)) f.y = (dH - f.height)/2 + (lcY*dH) ;
2135
+ else f.y = (dH - f.height)/2 + lcY ;
2136
+
2137
+ // fallback
2138
+ } else {
2139
+ f.y = 0 ; // fallback
2140
+ if (SC.none(lH)) {
2141
+ f.height = dH ;
2142
+ } else {
2143
+ if(lH === AUTO) f.height = AUTO ;
2144
+ if (SC.isPercentage(lH)) f.height = lH*dH ;
2145
+ else f.height = lH || 0 ;
2146
+ }
2147
+ }
2148
+
2149
+ f.x = Math.floor(f.x);
2150
+ f.y = Math.floor(f.y);
2151
+ if(f.height !== AUTO) f.height = Math.floor(f.height);
2152
+ if(f.width !== AUTO) f.width = Math.floor(f.width);
2153
+
2154
+ // if width or height were set to auto and we have a layer, try lookup
2155
+ if (f.height === AUTO || f.width === AUTO) {
2156
+ layer = this.get('layer');
2157
+ if (f.height === AUTO) f.height = layer ? layer.clientHeight : 0;
2158
+ if (f.width === AUTO) f.width = layer ? layer.clientWidth : 0;
2159
+ }
2160
+
2161
+ // views with SC.Border mixin applied applied
2162
+ if (this.get('hasBorder')) {
2163
+ borderTop = this.get('borderTop');
2164
+ borderLeft = this.get('borderLeft');
2165
+ f.height -= borderTop+this.get('borderBottom');
2166
+ f.y += borderTop;
2167
+ f.width -= borderLeft+this.get('borderRight');
2168
+ f.x += borderLeft;
2169
+ }
2170
+
2171
+ // Account for special cases inside ScrollView, where we adjust the
2172
+ // element's scrollTop/scrollLeft property for performance reasons.
2173
+ if (pv && pv.isScrollContainer) {
2174
+ pv = pv.get('parentView');
2175
+ f.x -= pv.get('horizontalScrollOffset');
2176
+ f.y -= pv.get('verticalScrollOffset');
2177
+ }
2178
+
2179
+ // make sure the width/height fix min/max...
2180
+ if (!SC.none(layout.maxHeight) && (f.height > layout.maxHeight)) {
2181
+ f.height = layout.maxHeight ;
2182
+ }
2183
+
2184
+ if (!SC.none(layout.minHeight) && (f.height < layout.minHeight)) {
2185
+ f.height = layout.minHeight ;
2186
+ }
2187
+
2188
+ if (!SC.none(layout.maxWidth) && (f.width > layout.maxWidth)) {
2189
+ f.width = layout.maxWidth ;
2190
+ }
2191
+
2192
+ if (!SC.none(layout.minWidth) && (f.width < layout.minWidth)) {
2193
+ f.width = layout.minWidth ;
2194
+ }
2195
+
2196
+ // make sure width/height are never < 0
2197
+ if (f.height < 0) f.height = 0 ;
2198
+ if (f.width < 0) f.width = 0 ;
2199
+
2200
+ return f;
2201
+ },
2202
+
2203
+ computeParentDimensions: function(frame) {
2204
+ var ret, pv = this.get('parentView'), pf = (pv) ? pv.get('frame') : null ;
2205
+
2206
+ if (pf) {
2207
+ ret = { width: pf.width, height: pf.height };
2208
+ } else {
2209
+ var f = frame ;
2210
+ ret = {
2211
+ width: (f.left || 0) + (f.width || 0) + (f.right || 0),
2212
+ height: (f.top || 0) + (f.height || 0) + (f.bottom || 0)
2213
+ };
2214
+ }
2215
+ return ret ;
2216
+ },
2217
+
2218
+ /**
2219
+ The clipping frame returns the visible portion of the view, taking into
2220
+ account the contentClippingFrame of the parent view. Keep in mind that
2221
+ the clippingFrame is in the context of the view itself, not it's parent
2222
+ view.
2223
+
2224
+ Normally this will be calculated based on the intersection of your own
2225
+ clippingFrame and your parentView's contentClippingFrame.
2226
+
2227
+ @property {Rect}
2228
+ */
2229
+ clippingFrame: function() {
2230
+ var f = this.get('frame'),
2231
+ ret = f,
2232
+ pv, cf;
2233
+
2234
+ if (!f) return null;
2235
+ pv = this.get('parentView');
2236
+ if (pv) {
2237
+ cf = pv.get('contentClippingFrame');
2238
+ if (!cf) return f;
2239
+ ret = SC.intersectRects(cf, f);
2240
+ }
2241
+ ret.x -= f.x;
2242
+ ret.y -= f.y;
2243
+
2244
+ return ret;
2245
+ }.property('parentView', 'frame').cacheable(),
2246
+
2247
+ /**
2248
+ The clipping frame child views should intersect with. Normally this is
2249
+ the same as the regular clippingFrame. However, you may override this
2250
+ method if you want the child views to actually draw more or less content
2251
+ than is actually visible for some reason.
2252
+
2253
+ Usually this is only used by the ScrollView to optimize drawing on touch
2254
+ devices.
2255
+
2256
+ @property {Rect}
2257
+ */
2258
+ contentClippingFrame: function() {
2259
+ return this.get('clippingFrame');
2260
+ }.property('clippingFrame').cacheable(),
2261
+
2262
+ /** @private
2263
+ This method is invoked whenever the clippingFrame changes, notifying
2264
+ each child view that its clippingFrame has also changed.
2265
+ */
2266
+ _sc_view_clippingFrameDidChange: function() {
2267
+ var cvs = this.get('childViews'), len = cvs.length, idx, cv ;
2268
+ for (idx=0; idx<len; ++idx) {
2269
+ cv = cvs[idx] ;
2270
+
2271
+ // In SC 1.0 views with static layout did not receive notifications
2272
+ // of frame changes because they didn't support frames. In SC 1.1 they
2273
+ // do support frames, so they should receive notifications. Also in
2274
+ // SC 1.1 SC.StaticLayout is merged into SC.View. The mixin is only
2275
+ // for compatibility. This property is defined on the mixin.
2276
+ //
2277
+ // frame changes should be sent all the time unless this property is
2278
+ // present to indicate that we want the old 1.0 API behavior instead.
2279
+ //
2280
+ if (!cv.hasStaticLayout) {
2281
+ cv.notifyPropertyChange('clippingFrame') ;
2282
+ cv._sc_view_clippingFrameDidChange();
2283
+ }
2284
+ }
2285
+ },
2286
+
2287
+ /**
2288
+ This method may be called on your view whenever the parent view resizes.
2289
+
2290
+ The default version of this method will reset the frame and then call
2291
+ viewDidResize(). You will not usually override this method, but you may
2292
+ override the viewDidResize() method.
2293
+
2294
+ @returns {void}
2295
+ @test in viewDidResize
2296
+ */
2297
+ parentViewDidResize: function() {
2298
+ var frameMayHaveChanged, layout, isFixed, isPercentageFunc, isPercentage;
2299
+
2300
+ // If this view uses static layout, our "do we think the frame changed?"
2301
+ // logic is not applicable and we simply have to assume that the frame may
2302
+ // have changed.
2303
+ if (this.useStaticLayout) {
2304
+ frameMayHaveChanged = YES;
2305
+ }
2306
+ else {
2307
+ layout = this.get('layout');
2308
+
2309
+ // only resizes if the layout does something other than left/top - fixed
2310
+ // size.
2311
+ isFixed = (
2312
+ (layout.left !== undefined) && (layout.top !== undefined) &&
2313
+ (layout.width !== undefined) && (layout.height !== undefined)
2314
+ );
2315
+
2316
+
2317
+ // If it's fixed, our frame still could have changed if it's fixed to a
2318
+ // percentage of the parent.
2319
+ if (isFixed) {
2320
+ isPercentageFunc = SC.isPercentage;
2321
+ isPercentage = (isPercentageFunc(layout.left) ||
2322
+ isPercentageFunc(layout.top) ||
2323
+ isPercentageFunc(layout.width) ||
2324
+ isPercentageFunc(layout.right) ||
2325
+ isPercentageFunc(layout.centerX) ||
2326
+ isPercentageFunc(layout.centerY));
2327
+ }
2328
+
2329
+ frameMayHaveChanged = (!isFixed || isPercentage);
2330
+ }
2331
+
2332
+ // Do we think there's a chance our frame will have changed as a result?
2333
+ if (frameMayHaveChanged) {
2334
+ // There's a chance our frame changed. Invoke viewDidResize(), which
2335
+ // will notify about our change to 'frame' (if it actually changed) and
2336
+ // appropriately notify our child views.
2337
+ this.viewDidResize();
2338
+ }
2339
+ },
2340
+
2341
+
2342
+
2343
+ /**
2344
+ This method is invoked on your view when the view resizes due to a layout
2345
+ change or potentially due to the parent view resizing (if your view’s size
2346
+ depends on the size of your parent view). You can override this method
2347
+ to implement your own layout if you like, such as performing a grid
2348
+ layout.
2349
+
2350
+ The default implementation simply notifies about the change to 'frame' and
2351
+ then calls parentViewDidResize on all of your children.
2352
+
2353
+ @returns {void}
2354
+ */
2355
+ viewDidResize: function() {
2356
+ this._viewFrameDidChange();
2357
+
2358
+ // Also notify our children.
2359
+ var cv = this.childViews, len = cv.length, idx, view ;
2360
+ for (idx=0; idx<len; ++idx) {
2361
+ view = cv[idx];
2362
+ view.parentViewDidResize();
2363
+ }
2364
+ },
2365
+
2366
+ /** @private
2367
+ Invoked by other views to notify this view that its frame has changed.
2368
+
2369
+ This notifies the view that its frame property has changed,
2370
+ then propagates those changes to its child views.
2371
+ */
2372
+ _viewFrameDidChange: function() {
2373
+ this.notifyPropertyChange('frame');
2374
+ this._sc_view_clippingFrameDidChange();
2375
+ },
2376
+
2377
+ // Implementation note: As a general rule, paired method calls, such as
2378
+ // beginLiveResize/endLiveResize that are called recursively on the tree
2379
+ // should reverse the order when doing the final half of the call. This
2380
+ // ensures that the calls are propertly nested for any cleanup routines.
2381
+ //
2382
+ // -> View A.beginXXX()
2383
+ // -> View B.beginXXX()
2384
+ // -> View C.begitXXX()
2385
+ // -> View D.beginXXX()
2386
+ //
2387
+ // ...later on, endXXX methods are called in reverse order of beginXXX...
2388
+ //
2389
+ // <- View D.endXXX()
2390
+ // <- View C.endXXX()
2391
+ // <- View B.endXXX()
2392
+ // <- View A.endXXX()
2393
+ //
2394
+ // See the two methods below for an example implementation.
2395
+
2396
+ /**
2397
+ Call this method when you plan to begin a live resize. This will
2398
+ notify the receiver view and any of its children that are interested
2399
+ that the resize is about to begin.
2400
+
2401
+ @returns {SC.View} receiver
2402
+ @test in viewDidResize
2403
+ */
2404
+ beginLiveResize: function() {
2405
+ // call before children have been notified...
2406
+ if (this.willBeginLiveResize) this.willBeginLiveResize() ;
2407
+
2408
+ // notify children in order
2409
+ var ary = this.get('childViews'), len = ary.length, idx, view ;
2410
+ for (idx=0; idx<len; ++idx) {
2411
+ view = ary[idx] ;
2412
+ if (view.beginLiveResize) view.beginLiveResize();
2413
+ }
2414
+ return this ;
2415
+ },
2416
+
2417
+ /**
2418
+ Call this method when you are finished with a live resize. This will
2419
+ notify the receiver view and any of its children that are interested
2420
+ that the live resize has ended.
2421
+
2422
+ @returns {SC.View} receiver
2423
+ @test in viewDidResize
2424
+ */
2425
+ endLiveResize: function() {
2426
+ // notify children in *reverse* order
2427
+ var ary = this.get('childViews'), len = ary.length, idx, view ;
2428
+ for (idx=len-1; idx>=0; --idx) { // loop backwards
2429
+ view = ary[idx] ;
2430
+ if (view.endLiveResize) view.endLiveResize() ;
2431
+ }
2432
+
2433
+ // call *after* all children have been notified...
2434
+ if (this.didEndLiveResize) this.didEndLiveResize() ;
2435
+ return this ;
2436
+ },
2437
+
2438
+ /**
2439
+ Setting wantsAcceleratedLayer to YES will use 3d transforms to move the
2440
+ layer when available.
2441
+ */
2442
+ wantsAcceleratedLayer: NO,
2443
+
2444
+ /**
2445
+ Specifies whether 3d transforms can be used to move the layer.
2446
+ */
2447
+ hasAcceleratedLayer: function(){
2448
+ return this.get('wantsAcceleratedLayer') && SC.platform.supportsAcceleratedLayers;
2449
+ }.property('wantsAcceleratedLayer').cacheable(),
2450
+
2451
+
2452
+ /**
2453
+ layoutStyle describes the current styles to be written to your element
2454
+ based on the layout you defined. Both layoutStyle and frame reset when
2455
+ you edit the layout property. Both are read only.
2456
+
2457
+ Computes the layout style settings needed for the current anchor.
2458
+
2459
+ @property {Hash}
2460
+ @readOnly
2461
+ */
2462
+
2463
+
2464
+ layoutStyle: function() {
2465
+ var layout = this.get('layout'), ret = {}, pdim = null, error,
2466
+ AUTO = SC.LAYOUT_AUTO,
2467
+ dims = SC._VIEW_DEFAULT_DIMS, loc = dims.length, x, value, key,
2468
+ stLayout = this.get('useStaticLayout'),
2469
+ lR = layout.right,
2470
+ lL = layout.left,
2471
+ lT = layout.top,
2472
+ lB = layout.bottom,
2473
+ lW = layout.width,
2474
+ lH = layout.height,
2475
+ lMW = layout.maxWidth,
2476
+ lMH = layout.maxHeight,
2477
+ lcX = layout.centerX,
2478
+ lcY = layout.centerY,
2479
+ hasAcceleratedLayer = this.get('hasAcceleratedLayer'),
2480
+ translateTop = 0,
2481
+ translateLeft = 0;
2482
+ if (lW !== undefined && lW === SC.LAYOUT_AUTO && !stLayout) {
2483
+ error= SC.Error.desc("%@.layout() you cannot use width:auto if "+
2484
+ "staticLayout is disabled".fmt(this),"%@".fmt(this),-1);
2485
+ console.error(error.toString()) ;
2486
+ throw error ;
2487
+ }
2488
+
2489
+ if (lH !== undefined && lH === SC.LAYOUT_AUTO && !stLayout) {
2490
+ error = SC.Error.desc("%@.layout() you cannot use height:auto if "+
2491
+ "staticLayout is disabled".fmt(this),"%@".fmt(this),-1);
2492
+ console.error(error.toString()) ;
2493
+ throw error ;
2494
+ }
2495
+
2496
+ // X DIRECTION
2497
+
2498
+ // handle left aligned and left/right
2499
+ if (!SC.none(lL)) {
2500
+ if(SC.isPercentage(lL)) {
2501
+ ret.left = (lL*100)+"%"; //percentage left
2502
+ } else if (hasAcceleratedLayer && SC.empty(lR)) {
2503
+ translateLeft = Math.floor(lL);
2504
+ ret.left = 0;
2505
+ } else {
2506
+ ret.left = Math.floor(lL); //px left
2507
+ }
2508
+ ret.marginLeft = 0 ;
2509
+
2510
+ if (lW !== undefined) {
2511
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
2512
+ else if(SC.isPercentage(lW)) ret.width = (lW*100)+"%"; //percentage width
2513
+ else ret.width = Math.floor(lW) ; //px width
2514
+ ret.right = null ;
2515
+ } else {
2516
+ ret.width = null ;
2517
+ if(lR && SC.isPercentage(lR)) ret.right = (lR*100)+"%"; //percentage right
2518
+ else ret.right = Math.floor(lR || 0) ; //px right
2519
+ }
2520
+
2521
+ // handle right aligned
2522
+ } else if (!SC.none(lR)) {
2523
+ if(SC.isPercentage(lR)) {
2524
+ ret.right = Math.floor(lR*100)+"%"; //percentage left
2525
+ }else{
2526
+ ret.right = Math.floor(lR) ;
2527
+ }
2528
+ ret.marginLeft = 0 ;
2529
+
2530
+ if (SC.none(lW)) {
2531
+ if (SC.none(lMW)) ret.left = 0;
2532
+ ret.width = null;
2533
+ } else {
2534
+ ret.left = null ;
2535
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
2536
+ else if(lW && SC.isPercentage(lW)) ret.width = (lW*100)+"%" ; //percentage width
2537
+ else ret.width = Math.floor(lW || 0) ; //px width
2538
+ }
2539
+
2540
+ // handle centered
2541
+ } else if (!SC.none(lcX)) {
2542
+ ret.left = "50%";
2543
+ if(lW && SC.isPercentage(lW)) ret.width = (lW*100)+"%" ; //percentage width
2544
+ else ret.width = Math.floor(lW || 0) ;
2545
+ if(lW && SC.isPercentage(lW) && (SC.isPercentage(lcX) || SC.isPercentage(lcX*-1))){
2546
+ ret.marginLeft = Math.floor((lcX - lW/2)*100)+"%" ;
2547
+ }else if(lW && lW >= 1 && !SC.isPercentage(lcX)){
2548
+ ret.marginLeft = Math.floor(lcX - ret.width/2) ;
2549
+ }else {
2550
+ // This error message happens whenever width is not set.
2551
+ console.warn("You have to set width and centerX usign both percentages or pixels");
2552
+ ret.marginLeft = "50%";
2553
+ }
2554
+ ret.right = null ;
2555
+
2556
+ // if width defined, assume top/left of zero
2557
+ } else if (!SC.none(lW)) {
2558
+ ret.left = 0;
2559
+ ret.right = null;
2560
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
2561
+ else if(SC.isPercentage(lW)) ret.width = (lW*100)+"%";
2562
+ else ret.width = Math.floor(lW);
2563
+ ret.marginLeft = 0;
2564
+
2565
+ // fallback, full width.
2566
+ } else {
2567
+ ret.left = 0;
2568
+ ret.right = 0;
2569
+ ret.width = null ;
2570
+ ret.marginLeft= 0;
2571
+ }
2572
+
2573
+
2574
+ // handle min/max
2575
+ ret.minWidth = (layout.minWidth === undefined) ? null : layout.minWidth ;
2576
+ ret.maxWidth = (layout.maxWidth === undefined) ? null : layout.maxWidth ;
2577
+
2578
+ // Y DIRECTION
2579
+
2580
+ // handle top aligned and left/right
2581
+ if (!SC.none(lT)) {
2582
+ if(SC.isPercentage(lT)) {
2583
+ ret.top = (lT*100)+"%";
2584
+ } else if (hasAcceleratedLayer && SC.empty(lB)) {
2585
+ translateTop = Math.floor(lT);
2586
+ ret.top = 0;
2587
+ } else {
2588
+ ret.top = Math.floor(lT);
2589
+ }
2590
+ if (lH !== undefined) {
2591
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
2592
+ else if(SC.isPercentage(lH)) ret.height = (lH*100)+"%" ;
2593
+ else ret.height = Math.floor(lH) ;
2594
+ ret.bottom = null ;
2595
+ } else {
2596
+ ret.height = null ;
2597
+ if(lB && SC.isPercentage(lB)) ret.bottom = (lB*100)+"%" ;
2598
+ else ret.bottom = Math.floor(lB || 0) ;
2599
+ }
2600
+ ret.marginTop = 0 ;
2601
+
2602
+ // handle bottom aligned
2603
+ } else if (!SC.none(lB)) {
2604
+ ret.marginTop = 0 ;
2605
+ if(SC.isPercentage(lB)) ret.bottom = (lB*100)+"%";
2606
+ else ret.bottom = Math.floor(lB) ;
2607
+ if (SC.none(lH)) {
2608
+ if (SC.none(lMH)) ret.top = 0;
2609
+ ret.height = null ;
2610
+ } else {
2611
+ ret.top = null ;
2612
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
2613
+ else if(lH && SC.isPercentage(lH)) ret.height = (lH*100)+"%" ;
2614
+ else ret.height = Math.floor(lH || 0) ;
2615
+ }
2616
+
2617
+ // handle centered
2618
+ } else if (!SC.none(lcY)) {
2619
+ ret.top = "50%";
2620
+ ret.bottom = null ;
2621
+
2622
+ if(lH && SC.isPercentage(lH)) ret.height = (lH*100)+ "%" ;
2623
+ else ret.height = Math.floor(lH || 0) ;
2624
+
2625
+ if(lH && SC.isPercentage(lH) && (SC.isPercentage(lcY) || SC.isPercentage(lcY*-1))){ //height is percentage and lcy too
2626
+ ret.marginTop = Math.floor((lcY - lH/2)*100)+"%" ;
2627
+ }else if(lH && lH >= 1 && !SC.isPercentage(lcY)){
2628
+ ret.marginTop = Math.floor(lcY - ret.height/2) ;
2629
+ }else {
2630
+ console.warn("You have to set height and centerY to use both percentages or pixels");
2631
+ ret.marginTop = "50%";
2632
+ }
2633
+ } else if (!SC.none(lH)) {
2634
+ ret.top = 0;
2635
+ ret.bottom = null;
2636
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
2637
+ else if(lH && SC.isPercentage(lH)) ret.height = (lH*100)+"%" ;
2638
+ else ret.height = Math.floor(lH || 0) ;
2639
+ ret.marginTop = 0;
2640
+
2641
+ // fallback, full width.
2642
+ } else {
2643
+ ret.top = 0;
2644
+ ret.bottom = 0;
2645
+ ret.height = null ;
2646
+ ret.marginTop= 0;
2647
+ }
2648
+
2649
+ // handle min/max
2650
+ ret.minHeight = (layout.minHeight === undefined) ?
2651
+ null :
2652
+ layout.minHeight ;
2653
+ ret.maxHeight = (layout.maxHeight === undefined) ?
2654
+ null :
2655
+ layout.maxHeight ;
2656
+
2657
+ // if zIndex is set, use it. otherwise let default shine through
2658
+ ret.zIndex = SC.none(layout.zIndex) ? null : layout.zIndex.toString();
2659
+
2660
+ // if backgroundPosition is set, use it.
2661
+ // otherwise let default shine through
2662
+ ret.backgroundPosition = SC.none(layout.backgroundPosition) ?
2663
+ null :
2664
+ layout.backgroundPosition.toString() ;
2665
+
2666
+ // set default values to null to allow built-in CSS to shine through
2667
+ // currently applies only to marginLeft & marginTop
2668
+ while(--loc >=0) {
2669
+ x = dims[loc];
2670
+ if (ret[x]===0) ret[x]=null;
2671
+ }
2672
+
2673
+ if (hasAcceleratedLayer) {
2674
+ var transform = 'translateX('+translateLeft+'px) translateY('+translateTop+'px)';
2675
+ if (SC.platform.supportsCSS3DTransforms) transform += ' translateZ(0px)'
2676
+ ret[SC.platform.domCSSPrefix+'Transform'] = transform;
2677
+ }
2678
+
2679
+ // convert any numbers into a number + "px".
2680
+ for(key in ret) {
2681
+ value = ret[key];
2682
+ if (typeof value === SC.T_NUMBER) ret[key] = (value + "px");
2683
+ }
2684
+ return ret ;
2685
+ }.property().cacheable(),
2686
+
2687
+ /**
2688
+ The view responsible for laying out this view. The default version
2689
+ returns the current parent view.
2690
+ */
2691
+ layoutView: function() {
2692
+ return this.get('parentView') ;
2693
+ }.property('parentView').cacheable(),
2694
+
2695
+ /**
2696
+ This method is called whenever a property changes that invalidates the
2697
+ layout of the view. Changing the layout will do this automatically, but
2698
+ you can add others if you want.
2699
+
2700
+ Implementation Note: In a traditional setup, we would simply observe
2701
+ 'layout' here, but as described above in the documentation for our custom
2702
+ implementation of propertyDidChange(), this method must always run
2703
+ immediately after 'layout' is updated to avoid the potential for stale
2704
+ (incorrect) cached 'frame' values.
2705
+
2706
+ @returns {SC.View} receiver
2707
+ */
2708
+ layoutDidChange: function() {
2709
+ // Did our layout change in a way that could cause us to be resized? If
2710
+ // not, then there's no need to invalidate the frames of our child views.
2711
+ var previousLayout = this._previousLayout,
2712
+ currentLayout = this.get('layout'),
2713
+ didResize = YES,
2714
+ previousWidth, previousHeight, currentWidth, currentHeight;
2715
+
2716
+ if (previousLayout && previousLayout !== currentLayout) {
2717
+ // This is a simple check to see whether we think the view may have
2718
+ // resized. We could look for a number of cases, but for now we'll
2719
+ // handle only one simple case: if the width and height are both
2720
+ // specified, and they have not changed.
2721
+ previousWidth = previousLayout.width;
2722
+ if (previousWidth !== undefined) {
2723
+ currentWidth = currentLayout.width;
2724
+ if (previousWidth === currentWidth) {
2725
+ previousHeight = previousLayout.height;
2726
+ if (previousLayout !== undefined) {
2727
+ currentHeight = currentLayout.height;
2728
+ if (previousHeight === currentHeight) didResize = NO;
2729
+ }
2730
+ }
2731
+ }
2732
+ }
2733
+
2734
+ this.beginPropertyChanges() ;
2735
+ this.notifyPropertyChange('layoutStyle') ;
2736
+ if (didResize) {
2737
+ this.viewDidResize();
2738
+ }
2739
+ else {
2740
+ // Even if we didn't resize, our frame might have changed.
2741
+ // viewDidResize() handles this in the other case.
2742
+ this._viewFrameDidChange();
2743
+ }
2744
+ this.endPropertyChanges() ;
2745
+
2746
+ // notify layoutView...
2747
+ var layoutView = this.get('layoutView');
2748
+ if (layoutView) {
2749
+ layoutView.set('childViewsNeedLayout', YES);
2750
+ layoutView.layoutDidChangeFor(this) ;
2751
+ if (layoutView.get('childViewsNeedLayout')) {
2752
+ layoutView.invokeOnce(layoutView.layoutChildViewsIfNeeded);
2753
+ }
2754
+ }
2755
+
2756
+ return this ;
2757
+ },
2758
+
2759
+ /**
2760
+ This this property to YES whenever the view needs to layout its child
2761
+ views. Normally this property is set automatically whenever the layout
2762
+ property for a child view changes.
2763
+
2764
+ @property {Boolean}
2765
+ */
2766
+ childViewsNeedLayout: NO,
2767
+
2768
+ /**
2769
+ One of two methods that are invoked whenever one of your childViews
2770
+ layout changes. This method is invoked everytime a child view's layout
2771
+ changes to give you a chance to record the information about the view.
2772
+
2773
+ Since this method may be called many times during a single run loop, you
2774
+ should keep this method pretty short. The other method called when layout
2775
+ changes, layoutChildViews(), is invoked only once at the end of
2776
+ the run loop. You should do any expensive operations (including changing
2777
+ a childView's actual layer) in this other method.
2778
+
2779
+ Note that if as a result of running this method you decide that you do not
2780
+ need your layoutChildViews() method run later, you can set the
2781
+ childViewsNeedsLayout property to NO from this method and the layout
2782
+ method will not be called layer.
2783
+
2784
+ @param {SC.View} childView the view whose layout has changed.
2785
+ @returns {void}
2786
+ */
2787
+ layoutDidChangeFor: function(childView) {
2788
+ var set = this._needLayoutViews ;
2789
+ if (!set) set = this._needLayoutViews = SC.CoreSet.create();
2790
+ set.add(childView);
2791
+ },
2792
+
2793
+ /**
2794
+ Called your layout method if the view currently needs to layout some
2795
+ child views.
2796
+
2797
+ @param {Boolean} isVisible if true assume view is visible even if it is not.
2798
+ @returns {SC.View} receiver
2799
+ @test in layoutChildViews
2800
+ */
2801
+ layoutChildViewsIfNeeded: function(isVisible) {
2802
+ if (!isVisible) isVisible = this.get('isVisibleInWindow');
2803
+ if (isVisible && this.get('childViewsNeedLayout')) {
2804
+ this.set('childViewsNeedLayout', NO);
2805
+ this.layoutChildViews();
2806
+ }
2807
+ return this ;
2808
+ },
2809
+
2810
+ /**
2811
+ Applies the current layout to the layer. This method is usually only
2812
+ called once per runloop. You can override this method to provide your
2813
+ own layout updating method if you want, though usually the better option
2814
+ is to override the layout method from the parent view.
2815
+
2816
+ The default implementation of this method simply calls the renderLayout()
2817
+ method on the views that need layout.
2818
+
2819
+ @returns {void}
2820
+ */
2821
+ layoutChildViews: function() {
2822
+ var set = this._needLayoutViews,
2823
+ len = set ? set.length : 0,
2824
+ i;
2825
+ for (i = 0; i < len; ++i) {
2826
+ set[i].updateLayout();
2827
+ }
2828
+ set.clear(); // reset & reuse
2829
+ },
2830
+
2831
+ /**
2832
+ Invoked by the layoutChildViews method to update the layout on a
2833
+ particular view. This method creates a render context and calls the
2834
+ renderLayout() method, which is probably what you want to override instead
2835
+ of this.
2836
+
2837
+ You will not usually override this method, but you may call it if you
2838
+ implement layoutChildViews() in a view yourself.
2839
+
2840
+ @returns {SC.View} receiver
2841
+ @test in layoutChildViews
2842
+ */
2843
+ updateLayout: function() {
2844
+ var layer = this.get('layer'), context;
2845
+ if (layer) {
2846
+ context = this.renderContext(layer);
2847
+ this.renderLayout(context);
2848
+ context.update();
2849
+
2850
+ // If this view uses static layout, then notify if the frame changed.
2851
+ // (viewDidResize will do a comparison)
2852
+ if (this.useStaticLayout) this.viewDidResize();
2853
+ }
2854
+ layer = null ;
2855
+ return this ;
2856
+ },
2857
+
2858
+ /**
2859
+ Default method called by the layout view to actually apply the current
2860
+ layout to the layer. The default implementation simply assigns the
2861
+ current layoutStyle to the layer. This method is also called whenever
2862
+ the layer is first created.
2863
+
2864
+ @param {SC.RenderContext} the render context
2865
+ @returns {void}
2866
+ @test in layoutChildViews
2867
+ */
2868
+ renderLayout: function(context, firstTime) {
2869
+ context.addStyle(this.get('layoutStyle'));
2870
+ },
2871
+
2872
+ /** walk like a duck */
2873
+ isView: YES,
2874
+
2875
+ /**
2876
+ Default method called when a selectstart event is triggered. This event is
2877
+ only supported by IE. Used in sproutcore to disable text selection and
2878
+ IE8 accelerators. The accelerators will be enabled only in
2879
+ text selectable views. In FF and Safari we use the css style 'allow-select'.
2880
+
2881
+ If you want to enable text selection in certain controls is recommended
2882
+ to override this function to always return YES , instead of setting
2883
+ isTextSelectable to true.
2884
+
2885
+ For example in textfield you dont want to enable textSelection on the text
2886
+ hint only on the actual text you are entering. You can achieve that by
2887
+ only overriding this method.
2888
+
2889
+ @param evt {SC.Event} the selectstart event
2890
+ @returns YES if selectable
2891
+ */
2892
+ selectStart: function(evt) {
2893
+ return this.get('isTextSelectable');
2894
+ },
2895
+
2896
+ /**
2897
+ Used to block the contextMenu per view.
2898
+
2899
+ @param evt {SC.Event} the contextmenu event
2900
+ @returns YES if the contextmenu can show up
2901
+ */
2902
+ contextMenu: function(evt) {
2903
+ if(!this.get('isContextMenuEnabled')) evt.stop();
2904
+ return true;
2905
+ },
2906
+
2907
+ /**
2908
+ A boundary set of distances outside which the touch will not be considered "inside" the view anymore.
2909
+
2910
+ By default, up to 50px on each side.
2911
+ */
2912
+ touchBoundary: { left: 50, right: 50, top: 50, bottom: 50 },
2913
+
2914
+ /**
2915
+ @private
2916
+ A computed property based on frame.
2917
+ */
2918
+ _touchBoundaryFrame: function (){
2919
+ return this.get("parentView").convertFrameToView(this.get('frame'), null);
2920
+ }.property("frame", "parentView").cacheable(),
2921
+
2922
+ /**
2923
+ Returns YES if the provided touch is within the boundary.
2924
+ */
2925
+ touchIsInBoundary: function(touch) {
2926
+ var f = this.get("_touchBoundaryFrame"), maxX = 0, maxY = 0, boundary = this.get("touchBoundary");
2927
+ var x = touch.pageX, y = touch.pageY;
2928
+
2929
+ if (x < f.x) {
2930
+ x = f.x - x;
2931
+ maxX = boundary.left;
2932
+ } else if (x > f.x + f.width) {
2933
+ x = x - (f.x + f.width);
2934
+ maxX = boundary.right;
2935
+ } else {
2936
+ x = 0;
2937
+ maxX = 1;
2938
+ }
2939
+
2940
+ if (y < f.y) {
2941
+ y = f.y - y;
2942
+ maxY = boundary.top;
2943
+ } else if (y > f.y + f.height) {
2944
+ y = y - (f.y + f.height);
2945
+ maxY = boundary.bottom;
2946
+ } else {
2947
+ y = 0;
2948
+ maxY = 1;
2949
+ }
2950
+
2951
+ if (x > 100 || y > 100) return NO;
2952
+ return YES;
2953
+ }
2954
+ });
2955
+
2956
+ SC.View.mixin(/** @scope SC.View */ {
2957
+
2958
+ /** @private walk like a duck -- used by SC.Page */
2959
+ isViewClass: YES,
2960
+
2961
+ /**
2962
+ This method works just like extend() except that it will also preserve
2963
+ the passed attributes in case you want to use a view builder later, if
2964
+ needed.
2965
+
2966
+ @param {Hash} attrs Attributes to add to view
2967
+ @returns {Class} SC.View subclass to create
2968
+ @function
2969
+ */
2970
+ design: function() {
2971
+ if (this.isDesign) return this; // only run design one time
2972
+ var ret = this.extend.apply(this, arguments);
2973
+ ret.isDesign = YES ;
2974
+ if (SC.ViewDesigner) {
2975
+ SC.ViewDesigner.didLoadDesign(ret, this, SC.A(arguments));
2976
+ }
2977
+ return ret ;
2978
+ },
2979
+
2980
+ /**
2981
+ Helper applies the layout to the prototype.
2982
+ */
2983
+ layout: function(layout) {
2984
+ this.prototype.layout = layout ;
2985
+ return this ;
2986
+ },
2987
+
2988
+ /**
2989
+ Convert any layout to a Top, Left, Width, Height layout
2990
+ */
2991
+ convertLayoutToAnchoredLayout: function(layout, parentFrame){
2992
+ var ret = {top: 0, left: 0, width: parentFrame.width, height: parentFrame.height},
2993
+ pFW = parentFrame.width, pFH = parentFrame.height, //shortHand for parentDimensions
2994
+ lR = layout.right,
2995
+ lL = layout.left,
2996
+ lT = layout.top,
2997
+ lB = layout.bottom,
2998
+ lW = layout.width,
2999
+ lH = layout.height,
3000
+ lcX = layout.centerX,
3001
+ lcY = layout.centerY;
3002
+
3003
+ // X Conversion
3004
+ // handle left aligned and left/right
3005
+ if (!SC.none(lL)) {
3006
+ if(SC.isPercentage(lL)) ret.left = lL*pFW;
3007
+ else ret.left = lL;
3008
+ if (lW !== undefined) {
3009
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
3010
+ else if(SC.isPercentage(lW)) ret.width = lW*pFW ;
3011
+ else ret.width = lW ;
3012
+ } else {
3013
+ if (lR && SC.isPercentage(lR)) ret.width = pFW - ret.left - (lR*pFW);
3014
+ else ret.width = pFW - ret.left - (lR || 0);
3015
+ }
3016
+
3017
+ // handle right aligned
3018
+ } else if (!SC.none(lR)) {
3019
+
3020
+ // if no width, calculate it from the parent frame
3021
+ if (SC.none(lW)) {
3022
+ ret.left = 0;
3023
+ if(lR && SC.isPercentage(lR)) ret.width = pFW - (lR*pFW);
3024
+ else ret.width = pFW - (lR || 0);
3025
+
3026
+ // If has width, calculate the left anchor from the width and right and parent frame
3027
+ } else {
3028
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
3029
+ else {
3030
+ if (SC.isPercentage(lW)) ret.width = lW*pFW;
3031
+ else ret.width = lW;
3032
+ if (SC.isPercentage(lR)) ret.left = pFW - (ret.width + lR);
3033
+ else ret.left = pFW - (ret.width + lR);
3034
+ }
3035
+ }
3036
+
3037
+ // handle centered
3038
+ } else if (!SC.none(lcX)) {
3039
+ if(lW && SC.isPercentage(lW)) ret.width = (lW*pFW) ;
3040
+ else ret.width = (lW || 0) ;
3041
+ ret.left = ((pFW - ret.width)/2);
3042
+ if (SC.isPercentage(lcX)) ret.left = ret.left + lcX*pFW;
3043
+ else ret.left = ret.left + lcX;
3044
+
3045
+ // if width defined, assume left of zero
3046
+ } else if (!SC.none(lW)) {
3047
+ ret.left = 0;
3048
+ if(lW === SC.LAYOUT_AUTO) ret.width = SC.LAYOUT_AUTO ;
3049
+ else {
3050
+ if(SC.isPercentage(lW)) ret.width = lW*pFW;
3051
+ else ret.width = lW;
3052
+ }
3053
+
3054
+ // fallback, full width.
3055
+ } else {
3056
+ ret.left = 0;
3057
+ ret.width = 0;
3058
+ }
3059
+
3060
+ // handle min/max
3061
+ if (layout.minWidth !== undefined) ret.minWidth = layout.minWidth ;
3062
+ if (layout.maxWidth !== undefined) ret.maxWidth = layout.maxWidth ;
3063
+
3064
+ // Y Conversion
3065
+ // handle left aligned and top/bottom
3066
+ if (!SC.none(lT)) {
3067
+ if(SC.isPercentage(lT)) ret.top = lT*pFH;
3068
+ else ret.top = lT;
3069
+ if (lH !== undefined) {
3070
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
3071
+ else if (SC.isPercentage(lH)) ret.height = lH*pFH;
3072
+ else ret.height = lH ;
3073
+ } else {
3074
+ ret.height = pFH - ret.top;
3075
+ if(lB && SC.isPercentage(lB)) ret.height = ret.height - (lB*pFH);
3076
+ else ret.height = ret.height - (lB || 0);
3077
+ }
3078
+
3079
+ // handle bottom aligned
3080
+ } else if (!SC.none(lB)) {
3081
+
3082
+ // if no height, calculate it from the parent frame
3083
+ if (SC.none(lH)) {
3084
+ ret.top = 0;
3085
+ if (lB && SC.isPercentage(lB)) ret.height = pFH - (lB*pFH);
3086
+ else ret.height = pFH - (lB || 0);
3087
+
3088
+ // If has height, calculate the top anchor from the height and bottom and parent frame
3089
+ } else {
3090
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
3091
+ else {
3092
+ if (SC.isPercentage(lH)) ret.height = lH*pFH;
3093
+ else ret.height = lH;
3094
+ ret.top = pFH - ret.height;
3095
+ if (SC.isPercentage(lB)) ret.top = ret.top - (lB*pFH);
3096
+ else ret.top = ret.top - lB;
3097
+ }
3098
+ }
3099
+
3100
+ // handle centered
3101
+ } else if (!SC.none(lcY)) {
3102
+ if(lH && SC.isPercentage(lH)) ret.height = (lH*pFH) ;
3103
+ else ret.height = (lH || 0) ;
3104
+ ret.top = ((pFH - ret.height)/2);
3105
+ if(SC.isPercentage(lcY)) ret.top = ret.top + lcY*pFH;
3106
+ else ret.top = ret.top + lcY;
3107
+
3108
+ // if height defined, assume top of zero
3109
+ } else if (!SC.none(lH)) {
3110
+ ret.top = 0;
3111
+ if(lH === SC.LAYOUT_AUTO) ret.height = SC.LAYOUT_AUTO ;
3112
+ else if (SC.isPercentage(lH)) ret.height = lH*pFH;
3113
+ else ret.height = lH;
3114
+
3115
+ // fallback, full height.
3116
+ } else {
3117
+ ret.top = 0;
3118
+ ret.height = 0;
3119
+ }
3120
+
3121
+ if(ret.top) ret.top = Math.floor(ret.top);
3122
+ if(ret.bottom) ret.bottom = Math.floor(ret.bottom);
3123
+ if(ret.left) ret.left = Math.floor(ret.left);
3124
+ if(ret.right) ret.right = Math.floor(ret.right);
3125
+ if(ret.width !== SC.LAYOUT_AUTO) ret.width = Math.floor(ret.width);
3126
+ if(ret.height !== SC.LAYOUT_AUTO) ret.height = Math.floor(ret.height);
3127
+
3128
+ // handle min/max
3129
+ if (layout.minHeight !== undefined) ret.minHeight = layout.minHeight ;
3130
+ if (layout.maxHeight !== undefined) ret.maxHeight = layout.maxHeight ;
3131
+
3132
+ return ret;
3133
+ },
3134
+
3135
+ /**
3136
+ For now can only convert Top/Left/Width/Height to a Custom Layout
3137
+ */
3138
+ convertLayoutToCustomLayout: function(layout, layoutParams, parentFrame){
3139
+ // TODO: [EG] Create Top/Left/Width/Height to a Custom Layout conversion
3140
+ },
3141
+
3142
+ /**
3143
+ Helper applies the classNames to the prototype
3144
+ */
3145
+ classNames: function(sc) {
3146
+ sc = (this.prototype.classNames || []).concat(sc);
3147
+ this.prototype.classNames = sc;
3148
+ return this ;
3149
+ },
3150
+
3151
+ /**
3152
+ Help applies the tagName
3153
+ */
3154
+ tagName: function(tg) {
3155
+ this.prototype.tagName = tg;
3156
+ return this ;
3157
+ },
3158
+
3159
+ /**
3160
+ Helper adds the childView
3161
+ */
3162
+ childView: function(cv) {
3163
+ var childViews = this.prototype.childViews || [];
3164
+ if (childViews === this.superclass.prototype.childViews) {
3165
+ childViews = childViews.slice();
3166
+ }
3167
+ childViews.push(cv) ;
3168
+ this.prototype.childViews = childViews;
3169
+ return this ;
3170
+ },
3171
+
3172
+ /**
3173
+ Helper adds a binding to a design
3174
+ */
3175
+ bind: function(keyName, path) {
3176
+ var p = this.prototype, s = this.superclass.prototype;
3177
+ var bindings = p._bindings ;
3178
+ if (!bindings || bindings === s._bindings) {
3179
+ bindings = p._bindings = (bindings || []).slice() ;
3180
+ }
3181
+
3182
+ keyName = keyName + "Binding";
3183
+ p[keyName] = path ;
3184
+ bindings.push(keyName);
3185
+
3186
+ return this ;
3187
+ },
3188
+
3189
+ /**
3190
+ Helper sets a generic property on a design.
3191
+ */
3192
+ prop: function(keyName, value) {
3193
+ this.prototype[keyName] = value;
3194
+ return this ;
3195
+ },
3196
+
3197
+ /**
3198
+ Used to construct a localization for a view. The default implementation
3199
+ will simply return the passed attributes.
3200
+ */
3201
+ localization: function(attrs, rootElement) {
3202
+ // add rootElement
3203
+ if (rootElement) attrs.rootElement = SC.$(rootElement)[0];
3204
+ return attrs;
3205
+ },
3206
+
3207
+ /**
3208
+ Creates a view instance, first finding the DOM element you name and then
3209
+ using that as the root element. You should not use this method very
3210
+ often, but it is sometimes useful if you want to attach to already
3211
+ existing HTML.
3212
+
3213
+ @param {String|Element} element
3214
+ @param {Hash} attrs
3215
+ @returns {SC.View} instance
3216
+ */
3217
+ viewFor: function(element, attrs) {
3218
+ var args = SC.$A(arguments); // prepare to edit
3219
+ if (SC.none(element)) {
3220
+ args.shift(); // remove if no element passed
3221
+ } else args[0] = { rootElement: SC.$(element)[0] } ;
3222
+ var ret = this.create.apply(this, arguments) ;
3223
+ args = args[0] = null;
3224
+ return ret ;
3225
+ },
3226
+
3227
+ /**
3228
+ Create a new view with the passed attributes hash. If you have the
3229
+ Designer module loaded, this will also create a peer designer if needed.
3230
+ */
3231
+ create: function() {
3232
+ var C=this, ret = new C(arguments);
3233
+ if (SC.ViewDesigner) {
3234
+ SC.ViewDesigner.didCreateView(ret, SC.$A(arguments));
3235
+ }
3236
+ return ret ;
3237
+ },
3238
+
3239
+ /**
3240
+ Applies the passed localization hash to the component views. Call this
3241
+ method before you call create(). Returns the receiver. Typically you
3242
+ will do something like this:
3243
+
3244
+ view = SC.View.design({...}).loc(localizationHash).create();
3245
+
3246
+ @param {Hash} loc
3247
+ @param rootElement {String} optional rootElement with prepped HTML
3248
+ @returns {SC.View} receiver
3249
+ */
3250
+ loc: function(loc) {
3251
+ var childLocs = loc.childViews;
3252
+ delete loc.childViews; // clear out child views before applying to attrs
3253
+
3254
+ this.applyLocalizedAttributes(loc) ;
3255
+ if (SC.ViewDesigner) {
3256
+ SC.ViewDesigner.didLoadLocalization(this, SC.$A(arguments));
3257
+ }
3258
+
3259
+ // apply localization recursively to childViews
3260
+ var childViews = this.prototype.childViews, idx = childViews.length,
3261
+ viewClass;
3262
+ while(--idx>=0) {
3263
+ viewClass = childViews[idx];
3264
+ loc = childLocs[idx];
3265
+ if (loc && viewClass && viewClass.loc) viewClass.loc(loc) ;
3266
+ }
3267
+
3268
+ return this; // done!
3269
+ },
3270
+
3271
+ /**
3272
+ Internal method actually updates the localizated attributes on the view
3273
+ class. This is overloaded in design mode to also save the attributes.
3274
+ */
3275
+ applyLocalizedAttributes: function(loc) {
3276
+ SC.mixin(this.prototype, loc) ;
3277
+ },
3278
+
3279
+ views: {}
3280
+
3281
+ }) ;
3282
+
3283
+ // .......................................................
3284
+ // OUTLET BUILDER
3285
+ //
3286
+
3287
+ /**
3288
+ Generates a computed property that will look up the passed property path
3289
+ the first time you try to get the value. Use this whenever you want to
3290
+ define an outlet that points to another view or object. The root object
3291
+ used for the path will be the receiver.
3292
+ */
3293
+ SC.outlet = function(path, root) {
3294
+ return function(key) {
3295
+ return (this[key] = SC.objectForPropertyPath(path, (root !== undefined) ? root : this)) ;
3296
+ }.property();
3297
+ };
3298
+
3299
+ /** @private on unload clear cached divs. */
3300
+ SC.View.unload = function() {
3301
+ // delete view items this way to ensure the views are cleared. The hash
3302
+ // itself may be owned by multiple view subclasses.
3303
+ var views = SC.View.views;
3304
+ if (views) {
3305
+ for(var key in views) {
3306
+ if (!views.hasOwnProperty(key)) continue ;
3307
+ delete views[key];
3308
+ }
3309
+ }
3310
+ } ;
3311
+
3312
+ //unload views for IE, trying to collect memory.
3313
+ if(SC.browser.msie) SC.Event.add(window, 'unload', SC.View, SC.View.unload) ;