sproutcore 1.6.0.beta.3-java → 1.6.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (633) hide show
  1. data/CHANGELOG +70 -0
  2. data/{History.txt → History.rdoc} +0 -0
  3. data/{README.txt → README.rdoc} +3 -2
  4. data/Rakefile +213 -10
  5. data/{Todo.txt → Todo.rdoc} +0 -0
  6. data/VERSION.yml +1 -1
  7. data/bin/sc-docs +6 -1
  8. data/lib/Buildfile +5 -1
  9. data/lib/buildtasks/manifest.rake +14 -1
  10. data/lib/buildtasks/target.rake +20 -23
  11. data/lib/frameworks/sproutcore/Buildfile +8 -3
  12. data/lib/frameworks/sproutcore/CHANGELOG.md +364 -1
  13. data/lib/frameworks/sproutcore/README.md +1 -1
  14. data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
  15. data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
  16. data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.css +9 -0
  17. data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +243 -199
  18. data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +250 -172
  19. data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +29 -0
  20. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +5 -0
  21. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
  22. data/lib/frameworks/sproutcore/frameworks/core_foundation/controls/button.js +6 -2
  23. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +2 -42
  24. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/bind.js +38 -15
  25. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/handlebars/collection.js +6 -4
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +11 -6
  28. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +55 -20
  29. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
  30. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +26 -20
  31. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +37 -21
  32. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +2 -7
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +7 -7
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +2 -2
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +1 -1
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +29 -15
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +162 -1
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +24 -8
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +42 -0
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controls/button.js +39 -57
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +19 -2
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +5 -3
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +32 -0
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/collection.js +135 -0
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +29 -18
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +414 -1
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +1 -1
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/{system → views}/bindable_span.js +2 -1
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +112 -40
  60. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +13 -7
  61. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +2 -1
  62. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +245 -67
  63. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +17 -9
  64. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
  65. data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +8 -2
  66. data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +1 -1
  67. data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +1 -1
  68. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +15 -8
  69. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
  70. data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
  71. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +3 -3
  72. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
  73. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +23 -1
  74. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -5
  75. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
  76. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +69 -58
  77. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
  78. data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +203 -0
  79. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
  80. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +44 -0
  81. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
  82. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
  83. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
  84. data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +76 -47
  85. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
  86. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/core_methods.js +74 -53
  87. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +0 -1
  88. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
  89. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
  90. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
  91. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +212 -182
  92. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +6 -67
  93. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
  94. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +1 -1
  95. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
  96. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +13 -15
  97. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +41 -12
  98. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
  99. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +6 -3
  100. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
  101. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
  102. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
  103. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
  104. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
  105. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
  106. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
  107. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
  108. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
  109. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
  110. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
  111. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
  112. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
  113. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
  114. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
  115. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
  116. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
  117. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
  118. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
  119. data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
  120. data/lib/frameworks/sproutcore/frameworks/desktop/resources/alert.css +49 -0
  121. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/a_sample_image.jpg +0 -0
  122. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/apple-logo1.jpeg +0 -0
  123. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/debug/iframe.html +0 -0
  124. data/lib/frameworks/sproutcore/frameworks/desktop/resources/disclosure.css +20 -0
  125. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/drag.css +1 -1
  126. data/lib/frameworks/sproutcore/frameworks/desktop/resources/icons.css +214 -0
  127. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/cap.png +0 -0
  128. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/downbutton.png +0 -0
  129. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-16.png +0 -0
  130. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-24.png +0 -0
  131. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-alert-48.png +0 -0
  132. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-16.png +0 -0
  133. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-bookmark-24.png +0 -0
  134. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-cancel-24.png +0 -0
  135. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-16.png +0 -0
  136. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-document-24.png +0 -0
  137. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-down-24.png +0 -0
  138. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-error-48.png +0 -0
  139. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-16.png +0 -0
  140. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-favorite-24.png +0 -0
  141. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-16.png +0 -0
  142. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-folder-24.png +0 -0
  143. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-16.png +0 -0
  144. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-group-24.png +0 -0
  145. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-16.png +0 -0
  146. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-help-24.png +0 -0
  147. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-16.png +0 -0
  148. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-24.png +0 -0
  149. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-info-48.png +0 -0
  150. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-left-24.png +0 -0
  151. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-16.png +0 -0
  152. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-options-24.png +0 -0
  153. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-redo-24.png +0 -0
  154. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-right-24.png +0 -0
  155. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-tools-24.png +0 -0
  156. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-16.png +0 -0
  157. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-trash-24.png +0 -0
  158. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-undo-24.png +0 -0
  159. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-up-24.png +0 -0
  160. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-16.png +0 -0
  161. data/lib/frameworks/sproutcore/frameworks/desktop/resources/images/icons/sc-icon-user-24.png +0 -0
  162. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-bottom.png +0 -0
  163. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-center.png +0 -0
  164. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/thumb-top.png +0 -0
  165. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/track.png +0 -0
  166. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/images/upbutton.png +0 -0
  167. data/lib/frameworks/sproutcore/frameworks/desktop/resources/list_item.css +145 -0
  168. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu.css +10 -0
  169. data/lib/frameworks/sproutcore/frameworks/desktop/resources/menu_item_view.css +88 -0
  170. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/modal.css +3 -4
  171. data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +91 -0
  172. data/lib/frameworks/sproutcore/frameworks/desktop/resources/picker.css +37 -0
  173. data/lib/frameworks/sproutcore/frameworks/desktop/resources/progress.css +29 -0
  174. data/lib/frameworks/sproutcore/frameworks/desktop/resources/radio.css +11 -0
  175. data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +122 -0
  176. data/lib/frameworks/sproutcore/frameworks/desktop/resources/separator.css +20 -0
  177. data/lib/frameworks/sproutcore/frameworks/desktop/resources/slider.css +34 -0
  178. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split.css +0 -0
  179. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/split_divider.css +0 -0
  180. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/tab.css +0 -0
  181. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/toolbar.css +0 -0
  182. data/lib/frameworks/sproutcore/frameworks/desktop/{english.lproj → resources}/touch-scroller.css +13 -13
  183. data/lib/frameworks/sproutcore/frameworks/desktop/resources/well.css +65 -0
  184. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +58 -23
  185. data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
  186. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +121 -103
  187. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
  188. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/static_content.js +3 -2
  189. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/methods.js +1 -3
  190. data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +20 -1
  191. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
  192. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +43 -16
  193. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +717 -700
  194. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
  195. data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
  196. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
  197. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +4 -7
  198. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
  199. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
  200. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +9 -2
  201. data/lib/frameworks/sproutcore/frameworks/desktop/{panes → views}/select_button.js +52 -0
  202. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +7 -3
  203. data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
  204. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +46 -49
  205. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
  206. data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
  207. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
  208. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
  209. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
  210. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
  211. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
  212. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
  213. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
  214. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
  215. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
  216. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +98 -126
  217. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
  218. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
  219. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
  220. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
  221. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
  222. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
  223. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
  224. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
  225. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
  226. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
  227. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
  228. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
  229. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
  230. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
  231. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
  232. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
  233. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
  234. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
  235. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
  236. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
  237. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
  238. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
  239. data/lib/frameworks/sproutcore/frameworks/foundation/core.js +2 -2
  240. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +16 -19
  241. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +4 -7
  242. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
  243. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +85 -16
  244. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
  245. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
  246. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
  247. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
  248. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +4 -2
  249. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
  250. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
  251. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
  252. data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +13 -13
  253. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/benchmark.css +0 -0
  254. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/blank.gif +0 -0
  255. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/bootstrap.rhtml +0 -0
  256. data/lib/frameworks/sproutcore/frameworks/foundation/resources/button_view.css +36 -0
  257. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/checkbox_view.css +0 -0
  258. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/debug/control-test-pane.css +0 -0
  259. data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
  260. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-logo.png +0 -0
  261. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.jpg +0 -0
  262. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-landscape.png +0 -0
  263. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.jpg +0 -0
  264. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup-portrait.png +0 -0
  265. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore-startup.png +0 -0
  266. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/images/sproutcore.png +0 -0
  267. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/inline_editor.css +0 -0
  268. data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +47 -0
  269. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/radio_view.css +0 -0
  270. data/lib/frameworks/sproutcore/frameworks/foundation/{english.lproj → resources}/static_layout.css +1 -1
  271. data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +125 -0
  272. data/lib/frameworks/sproutcore/frameworks/foundation/system/chance.js +5 -1
  273. data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
  274. data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
  275. data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
  276. data/lib/frameworks/sproutcore/frameworks/foundation/system/string.js +0 -43
  277. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +11 -11
  278. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
  279. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +23 -0
  280. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
  281. data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
  282. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date.js +4 -4
  283. data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
  284. data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +17 -6
  285. data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
  286. data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +3 -3
  287. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +30 -19
  288. data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
  289. data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +2 -76
  290. data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +3348 -1591
  291. data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +6 -3
  292. data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +11 -0
  293. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +38 -12
  294. data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
  295. data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
  296. data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
  297. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +21 -2
  298. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
  299. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
  300. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
  301. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +2 -2
  302. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
  303. data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +4 -1
  304. data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +0 -3
  305. data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +4 -4
  306. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +4 -4
  307. data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
  308. data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
  309. data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
  310. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
  311. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/objectForPropertyPath.js +10 -5
  312. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/requiredObjectForPropertyPath.js +29 -0
  313. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue.js +98 -0
  314. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
  315. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
  316. data/lib/frameworks/sproutcore/frameworks/statechart/debug/monitor.js +4 -73
  317. data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +189 -0
  318. data/lib/frameworks/sproutcore/frameworks/statechart/ext/function.js +122 -0
  319. data/lib/frameworks/sproutcore/frameworks/statechart/system/async.js +88 -0
  320. data/lib/frameworks/sproutcore/frameworks/statechart/system/empty_state.js +34 -0
  321. data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +97 -0
  322. data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +16 -191
  323. data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +17 -79
  324. data/lib/frameworks/sproutcore/frameworks/statechart/tests/debug/sequence_matcher.js +464 -0
  325. data/lib/frameworks/sproutcore/frameworks/statechart/tests/event_handling/basic/with_concurrent_states.js +31 -11
  326. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/async/with_concurrent_states.js +6 -4
  327. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/advanced.js +40 -6
  328. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/basic.js +22 -2
  329. data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/standard/with_concurrent_states/intermediate.js +44 -3
  330. data/lib/frameworks/sproutcore/frameworks/testing/core.js +61 -9
  331. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/additions.css +0 -0
  332. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/runner.css +10 -2
  333. data/lib/frameworks/sproutcore/frameworks/testing/{english.lproj → resources}/testsuite.css +0 -0
  334. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +66 -27
  335. data/lib/frameworks/sproutcore/frameworks/testing/tests/spy_on.js +41 -0
  336. data/lib/frameworks/sproutcore/frameworks/testing/tests/stub_method.js +9 -0
  337. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
  338. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +20 -0
  339. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/fonts.css +39 -0
  340. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/reset.css +126 -0
  341. data/lib/frameworks/sproutcore/frameworks/yuireset/resources/view.css +57 -0
  342. data/lib/frameworks/sproutcore/lib/index.rhtml +8 -4
  343. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_checked.psd +0 -0
  344. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_checked_active.psd +0 -0
  345. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_mixed.psd +0 -0
  346. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_mixed_active.psd +0 -0
  347. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_unchecked.psd +0 -0
  348. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/14px/checkbox_unchecked_active.psd +0 -0
  349. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_checked.psd +0 -0
  350. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_checked_active.psd +0 -0
  351. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_mixed.psd +0 -0
  352. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_mixed_active.psd +0 -0
  353. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_unchecked.psd +0 -0
  354. data/lib/frameworks/sproutcore/themes/ace/designs/psds/checkbox/ace/16px/checkbox_unchecked_active.psd +0 -0
  355. data/lib/frameworks/sproutcore/themes/ace/designs/psds/menu/menu_item.psd +0 -0
  356. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked.png +0 -0
  357. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_checked_active.png +0 -0
  358. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed.png +0 -0
  359. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_mixed_active.png +0 -0
  360. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked.png +0 -0
  361. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/14px/checkbox_unchecked_active.png +0 -0
  362. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked.png +0 -0
  363. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_checked_active.png +0 -0
  364. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed.png +0 -0
  365. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_mixed_active.png +0 -0
  366. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked.png +0 -0
  367. data/lib/frameworks/sproutcore/themes/ace/resources/checkbox/ace/16px/checkbox_unchecked_active.png +0 -0
  368. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +13 -4
  369. data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +16 -14
  370. data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
  371. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
  372. data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu_item.png +0 -0
  373. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
  374. data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
  375. data/lib/frameworks/sproutcore/themes/ace/resources/split/split.css +1 -1
  376. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
  377. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
  378. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
  379. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
  380. data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
  381. data/lib/gen/app/templates/apps/@target_name@/Buildfile +1 -4
  382. data/lib/gen/app/templates/apps/@target_name@/core.js +1 -4
  383. data/lib/gen/app/templates/apps/@target_name@/main.js +1 -4
  384. data/lib/gen/app/templates/apps/@target_name@/resources/main_page.js +1 -4
  385. data/lib/gen/app/templates/apps/@target_name@/theme.js +1 -4
  386. data/lib/gen/controller/templates/controllers/{@filename@.js → @filename@_controller.js} +1 -4
  387. data/lib/gen/controller/templates/tests/controllers/{@filename@.js → @filename@_test.js} +1 -4
  388. data/lib/gen/data-source/templates/data_sources/{@filename@.js → @filename@_data_source.js} +1 -4
  389. data/lib/gen/design/templates/resources/@filename@.js +1 -4
  390. data/lib/gen/framework/templates/frameworks/@target_name@/core.js +1 -4
  391. data/lib/gen/framework/templates/frameworks/@target_name@/english.lproj/strings.js +1 -4
  392. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -4
  393. data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +2 -0
  394. data/lib/gen/html_project/templates/@filename@/Buildfile +1 -4
  395. data/lib/gen/html_project/templates/@filename@/README +1 -4
  396. data/lib/gen/language/Buildfile +1 -1
  397. data/lib/gen/language/templates/@filename@/strings.js +1 -4
  398. data/lib/gen/model/templates/fixtures/{@filename@.js → @filename@_fixtures.js} +2 -5
  399. data/lib/gen/model/templates/models/{@filename@.js → @filename@_model.js} +1 -4
  400. data/lib/gen/model/templates/tests/models/{@filename@.js → @filename@_test.js} +1 -4
  401. data/lib/gen/page/templates/pages/@target_name@/Buildfile +1 -4
  402. data/lib/gen/page/templates/pages/@target_name@/core.js +1 -4
  403. data/lib/gen/page/templates/pages/@target_name@/en.lproj/strings.js +1 -4
  404. data/lib/gen/page/templates/pages/@target_name@/resources/body.css +3 -1
  405. data/lib/gen/project/templates/@filename@/Buildfile +1 -4
  406. data/lib/gen/project/templates/@filename@/README +1 -5
  407. data/lib/gen/responder/templates/states/{@filename@.js → @filename@_state.js} +1 -4
  408. data/lib/gen/test/templates/tests/{@filename@.js → @filename@_test.js} +1 -4
  409. data/lib/gen/theme/templates/themes/@target_name@/resources/theme_styles.css +1 -5
  410. data/lib/gen/theme/templates/themes/@target_name@/theme.js +1 -4
  411. data/lib/gen/view/templates/tests/views/{@filename@.js → @filename@_test.js} +1 -4
  412. data/lib/gen/view/templates/views/{@filename@.js → @filename@_view.js} +1 -4
  413. data/lib/sproutcore.rb +5 -15
  414. data/lib/sproutcore/builders/base.rb +5 -1
  415. data/lib/sproutcore/builders/handlebars.rb +12 -1
  416. data/lib/sproutcore/builders/module.rb +2 -2
  417. data/lib/sproutcore/buildfile/string_ext.rb +0 -4
  418. data/lib/sproutcore/helpers/cssmin.rb +44 -59
  419. data/lib/sproutcore/helpers/static_helper.rb +4 -2
  420. data/lib/sproutcore/helpers/text_helper.rb +11 -13
  421. data/lib/sproutcore/models/generator.rb +22 -0
  422. data/lib/sproutcore/models/manifest.rb +4 -4
  423. data/lib/sproutcore/models/manifest_entry.rb +1 -0
  424. data/lib/sproutcore/models/target.rb +3 -107
  425. data/lib/sproutcore/rack.rb +0 -1
  426. data/lib/sproutcore/rack/builder.rb +3 -0
  427. data/lib/sproutcore/rack/dev.rb +0 -1
  428. data/lib/sproutcore/rack/proxy.rb +240 -93
  429. data/lib/sproutcore/rack/service.rb +1 -1
  430. data/lib/sproutcore/render_engines/haml.rb +2 -5
  431. data/lib/sproutcore/tools.rb +11 -11
  432. data/lib/sproutcore/tools/build.rb +2 -0
  433. data/lib/sproutcore/tools/docs.rb +2 -37
  434. data/lib/sproutcore/tools/init.rb +10 -22
  435. data/lib/sproutcore/tools/manifest.rb +21 -22
  436. data/spec/buildtasks/manifest/prepare_build_tasks/combine_spec.rb +21 -1
  437. data/spec/buildtasks/target_spec.rb +9 -0
  438. data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
  439. data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
  440. data/{lib/doc_templates/sproutcore/allclasses.tmpl → spec/fixtures/ordered_entries/apps/template_style/a.js} +0 -0
  441. data/spec/fixtures/{real_world/frameworks/sproutcore/apps/docs/PLACEHOLDER → ordered_entries/apps/template_style/template_style.js} +0 -0
  442. data/spec/fixtures/real_world/frameworks/sproutcore/Buildfile +1 -1
  443. data/spec/lib/builders/handlebars_spec.rb +10 -4
  444. data/spec/lib/buildfile_commands/build_task_spec.rb +1 -1
  445. data/spec/lib/tools/manifest_spec.rb +11 -0
  446. data/sproutcore.gemspec +8 -7
  447. data/vendor/chance/lib/chance/instance.rb +8 -9
  448. metadata +167 -266
  449. data/lib/doc_templates/jsdoc/allclasses.tmpl +0 -17
  450. data/lib/doc_templates/jsdoc/allfiles.tmpl +0 -56
  451. data/lib/doc_templates/jsdoc/class.tmpl +0 -487
  452. data/lib/doc_templates/jsdoc/index.tmpl +0 -38
  453. data/lib/doc_templates/jsdoc/publish.js +0 -170
  454. data/lib/doc_templates/jsdoc/static/default.css +0 -162
  455. data/lib/doc_templates/jsdoc/static/header.html +0 -2
  456. data/lib/doc_templates/jsdoc/static/index.html +0 -19
  457. data/lib/doc_templates/jsdoc/symbol.tmpl +0 -35
  458. data/lib/doc_templates/sproutcore/allfiles.tmpl +0 -56
  459. data/lib/doc_templates/sproutcore/class.tmpl +0 -674
  460. data/lib/doc_templates/sproutcore/classes-json.tmpl +0 -55
  461. data/lib/doc_templates/sproutcore/index.tmpl +0 -62
  462. data/lib/doc_templates/sproutcore/publish.js +0 -346
  463. data/lib/doc_templates/sproutcore/static/default.css +0 -258
  464. data/lib/doc_templates/sproutcore/static/header.html +0 -2
  465. data/lib/doc_templates/sproutcore/static/index.html +0 -19
  466. data/lib/doc_templates/sproutcore/symbol.tmpl +0 -35
  467. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/core.css +0 -378
  468. data/lib/frameworks/sproutcore/frameworks/core_foundation/resources/view.css +0 -57
  469. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/alert.css +0 -56
  470. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/disclosure.css +0 -73
  471. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/icons.css +0 -916
  472. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/images/icons/shared.png +0 -0
  473. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/list_item.css +0 -185
  474. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu.css +0 -12
  475. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/menu_item_view.css +0 -101
  476. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/panel.css +0 -91
  477. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/picker.css +0 -35
  478. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/progress.css +0 -33
  479. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/radio.css +0 -10
  480. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +0 -132
  481. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/separator.css +0 -19
  482. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/slider.css +0 -69
  483. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/strings.js +0 -14
  484. data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/well.css +0 -71
  485. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
  486. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
  487. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
  488. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
  489. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
  490. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
  491. data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
  492. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/button_view.css +0 -40
  493. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/images/favicon.ico +0 -0
  494. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/label.css +0 -47
  495. data/lib/frameworks/sproutcore/frameworks/foundation/english.lproj/text_field.css +0 -146
  496. data/lib/frameworks/sproutcore/frameworks/runtime/tests/private/observer_queue/isObservingSuspended.js +0 -55
  497. data/lib/frameworks/sproutcore/themes/empty_theme/tests/mini_icons.rhtml +0 -69
  498. data/lib/sproutcore/rack/docs.rb +0 -24
  499. data/vendor/jsdoc/README.txt +0 -151
  500. data/vendor/jsdoc/app/frame.js +0 -33
  501. data/vendor/jsdoc/app/frame/Chain.js +0 -102
  502. data/vendor/jsdoc/app/frame/Dumper.js +0 -144
  503. data/vendor/jsdoc/app/frame/Hash.js +0 -47
  504. data/vendor/jsdoc/app/frame/Link.js +0 -142
  505. data/vendor/jsdoc/app/frame/Namespace.js +0 -10
  506. data/vendor/jsdoc/app/frame/Opt.js +0 -134
  507. data/vendor/jsdoc/app/frame/Reflection.js +0 -26
  508. data/vendor/jsdoc/app/frame/String.js +0 -93
  509. data/vendor/jsdoc/app/frame/Testrun.js +0 -129
  510. data/vendor/jsdoc/app/handlers/FOODOC.js +0 -26
  511. data/vendor/jsdoc/app/handlers/XMLDOC.js +0 -26
  512. data/vendor/jsdoc/app/handlers/XMLDOC/DomReader.js +0 -159
  513. data/vendor/jsdoc/app/handlers/XMLDOC/XMLDoc.js +0 -16
  514. data/vendor/jsdoc/app/handlers/XMLDOC/XMLParse.js +0 -292
  515. data/vendor/jsdoc/app/lib/JSDOC.js +0 -98
  516. data/vendor/jsdoc/app/lib/JSDOC/DocComment.js +0 -200
  517. data/vendor/jsdoc/app/lib/JSDOC/DocTag.js +0 -294
  518. data/vendor/jsdoc/app/lib/JSDOC/JsDoc.js +0 -162
  519. data/vendor/jsdoc/app/lib/JSDOC/JsPlate.js +0 -100
  520. data/vendor/jsdoc/app/lib/JSDOC/Lang.js +0 -144
  521. data/vendor/jsdoc/app/lib/JSDOC/Parser.js +0 -109
  522. data/vendor/jsdoc/app/lib/JSDOC/PluginManager.js +0 -33
  523. data/vendor/jsdoc/app/lib/JSDOC/Symbol.js +0 -681
  524. data/vendor/jsdoc/app/lib/JSDOC/SymbolSet.js +0 -226
  525. data/vendor/jsdoc/app/lib/JSDOC/TextStream.js +0 -41
  526. data/vendor/jsdoc/app/lib/JSDOC/Token.js +0 -18
  527. data/vendor/jsdoc/app/lib/JSDOC/TokenReader.js +0 -332
  528. data/vendor/jsdoc/app/lib/JSDOC/TokenStream.js +0 -133
  529. data/vendor/jsdoc/app/lib/JSDOC/Util.js +0 -32
  530. data/vendor/jsdoc/app/lib/JSDOC/Walker.js +0 -453
  531. data/vendor/jsdoc/app/main.js +0 -74
  532. data/vendor/jsdoc/app/plugins/commentSrcJson.js +0 -19
  533. data/vendor/jsdoc/app/plugins/frameworkPrototype.js +0 -16
  534. data/vendor/jsdoc/app/plugins/functionCall.js +0 -10
  535. data/vendor/jsdoc/app/plugins/publishSrcHilite.js +0 -62
  536. data/vendor/jsdoc/app/plugins/sproutcoreTags.js +0 -26
  537. data/vendor/jsdoc/app/plugins/symbolLink.js +0 -9
  538. data/vendor/jsdoc/app/plugins/tagParamConfig.js +0 -31
  539. data/vendor/jsdoc/app/plugins/tagSynonyms.js +0 -43
  540. data/vendor/jsdoc/app/run.js +0 -346
  541. data/vendor/jsdoc/app/t/TestDoc.js +0 -144
  542. data/vendor/jsdoc/app/t/runner.js +0 -13
  543. data/vendor/jsdoc/app/test.js +0 -304
  544. data/vendor/jsdoc/app/test/addon.js +0 -24
  545. data/vendor/jsdoc/app/test/anon_inner.js +0 -14
  546. data/vendor/jsdoc/app/test/augments.js +0 -31
  547. data/vendor/jsdoc/app/test/augments2.js +0 -26
  548. data/vendor/jsdoc/app/test/borrows.js +0 -41
  549. data/vendor/jsdoc/app/test/borrows2.js +0 -23
  550. data/vendor/jsdoc/app/test/config.js +0 -22
  551. data/vendor/jsdoc/app/test/constructs.js +0 -18
  552. data/vendor/jsdoc/app/test/encoding.js +0 -10
  553. data/vendor/jsdoc/app/test/encoding_other.js +0 -12
  554. data/vendor/jsdoc/app/test/functions_anon.js +0 -39
  555. data/vendor/jsdoc/app/test/functions_nested.js +0 -33
  556. data/vendor/jsdoc/app/test/global.js +0 -13
  557. data/vendor/jsdoc/app/test/globals.js +0 -25
  558. data/vendor/jsdoc/app/test/ignore.js +0 -10
  559. data/vendor/jsdoc/app/test/inner.js +0 -16
  560. data/vendor/jsdoc/app/test/jsdoc_test.js +0 -477
  561. data/vendor/jsdoc/app/test/lend.js +0 -33
  562. data/vendor/jsdoc/app/test/memberof.js +0 -20
  563. data/vendor/jsdoc/app/test/memberof_constructor.js +0 -15
  564. data/vendor/jsdoc/app/test/name.js +0 -19
  565. data/vendor/jsdoc/app/test/namespace_nested.js +0 -23
  566. data/vendor/jsdoc/app/test/nocode.js +0 -13
  567. data/vendor/jsdoc/app/test/oblit_anon.js +0 -20
  568. data/vendor/jsdoc/app/test/overview.js +0 -20
  569. data/vendor/jsdoc/app/test/param_inline.js +0 -37
  570. data/vendor/jsdoc/app/test/params_optional.js +0 -8
  571. data/vendor/jsdoc/app/test/prototype.js +0 -17
  572. data/vendor/jsdoc/app/test/prototype_nested.js +0 -9
  573. data/vendor/jsdoc/app/test/prototype_oblit.js +0 -13
  574. data/vendor/jsdoc/app/test/prototype_oblit_constructor.js +0 -24
  575. data/vendor/jsdoc/app/test/public.js +0 -10
  576. data/vendor/jsdoc/app/test/shared.js +0 -42
  577. data/vendor/jsdoc/app/test/shared2.js +0 -2
  578. data/vendor/jsdoc/app/test/shortcuts.js +0 -22
  579. data/vendor/jsdoc/app/test/static_this.js +0 -13
  580. data/vendor/jsdoc/app/test/synonyms.js +0 -23
  581. data/vendor/jsdoc/app/test/tosource.js +0 -23
  582. data/vendor/jsdoc/app/test/variable_redefine.js +0 -14
  583. data/vendor/jsdoc/changes.txt +0 -47
  584. data/vendor/jsdoc/conf/sample.conf +0 -31
  585. data/vendor/jsdoc/java/build.xml +0 -36
  586. data/vendor/jsdoc/java/build_1.4.xml +0 -36
  587. data/vendor/jsdoc/java/classes/js.jar +0 -0
  588. data/vendor/jsdoc/java/src/JsDebugRun.java +0 -21
  589. data/vendor/jsdoc/java/src/JsRun.java +0 -21
  590. data/vendor/jsdoc/jsdebug.jar +0 -0
  591. data/vendor/jsdoc/jsrun.jar +0 -0
  592. data/vendor/jsdoc/t/TestDoc.js +0 -144
  593. data/vendor/jsdoc/t/runner.js +0 -13
  594. data/vendor/jsdoc/test.js +0 -304
  595. data/vendor/jsdoc/test/addon.js +0 -24
  596. data/vendor/jsdoc/test/anon_inner.js +0 -14
  597. data/vendor/jsdoc/test/augments.js +0 -31
  598. data/vendor/jsdoc/test/augments2.js +0 -26
  599. data/vendor/jsdoc/test/borrows.js +0 -41
  600. data/vendor/jsdoc/test/borrows2.js +0 -23
  601. data/vendor/jsdoc/test/config.js +0 -22
  602. data/vendor/jsdoc/test/constructs.js +0 -18
  603. data/vendor/jsdoc/test/encoding.js +0 -10
  604. data/vendor/jsdoc/test/encoding_other.js +0 -12
  605. data/vendor/jsdoc/test/functions_anon.js +0 -39
  606. data/vendor/jsdoc/test/functions_nested.js +0 -33
  607. data/vendor/jsdoc/test/global.js +0 -13
  608. data/vendor/jsdoc/test/globals.js +0 -25
  609. data/vendor/jsdoc/test/ignore.js +0 -10
  610. data/vendor/jsdoc/test/inner.js +0 -16
  611. data/vendor/jsdoc/test/jsdoc_test.js +0 -477
  612. data/vendor/jsdoc/test/lend.js +0 -33
  613. data/vendor/jsdoc/test/memberof.js +0 -20
  614. data/vendor/jsdoc/test/memberof_constructor.js +0 -15
  615. data/vendor/jsdoc/test/name.js +0 -19
  616. data/vendor/jsdoc/test/namespace_nested.js +0 -23
  617. data/vendor/jsdoc/test/nocode.js +0 -13
  618. data/vendor/jsdoc/test/oblit_anon.js +0 -20
  619. data/vendor/jsdoc/test/overview.js +0 -20
  620. data/vendor/jsdoc/test/param_inline.js +0 -37
  621. data/vendor/jsdoc/test/params_optional.js +0 -8
  622. data/vendor/jsdoc/test/prototype.js +0 -17
  623. data/vendor/jsdoc/test/prototype_nested.js +0 -9
  624. data/vendor/jsdoc/test/prototype_oblit.js +0 -13
  625. data/vendor/jsdoc/test/prototype_oblit_constructor.js +0 -24
  626. data/vendor/jsdoc/test/public.js +0 -10
  627. data/vendor/jsdoc/test/shared.js +0 -42
  628. data/vendor/jsdoc/test/shared2.js +0 -2
  629. data/vendor/jsdoc/test/shortcuts.js +0 -22
  630. data/vendor/jsdoc/test/static_this.js +0 -13
  631. data/vendor/jsdoc/test/synonyms.js +0 -23
  632. data/vendor/jsdoc/test/tosource.js +0 -23
  633. data/vendor/jsdoc/test/variable_redefine.js +0 -14
@@ -31,13 +31,6 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
31
31
  */
32
32
  classNames: ['sc-checkbox-view', 'sc-checkbox-control'],
33
33
 
34
- /**
35
- @type String
36
- @default 'label'
37
- @see SC.View#tagName
38
- */
39
- tagName: 'label',
40
-
41
34
  /**
42
35
  The WAI-ARIA role of checkbox.
43
36
 
@@ -75,6 +68,11 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
75
68
  return NO;
76
69
  }.property('isEnabled'),
77
70
 
71
+ /** @private */
72
+ _toggleValue: function(){
73
+ var isOn = this.get('value') === this.get('toggleOnValue');
74
+ this.set('value', isOn ? this.get('toggleOffValue') : this.get('toggleOnValue'));
75
+ },
78
76
 
79
77
  /** @private */
80
78
  mouseDown: function(evt) {
@@ -89,24 +87,53 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
89
87
 
90
88
  /** @private */
91
89
  mouseUp: function(evt) {
90
+ if(!this.get('isEnabled')) return YES;
91
+
92
92
  this.set('isActive', NO);
93
93
  this._isMouseDown = NO;
94
94
 
95
- if(!this.get('isEnabled')) {
96
- return YES;
95
+ this._toggleValue();
96
+
97
+ // fire action
98
+ if (this.get('buttonBehavior') !== SC.HOLD_BEHAVIOR) {
99
+ if (this.$().within(evt.target)) { this._action(evt); }
97
100
  }
98
- var val = this.get('value');
99
- if (val === this.get('toggleOnValue')) {
100
101
 
101
- this.set('value', this.get('toggleOffValue'));
102
+ return YES;
103
+
104
+ },
105
+
106
+ /** @private */
107
+ keyDown: function(evt) {
108
+ // handle tab key
109
+ if(!this.get('isEnabled')) return YES;
110
+
111
+ if (evt.which === 9 || evt.keyCode === 9) {
112
+ var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
113
+ if(view) view.becomeFirstResponder();
114
+ else evt.allowDefault();
115
+ return YES ; // handled
102
116
  }
103
- else {
104
- this.set('value', this.get('toggleOnValue'));
117
+
118
+ if (evt.which === 13 || evt.which === 32) {
119
+ this._toggleValue();
120
+
121
+ // fire action
122
+ if (this.get('buttonBehavior') !== SC.HOLD_BEHAVIOR) {
123
+ if (this.$().within(evt.target)) { this._action(evt); }
124
+ }
125
+
126
+ return YES ; // handled
105
127
  }
106
- return YES;
128
+
129
+ // let other keys through to browser
130
+ evt.allowDefault();
131
+
132
+ return NO;
107
133
  },
108
134
 
109
135
 
136
+
110
137
  /** @private */
111
138
  touchStart: function(evt) {
112
139
  return this.mouseDown(evt);
@@ -117,4 +144,4 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
117
144
  return this.mouseUp(evt);
118
145
  }
119
146
 
120
- }) ;
147
+ });
@@ -11,7 +11,7 @@ sc_require('views/list_item');
11
11
  /**
12
12
  Special drag operation passed to delegate if the collection view proposes
13
13
  to perform a reorder event.
14
-
14
+
15
15
  @static
16
16
  @constant
17
17
  */
@@ -29,22 +29,22 @@ SC.BENCHMARK_RELOAD = NO;
29
29
  */
30
30
 
31
31
  /**
32
- @class
32
+ @class
33
33
 
34
34
  Renders a collection of views from a source array of model objects.
35
-
35
+
36
36
  The `CollectionView` is the root view class for rendering collections of
37
37
  views based on a source array of objects. It can automatically create the
38
- and layout the views, including displaying them in groups. It also
38
+ and layout the views, including displaying them in groups. It also
39
39
  handles event input for the entire collection.
40
-
40
+
41
41
  To use `CollectionView`, just create the view and set the 'content' property
42
- to an array of objects. (Note that if you setup a binding, it will
42
+ to an array of objects. (Note that if you setup a binding, it will
43
43
  always transform content to an array.) The view will create instances of
44
- exampleView to render the array. You can also bind to the selection
44
+ exampleView to render the array. You can also bind to the selection
45
45
  property if you want to monitor selection. (be sure to set the isEnabled
46
46
  property to allow selection.)
47
-
47
+
48
48
  @extends SC.View
49
49
  @extends SC.CollectionViewDelegate
50
50
  @extends SC.CollectionContent
@@ -52,14 +52,14 @@ SC.BENCHMARK_RELOAD = NO;
52
52
  */
53
53
  SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionContent,
54
54
  /** @scope SC.CollectionView.prototype */ {
55
-
55
+
56
56
  /**
57
57
  @type Array
58
58
  @default ['sc-collection-view']
59
59
  @see SC.View#classNames
60
60
  */
61
61
  classNames: ['sc-collection-view'],
62
-
62
+
63
63
  /**
64
64
  @type Array
65
65
  @default ['isFirstResponder', 'isEnabled', 'isActive']
@@ -71,68 +71,68 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
71
71
  @default 'collectionRenderDelegate'
72
72
  */
73
73
  renderDelegateName: 'collectionRenderDelegate',
74
-
74
+
75
75
  /**
76
76
  @type Number
77
77
  @default 200
78
78
  */
79
79
  ACTION_DELAY: 200,
80
-
80
+
81
81
  // ......................................
82
82
  // PROPERTIES
83
83
  //
84
-
84
+
85
85
  /**
86
86
  If `YES`, uses the experimental fast `CollectionView` path.
87
-
87
+
88
88
  @type Boolean
89
89
  @default NO
90
90
  */
91
91
  useFastPath: NO,
92
-
92
+
93
93
  /**
94
94
  An array of content objects
95
-
96
- This array should contain the content objects you want the collection view
95
+
96
+ This array should contain the content objects you want the collection view
97
97
  to display. An item view (based on the `exampleView` view class) will be
98
- created for each content object, in the order the content objects appear
98
+ created for each content object, in the order the content objects appear
99
99
  in this array.
100
-
101
- If you make the collection editable, the collection view will also modify
100
+
101
+ If you make the collection editable, the collection view will also modify
102
102
  this array using the observable array methods of `SC.Array`.
103
-
104
- Usually you will want to bind this property to a controller property
103
+
104
+ Usually you will want to bind this property to a controller property
105
105
  that actually contains the array of objects you to display.
106
-
106
+
107
107
  @type SC.Array
108
108
  @default null
109
109
  */
110
110
  content: null,
111
-
111
+
112
112
  /** @private */
113
113
  contentBindingDefault: SC.Binding.multiple(),
114
-
114
+
115
115
  /**
116
116
  The current length of the content.
117
-
117
+
118
118
  @type Number
119
119
  @default 0
120
120
  */
121
121
  length: 0,
122
-
122
+
123
123
  /**
124
124
  The set of indexes that are currently tracked by the collection view.
125
125
  This property is used to determine the range of items the collection view
126
126
  should monitor for changes.
127
-
127
+
128
128
  The default implementation of this property returns an index set covering
129
129
  the entire range of the content. It changes automatically whenever the
130
130
  length changes.
131
-
131
+
132
132
  Note that the returned index set for this property will always be frozen.
133
- To change the nowShowing index set, you must create a new index set and
133
+ To change the nowShowing index set, you must create a new index set and
134
134
  apply it.
135
-
135
+
136
136
  @field
137
137
  @type SC.IndexSet
138
138
  @observes length
@@ -141,197 +141,197 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
141
141
  nowShowing: function() {
142
142
  return this.computeNowShowing();
143
143
  }.property('length', 'clippingFrame').cacheable(),
144
-
144
+
145
145
  /**
146
146
  Indexes of selected content objects. This `SC.SelectionSet` is modified
147
- automatically by the collection view when the user changes the selection
147
+ automatically by the collection view when the user changes the selection
148
148
  on the collection.
149
-
150
- Any item views representing content objects in this set will have their
149
+
150
+ Any item views representing content objects in this set will have their
151
151
  isSelected property set to `YES` automatically.
152
-
152
+
153
153
  @type SC.SelectionSet
154
154
  @default null
155
155
  */
156
156
  selection: null,
157
-
158
- /**
157
+
158
+ /**
159
159
  Allow user to select content using the mouse and keyboard.
160
-
160
+
161
161
  Set this property to `NO` to disallow the user from selecting items. If you
162
162
  have items in your `selectedIndexes property, they will still be reflected
163
163
  visually.
164
-
164
+
165
165
  @type Boolean
166
166
  @default YES
167
167
  */
168
168
  isSelectable: YES,
169
-
169
+
170
170
  /** @private */
171
171
  isSelectableBindingDefault: SC.Binding.bool(),
172
-
172
+
173
173
  /**
174
174
  Enable or disable the view.
175
-
175
+
176
176
  The collection view will set the `isEnabled` property of its item views to
177
177
  reflect the same view of this property. Whenever ``isEnabled` is false,
178
- the collection view will also be not selectable or editable, regardless of
178
+ the collection view will also be not selectable or editable, regardless of
179
179
  the settings for isEditable` & `isSelectable`.
180
-
180
+
181
181
  @type Boolean
182
182
  @default YES
183
183
  */
184
184
  isEnabled: YES,
185
-
185
+
186
186
  /** @private */
187
187
  isEnabledBindingDefault: SC.Binding.bool(),
188
-
188
+
189
189
  /**
190
190
  Allow user to edit content views.
191
-
191
+
192
192
  The collection view will set the `isEditable` property on its item views to
193
193
  reflect the same value of this property. Whenever `isEditable` is false,
194
- the user will not be able to reorder, add, or delete items regardless of
194
+ the user will not be able to reorder, add, or delete items regardless of
195
195
  the `canReorderContent` and `canDeleteContent` and `isDropTarget`
196
196
  properties.
197
-
197
+
198
198
  @type Boolean
199
199
  @default YES
200
200
  */
201
201
  isEditable: YES,
202
-
202
+
203
203
  /** @private */
204
204
  isEditableBindingDefault: SC.Binding.bool(),
205
-
205
+
206
206
  /**
207
207
  Allow user to reorder items using drag and drop.
208
-
208
+
209
209
  If true, the user will can use drag and drop to reorder items in the list.
210
- If you also accept drops, this will allow the user to drop items into
210
+ If you also accept drops, this will allow the user to drop items into
211
211
  specific points in the list. Otherwise items will be added to the end.
212
-
212
+
213
213
  @type Boolean
214
214
  @default NO
215
215
  */
216
216
  canReorderContent: NO,
217
-
217
+
218
218
  /** @private */
219
219
  canReorderContentBindingDefault: SC.Binding.bool(),
220
-
220
+
221
221
  /**
222
222
  Allow the user to delete items using the delete key
223
-
223
+
224
224
  If true the user will be allowed to delete selected items using the delete
225
225
  key. Otherwise deletes will not be permitted.
226
-
226
+
227
227
  @type Boolean
228
228
  @default NO
229
229
  */
230
230
  canDeleteContent: NO,
231
-
231
+
232
232
  /** @private */
233
233
  canDeleteContentBindingDefault: SC.Binding.bool(),
234
-
234
+
235
235
  /**
236
236
  Allow user to edit the content by double clicking on it or hitting return.
237
237
  This will only work if isEditable is `YES` and the item view implements
238
238
  the `beginEditing()` method.
239
-
239
+
240
240
  @type Boolean
241
241
  */
242
242
  canEditContent: NO,
243
-
243
+
244
244
  /** @private */
245
245
  canEditContentBindingDefault: SC.Binding.bool(),
246
-
246
+
247
247
  /**
248
248
  Accept drops for data other than reordering.
249
-
250
- Setting this property to return true when the view is instantiated will
251
- cause it to be registered as a drop target, activating the other drop
249
+
250
+ Setting this property to return true when the view is instantiated will
251
+ cause it to be registered as a drop target, activating the other drop
252
252
  machinery.
253
-
253
+
254
254
  @type Boolean
255
255
  @default NO
256
256
  */
257
257
  isDropTarget: NO,
258
-
258
+
259
259
  /**
260
260
  Use toggle selection instead of normal click behavior.
261
-
261
+
262
262
  If set to true, then selection will use a toggle instead of the normal
263
263
  click behavior. Command modifiers will be ignored and instead clicking
264
264
  once will select an item and clicking on it again will deselect it.
265
-
265
+
266
266
  @type Boolean
267
267
  @default NO
268
268
  */
269
269
  useToggleSelection: NO,
270
-
270
+
271
271
  /**
272
272
  Trigger the action method on a single click.
273
-
274
- Normally, clicking on an item view in a collection will select the content
275
- object and double clicking will trigger the action method on the
273
+
274
+ Normally, clicking on an item view in a collection will select the content
275
+ object and double clicking will trigger the action method on the
276
276
  collection view.
277
-
277
+
278
278
  If you set this property to `YES`, then clicking on a view will both select
279
279
  it (if `isSelected` is true) and trigger the action method.
280
-
280
+
281
281
  Use this if you are using the collection view as a menu of items.
282
-
282
+
283
283
  @type Boolean
284
284
  @default NO
285
285
  */
286
286
  actOnSelect: NO,
287
-
288
-
287
+
288
+
289
289
  /**
290
290
  Select an item immediately on mouse down
291
-
291
+
292
292
  Normally as soon as you begin a click the item will be selected.
293
-
293
+
294
294
  In some UI scenarios, you might want to prevent selection until
295
295
  the mouse is released, so you can perform, for instance, a drag operation
296
296
  without actually selecting the target item.
297
-
297
+
298
298
  @type Boolean
299
299
  @default YES
300
300
  */
301
301
  selectOnMouseDown: YES,
302
-
302
+
303
303
  /**
304
304
  The view class to use when creating new item views.
305
-
306
- The collection view will automatically create an instance of the view
307
- class you set here for each item in its content array. You should provide
308
- your own subclass for this property to display the type of content you
305
+
306
+ The collection view will automatically create an instance of the view
307
+ class you set here for each item in its content array. You should provide
308
+ your own subclass for this property to display the type of content you
309
309
  want.
310
-
311
- For best results, the view you set here should understand the following
310
+
311
+ For best results, the view you set here should understand the following
312
312
  properties:
313
-
313
+
314
314
  - `content` -- The content object from the content array your view should display
315
315
  - `isEnabled` -- True if the view should appear enabled
316
316
  - `isSelected` -- True if the view should appear selected
317
-
318
- In general you do not want your child views to actually respond to mouse
319
- and keyboard events themselves. It is better to let the collection view
317
+
318
+ In general you do not want your child views to actually respond to mouse
319
+ and keyboard events themselves. It is better to let the collection view
320
320
  do that.
321
-
322
- If you do implement your own event handlers such as mouseDown or mouseUp,
323
- you should be sure to actually call the same method on the collection view
321
+
322
+ If you do implement your own event handlers such as mouseDown or mouseUp,
323
+ you should be sure to actually call the same method on the collection view
324
324
  to give it the chance to perform its own selection housekeeping.
325
-
325
+
326
326
  @type SC.View
327
327
  @default SC.ListItemView
328
328
  */
329
329
  exampleView: SC.ListItemView,
330
-
330
+
331
331
  /**
332
332
  If set, this key will be used to get the example view for a given
333
333
  content object. The exampleView property will be ignored.
334
-
334
+
335
335
  @type String
336
336
  @default null
337
337
  */
@@ -339,155 +339,155 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
339
339
 
340
340
  /**
341
341
  The view class to use when creating new group item views.
342
-
343
- The collection view will automatically create an instance of the view
344
- class you set here for each item in its content array. You should provide
345
- your own subclass for this property to display the type of content you
342
+
343
+ The collection view will automatically create an instance of the view
344
+ class you set here for each item in its content array. You should provide
345
+ your own subclass for this property to display the type of content you
346
346
  want.
347
-
347
+
348
348
  If you leave this set to null then the regular example view will be used
349
349
  with the isGroupView property set to YES on the item view.
350
-
350
+
351
351
  @type SC.View
352
352
  @default null
353
353
  */
354
354
  groupExampleView: null,
355
-
355
+
356
356
  /**
357
357
  If set, this key will be used to get the example view for a given
358
358
  content object. The `groupExampleView` property will be ignored.
359
-
359
+
360
360
  @type String
361
361
  @default null
362
362
  */
363
363
  contentGroupExampleViewKey: null,
364
-
364
+
365
365
  /**
366
- Invoked when the user double clicks on an item (or single clicks of
366
+ Invoked when the user double clicks on an item (or single clicks of
367
367
  actOnSelect is true)
368
-
368
+
369
369
  Set this to the name of the action you want to send down the
370
- responder chain when the user double clicks on an item (or single clicks
370
+ responder chain when the user double clicks on an item (or single clicks
371
371
  if `actOnSelect` is true). You can optionally specify a specific target as
372
372
  well using the target property.
373
-
374
- If you do not specify an action, then the collection view will also try to
373
+
374
+ If you do not specify an action, then the collection view will also try to
375
375
  invoke the action named on the target item view.
376
-
377
- Older versions of SproutCore expected the action property to contain an
378
- actual function that would be run. This format is still supported but is
379
- deprecated for future use. You should generally use the responder chain
376
+
377
+ Older versions of SproutCore expected the action property to contain an
378
+ actual function that would be run. This format is still supported but is
379
+ deprecated for future use. You should generally use the responder chain
380
380
  to handle your action for you.
381
-
381
+
382
382
  @type String
383
383
  @default null
384
- */
384
+ */
385
385
  action: null,
386
-
386
+
387
387
  /**
388
388
  Optional target to send the action to when the user double clicks.
389
-
390
- If you set the action property to the name of an action, you can
391
- optionally specify the target object you want the action to be sent to.
392
- This can be either an actual object or a property path that will resolve
393
- to an object at the time that the action is invoked.
394
-
389
+
390
+ If you set the action property to the name of an action, you can
391
+ optionally specify the target object you want the action to be sent to.
392
+ This can be either an actual object or a property path that will resolve
393
+ to an object at the time that the action is invoked.
394
+
395
395
  This property is ignored if you use the deprecated approach of making the
396
396
  action property a function.
397
-
397
+
398
398
  @type String|Object
399
399
  @default null
400
400
  */
401
401
  target: null,
402
-
403
- /**
402
+
403
+ /**
404
404
  Property on content items to use for display.
405
-
405
+
406
406
  Built-in item views such as the `LabelView`s and `ImageView`s will use the
407
407
  value of this property as a key on the content object to determine the
408
408
  value they should display.
409
-
410
- For example, if you set `contentValueKey` to 'name' and set the
409
+
410
+ For example, if you set `contentValueKey` to 'name' and set the
411
411
  exampleView to an `SC.LabelView`, then the label views created by the
412
412
  colleciton view will display the value of the content.name.
413
-
413
+
414
414
  If you are writing your own custom item view for a collection, you can
415
415
  get this behavior automatically by including the SC.Control mixin on your
416
416
  view. You can also ignore this property if you like. The collection view
417
417
  itself does not use this property to impact rendering.
418
-
418
+
419
419
  @type String
420
420
  @default null
421
421
  */
422
422
  contentValueKey: null,
423
-
423
+
424
424
  /**
425
425
  Enables keyboard-based navigate, deletion, etc. if set to true.
426
-
426
+
427
427
  @type Boolean
428
428
  @default NO
429
429
  */
430
430
  acceptsFirstResponder: NO,
431
-
431
+
432
432
  /**
433
433
  Changing this property value by default will cause the `CollectionView` to
434
434
  add/remove an 'active' class name to the root element.
435
-
435
+
436
436
  @type Boolean
437
437
  @default NO
438
438
  */
439
439
  isActive: NO,
440
-
441
-
442
- /**
443
- This property is used to store the calculated height to have
440
+
441
+
442
+ /**
443
+ This property is used to store the calculated height to have
444
444
  a consistent scrolling behavior due to the issues generated by using top
445
445
  instead of `scrollTop`. We could look at the min-height set in the view, but
446
- to avoid perf hits we simply store it and the scrollView will use it if
446
+ to avoid perf hits we simply store it and the scrollView will use it if
447
447
  different than 0.
448
-
448
+
449
449
  @type Number
450
450
  @default 0
451
- */
451
+ */
452
452
  calculatedHeight: 0,
453
-
454
- /**
455
- This property is used to store the calculated width to have
453
+
454
+ /**
455
+ This property is used to store the calculated width to have
456
456
  a consistent scrolling behavior due to the issues generated by using left
457
457
  instead of `scrollLeft`. We could look at the min-width set in the view, but
458
- to avoid perf hits we simply store it and the scrollView will use it if
458
+ to avoid perf hits we simply store it and the scrollView will use it if
459
459
  different than 0.
460
-
460
+
461
461
  @type Number
462
462
  @default 0
463
463
  */
464
464
  calculatedWidth: 0,
465
-
466
-
465
+
466
+
467
467
  // ..........................................................
468
468
  // SUBCLASS METHODS
469
- //
470
-
469
+ //
470
+
471
471
  /**
472
472
  Override to return the computed layout dimensions of the collection view.
473
- You can omit any dimensions you don't care about setting in your
473
+ You can omit any dimensions you don't care about setting in your
474
474
  computed value.
475
-
475
+
476
476
  This layout is automatically applied whenever the content changes.
477
-
477
+
478
478
  If you don't care about computing the layout at all, you can return null.
479
-
479
+
480
480
  @returns {Hash} layout properties
481
481
  */
482
482
  computeLayout: function() {
483
483
  return null;
484
484
  },
485
-
485
+
486
486
  /**
487
- Override to compute the layout of the itemView for the content at the
487
+ Override to compute the layout of the itemView for the content at the
488
488
  specified index. This layout will be applied to the view just before it
489
489
  is rendered.
490
-
490
+
491
491
  @param {Number} contentIndex the index of content being rendered by
492
492
  itemView
493
493
  @returns {Hash} a view layout
@@ -495,13 +495,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
495
495
  layoutForContentIndex: function(contentIndex) {
496
496
  return null;
497
497
  },
498
-
498
+
499
499
  /**
500
500
  This computed property returns an index set selecting all content indexes.
501
501
  It will recompute anytime the length of the collection view changes.
502
-
502
+
503
503
  This is used by the default `contentIndexesInRect()` implementation.
504
-
504
+
505
505
  @field
506
506
  @type SC.IndexSet
507
507
  @observes length
@@ -509,29 +509,29 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
509
509
  allContentIndexes: function() {
510
510
  return SC.IndexSet.create(0, this.get('length')).freeze();
511
511
  }.property('length').cacheable(),
512
-
512
+
513
513
  /**
514
- Override to return an IndexSet with the indexes that are at least
515
- partially visible in the passed rectangle. This method is used by the
514
+ Override to return an IndexSet with the indexes that are at least
515
+ partially visible in the passed rectangle. This method is used by the
516
516
  default implementation of `computeNowShowing()` to determine the new
517
517
  `nowShowing` range after a scroll.
518
-
518
+
519
519
  Override this method to implement incremental rendering.
520
-
520
+
521
521
  @param {Rect} rect the visible rect
522
522
  @returns {SC.IndexSet} now showing indexes
523
523
  */
524
524
  contentIndexesInRect: function(rect) {
525
525
  return null; // select all
526
526
  },
527
-
527
+
528
528
  /**
529
- Compute the nowShowing index set. The default implementation simply
529
+ Compute the nowShowing index set. The default implementation simply
530
530
  returns the full range. Override to implement incremental rendering.
531
-
532
- You should not normally call this method yourself. Instead get the
531
+
532
+ You should not normally call this method yourself. Instead get the
533
533
  nowShowing property.
534
-
534
+
535
535
  @returns {SC.IndexSet} new now showing range
536
536
  */
537
537
  computeNowShowing: function() {
@@ -541,94 +541,94 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
541
541
  // make sure the index set doesn't contain any indexes greater than the
542
542
  // actual content.
543
543
  else {
544
- var len = this.get('length'),
544
+ var len = this.get('length'),
545
545
  max = r.get('max');
546
546
  if (max > len) r = r.copy().remove(len, max-len).freeze();
547
547
  }
548
-
548
+
549
549
  return r;
550
550
  },
551
-
552
- /**
551
+
552
+ /**
553
553
  Override to show the insertion point during a drag.
554
-
554
+
555
555
  Called during a drag to show the insertion point. Passed value is the
556
556
  item view that you should display the insertion point before. If the
557
557
  passed value is `null`, then you should show the insertion point *AFTER* that
558
558
  last item view returned by the itemViews property.
559
-
559
+
560
560
  Once this method is called, you are guaranteed to also recieve a call to
561
561
  `hideInsertionPoint()` at some point in the future.
562
-
562
+
563
563
  The default implementation of this method does nothing.
564
-
564
+
565
565
  @param itemView {SC.ClassicView} view the insertion point should appear directly before. If null, show insertion point at end.
566
566
  @param dropOperation {Number} the drop operation. will be SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON
567
-
567
+
568
568
  @returns {void}
569
569
  */
570
570
  showInsertionPoint: function(itemView, dropOperation) {},
571
-
571
+
572
572
  /**
573
573
  Override to hide the insertion point when a drag ends.
574
-
575
- Called during a drag to hide the insertion point. This will be called
576
- when the user exits the view, cancels the drag or completes the drag. It
574
+
575
+ Called during a drag to hide the insertion point. This will be called
576
+ when the user exits the view, cancels the drag or completes the drag. It
577
577
  will not be called when the insertion point changes during a drag.
578
-
579
- You should expect to receive one or more calls to
578
+
579
+ You should expect to receive one or more calls to
580
580
  `showInsertionPointBefore()` during a drag followed by at least one call to
581
- this method at the end. Your method should not raise an error if it is
581
+ this method at the end. Your method should not raise an error if it is
582
582
  called more than once.
583
-
583
+
584
584
  @returns {void}
585
585
  */
586
586
  hideInsertionPoint: function() {},
587
-
588
-
587
+
588
+
589
589
  // ..........................................................
590
590
  // DELEGATE SUPPORT
591
- //
592
-
593
-
591
+ //
592
+
593
+
594
594
  /**
595
- Delegate used to implement fine-grained control over collection view
595
+ Delegate used to implement fine-grained control over collection view
596
596
  behaviors.
597
-
597
+
598
598
  You can assign a delegate object to this property that will be consulted
599
599
  for various decisions regarding drag and drop, selection behavior, and
600
600
  even rendering. The object you place here must implement some or all of
601
601
  the `SC.CollectionViewDelegate` mixin.
602
-
603
- If you do not supply a delegate but the content object you set implements
602
+
603
+ If you do not supply a delegate but the content object you set implements
604
604
  the `SC.CollectionViewDelegate` mixin, then the content will be
605
- automatically set as the delegate. Usually you will work with a
605
+ automatically set as the delegate. Usually you will work with a
606
606
  `CollectionView` in this way rather than setting a delegate explicitly.
607
-
607
+
608
608
  @type SC.CollectionViewDelegate
609
609
  @default null
610
610
  */
611
611
  delegate: null,
612
-
612
+
613
613
  /**
614
614
  The delegate responsible for handling selection changes. This property
615
- will be either the delegate, content, or the collection view itself,
615
+ will be either the delegate, content, or the collection view itself,
616
616
  whichever implements the `SC.CollectionViewDelegate` mixin.
617
-
617
+
618
618
  @field
619
619
  @type Object
620
620
  */
621
621
  selectionDelegate: function() {
622
622
  var del = this.get('delegate'), content = this.get('content');
623
- return this.delegateFor('isCollectionViewDelegate', del, content);
623
+ return this.delegateFor('isCollectionViewDelegate', del, content);
624
624
  }.property('delegate', 'content').cacheable(),
625
-
625
+
626
626
  /**
627
- The delegate responsible for providing additional display information
627
+ The delegate responsible for providing additional display information
628
628
  about the content. If you bind a collection view to a controller, this
629
- the content will usually also be the content delegate, though you
629
+ the content will usually also be the content delegate, though you
630
630
  could implement your own delegate if you prefer.
631
-
631
+
632
632
  @field
633
633
  @type Object
634
634
  */
@@ -636,8 +636,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
636
636
  var del = this.get('delegate'), content = this.get('content');
637
637
  return this.delegateFor('isCollectionContent', del, content);
638
638
  }.property('delegate', 'content').cacheable(),
639
-
640
-
639
+
640
+
641
641
  /** @private
642
642
  A cache of the `contentGroupIndexes` value returned by the delegate. This
643
643
  is frequently accessed and usually involves creating an `SC.IndexSet`
@@ -646,21 +646,21 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
646
646
  _contentGroupIndexes: function() {
647
647
  return this.get('contentDelegate').contentGroupIndexes(this, this.get('content'));
648
648
  }.property('contentDelegate', 'content').cacheable(),
649
-
650
-
649
+
650
+
651
651
  // ..........................................................
652
652
  // CONTENT CHANGES
653
- //
654
-
653
+ //
654
+
655
655
  /**
656
656
  Called whenever the content array or an item in the content array or a
657
657
  property on an item in the content array changes. Reloads the appropriate
658
- item view when the content array itself changes or calls
658
+ item view when the content array itself changes or calls
659
659
  `contentPropertyDidChange()` if a property changes.
660
-
660
+
661
661
  Normally you will not call this method directly though you may override
662
662
  it if you need to change the way changes to observed ranges are handled.
663
-
663
+
664
664
  @param {SC.Array} content the content array generating the change
665
665
  @param {Object} object the changed object
666
666
  @param {String} key the changed property or '[]' or an array change
@@ -679,45 +679,45 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
679
679
  /**
680
680
  Called whenever a property on an item in the content array changes. This
681
681
  is only called if you have set `observesContentProperties` to `YES`.
682
-
683
- Override this property if you want to do some custom work whenever a
682
+
683
+ Override this property if you want to do some custom work whenever a
684
684
  property on a content object changes.
685
685
 
686
686
  The default implementation does nothing.
687
-
687
+
688
688
  @param {Object} target the object that changed
689
689
  @param {String} key the property that changed value
690
690
  @param {SC.IndexSet} indexes the indexes in the content array affected
691
691
  @returns {void}
692
692
  */
693
693
  contentPropertyDidChange: function(target, key, indexes) {},
694
-
694
+
695
695
  /**
696
696
  Called whenever the view needs to updates its `contentRangeObserver` to
697
697
  reflect the current nowShowing index set. You will not usually call this
698
- method yourself but you may override it if you need to provide some
698
+ method yourself but you may override it if you need to provide some
699
699
  custom range observer behavior.
700
700
 
701
701
  Note that if you do implement this method, you are expected to maintain
702
702
  the range observer object yourself. If a range observer has not been
703
703
  created yet, this method should create it. If an observer already exists
704
704
  this method should udpate it.
705
-
705
+
706
706
  When you create a new range observer, the oberver must eventually call
707
707
  `contentRangeDidChange()` for the collection view to function properly.
708
-
709
- If you override this method you probably also need to override
708
+
709
+ If you override this method you probably also need to override
710
710
  `destroyRangeObserver()` to cleanup any existing range observer.
711
-
711
+
712
712
  @returns {void}
713
713
  */
714
714
  updateContentRangeObserver: function() {
715
715
  var nowShowing = this.get('nowShowing'),
716
716
  observer = this._cv_contentRangeObserver,
717
717
  content = this.get('content');
718
-
718
+
719
719
  if (!content) return ; // nothing to do
720
-
720
+
721
721
  if (observer) {
722
722
  content.updateRangeObserver(observer, nowShowing);
723
723
  } else {
@@ -725,53 +725,53 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
725
725
  observer = content.addRangeObserver(nowShowing, this, func, null);
726
726
  this._cv_contentRangeObserver = observer ;
727
727
  }
728
-
728
+
729
729
  },
730
-
730
+
731
731
  /**
732
- Called whever the view needs to invalidate the current content range
733
- observer. This is called whenever the content array changes. You will
734
- not usually call this method yourself but you may override it if you
732
+ Called whever the view needs to invalidate the current content range
733
+ observer. This is called whenever the content array changes. You will
734
+ not usually call this method yourself but you may override it if you
735
735
  provide your own range observer behavior.
736
-
736
+
737
737
  Note that if you override this method you should probably also override
738
738
  `updateRangeObserver()` to create or update a range oberver as needed.
739
-
739
+
740
740
  @returns {void}
741
741
  */
742
742
  removeContentRangeObserver: function() {
743
743
  var content = this.get('content'),
744
744
  observer = this._cv_contentRangeObserver ;
745
-
745
+
746
746
  if (observer) {
747
747
  if (content) content.removeRangeObserver(observer);
748
748
  this._cv_contentRangeObserver = null ;
749
749
  }
750
750
  },
751
-
751
+
752
752
  /**
753
- Called whenever the content length changes. This will invalidate the
753
+ Called whenever the content length changes. This will invalidate the
754
754
  length property of the view itself causing the nowShowing to recompute
755
755
  which will in turn update the UI accordingly.
756
-
756
+
757
757
  @returns {void}
758
758
  */
759
759
  contentLengthDidChange: function() {
760
760
  var content = this.get('content');
761
761
  this.set('length', content ? content.get('length') : 0);
762
762
  },
763
-
763
+
764
764
  /** @private
765
765
  Whenever content property changes to a new value:
766
-
767
- - remove any old observers
766
+
767
+ - remove any old observers
768
768
  - setup new observers (maybe wait until end of runloop to do this?)
769
769
  - recalc height/reload content
770
770
  - set content as delegate if delegate was old content
771
771
  - reset selection
772
-
772
+
773
773
  Whenever content array mutates:
774
-
774
+
775
775
  - possibly stop observing property changes on objects, observe new objs
776
776
  - reload effected item views
777
777
  - update layout for receiver
@@ -787,43 +787,43 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
787
787
  if (this._content) {
788
788
  this._content.removeObserver('length', this, lfunc);
789
789
  }
790
-
790
+
791
791
  // cache
792
792
  this._content = content;
793
-
793
+
794
794
  // add new observers - range observer will be added lazily
795
795
  if (content) {
796
796
  content.addObserver('length', this, lfunc);
797
797
  }
798
-
798
+
799
799
  // notify all items changed
800
800
  this.contentLengthDidChange();
801
801
  this.contentRangeDidChange(content, null, '[]', null);
802
-
802
+
803
803
  }.observes('content'),
804
-
804
+
805
805
  // ..........................................................
806
806
  // ITEM VIEWS
807
- //
808
-
807
+ //
808
+
809
809
  /** @private
810
810
  The indexes that need to be reloaded. Must be one of YES, NO, or an
811
811
  SC.IndexSet.
812
812
  */
813
813
  _invalidIndexes: NO,
814
-
815
- /**
814
+
815
+ /**
816
816
  Regenerates the item views for the content items at the specified indexes.
817
817
  If you pass null instead of an index set, regenerates all item views.
818
-
818
+
819
819
  This method is called automatically whenever the content array changes in
820
- an observable way, but you can call its yourself also if you need to
820
+ an observable way, but you can call its yourself also if you need to
821
821
  refresh the collection view for some reason.
822
-
822
+
823
823
  Note that if the length of the content is shorter than the child views
824
824
  and you call this method, then the child views will be removed no matter
825
825
  what the index.
826
-
826
+
827
827
  @param {SC.IndexSet} indexes
828
828
  @returns {SC.CollectionView} receiver
829
829
  */
@@ -837,34 +837,34 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
837
837
  else {
838
838
  this._invalidIndexes = YES ; // force a total reload
839
839
  }
840
-
840
+
841
841
  if (this.get('isVisibleInWindow')) this.invokeOnce(this.reloadIfNeeded);
842
-
842
+
843
843
  return this ;
844
844
  },
845
845
 
846
- /**
846
+ /**
847
847
  Invoked once per runloop to actually reload any needed item views.
848
848
  You can call this method at any time to actually force the reload to
849
849
  happen immediately if any item views need to be reloaded.
850
-
850
+
851
851
  Note that this method will also invoke two other callback methods if you
852
852
  define them on your subclass:
853
-
853
+
854
854
  - *willReload()* is called just before the items are reloaded
855
855
  - *didReload()* is called jsut after items are reloaded
856
-
856
+
857
857
  You can use these two methods to setup and teardown caching, which may
858
858
  reduce overall cost of a reload. Each method will be passed an index set
859
859
  of items that are reloaded or null if all items are reloaded.
860
-
860
+
861
861
  @returns {SC.CollectionView} receiver
862
862
  */
863
863
  reloadIfNeeded: function() {
864
864
  var invalid = this._invalidIndexes;
865
865
  if (!invalid || !this.get('isVisibleInWindow')) return this ; // delay
866
866
  this._invalidIndexes = NO ;
867
-
867
+
868
868
  var content = this.get('content'),
869
869
  i, len, existing,
870
870
  layout = this.computeLayout(),
@@ -883,7 +883,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
883
883
  if (invalid.isIndexSet && invalid.contains(nowShowing)) invalid = YES ;
884
884
  if (this.willReload) this.willReload(invalid === YES ? null : invalid);
885
885
 
886
-
886
+
887
887
  // Up-front, figure out whether the view class (and, if applicable,
888
888
  // group view class) is re-usable. If so, it's beneficial for us to
889
889
  // first return all no-longer-needed views to the pool before allocating
@@ -898,16 +898,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
898
898
  if (bench) {
899
899
  SC.Benchmark.start(bench="%@#reloadIfNeeded (Partial)".fmt(this),YES);
900
900
  }
901
-
901
+
902
902
  // Each of these arrays holds indexes.
903
903
  viewsToRemove = [];
904
904
  viewsToRedraw = [];
905
905
  viewsToCreate = [];
906
-
906
+
907
907
  invalid.forEach(function(idx) {
908
908
  // get the existing item view, if there is one
909
909
  existing = itemViews ? itemViews[idx] : null;
910
-
910
+
911
911
  // if nowShowing, then reload the item view.
912
912
  if (nowShowing.contains(idx)) {
913
913
  if (existing && existing.parentView === containerView) {
@@ -916,21 +916,21 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
916
916
  } else {
917
917
  viewsToCreate.push(idx);
918
918
  }
919
-
919
+
920
920
  // if not nowShowing, then remove the item view if needed
921
921
  } else if (existing && existing.parentView === containerView) {
922
922
  viewsToRemove.push(idx);
923
923
  }
924
924
  },this);
925
-
926
-
925
+
926
+
927
927
  // Now that we know what operations we need to perform, let's perform
928
928
  // all the removals first…
929
929
  for (i = 0, len = viewsToRemove.length; i < len; ++i) {
930
930
  idx = viewsToRemove[i];
931
- existing = itemViews ? itemViews[idx] : null;
931
+ existing = itemViews ? itemViews[idx] : null;
932
932
  delete itemViews[idx];
933
-
933
+
934
934
  // If this view class is reusable, then add it back to the pool.
935
935
  del = this.get('contentDelegate');
936
936
  groupIndexes = this.get('_contentGroupIndexes');
@@ -939,9 +939,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
939
939
  shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
940
940
  if (shouldReuse) {
941
941
  viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
942
-
942
+
943
943
  viewPool.push(existing);
944
-
944
+
945
945
  // Because it's possible that we'll return this view to the pool
946
946
  // and then immediately re-use it, there's the potential that the
947
947
  // layer will not be correctly destroyed, because that support
@@ -956,11 +956,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
956
956
  // (Charles Jolley personally guarantees this code)
957
957
  layer = existing.get('layer');
958
958
  if (layer && layer.parentNode) layer.parentNode.removeChild(layer);
959
-
959
+
960
960
  containerView.removeChild(existing);
961
961
  if (!shouldReuse) existing.destroy();
962
962
  }
963
-
963
+
964
964
  // …then the redraws…
965
965
  for (i = 0, len = viewsToRedraw.length; i < len; ++i) {
966
966
  idx = viewsToRedraw[i];
@@ -968,22 +968,22 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
968
968
  view = this.itemViewForContentIndex(idx, YES);
969
969
 
970
970
  // if the existing view has a layer, remove it immediately from
971
- // the parent. This is necessary because the old and new views
971
+ // the parent. This is necessary because the old and new views
972
972
  // will use the same layerId
973
- existing.destroyLayer();
973
+ existing.destroyLayer();
974
974
  containerView.replaceChild(view, existing);
975
975
  }
976
-
976
+
977
977
  // …and finally the creations.
978
978
  for (i = 0, len = viewsToCreate.length; i < len; ++i) {
979
979
  idx = viewsToCreate[i];
980
980
  view = this.itemViewForContentIndex(idx, YES);
981
981
  containerView.insertBefore(view, null); // Equivalent to 'append()', but avoids one more function call
982
982
  }
983
-
983
+
984
984
 
985
985
  if (bench) SC.Benchmark.end(bench);
986
-
986
+
987
987
  // if set is NOT defined, replace entire content with nowShowing
988
988
  } else {
989
989
  if (bench) {
@@ -992,7 +992,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
992
992
 
993
993
  // truncate cached item views since they will all be removed from the
994
994
  // container anyway.
995
- if (itemViews) itemViews.length = 0 ;
995
+ if (itemViews) itemViews.length = 0 ;
996
996
 
997
997
  views = containerView.get('childViews');
998
998
  if (views) views = views.copy();
@@ -1003,7 +1003,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1003
1003
  // views = containerView.get('views');
1004
1004
  if (this.willRemoveAllChildren) this.willRemoveAllChildren() ;
1005
1005
  containerView.destroyLayer().removeAllChildren();
1006
-
1006
+
1007
1007
  // For all previous views that can be re-used, return them to the pool.
1008
1008
  if (views) {
1009
1009
  for (i = 0, len = views.length; i < len; ++i) {
@@ -1012,9 +1012,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1012
1012
  shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
1013
1013
  if (shouldReuse) {
1014
1014
  viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
1015
-
1015
+
1016
1016
  viewPool.push(view);
1017
-
1017
+
1018
1018
  // Because it's possible that we'll return this view to the pool
1019
1019
  // and then immediately re-use it, there's the potential that the
1020
1020
  // layer will not be correctly destroyed, because that support
@@ -1027,7 +1027,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1027
1027
  }
1028
1028
  }
1029
1029
  }
1030
-
1030
+
1031
1031
 
1032
1032
  // Only after the children are removed should we create the new views.
1033
1033
  // We do this in order to maximize the change of re-use should the view
@@ -1037,19 +1037,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1037
1037
  views.push(this.itemViewForContentIndex(idx, YES));
1038
1038
  }, this);
1039
1039
 
1040
-
1040
+
1041
1041
  containerView.set('childViews', views); // quick swap
1042
1042
  containerView.replaceLayer();
1043
1043
  containerView.endPropertyChanges();
1044
-
1044
+
1045
1045
  if (bench) SC.Benchmark.end(bench);
1046
-
1046
+
1047
1047
  }
1048
-
1048
+
1049
1049
  // adjust my own layout if computed
1050
1050
  if (layout) this.adjust(layout);
1051
1051
  if (this.didReload) this.didReload(invalid === YES ? null : invalid);
1052
-
1052
+
1053
1053
  return this ;
1054
1054
  },
1055
1055
 
@@ -1067,22 +1067,22 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1067
1067
 
1068
1068
  /** @private */
1069
1069
  _GROUP_VIEW_POOL: null,
1070
-
1070
+
1071
1071
  /**
1072
1072
  Returns the item view for the content object at the specified index. Call
1073
- this method instead of accessing child views directly whenever you need
1073
+ this method instead of accessing child views directly whenever you need
1074
1074
  to get the view associated with a content index.
1075
1075
 
1076
1076
  Although this method take two parameters, you should almost always call
1077
- it with just the content index. The other two parameters are used
1077
+ it with just the content index. The other two parameters are used
1078
1078
  internally by the CollectionView.
1079
-
1079
+
1080
1080
  If you need to change the way the collection view manages item views
1081
1081
  you can override this method as well. If you just want to change the
1082
1082
  default options used when creating item views, override createItemView()
1083
1083
  instead.
1084
-
1085
- Note that if you override this method, then be sure to implement this
1084
+
1085
+ Note that if you override this method, then be sure to implement this
1086
1086
  method so that it uses a cache to return the same item view for a given
1087
1087
  index unless "force" is YES. In that case, generate a new item view and
1088
1088
  replace the old item view in your cache with the new item view.
@@ -1095,13 +1095,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1095
1095
  var ret;
1096
1096
 
1097
1097
  // Use the cached view for this index, if we have it. We'll do this up-
1098
- // front to avoid
1098
+ // front to avoid
1099
1099
  var itemViews = this._sc_itemViews;
1100
1100
  if (!itemViews) {
1101
1101
  itemViews = this._sc_itemViews = [] ;
1102
1102
  }
1103
1103
  else if (!rebuild && (ret = itemViews[idx])) {
1104
- return ret ;
1104
+ return ret ;
1105
1105
  }
1106
1106
 
1107
1107
  // return from cache if possible
@@ -1115,7 +1115,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1115
1115
  outlineLevel, disclosureState, isVisibleInWindow;
1116
1116
 
1117
1117
  // otherwise generate...
1118
-
1118
+
1119
1119
  // first, determine the class to use
1120
1120
  isGroupView = groupIndexes && groupIndexes.contains(idx);
1121
1121
  if (isGroupView) isGroupView = del.contentIndexIsGroup(this, content,idx);
@@ -1130,8 +1130,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1130
1130
  if (!E) E = this.get('exampleView');
1131
1131
  viewPoolKey = '_VIEW_POOL';
1132
1132
  }
1133
-
1134
-
1133
+
1134
+
1135
1135
  // Collect other state that we'll need whether we're re-using a previous
1136
1136
  // view or creating a new view.
1137
1137
  parentView = this.get('containerView') || this;
@@ -1141,16 +1141,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1141
1141
  outlineLevel = del.contentIndexOutlineLevel(this, content, idx);
1142
1142
  disclosureState = del.contentIndexDisclosureState(this, content, idx);
1143
1143
  isVisibleInWindow = this.isVisibleInWindow;
1144
- layout = this.layoutForContentIndex(idx);
1145
-
1146
-
1144
+ layout = this.layoutForContentIndex(idx);
1145
+
1146
+
1147
1147
  // If the view is reusable and there is an appropriate view inside the
1148
1148
  // pool, simply reuse it to avoid having to create a new view.
1149
1149
  if (E && E.isReusableInCollections) {
1150
1150
  // Lazily create the view pool.
1151
1151
  viewPool = this[viewPoolKey];
1152
1152
  if (!viewPool) viewPool = this[viewPoolKey] = [];
1153
-
1153
+
1154
1154
  // Is there a view we can re-use?
1155
1155
  if (viewPool.length > 0) {
1156
1156
  ret = viewPool.pop();
@@ -1158,7 +1158,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1158
1158
  // Tell the view it's about to be re-used.
1159
1159
  reuseFunc = ret.prepareForReuse;
1160
1160
  if (reuseFunc) reuseFunc.call(ret);
1161
-
1161
+
1162
1162
  // Set the new state. We'll set content last, because it's the most
1163
1163
  // likely to have observers.
1164
1164
  ret.beginPropertyChanges();
@@ -1169,18 +1169,18 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1169
1169
  ret.set('outlineLevel', outlineLevel);
1170
1170
  ret.set('disclosureState', disclosureState);
1171
1171
  ret.set('isVisibleInWindow', isVisibleInWindow);
1172
-
1172
+
1173
1173
  // TODO: In theory this shouldn't be needed, but without it, we
1174
1174
  // sometimes get errors when doing a full reload, because
1175
1175
  // 'childViews' contains the view but the parent is not set.
1176
1176
  // This implies a timing issue with the general flow of
1177
1177
  // collection view.
1178
1178
  ret.set('parentView', parentView);
1179
-
1179
+
1180
1180
  // Since we re-use layerIds, we need to reset SproutCore's internal
1181
1181
  // mapping table.
1182
1182
  SC.View.views[layerId] = ret;
1183
-
1183
+
1184
1184
  if (layout) {
1185
1185
  ret.set('layout', layout);
1186
1186
  }
@@ -1191,7 +1191,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1191
1191
  ret.endPropertyChanges();
1192
1192
  }
1193
1193
  }
1194
-
1194
+
1195
1195
  // If we weren't able to re-use a view, then create a new one.
1196
1196
  if (!ret) {
1197
1197
  // collect some other state
@@ -1210,48 +1210,48 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1210
1210
  attrs.isVisibleInWindow = isVisibleInWindow;
1211
1211
  if (isGroupView) attrs.classNames = this._GROUP_COLLECTION_CLASS_NAMES;
1212
1212
  else attrs.classNames = this._COLLECTION_CLASS_NAMES;
1213
-
1213
+
1214
1214
  if (layout) {
1215
1215
  attrs.layout = layout;
1216
1216
  } else {
1217
1217
  delete attrs.layout ;
1218
1218
  }
1219
-
1219
+
1220
1220
  ret = this.createItemView(E, idx, attrs);
1221
1221
  }
1222
-
1222
+
1223
1223
  itemViews[idx] = ret ;
1224
1224
  return ret ;
1225
1225
  },
1226
-
1226
+
1227
1227
  /**
1228
1228
  Helper method for getting the item view of a specific content object
1229
-
1229
+
1230
1230
  @param {Object} object
1231
1231
  */
1232
1232
  itemViewForContentObject: function(object) {
1233
1233
  return this.itemViewForContentIndex(this.get('content').indexOf(object));
1234
1234
  },
1235
-
1235
+
1236
1236
  /** @private */
1237
1237
  _TMP_LAYERID: [],
1238
-
1238
+
1239
1239
  /**
1240
- Primitive to instantiate an item view. You will be passed the class
1240
+ Primitive to instantiate an item view. You will be passed the class
1241
1241
  and a content index. You can override this method to perform any other
1242
1242
  one time setup.
1243
1243
 
1244
1244
  Note that item views may be created somewhat frequently so keep this fast.
1245
1245
 
1246
- *IMPORTANT:* The attrs hash passed is reused each time this method is
1246
+ *IMPORTANT:* The attrs hash passed is reused each time this method is
1247
1247
  called. If you add properties to this hash be sure to delete them before
1248
1248
  returning from this method.
1249
-
1249
+
1250
1250
  @param {Class} exampleClass example view class
1251
1251
  @param {Number} idx the content index
1252
1252
  @param {Hash} attrs expected attributes
1253
1253
  @returns {SC.View} item view instance
1254
- */
1254
+ */
1255
1255
  createItemView: function(exampleClass, idx, attrs) {
1256
1256
  return exampleClass.create(attrs);
1257
1257
  },
@@ -1259,60 +1259,60 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1259
1259
  /**
1260
1260
  Generates a layerId for the passed index and item. Usually the default
1261
1261
  implementation is suitable.
1262
-
1262
+
1263
1263
  @param {Number} idx the content index
1264
1264
  @returns {String} layer id, must be suitable for use in HTML id attribute
1265
1265
  */
1266
- layerIdFor: function(idx) {
1266
+ layerIdFor: function(idx) {
1267
1267
  var ret = this._TMP_LAYERID;
1268
1268
  ret[0] = SC.guidFor(this);
1269
1269
  ret[1] = idx;
1270
1270
  return ret.join('-');
1271
1271
  },
1272
-
1272
+
1273
1273
  /**
1274
1274
  Extracts the content index from the passed layerID. If the layer id does
1275
1275
  not belong to the receiver or if no value could be extracted, returns NO.
1276
-
1276
+
1277
1277
  @param {String} id the layer id
1278
1278
  */
1279
1279
  contentIndexForLayerId: function(id) {
1280
1280
  if (!id || !(id = id.toString())) return null ; // nothing to do
1281
-
1281
+
1282
1282
  var base = this._baseLayerId;
1283
1283
  if (!base) base = this._baseLayerId = SC.guidFor(this)+"-";
1284
-
1284
+
1285
1285
  // no match
1286
- if ((id.length <= base.length) || (id.indexOf(base) !== 0)) return null ;
1286
+ if ((id.length <= base.length) || (id.indexOf(base) !== 0)) return null ;
1287
1287
  var ret = Number(id.slice(id.lastIndexOf('-')+1));
1288
1288
  return isNaN(ret) ? null : ret ;
1289
1289
  },
1290
-
1291
1290
 
1292
- /**
1291
+
1292
+ /**
1293
1293
  Find the first content item view for the passed event.
1294
-
1295
- This method will go up the view chain, starting with the view that was the
1296
- target of the passed event, looking for a child item. This will become
1294
+
1295
+ This method will go up the view chain, starting with the view that was the
1296
+ target of the passed event, looking for a child item. This will become
1297
1297
  the view that is selected by the mouse event.
1298
-
1299
- This method only works for mouseDown & mouseUp events. mouseMoved events
1298
+
1299
+ This method only works for mouseDown & mouseUp events. mouseMoved events
1300
1300
  do not have a target.
1301
-
1301
+
1302
1302
  @param {SC.Event} evt An event
1303
1303
  @returns {SC.View} the item view or null
1304
1304
  */
1305
1305
  itemViewForEvent: function(evt) {
1306
1306
  var responder = this.getPath('pane.rootResponder') ;
1307
1307
  if (!responder) return null ; // fast path
1308
-
1308
+
1309
1309
  var base = SC.guidFor(this) + '-',
1310
1310
  baseLen = base.length,
1311
1311
  element = evt.target,
1312
1312
  layer = this.get('layer'),
1313
1313
  contentIndex = null,
1314
1314
  id, itemView, ret ;
1315
-
1315
+
1316
1316
  // walk up the element hierarchy until we find this or an element with an
1317
1317
  // id matching the base guid (i.e. a collection item)
1318
1318
  while (element && element !== document && element !== layer) {
@@ -1320,32 +1320,32 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1320
1320
  if (id && (contentIndex = this.contentIndexForLayerId(id)) !== null) {
1321
1321
  break;
1322
1322
  }
1323
- element = element.parentNode ;
1323
+ element = element.parentNode ;
1324
1324
  }
1325
-
1326
- // no matching element found?
1325
+
1326
+ // no matching element found?
1327
1327
  if (contentIndex===null || (element === layer)) {
1328
- element = layer = null; // avoid memory leaks
1329
- return null;
1328
+ element = layer = null; // avoid memory leaks
1329
+ return null;
1330
1330
  }
1331
-
1331
+
1332
1332
  // okay, found the DOM node for the view, go ahead and create it
1333
1333
  // first, find the contentIndex
1334
1334
  if (contentIndex >= this.get('length')) {
1335
1335
  throw "layout for item view %@ was found when item view does not exist (%@)".fmt(id, this);
1336
1336
  }
1337
-
1337
+
1338
1338
  return this.itemViewForContentIndex(contentIndex);
1339
1339
  },
1340
-
1340
+
1341
1341
  // ..........................................................
1342
1342
  // DISCLOSURE SUPPORT
1343
- //
1344
-
1343
+ //
1344
+
1345
1345
  /**
1346
1346
  Expands any items in the passed selection array that have a disclosure
1347
1347
  state.
1348
-
1348
+
1349
1349
  @param {SC.IndexSet} indexes the indexes to expand
1350
1350
  @returns {SC.CollectionView} receiver
1351
1351
  */
@@ -1353,8 +1353,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1353
1353
  if (!indexes) return this; // nothing to do
1354
1354
  var del = this.get('contentDelegate'),
1355
1355
  content = this.get('content');
1356
-
1357
- indexes.forEach(function(i) {
1356
+
1357
+ indexes.forEach(function(i) {
1358
1358
  var state = del.contentIndexDisclosureState(this, content, i);
1359
1359
  if (state === SC.BRANCH_CLOSED) del.contentIndexExpand(this,content,i);
1360
1360
  }, this);
@@ -1364,7 +1364,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1364
1364
  /**
1365
1365
  Collapses any items in the passed selection array that have a disclosure
1366
1366
  state.
1367
-
1367
+
1368
1368
  @param {SC.IndexSet} indexes the indexes to expand
1369
1369
  @returns {SC.CollectionView} receiver
1370
1370
  */
@@ -1372,19 +1372,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1372
1372
  if (!indexes) return this; // nothing to do
1373
1373
  var del = this.get('contentDelegate'),
1374
1374
  content = this.get('content');
1375
-
1376
- indexes.forEach(function(i) {
1375
+
1376
+ indexes.forEach(function(i) {
1377
1377
  var state = del.contentIndexDisclosureState(this, content, i);
1378
1378
  if (state === SC.BRANCH_OPEN) del.contentIndexCollapse(this,content,i);
1379
1379
  }, this);
1380
1380
  return this;
1381
1381
  },
1382
-
1382
+
1383
1383
  // ..........................................................
1384
1384
  // SELECTION SUPPORT
1385
- //
1386
-
1387
- /** @private
1385
+ //
1386
+
1387
+ /** @private
1388
1388
  Called whenever the selection object is changed to a new value. Begins
1389
1389
  observing the selection for changes.
1390
1390
  */
@@ -1392,11 +1392,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1392
1392
  var sel = this.get('selection'),
1393
1393
  last = this._cv_selection,
1394
1394
  func = this._cv_selectionContentDidChange;
1395
-
1395
+
1396
1396
  if (sel === last) return; // nothing to do
1397
1397
  if (last) last.removeObserver('[]', this, func);
1398
1398
  if (sel) sel.addObserver('[]', this, func);
1399
-
1399
+
1400
1400
  this._cv_selection = sel ;
1401
1401
  this._cv_selectionContentDidChange();
1402
1402
  }.observes('selection'),
@@ -1417,28 +1417,28 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1417
1417
  // determine which indexes are now invalid
1418
1418
  if (last) last = last.indexSetForSource(content);
1419
1419
  if (sel) sel = sel.indexSetForSource(content);
1420
-
1420
+
1421
1421
  if (sel && last) diff = sel.without(last).add(last.without(sel));
1422
1422
  else diff = sel || last;
1423
1423
 
1424
1424
  if (diff && diff.get('length')>0) this.reloadSelectionIndexes(diff);
1425
1425
  },
1426
-
1426
+
1427
1427
  /** @private
1428
1428
  Contains the current item views that need their selection to be repainted.
1429
1429
  This may be either NO, YES, or an IndexSet.
1430
1430
  */
1431
1431
  _invalidSelection: NO,
1432
-
1432
+
1433
1433
  /**
1434
1434
  Called whenever the selection changes. The passed index set will contain
1435
- any affected indexes including those indexes that were previously
1435
+ any affected indexes including those indexes that were previously
1436
1436
  selected and now should be deselected.
1437
-
1437
+
1438
1438
  Pass null to reload the selection state for all items.
1439
-
1439
+
1440
1440
  @param {SC.IndexSet} indexes affected indexes
1441
- @returns {SC.CollectionView} reciever
1441
+ @returns {SC.CollectionView} receiver
1442
1442
  */
1443
1443
  reloadSelectionIndexes: function(indexes) {
1444
1444
  var invalid = this._invalidSelection ;
@@ -1447,11 +1447,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1447
1447
  else { invalid = this._invalidSelection = indexes.copy(); }
1448
1448
 
1449
1449
  } else this._invalidSelection = YES ; // force a total reload
1450
-
1450
+
1451
1451
  if (this.get('isVisibleInWindow')) {
1452
1452
  this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
1453
- }
1454
-
1453
+ }
1454
+
1455
1455
  return this ;
1456
1456
  },
1457
1457
 
@@ -1459,30 +1459,30 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1459
1459
  Reloads the selection state if needed on any dirty indexes. Normally this
1460
1460
  will run once at the end of the runloop, but you can force the item views
1461
1461
  to reload their selection immediately by calling this method.
1462
-
1463
- You can also override this method if needed to change the way the
1462
+
1463
+ You can also override this method if needed to change the way the
1464
1464
  selection is reloaded on item views. The default behavior will simply
1465
- find any item views in the nowShowing range that are affected and
1465
+ find any item views in the nowShowing range that are affected and
1466
1466
  modify them.
1467
-
1467
+
1468
1468
  @returns {SC.CollectionView} receiver
1469
1469
  */
1470
1470
  reloadSelectionIndexesIfNeeded: function() {
1471
1471
  var invalid = this._invalidSelection;
1472
- if (!invalid || !this.get('isVisibleInWindow')) return this ;
1472
+ if (!invalid || !this.get('isVisibleInWindow')) return this ;
1473
1473
 
1474
1474
  var nowShowing = this.get('nowShowing'),
1475
1475
  reload = this._invalidIndexes,
1476
1476
  content = this.get('content'),
1477
1477
  sel = this.get('selection');
1478
-
1478
+
1479
1479
  this._invalidSelection = NO; // reset invalid
1480
-
1480
+
1481
1481
  // fast path. if we are going to reload everything anyway, just forget
1482
1482
  // about it. Also if we don't have a nowShowing, nothing to do.
1483
1483
  if (reload === YES || !nowShowing) return this ;
1484
-
1485
- // if invalid is YES instead of index set, just reload everything
1484
+
1485
+ // if invalid is YES instead of index set, just reload everything
1486
1486
  if (invalid === YES) invalid = nowShowing;
1487
1487
 
1488
1488
  // if we will reload some items anyway, don't bother
@@ -1494,16 +1494,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1494
1494
  var view = this.itemViewForContentIndex(idx, NO);
1495
1495
  if (view) view.set('isSelected', sel ? sel.contains(content, idx) : NO);
1496
1496
  },this);
1497
-
1497
+
1498
1498
  return this ;
1499
1499
  },
1500
-
1501
- /**
1502
- Selection primitive. Selects the passed IndexSet of items, optionally
1500
+
1501
+ /**
1502
+ Selection primitive. Selects the passed IndexSet of items, optionally
1503
1503
  extending the current selection. If extend is NO or not passed then this
1504
1504
  will replace the selection with the passed value. Otherwise the indexes
1505
1505
  will be added to the current selection.
1506
-
1506
+
1507
1507
  @param {Number|SC.IndexSet} indexes index or indexes to select
1508
1508
  @param extend {Boolean} optionally extend the selection
1509
1509
  @returns {SC.CollectionView} receiver
@@ -1513,7 +1513,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1513
1513
  del = this.get('selectionDelegate'),
1514
1514
  groupIndexes = this.get('_contentGroupIndexes'),
1515
1515
  sel;
1516
-
1516
+
1517
1517
  if(!this.get('isSelectable') || !this.get('isEnabled')) return this;
1518
1518
 
1519
1519
  // normalize
@@ -1528,41 +1528,41 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1528
1528
  if (groupIndexes && groupIndexes.get('length')>0) {
1529
1529
  indexes = indexes.copy().remove(groupIndexes);
1530
1530
  }
1531
-
1531
+
1532
1532
  // give the delegate a chance to alter the items
1533
1533
  indexes = del.collectionViewShouldSelectIndexes(this, indexes, extend);
1534
1534
  if (!indexes || indexes.get('length')===0) return this; // nothing to do
1535
-
1535
+
1536
1536
  } else indexes = null;
1537
1537
 
1538
1538
  // build the selection object, merging if needed
1539
1539
  if (extend && (sel = this.get('selection'))) sel = sel.copy();
1540
1540
  else sel = SC.SelectionSet.create();
1541
-
1541
+
1542
1542
  if (indexes && indexes.get('length')>0) {
1543
1543
 
1544
1544
  // when selecting only one item, always select by content
1545
1545
  if (indexes.get('length')===1) {
1546
1546
  sel.addObject(content.objectAt(indexes.get('firstObject')));
1547
-
1547
+
1548
1548
  // otherwise select an index range
1549
1549
  } else sel.add(content, indexes);
1550
-
1550
+
1551
1551
  }
1552
1552
 
1553
1553
  // give delegate one last chance
1554
1554
  sel = del.collectionViewSelectionForProposedSelection(this, sel);
1555
1555
  if (!sel) sel = SC.SelectionSet.create(); // empty
1556
-
1556
+
1557
1557
  // if we're not extending the selection, clear the selection anchor
1558
1558
  this._selectionAnchor = null ;
1559
- this.set('selection', sel.freeze()) ;
1559
+ this.set('selection', sel.freeze()) ;
1560
1560
  return this;
1561
1561
  },
1562
-
1562
+
1563
1563
  /**
1564
1564
  Primtive to remove the indexes from the selection.
1565
-
1565
+
1566
1566
  @param {Number|SC.IndexSet} indexes index or indexes to deselect
1567
1567
  @returns {SC.CollectionView} receiver
1568
1568
  */
@@ -1570,10 +1570,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1570
1570
  var sel = this.get('selection'),
1571
1571
  content = this.get('content'),
1572
1572
  del = this.get('selectionDelegate');
1573
-
1573
+
1574
1574
  if(!this.get('isSelectable') || !this.get('isEnabled')) return this;
1575
1575
  if (!sel || sel.get('length')===0) return this; // nothing to do
1576
-
1576
+
1577
1577
  // normalize
1578
1578
  if (SC.typeOf(indexes) === SC.T_NUMBER) {
1579
1579
  indexes = SC.IndexSet.create(indexes, 1);
@@ -1591,7 +1591,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1591
1591
  this.set('selection', sel.freeze()) ;
1592
1592
  return this ;
1593
1593
  },
1594
-
1594
+
1595
1595
  /** @private
1596
1596
  Finds the next selectable item, up to content length, by asking the
1597
1597
  delegate. If a non-selectable item is found, the index is skipped. If
@@ -1599,14 +1599,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1599
1599
 
1600
1600
  Return value will always be in the range of the bottom of the current
1601
1601
  selection index and the proposed index.
1602
-
1602
+
1603
1603
  @param {Number} proposedIndex the desired index to select
1604
1604
  @param {Number} bottom optional bottom of selection use as fallback
1605
- @returns {Number} next selectable index.
1605
+ @returns {Number} next selectable index.
1606
1606
  */
1607
1607
  _findNextSelectableItemFromIndex: function(proposedIndex, bottom) {
1608
1608
  var lim = this.get('length'),
1609
- range = SC.IndexSet.create(),
1609
+ range = SC.IndexSet.create(),
1610
1610
  content = this.get('content'),
1611
1611
  del = this.get('selectionDelegate'),
1612
1612
  groupIndexes = this.get('_contentGroupIndexes'),
@@ -1618,7 +1618,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1618
1618
  }
1619
1619
 
1620
1620
  // loop forwards looking for an index that is allowed by delegate
1621
- // we could alternatively just pass the whole range but this might be
1621
+ // we could alternatively just pass the whole range but this might be
1622
1622
  // slow for the delegate
1623
1623
  while (proposedIndex < lim) {
1624
1624
  if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
@@ -1627,7 +1627,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1627
1627
  if (ret && ret.get('length') >= 1) return proposedIndex ;
1628
1628
  range.remove(proposedIndex);
1629
1629
  }
1630
- proposedIndex++;
1630
+ proposedIndex++;
1631
1631
  }
1632
1632
 
1633
1633
  // if nothing was found, return top of selection
@@ -1637,31 +1637,31 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1637
1637
  }
1638
1638
  return bottom ;
1639
1639
  },
1640
-
1640
+
1641
1641
  /** @private
1642
1642
  Finds the previous selectable item, up to the first item, by asking the
1643
1643
  delegate. If a non-selectable item is found, the index is skipped. If
1644
1644
  no item is found, selection index is returned unmodified.
1645
-
1645
+
1646
1646
  @param {Integer} proposedIndex the desired index to select
1647
1647
  @returns {Integer} the previous selectable index. This will always be in the range of the top of the current selection index and the proposed index.
1648
1648
  */
1649
1649
  _findPreviousSelectableItemFromIndex: function(proposedIndex, top) {
1650
- var range = SC.IndexSet.create(),
1650
+ var range = SC.IndexSet.create(),
1651
1651
  content = this.get('content'),
1652
1652
  del = this.get('selectionDelegate'),
1653
1653
  groupIndexes = this.get('_contentGroupIndexes'),
1654
1654
  ret ;
1655
1655
 
1656
1656
  if (SC.none(proposedIndex)) proposedIndex = -1;
1657
-
1657
+
1658
1658
  // fast path
1659
1659
  if (!groupIndexes && (del.collectionViewShouldSelectIndexes === this.collectionViewShouldSelectIndexes)) {
1660
1660
  return proposedIndex;
1661
1661
  }
1662
1662
 
1663
1663
  // loop backwards looking for an index that is allowed by delegate
1664
- // we could alternatively just pass the whole range but this might be
1664
+ // we could alternatively just pass the whole range but this might be
1665
1665
  // slow for the delegate
1666
1666
  while (proposedIndex >= 0) {
1667
1667
  if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
@@ -1670,7 +1670,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1670
1670
  if (ret && ret.get('length') >= 1) return proposedIndex ;
1671
1671
  range.remove(proposedIndex);
1672
1672
  }
1673
- proposedIndex--;
1673
+ proposedIndex--;
1674
1674
  }
1675
1675
 
1676
1676
  // if nothing was found, return top of selection
@@ -1681,28 +1681,28 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1681
1681
  if (SC.none(top)) top = -1;
1682
1682
  return top ;
1683
1683
  },
1684
-
1684
+
1685
1685
  /**
1686
1686
  Select one or more items before the current selection, optionally
1687
- extending the current selection. Also scrolls the selected item into
1687
+ extending the current selection. Also scrolls the selected item into
1688
1688
  view.
1689
-
1689
+
1690
1690
  Selection does not wrap around.
1691
-
1692
- @param {Boolean} [extend] If true, the selection will be extended
1691
+
1692
+ @param {Boolean} [extend] If true, the selection will be extended
1693
1693
  instead of replaced. Defaults to false.
1694
- @param {Integer} [numberOfItems] The number of previous to be
1694
+ @param {Integer} [numberOfItems] The number of previous to be
1695
1695
  selected. Defaults to 1
1696
1696
  @returns {SC.CollectionView} receiver
1697
1697
  */
1698
1698
  selectPreviousItem: function(extend, numberOfItems) {
1699
1699
  if (SC.none(numberOfItems)) numberOfItems = 1;
1700
1700
  if (SC.none(extend)) extend = false;
1701
-
1701
+
1702
1702
  var sel = this.get('selection'),
1703
1703
  content = this.get('content');
1704
1704
  if (sel) sel = sel.indexSetForSource(content);
1705
-
1705
+
1706
1706
  var selTop = sel ? sel.get('min') : -1,
1707
1707
  selBottom = sel ? sel.get('max')-1 : -1,
1708
1708
  anchor = this._selectionAnchor;
@@ -1714,17 +1714,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1714
1714
  // If the selBottom is after the anchor, then reduce the selection
1715
1715
  if (selBottom > anchor) {
1716
1716
  selBottom = selBottom - numberOfItems ;
1717
-
1718
- // otherwise, select the previous item from the top
1717
+
1718
+ // otherwise, select the previous item from the top
1719
1719
  } else {
1720
1720
  selTop = this._findPreviousSelectableItemFromIndex(selTop - numberOfItems);
1721
1721
  }
1722
-
1722
+
1723
1723
  // Ensure we are not out of bounds
1724
1724
  if (SC.none(selTop) || (selTop < 0)) selTop = 0 ;
1725
1725
  if (!content.objectAt(selTop)) selTop = sel ? sel.get('min') : -1;
1726
1726
  if (selBottom < selTop) selBottom = selTop ;
1727
-
1727
+
1728
1728
  // if not extending, just select the item previous to the selTop
1729
1729
  } else {
1730
1730
  selTop = this._findPreviousSelectableItemFromIndex(selTop - numberOfItems);
@@ -1733,28 +1733,28 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1733
1733
  selBottom = selTop ;
1734
1734
  anchor = null ;
1735
1735
  }
1736
-
1736
+
1737
1737
  var scrollToIndex = selTop ;
1738
-
1738
+
1739
1739
  // now build new selection
1740
1740
  sel = SC.IndexSet.create(selTop, selBottom+1-selTop);
1741
-
1741
+
1742
1742
  // ensure that the item is visible and set the selection
1743
1743
  this.scrollToContentIndex(scrollToIndex) ;
1744
1744
  this.select(sel) ;
1745
1745
  this._selectionAnchor = anchor ;
1746
1746
  return this ;
1747
1747
  },
1748
-
1748
+
1749
1749
  /**
1750
1750
  Select one or more items following the current selection, optionally
1751
1751
  extending the current selection. Also scrolls to selected item.
1752
-
1752
+
1753
1753
  Selection does not wrap around.
1754
-
1755
- @param {Boolean} [extend] If true, the selection will be extended
1754
+
1755
+ @param {Boolean} [extend] If true, the selection will be extended
1756
1756
  instead of replaced. Defaults to false.
1757
- @param {Integer} [numberOfItems] The number of items to be
1757
+ @param {Integer} [numberOfItems] The number of items to be
1758
1758
  selected. Defaults to 1.
1759
1759
  @returns {SC.CollectionView} receiver
1760
1760
  */
@@ -1765,104 +1765,104 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1765
1765
  var sel = this.get('selection'),
1766
1766
  content = this.get('content');
1767
1767
  if (sel) sel = sel.indexSetForSource(content);
1768
-
1768
+
1769
1769
  var selTop = sel ? sel.get('min') : -1,
1770
1770
  selBottom = sel ? sel.get('max')-1 : -1,
1771
1771
  anchor = this._selectionAnchor,
1772
1772
  lim = this.get('length');
1773
-
1773
+
1774
1774
  if (SC.none(anchor)) anchor = selTop;
1775
1775
 
1776
1776
  // if extending, then we need to do some fun stuff to build the array
1777
1777
  if (extend) {
1778
-
1778
+
1779
1779
  // If the selTop is before the anchor, then reduce the selection
1780
1780
  if (selTop < anchor) {
1781
1781
  selTop = selTop + numberOfItems ;
1782
-
1783
- // otherwise, select the next item after the bottom
1782
+
1783
+ // otherwise, select the next item after the bottom
1784
1784
  } else {
1785
1785
  selBottom = this._findNextSelectableItemFromIndex(selBottom + numberOfItems, selBottom);
1786
1786
  }
1787
-
1787
+
1788
1788
  // Ensure we are not out of bounds
1789
1789
  if (selBottom >= lim) selBottom = lim-1;
1790
-
1790
+
1791
1791
  // we also need to check that the item exists
1792
1792
  if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
1793
-
1793
+
1794
1794
  // and if top has eclipsed bottom, handle that too.
1795
1795
  if (selTop > selBottom) selTop = selBottom ;
1796
-
1796
+
1797
1797
  // if not extending, just select the item next to the selBottom
1798
1798
  } else {
1799
1799
  selBottom = this._findNextSelectableItemFromIndex(selBottom + numberOfItems, selBottom);
1800
-
1800
+
1801
1801
  if (selBottom >= lim) selBottom = lim-1;
1802
1802
  if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
1803
1803
  selTop = selBottom ;
1804
1804
  anchor = null ;
1805
1805
  }
1806
-
1806
+
1807
1807
  var scrollToIndex = selBottom ;
1808
-
1808
+
1809
1809
  // now build new selection
1810
1810
  sel = SC.IndexSet.create(selTop, selBottom-selTop+1);
1811
-
1811
+
1812
1812
  // ensure that the item is visible and set the selection
1813
1813
  this.scrollToContentIndex(scrollToIndex) ;
1814
1814
  this.select(sel) ;
1815
1815
  this._selectionAnchor = anchor ;
1816
1816
  return this ;
1817
1817
  },
1818
-
1818
+
1819
1819
  /**
1820
- Deletes the selected content if canDeleteContent is YES. This will invoke
1821
- delegate methods to provide fine-grained control. Returns YES if the
1820
+ Deletes the selected content if canDeleteContent is YES. This will invoke
1821
+ delegate methods to provide fine-grained control. Returns YES if the
1822
1822
  deletion was possible, even if none actually occurred.
1823
-
1823
+
1824
1824
  @returns {Boolean} YES if deletion is possible.
1825
1825
  */
1826
1826
  deleteSelection: function() {
1827
1827
  // perform some basic checks...
1828
- if (!this.get('canDeleteContent')) return NO;
1828
+ if (!this.get('canDeleteContent')) return NO;
1829
1829
 
1830
1830
  var sel = this.get('selection'),
1831
1831
  content = this.get('content'),
1832
1832
  del = this.get('selectionDelegate'),
1833
1833
  indexes = sel&&content ? sel.indexSetForSource(content) : null;
1834
-
1834
+
1835
1835
  if (!content || !indexes || indexes.get('length') === 0) return NO ;
1836
-
1836
+
1837
1837
  // let the delegate decide what to actually delete. If this returns an
1838
1838
  // empty index set or null, just do nothing.
1839
1839
  indexes = del.collectionViewShouldDeleteIndexes(this, indexes);
1840
1840
  if (!indexes || indexes.get('length') === 0) return NO ;
1841
-
1842
- // now have the delegate (or us) perform the deletion. The default
1841
+
1842
+ // now have the delegate (or us) perform the deletion. The default
1843
1843
  // delegate implementation just uses standard SC.Array methods to do the
1844
1844
  // right thing.
1845
1845
  del.collectionViewDeleteContent(this, this.get('content'), indexes);
1846
1846
 
1847
1847
  return YES ;
1848
1848
  },
1849
-
1849
+
1850
1850
  // ..........................................................
1851
1851
  // SCROLLING
1852
- //
1853
-
1852
+ //
1853
+
1854
1854
  /**
1855
1855
  Scroll the rootElement (if needed) to ensure that the item is visible.
1856
-
1856
+
1857
1857
  @param {Number} contentIndex The index of the item to scroll to
1858
1858
  @returns {SC.CollectionView} receiver
1859
1859
  */
1860
1860
  scrollToContentIndex: function(contentIndex) {
1861
1861
  var itemView = this.itemViewForContentIndex(contentIndex) ;
1862
1862
  if (itemView) this.scrollToItemView(itemView) ;
1863
- return this;
1863
+ return this;
1864
1864
  },
1865
-
1865
+
1866
1866
  /**
1867
1867
  Scroll to the passed item view. If the item view is not visible on screen
1868
1868
  this method will not work.
@@ -1877,17 +1877,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1877
1877
 
1878
1878
  // ..........................................................
1879
1879
  // KEYBOARD EVENTS
1880
- //
1881
-
1880
+ //
1881
+
1882
1882
  /** @private */
1883
1883
  keyDown: function(evt) {
1884
1884
  var ret = this.interpretKeyEvents(evt) ;
1885
1885
  return !ret ? NO : ret ;
1886
1886
  },
1887
-
1887
+
1888
1888
  /** @private */
1889
1889
  keyUp: function() { return true; },
1890
-
1890
+
1891
1891
  /** @private
1892
1892
  Handle space key event. Do action
1893
1893
  */
@@ -1896,11 +1896,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1896
1896
  var sel = this.get('selection');
1897
1897
  if (sel && sel.get('length')>0) {
1898
1898
  this.invokeLater(this._cv_action, 0, null, evt);
1899
- }
1899
+ }
1900
1900
  return YES ;
1901
1901
  } else return NO ;
1902
1902
  },
1903
-
1903
+
1904
1904
  /** @private
1905
1905
  Handle select all keyboard event.
1906
1906
  */
@@ -1927,14 +1927,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1927
1927
  deleteBackward: function(evt) {
1928
1928
  return this.deleteSelection() ;
1929
1929
  },
1930
-
1930
+
1931
1931
  /** @private
1932
1932
  Handle delete keyboard event.
1933
1933
  */
1934
1934
  deleteForward: function(evt) {
1935
1935
  return this.deleteSelection() ;
1936
1936
  },
1937
-
1937
+
1938
1938
  /** @private
1939
1939
  Selects the same item on the next row or moves down one if itemsPerRow = 1
1940
1940
  */
@@ -1943,7 +1943,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1943
1943
  this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1944
1944
  return true ;
1945
1945
  },
1946
-
1946
+
1947
1947
  /** @private
1948
1948
  Selects the same item on the next row or moves up one if itemsPerRow = 1
1949
1949
  */
@@ -1965,12 +1965,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1965
1965
  if ((this.get('itemsPerRow') || 1) > 1) {
1966
1966
  this.selectPreviousItem(false, 1);
1967
1967
  this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
1968
-
1968
+
1969
1969
  } else {
1970
1970
  var sel = this.get('selection'),
1971
1971
  content = this.get('content'),
1972
1972
  indexes = sel ? sel.indexSetForSource(content) : null;
1973
-
1973
+
1974
1974
  // Collapse the element if it is expanded. However, if there is exactly
1975
1975
  // one item selected and the item is already collapsed or is a leaf
1976
1976
  // node, then select the (expanded) parent element instead as a
@@ -1986,7 +1986,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
1986
1986
  var state = del.contentIndexDisclosureState(this, content, index);
1987
1987
  if (state !== SC.BRANCH_OPEN) selectParent = true;
1988
1988
  }
1989
-
1989
+
1990
1990
  if ( selectParent ) {
1991
1991
  // TODO: PERFORMANCE: It would be great to have a function like
1992
1992
  // SC.CollectionView.selectParentItem() or something similar
@@ -2006,7 +2006,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2006
2006
  parentIndex = previousItemIndex;
2007
2007
  }
2008
2008
  }
2009
-
2009
+
2010
2010
  // If we found the parent, select it now.
2011
2011
  if ( parentIndex !== -1 ) {
2012
2012
  this.select(index);
@@ -2018,10 +2018,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2018
2018
  }
2019
2019
  }
2020
2020
  }
2021
-
2021
+
2022
2022
  return true ;
2023
2023
  },
2024
-
2024
+
2025
2025
  /** @private
2026
2026
  Selects the next item if itemsPerRow > 1. Otherwise does nothing.
2027
2027
  */
@@ -2039,24 +2039,24 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2039
2039
  indexes = sel ? sel.indexSetForSource(content) : null;
2040
2040
  if (indexes) this.expand(indexes);
2041
2041
  }
2042
-
2042
+
2043
2043
  return true ;
2044
2044
  },
2045
-
2045
+
2046
2046
  /** @private */
2047
2047
  moveDownAndModifySelection: function(sender, evt) {
2048
2048
  this.selectNextItem(true, this.get('itemsPerRow') || 1) ;
2049
2049
  this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
2050
2050
  return true ;
2051
2051
  },
2052
-
2052
+
2053
2053
  /** @private */
2054
2054
  moveUpAndModifySelection: function(sender, evt) {
2055
2055
  this.selectPreviousItem(true, this.get('itemsPerRow') || 1) ;
2056
2056
  this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
2057
2057
  return true ;
2058
2058
  },
2059
-
2059
+
2060
2060
  /** @private
2061
2061
  Selects the previous item if itemsPerRow > 1. Otherwise does nothing.
2062
2062
  */
@@ -2086,8 +2086,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2086
2086
  insertNewline: function(sender, evt) {
2087
2087
  var canEdit = this.get('isEditable') && this.get('canEditContent'),
2088
2088
  sel, content, set, idx, itemView;
2089
-
2090
- // first make sure we have a single item selected; get idx
2089
+
2090
+ // first make sure we have a single item selected; get idx
2091
2091
  if (canEdit) {
2092
2092
  sel = this.get('selection') ;
2093
2093
  content = this.get('content');
@@ -2097,61 +2097,77 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2097
2097
  canEdit = idx>=0;
2098
2098
  }
2099
2099
  }
2100
-
2100
+
2101
2101
  // next find itemView and ensure it supports editing
2102
2102
  if (canEdit) {
2103
2103
  itemView = this.itemViewForContentIndex(idx);
2104
2104
  canEdit = itemView && SC.typeOf(itemView.beginEditing)===SC.T_FUNCTION;
2105
2105
  }
2106
-
2106
+
2107
2107
  // ok, we can edit..
2108
2108
  if (canEdit) {
2109
2109
  this.scrollToContentIndex(idx);
2110
2110
  itemView = this.itemViewForContentIndex(idx); // just in case
2111
2111
  itemView.beginEditing();
2112
-
2113
- // invoke action
2112
+
2113
+ // invoke action
2114
2114
  } else {
2115
2115
  this.invokeLater(this._cv_action, 0, itemView, null) ;
2116
2116
  }
2117
-
2117
+
2118
2118
  return YES ; // always handle
2119
2119
  },
2120
2120
 
2121
+ insertTab: function(evt) {
2122
+ var view = this.get('nextValidKeyView');
2123
+ if (view) view.becomeFirstResponder();
2124
+ else evt.allowDefault();
2125
+ return YES ; // handled
2126
+ },
2127
+
2128
+ insertBacktab: function(evt) {
2129
+ var view = this.get('previousValidKeyView');
2130
+ if (view) view.becomeFirstResponder();
2131
+ else evt.allowDefault();
2132
+ return YES ; // handled
2133
+ },
2134
+
2121
2135
  // ..........................................................
2122
2136
  // MOUSE EVENTS
2123
- //
2124
-
2137
+ //
2138
+
2125
2139
  /** @private
2126
- Handles mouse down events on the collection view or on any of its
2140
+ Handles mouse down events on the collection view or on any of its
2127
2141
  children.
2128
-
2142
+
2129
2143
  The default implementation of this method can handle a wide variety
2130
2144
  of user behaviors depending on how you have configured the various
2131
2145
  options for the collection view.
2132
-
2146
+
2133
2147
  @param ev {Event} the mouse down event
2134
2148
  @returns {Boolean} Usually YES.
2135
2149
  */
2136
2150
  mouseDown: function(ev) {
2137
2151
  var itemView = this.itemViewForEvent(ev),
2138
2152
  content = this.get('content'),
2139
- contentIndex = itemView ? itemView.get('contentIndex') : -1,
2153
+ contentIndex = itemView ? itemView.get('contentIndex') : -1,
2140
2154
  info, anchor, sel, isSelected, modifierKeyPressed, didSelect = NO,
2141
2155
  allowsMultipleSel = content.get('allowsMultipleSelection');
2142
2156
 
2143
2157
  if (!this.get('isEnabled')) return contentIndex > -1;
2144
2158
 
2159
+ if(!this.get('isSelectable')) return NO;
2160
+
2145
2161
  info = this.mouseDownInfo = {
2146
- event: ev,
2162
+ event: ev,
2147
2163
  itemView: itemView,
2148
2164
  contentIndex: contentIndex,
2149
2165
  at: Date.now()
2150
2166
  };
2151
-
2167
+
2152
2168
  // become first responder if possible.
2153
2169
  this.becomeFirstResponder() ;
2154
-
2170
+
2155
2171
  // Toggle the selection if selectOnMouseDown is true
2156
2172
  if (this.get('useToggleSelection')) {
2157
2173
  if (this.get('selectOnMouseDown')) {
@@ -2170,32 +2186,32 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2170
2186
  this.select(contentIndex, YES);
2171
2187
  didSelect = YES;
2172
2188
  }
2173
-
2189
+
2174
2190
  if (didSelect && this.get('actOnSelect')) {
2175
2191
  // handle actions on editing
2176
2192
  this._cv_performSelectAction(itemView, ev);
2177
2193
  }
2178
2194
  }
2179
-
2195
+
2180
2196
  return YES;
2181
2197
  }
2182
-
2183
- // recieved a mouseDown on the collection element, but not on one of the
2198
+
2199
+ // recieved a mouseDown on the collection element, but not on one of the
2184
2200
  // childItems... unless we do not allow empty selections, set it to empty.
2185
2201
  if (!itemView) {
2186
2202
  if (this.get('allowDeselectAll')) this.select(null, false);
2187
2203
  return YES ;
2188
2204
  }
2189
-
2205
+
2190
2206
  // collection some basic setup info
2191
2207
  sel = this.get('selection');
2192
2208
  if (sel) sel = sel.indexSetForSource(content);
2193
-
2209
+
2194
2210
  isSelected = sel ? sel.contains(contentIndex) : NO;
2195
2211
  info.modifierKeyPressed = modifierKeyPressed = ev.ctrlKey || ev.metaKey ;
2196
-
2197
-
2198
- // holding down a modifier key while clicking a selected item should
2212
+
2213
+
2214
+ // holding down a modifier key while clicking a selected item should
2199
2215
  // deselect that item...deselect and bail.
2200
2216
  if (modifierKeyPressed && isSelected) {
2201
2217
  info.shouldDeselect = contentIndex >= 0;
@@ -2204,36 +2220,36 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2204
2220
  // from the last selected item
2205
2221
  } else if (ev.shiftKey && sel && sel.get('length') > 0 && allowsMultipleSel) {
2206
2222
  sel = this._findSelectionExtendedByShift(sel, contentIndex);
2207
- anchor = this._selectionAnchor ;
2223
+ anchor = this._selectionAnchor ;
2208
2224
  this.select(sel) ;
2209
2225
  this._selectionAnchor = anchor; //save the anchor
2210
-
2211
- // If no modifier key was pressed, then clicking on the selected item
2226
+
2227
+ // If no modifier key was pressed, then clicking on the selected item
2212
2228
  // should clear the selection and reselect only the clicked on item.
2213
2229
  } else if (!modifierKeyPressed && isSelected) {
2214
2230
  info.shouldReselect = contentIndex >= 0;
2215
-
2216
- // Otherwise, if selecting on mouse down, simply select the clicked on
2231
+
2232
+ // Otherwise, if selecting on mouse down, simply select the clicked on
2217
2233
  // item, adding it to the current selection if a modifier key was pressed.
2218
2234
  } else {
2219
-
2235
+
2220
2236
  if((ev.shiftKey || modifierKeyPressed) && !allowsMultipleSel){
2221
2237
  this.select(null, false);
2222
2238
  }
2223
-
2239
+
2224
2240
  if (this.get("selectOnMouseDown")) {
2225
2241
  this.select(contentIndex, modifierKeyPressed);
2226
2242
  } else {
2227
2243
  info.shouldSelect = contentIndex >= 0 ;
2228
2244
  }
2229
2245
  }
2230
-
2246
+
2231
2247
  // saved for extend by shift ops.
2232
2248
  info.previousContentIndex = contentIndex;
2233
-
2249
+
2234
2250
  return YES;
2235
2251
  },
2236
-
2252
+
2237
2253
  /** @private */
2238
2254
  mouseUp: function(ev) {
2239
2255
  var view = this.itemViewForEvent(ev),
@@ -2245,14 +2261,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2245
2261
 
2246
2262
  if (!this.get('isEnabled')) return contentIndex > -1;
2247
2263
 
2264
+ if(!this.get('isSelectable')) return NO;
2265
+
2248
2266
  if (this.get('useToggleSelection')) {
2249
2267
  // Return if clicked outside of elements or if toggle was handled by mouseDown
2250
2268
  if (!view || this.get('selectOnMouseDown')) return NO;
2251
-
2269
+
2252
2270
  // determine if item is selected. If so, then go on.
2253
2271
  sel = this.get('selection') ;
2254
2272
  isSelected = sel && sel.containsObject(view.get('content')) ;
2255
-
2273
+
2256
2274
  if (isSelected) {
2257
2275
  this.deselect(contentIndex) ;
2258
2276
  } else if (!allowsMultipleSel) {
@@ -2260,37 +2278,37 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2260
2278
  } else {
2261
2279
  this.select(contentIndex, YES) ;
2262
2280
  }
2263
-
2281
+
2264
2282
  } else if(info) {
2265
2283
  idx = info.contentIndex;
2266
2284
  contentIndex = (view) ? view.get('contentIndex') : -1 ;
2267
-
2268
- // this will be set if the user simply clicked on an unselected item and
2285
+
2286
+ // this will be set if the user simply clicked on an unselected item and
2269
2287
  // selectOnMouseDown was NO.
2270
2288
  if (info.shouldSelect) this.select(idx, info.modifierKeyPressed);
2271
-
2289
+
2272
2290
  // This is true if the user clicked on a selected item with a modifier
2273
2291
  // key pressed.
2274
2292
  if (info.shouldDeselect) this.deselect(idx);
2275
-
2276
- // This is true if the user clicked on a selected item without a
2277
- // modifier-key pressed. When this happens we try to begin editing
2278
- // on the content. If that is not allowed, then simply clear the
2293
+
2294
+ // This is true if the user clicked on a selected item without a
2295
+ // modifier-key pressed. When this happens we try to begin editing
2296
+ // on the content. If that is not allowed, then simply clear the
2279
2297
  // selection and reselect the clicked on item.
2280
2298
  if (info.shouldReselect) {
2281
-
2299
+
2282
2300
  // - contentValueIsEditable is true
2283
2301
  canEdit = this.get('isEditable') && this.get('canEditContent') ;
2284
-
2302
+
2285
2303
  // - the user clicked on an item that was already selected
2286
2304
  // ^ this is the only way shouldReset is set to YES
2287
-
2305
+
2288
2306
  // - is the only item selected
2289
2307
  if (canEdit) {
2290
2308
  sel = this.get('selection') ;
2291
2309
  canEdit = sel && (sel.get('length') === 1);
2292
2310
  }
2293
-
2311
+
2294
2312
  // - the item view responds to contentHitTest() and returns YES.
2295
2313
  // - the item view responds to beginEditing and returns YES.
2296
2314
  if (canEdit) {
@@ -2298,26 +2316,26 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2298
2316
  canEdit = itemView && (!itemView.contentHitTest || itemView.contentHitTest(ev)) ;
2299
2317
  canEdit = (canEdit && itemView.beginEditing) ? itemView.beginEditing() : NO ;
2300
2318
  }
2301
-
2319
+
2302
2320
  // if cannot edit, schedule a reselect (but give doubleClick a chance)
2303
2321
  if (!canEdit) {
2304
2322
  if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate() ;
2305
2323
  this._cv_reselectTimer = this.invokeLater(this.select, 300, idx, false) ;
2306
2324
  }
2307
2325
  }
2308
-
2326
+
2309
2327
  this._cleanupMouseDown() ;
2310
2328
  }
2311
2329
 
2312
2330
  // handle actions on editing
2313
2331
  this._cv_performSelectAction(view, ev, 0, ev.clickCount);
2314
-
2332
+
2315
2333
  return NO; // bubble event to allow didDoubleClick to be called...
2316
2334
  },
2317
-
2335
+
2318
2336
  /** @private */
2319
2337
  _cleanupMouseDown: function() {
2320
-
2338
+
2321
2339
  // delete items explicitly to avoid leaks on IE
2322
2340
  var info = this.mouseDownInfo, key;
2323
2341
  if (info) {
@@ -2328,10 +2346,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2328
2346
  }
2329
2347
  this.mouseDownInfo = null;
2330
2348
  },
2331
-
2349
+
2332
2350
  /** @private */
2333
2351
  mouseMoved: function(ev) {
2334
- var view = this.itemViewForEvent(ev),
2352
+ var view = this.itemViewForEvent(ev),
2335
2353
  last = this._lastHoveredItem ;
2336
2354
 
2337
2355
  // handle hover events.
@@ -2344,7 +2362,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2344
2362
  if (view && view.mouseMoved) view.mouseMoved(ev);
2345
2363
  return YES;
2346
2364
  },
2347
-
2365
+
2348
2366
  /** @private */
2349
2367
  mouseExited: function(ev) {
2350
2368
  var view = this._lastHoveredItem ;
@@ -2352,11 +2370,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2352
2370
  if (view && view.mouseExited) view.mouseExited(ev) ;
2353
2371
  return YES ;
2354
2372
  },
2355
-
2373
+
2356
2374
  // ..........................................................
2357
2375
  // TOUCH EVENTS
2358
2376
  //
2359
-
2377
+
2360
2378
  /** @private */
2361
2379
  touchStart: function(touch, evt) {
2362
2380
  var itemView = this.itemViewForEvent(touch),
@@ -2367,14 +2385,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2367
2385
  // become first responder if possible.
2368
2386
  this.becomeFirstResponder() ;
2369
2387
 
2388
+ this._touchSelectedView = itemView;
2389
+
2370
2390
  if (!this.get('useToggleSelection')) {
2371
2391
  // We're faking the selection visually here
2372
2392
  // Only track this if we added a selection so we can remove it later
2373
2393
  if (itemView && !itemView.get('isSelected')) {
2374
2394
  itemView.set('isSelected', YES);
2375
- this._touchSelectedView = itemView;
2376
- } else {
2377
- this._touchSelectedView = null;
2378
2395
  }
2379
2396
  }
2380
2397
 
@@ -2444,12 +2461,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2444
2461
 
2445
2462
  /** @private */
2446
2463
  _findSelectionExtendedByShift: function(sel, contentIndex) {
2447
-
2464
+
2448
2465
  // fast path. if we don't have a selection, just select index
2449
2466
  if (!sel || sel.get('length')===0) {
2450
2467
  return SC.IndexSet.create(contentIndex);
2451
2468
  }
2452
-
2469
+
2453
2470
  // if we do have a selection, then figure out how to extend it.
2454
2471
  var content = this.get('content'),
2455
2472
  lim = content.get('length')-1,
@@ -2463,17 +2480,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2463
2480
  if (contentIndex < min) {
2464
2481
  min = contentIndex;
2465
2482
  if (anchor<0) this._selectionAnchor = anchor = max; //anchor at end
2466
-
2483
+
2467
2484
  // clicked after the current selection set... extend it's ending...
2468
2485
  } else if (contentIndex > max) {
2469
2486
  max = contentIndex;
2470
2487
  if (anchor<0) this._selectionAnchor = anchor = min; // anchor at start
2471
-
2488
+
2472
2489
  // clicked inside the selection set... need to determine where the last
2473
2490
  // selection was and use that as an anchor.
2474
2491
  } else if (contentIndex >= min && contentIndex <= max) {
2475
2492
  if (anchor<0) this._selectionAnchor = anchor = min; //anchor at start
2476
-
2493
+
2477
2494
  if (contentIndex === anchor) min = max = contentIndex ;
2478
2495
  else if (contentIndex > anchor) {
2479
2496
  min = anchor;
@@ -2486,62 +2503,62 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2486
2503
 
2487
2504
  return SC.IndexSet.create(min, max - min + 1);
2488
2505
  },
2489
-
2506
+
2490
2507
  // ......................................
2491
2508
  // DRAG AND DROP SUPPORT
2492
2509
  //
2493
2510
 
2494
2511
  /**
2495
2512
  When reordering its content, the collection view will store its reorder
2496
- data using this special data type. The data type is unique to each
2513
+ data using this special data type. The data type is unique to each
2497
2514
  collection view instance. You can use this data type to detect reorders
2498
2515
  if necessary.
2499
-
2516
+
2500
2517
  @field
2501
2518
  @type String
2502
2519
  */
2503
2520
  reorderDataType: function() {
2504
2521
  return 'SC.CollectionView.Reorder.'+SC.guidFor(this) ;
2505
2522
  }.property().cacheable(),
2506
-
2523
+
2507
2524
  /**
2508
- This property is set to the IndexSet of content objects that are the
2509
- subject of a drag whenever a drag is initiated on the collection view.
2510
- You can consult this property when implementing your collection view
2511
- delegate methods, but otherwise you should not use this property in your
2525
+ This property is set to the IndexSet of content objects that are the
2526
+ subject of a drag whenever a drag is initiated on the collection view.
2527
+ You can consult this property when implementing your collection view
2528
+ delegate methods, but otherwise you should not use this property in your
2512
2529
  code.
2513
2530
 
2514
2531
  @type SC.IndexSet
2515
2532
  @default null
2516
2533
  */
2517
2534
  dragContent: null,
2518
-
2535
+
2519
2536
  /**
2520
2537
  This property is set to the proposed insertion index during a call to
2521
- collectionViewValidateDragOperation(). Your delegate implementations can
2522
- change the value of this property to enforce a drop some in some other
2538
+ collectionViewValidateDragOperation(). Your delegate implementations can
2539
+ change the value of this property to enforce a drop some in some other
2523
2540
  location.
2524
-
2541
+
2525
2542
  @type Number
2526
2543
  @default null
2527
2544
  */
2528
2545
  proposedInsertionIndex: null,
2529
-
2546
+
2530
2547
  /**
2531
2548
  This property is set to the proposed drop operation during a call to
2532
- collectionViewValidateDragOperation(). Your delegate implementations can
2533
- change the value of this property to enforce a different type of drop
2549
+ collectionViewValidateDragOperation(). Your delegate implementations can
2550
+ change the value of this property to enforce a different type of drop
2534
2551
  operation.
2535
-
2552
+
2536
2553
  @type Number
2537
2554
  @default null
2538
2555
  */
2539
2556
  proposedDropOperation: null,
2540
-
2557
+
2541
2558
  /** @private
2542
2559
  mouseDragged event handler. Initiates a drag if the following conditions
2543
2560
  are met:
2544
-
2561
+
2545
2562
  - collectionViewShouldBeginDrag() returns YES *OR*
2546
2563
  - the above method is not implemented and canReorderContent is true.
2547
2564
  - the dragDataTypes property returns a non-empty array
@@ -2554,55 +2571,55 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2554
2571
  info = this.mouseDownInfo,
2555
2572
  groupIndexes = this.get('_contentGroupIndexes'),
2556
2573
  dragContent, dragDataTypes, dragView;
2557
-
2574
+
2558
2575
  // if the mouse down event was cleared, there is nothing to do; return.
2559
2576
  if (!info || info.contentIndex<0) return YES ;
2560
-
2577
+
2561
2578
  // Don't do anything unless the user has been dragging for 123msec
2562
2579
  if ((Date.now() - info.at) < 123) return YES ;
2563
-
2580
+
2564
2581
  // OK, they must be serious, decide if a drag will be allowed.
2565
2582
  if (del.collectionViewShouldBeginDrag(this)) {
2566
-
2583
+
2567
2584
  // First, get the selection to drag. Drag an array of selected
2568
- // items appearing in this collection, in the order of the
2585
+ // items appearing in this collection, in the order of the
2569
2586
  // collection.
2570
2587
  //
2571
- // Compute the dragContent - the indexes we will be dragging.
2572
- // if we don't select on mouse down, then the selection has not been
2588
+ // Compute the dragContent - the indexes we will be dragging.
2589
+ // if we don't select on mouse down, then the selection has not been
2573
2590
  // updated to whatever the user clicked. Instead use
2574
2591
  // mouse down content.
2575
2592
  if (!this.get("selectOnMouseDown")) {
2576
2593
  dragContent = SC.IndexSet.create(info.contentIndex);
2577
2594
  } else dragContent = sel ? sel.indexSetForSource(content) : null;
2578
-
2595
+
2579
2596
  // remove any group indexes. groups cannot be dragged.
2580
2597
  if (dragContent && groupIndexes && groupIndexes.get('length')>0) {
2581
2598
  dragContent = dragContent.copy().remove(groupIndexes);
2582
2599
  if (dragContent.get('length')===0) dragContent = null;
2583
2600
  else dragContent.freeze();
2584
2601
  }
2585
-
2602
+
2586
2603
  if (!dragContent) return YES; // nothing to drag
2587
2604
  else dragContent = dragContent.frozenCopy(); // so it doesn't change
2588
-
2605
+
2589
2606
  dragContent = { content: content, indexes: dragContent };
2590
2607
  this.set('dragContent', dragContent) ;
2591
-
2608
+
2592
2609
  // Get the set of data types supported by the delegate. If this returns
2593
2610
  // a null or empty array and reordering content is not also supported
2594
2611
  // then do not start the drag.
2595
2612
  dragDataTypes = this.get('dragDataTypes');
2596
2613
  if (dragDataTypes && dragDataTypes.get('length') > 0) {
2597
-
2598
- // Build the drag view to use for the ghost drag. This
2614
+
2615
+ // Build the drag view to use for the ghost drag. This
2599
2616
  // should essentially contain any visible drag items.
2600
2617
  dragView = del.collectionViewDragViewFor(this, dragContent.indexes);
2601
2618
  if (!dragView) dragView = this._cv_dragViewFor(dragContent.indexes);
2602
-
2619
+
2603
2620
  // Make sure the dragView has created its layer.
2604
2621
  dragView.createLayer();
2605
-
2622
+
2606
2623
  // Initiate the drag
2607
2624
  SC.Drag.start({
2608
2625
  event: info.event,
@@ -2612,16 +2629,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2612
2629
  ghostActsLikeCursor: del.ghostActsLikeCursor,
2613
2630
  slideBack: YES,
2614
2631
  dataSource: this
2615
- });
2632
+ });
2616
2633
 
2617
- // Also use this opportunity to clean up since mouseUp won't
2634
+ // Also use this opportunity to clean up since mouseUp won't
2618
2635
  // get called.
2619
2636
  this._cleanupMouseDown() ;
2620
2637
  this._lastInsertionIndex = null ;
2621
-
2638
+
2622
2639
  // Drag was not allowed by the delegate, so bail.
2623
2640
  } else this.set('dragContent', null) ;
2624
-
2641
+
2625
2642
  return YES ;
2626
2643
  }
2627
2644
  },
@@ -2643,20 +2660,20 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2643
2660
  SC.$(dragLayer).css('backgroundColor', 'transparent')
2644
2661
  .css('border', 'none')
2645
2662
  .css('top', 0).css('left', 0);
2646
-
2663
+
2647
2664
  indexes.forEach(function(i) {
2648
2665
  var itemView = this.itemViewForContentIndex(i),
2649
2666
  isSelected, layer;
2650
-
2651
- // render item view without isSelected state.
2667
+
2668
+ // render item view without isSelected state.
2652
2669
  if (itemView) {
2653
2670
  isSelected = itemView.get('isSelected');
2654
2671
  itemView.set('isSelected', NO);
2655
-
2672
+
2656
2673
  itemView.updateLayerIfNeeded();
2657
2674
  layer = itemView.get('layer');
2658
2675
  if (layer) layer = layer.cloneNode(true);
2659
-
2676
+
2660
2677
  itemView.set('isSelected', isSelected);
2661
2678
  itemView.updateLayerIfNeeded();
2662
2679
  }
@@ -2669,7 +2686,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2669
2686
  }
2670
2687
  }
2671
2688
  layer = null;
2672
-
2689
+
2673
2690
  }, this);
2674
2691
  // we don't want to show the scrollbars, resize the dragview'
2675
2692
  view.set('layout', {height:height});
@@ -2678,12 +2695,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2678
2695
  return view ;
2679
2696
  },
2680
2697
 
2681
-
2698
+
2682
2699
  /**
2683
2700
  Implements the drag data source protocol for the collection view. This
2684
2701
  property will consult the collection view delegate if one is provided. It
2685
2702
  will also do the right thing if you have set canReorderContent to YES.
2686
-
2703
+
2687
2704
  @field
2688
2705
  @type Array
2689
2706
  */
@@ -2698,37 +2715,37 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2698
2715
  key = this.get('reorderDataType');
2699
2716
  if (ret.indexOf(key) < 0) ret.push(key);
2700
2717
  }
2701
-
2718
+
2702
2719
  return ret ? ret : [];
2703
2720
  }.property(),
2704
-
2721
+
2705
2722
  /**
2706
2723
  Implements the drag data source protocol method. The implementation of
2707
2724
  this method will consult the collection view delegate if one has been
2708
- provided. It also respects the canReoderContent method.
2725
+ provided. It also respects the canReorderContent method.
2709
2726
  */
2710
2727
  dragDataForType: function(drag, dataType) {
2711
-
2728
+
2712
2729
  // if this is a reorder, then return drag content.
2713
2730
  if (this.get('canReorderContent')) {
2714
2731
  if (dataType === this.get('reorderDataType')) {
2715
2732
  return this.get('dragContent') ;
2716
2733
  }
2717
2734
  }
2718
-
2735
+
2719
2736
  // otherwise, just pass along to the delegate
2720
2737
  var del = this.get('selectionDelegate');
2721
2738
  return del.collectionViewDragDataForType(this, drag, dataType);
2722
2739
  },
2723
-
2740
+
2724
2741
  /**
2725
2742
  Implements the SC.DropTarget interface. The default implementation will
2726
2743
  consult the collection view delegate, if you implement those methods.
2727
-
2728
- This method is called once when the drag enters the view area. It's
2744
+
2745
+ This method is called once when the drag enters the view area. It's
2729
2746
  return value will be stored on the drag object as allowedDragOperations,
2730
2747
  possibly further constrained by the drag source.
2731
-
2748
+
2732
2749
  @param {SC.Drag} drag the drag object
2733
2750
  @param {SC.Event} evt the event triggering this change, if available
2734
2751
  @returns {Number} logical OR'd mask of allowed drag operations.
@@ -2744,17 +2761,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2744
2761
  op = SC.DRAG_REORDER ;
2745
2762
  }
2746
2763
  }
2747
-
2764
+
2748
2765
  // Now pass this onto the delegate.
2749
2766
  op = del.collectionViewComputeDragOperations(this, drag, op);
2750
2767
  if (op & SC.DRAG_REORDER) op = SC.DRAG_MOVE ;
2751
-
2768
+
2752
2769
  return op ;
2753
2770
  },
2754
-
2771
+
2755
2772
  /** @private
2756
2773
  Determines the allowed drop operation insertion point, operation type,
2757
- and the drag operation to be performed. Used by dragUpdated() and
2774
+ and the drag operation to be performed. Used by dragUpdated() and
2758
2775
  performDragOperation().
2759
2776
 
2760
2777
  @param {SC.Drag} drag the drag object
@@ -2765,17 +2782,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2765
2782
  _computeDropOperationState: function(drag, evt, dragOp) {
2766
2783
  // get the insertion index for this location. This can be computed
2767
2784
  // by a subclass using whatever method. This method is not expected to
2768
- // do any data valdidation, just to map the location to an insertion
2785
+ // do any data valdidation, just to map the location to an insertion
2769
2786
  // index.
2770
2787
  var loc = this.convertFrameFromView(drag.get('location'), null),
2771
2788
  dropOp = SC.DROP_BEFORE,
2772
2789
  del = this.get('selectionDelegate'),
2773
2790
  canReorder = this.get('canReorderContent'),
2774
2791
  objects, content, isPreviousInDrag, isNextInDrag, len, tmp;
2775
-
2776
- // STEP 1: Try with a DROP_ON option -- send straight to delegate if
2792
+
2793
+ // STEP 1: Try with a DROP_ON option -- send straight to delegate if
2777
2794
  // supported by view.
2778
-
2795
+
2779
2796
  // get the computed insertion index and possibly drop operation.
2780
2797
  // prefer to drop ON.
2781
2798
  var idx = this.insertionIndexForLocation(loc, SC.DROP_ON) ;
@@ -2783,13 +2800,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2783
2800
  dropOp = idx[1] ; // order matters here
2784
2801
  idx = idx[0] ;
2785
2802
  }
2786
-
2803
+
2787
2804
  // if the return drop operation is DROP_ON, then just check it with the
2788
2805
  // delegate method. If the delegate method does not support dropping on,
2789
2806
  // then it will return DRAG_NONE, in which case we will try again with
2790
2807
  // drop before.
2791
2808
  if (dropOp === SC.DROP_ON) {
2792
-
2809
+
2793
2810
  // Now save the insertion index and the dropOp. This may be changed by
2794
2811
  // the collection delegate.
2795
2812
  this.set('proposedInsertionIndex', idx) ;
@@ -2801,9 +2818,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2801
2818
 
2802
2819
  // The delegate is OK with a drop on also, so just return.
2803
2820
  if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp] ;
2804
-
2821
+
2805
2822
  // The delegate is NOT OK with a drop on, try to get the insertion
2806
- // index again, but this time prefer SC.DROP_BEFORE, then let the
2823
+ // index again, but this time prefer SC.DROP_BEFORE, then let the
2807
2824
  // rest of the method run...
2808
2825
  else {
2809
2826
  dropOp = SC.DROP_BEFORE ;
@@ -2814,19 +2831,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2814
2831
  }
2815
2832
  }
2816
2833
  }
2817
-
2834
+
2818
2835
  // if this is a reorder drag, set the proposed op to SC.DRAG_REORDER and
2819
2836
  // validate the insertion point. This only works if the insertion point
2820
- // is DROP_BEFORE or DROP_AFTER. DROP_ON is not handled by reordering
2837
+ // is DROP_BEFORE or DROP_AFTER. DROP_ON is not handled by reordering
2821
2838
  // content.
2822
2839
  if ((idx >= 0) && canReorder && (dropOp !== SC.DROP_ON)) {
2823
-
2840
+
2824
2841
  objects = drag.dataForType(this.get('reorderDataType')) ;
2825
2842
  if (objects) {
2826
2843
  content = this.get('content') ;
2827
-
2828
- // if the insertion index is in between two items in the drag itself,
2829
- // then this is not allowed. Either use the last insertion index or
2844
+
2845
+ // if the insertion index is in between two items in the drag itself,
2846
+ // then this is not allowed. Either use the last insertion index or
2830
2847
  // find the first index that is not in between selections. Stop when
2831
2848
  // we get to the beginning.
2832
2849
  if (dropOp === SC.DROP_BEFORE) {
@@ -2836,7 +2853,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2836
2853
  isPreviousInDrag = objects.indexes.contains(idx);
2837
2854
  isNextInDrag = objects.indexes.contains(idx-1);
2838
2855
  }
2839
-
2856
+
2840
2857
  if (isPreviousInDrag && isNextInDrag) {
2841
2858
  if (SC.none(this._lastInsertionIndex)) {
2842
2859
  if (dropOp === SC.DROP_BEFORE) {
@@ -2847,7 +2864,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2847
2864
  }
2848
2865
  } else idx = this._lastInsertionIndex ;
2849
2866
  }
2850
-
2867
+
2851
2868
  // If we found a valid insertion point to reorder at, then set the op
2852
2869
  // to custom DRAG_REORDER.
2853
2870
  if (idx >= 0) dragOp = SC.DRAG_REORDER ;
@@ -2862,17 +2879,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2862
2879
  idx = this.get('proposedInsertionIndex') ;
2863
2880
  dropOp = this.get('proposedDropOperation') ;
2864
2881
  this._dropInsertionIndex = this._dropOperation = null ;
2865
-
2882
+
2866
2883
  // return generated state
2867
2884
  return [idx, dropOp, dragOp] ;
2868
2885
  },
2869
-
2870
- /**
2886
+
2887
+ /**
2871
2888
  Implements the SC.DropTarget interface. The default implementation will
2872
2889
  determine the drop location and then consult the collection view delegate
2873
2890
  if you implement those methods. Otherwise it will handle reordering
2874
2891
  content on its own.
2875
-
2892
+
2876
2893
  @param {SC.Drag} drag The drag that was updated
2877
2894
  @param {SC.Event} evt The event for the drag
2878
2895
  */
@@ -2880,50 +2897,50 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2880
2897
  var op = drag.get('allowedDragOperations'),
2881
2898
  state = this._computeDropOperationState(drag, evt, op),
2882
2899
  idx = state[0], dropOp = state[1], dragOp = state[2];
2883
-
2884
- // if the insertion index or dropOp have changed, update the insertion
2900
+
2901
+ // if the insertion index or dropOp have changed, update the insertion
2885
2902
  // point
2886
2903
  if (dragOp !== SC.DRAG_NONE) {
2887
2904
  if ((this._lastInsertionIndex !== idx) || (this._lastDropOperation !== dropOp)) {
2888
2905
  var itemView = this.itemViewForContentIndex(idx) ;
2889
2906
  this.showInsertionPoint(itemView, dropOp) ;
2890
2907
  }
2891
-
2908
+
2892
2909
  this._lastInsertionIndex = idx ;
2893
2910
  this._lastDropOperation = dropOp ;
2894
2911
  } else {
2895
2912
  this.hideInsertionPoint() ;
2896
2913
  this._lastInsertionIndex = this._lastDropOperation = null ;
2897
2914
  }
2898
-
2899
- // Normalize drag operation to the standard kinds accepted by the drag
2915
+
2916
+ // Normalize drag operation to the standard kinds accepted by the drag
2900
2917
  // system.
2901
- return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
2918
+ return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
2902
2919
  },
2903
-
2920
+
2904
2921
  /**
2905
- Implements the SC.DropTarget protocol. Hides any visible insertion
2922
+ Implements the SC.DropTarget protocol. Hides any visible insertion
2906
2923
  point and clears some cached values.
2907
2924
  */
2908
2925
  dragExited: function() {
2909
2926
  this.hideInsertionPoint() ;
2910
2927
  this._lastInsertionIndex = this._lastDropOperation = null ;
2911
2928
  },
2912
-
2929
+
2913
2930
  /**
2914
2931
  Implements the SC.DropTarget protocol.
2915
-
2932
+
2916
2933
  @returns {Boolean} YES
2917
2934
  */
2918
2935
  acceptDragOperation: function(drag, op) {
2919
2936
  return YES;
2920
2937
  },
2921
-
2938
+
2922
2939
  /**
2923
2940
  Implements the SC.DropTarget protocol. Consults the collection view
2924
- delegate to actually perform the operation unless the operation is
2941
+ delegate to actually perform the operation unless the operation is
2925
2942
  reordering content.
2926
-
2943
+
2927
2944
  @param {SC.Drag} drag The drag to perform the operation on
2928
2945
  @param {Number} op The drag operation to perform
2929
2946
  @return {Number} The operation performed
@@ -2934,51 +2951,51 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2934
2951
  idx = state[0], dropOp = state[1], dragOp = state[2],
2935
2952
  del = this.get('selectionDelegate'),
2936
2953
  performed, objects, data, content, shift, indexes;
2937
-
2938
- // The dragOp is the kinds of ops allowed. The drag operation must
2954
+
2955
+ // The dragOp is the kinds of ops allowed. The drag operation must
2939
2956
  // be included in that set.
2940
2957
  if (dragOp & SC.DRAG_REORDER) {
2941
2958
  op = (op & SC.DRAG_MOVE) ? SC.DRAG_REORDER : SC.DRAG_NONE ;
2942
2959
  } else op = op & dragOp ;
2943
-
2960
+
2944
2961
  // If no allowed drag operation could be found, just return.
2945
2962
  if (op === SC.DRAG_NONE) return op;
2946
-
2963
+
2947
2964
  // Some operation is allowed through, give the delegate a chance to
2948
2965
  // handle it.
2949
2966
  performed = del.collectionViewPerformDragOperation(this, drag, op, idx, dropOp) ;
2950
-
2967
+
2951
2968
  // If the delegate did not handle the drag (i.e. returned SC.DRAG_NONE),
2952
2969
  // and the op type is REORDER, then do the reorder here.
2953
2970
  if ((performed === SC.DRAG_NONE) && (op & SC.DRAG_REORDER)) {
2954
-
2971
+
2955
2972
  data = drag.dataForType(this.get('reorderDataType')) ;
2956
2973
  if (!data) return SC.DRAG_NONE ;
2957
-
2974
+
2958
2975
  content = this.get('content') ;
2959
-
2976
+
2960
2977
  // check for special case - inserting BEFORE ourself...
2961
- // in this case just pretend the move happened since it's a no-op
2978
+ // in this case just pretend the move happened since it's a no-op
2962
2979
  // anyway
2963
2980
  indexes = data.indexes;
2964
2981
  if (indexes.get('length')===1) {
2965
2982
  if (((dropOp === SC.DROP_BEFORE) || (dropOp === SC.DROP_AFTER)) &&
2966
2983
  (indexes.get('min')===idx)) return SC.DRAG_MOVE;
2967
2984
  }
2968
-
2985
+
2969
2986
  content.beginPropertyChanges(); // suspend notifications
2970
2987
 
2971
- // get each object, then remove it from the content. they will be
2988
+ // get each object, then remove it from the content. they will be
2972
2989
  // added again later.
2973
2990
  objects = [];
2974
2991
  shift = 0;
2975
- data.indexes.forEach(function(i) {
2992
+ data.indexes.forEach(function(i) {
2976
2993
  objects.push(content.objectAt(i-shift));
2977
2994
  content.removeAt(i-shift);
2978
2995
  shift++;
2979
2996
  if (i < idx) idx--;
2980
2997
  }, this);
2981
-
2998
+
2982
2999
  // now insert objects into new insertion locaiton
2983
3000
  if (dropOp === SC.DROP_AFTER) idx++;
2984
3001
  content.replace(idx, 0, objects, dropOp);
@@ -2988,62 +3005,62 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
2988
3005
  // make the op into its actual value
2989
3006
  op = SC.DRAG_MOVE ;
2990
3007
  }
2991
-
2992
- return op;
3008
+
3009
+ return op;
2993
3010
  },
2994
-
3011
+
2995
3012
  /**
2996
3013
  Default delegate method implementation, returns YES if canReorderContent
2997
3014
  is also true.
2998
-
3015
+
2999
3016
  @param {SC.View} view
3000
3017
  */
3001
3018
  collectionViewShouldBeginDrag: function(view) {
3002
3019
  return this.get('canReorderContent');
3003
3020
  },
3004
3021
 
3005
-
3022
+
3006
3023
  // ..........................................................
3007
3024
  // INSERTION POINT
3008
- //
3009
-
3010
-
3025
+ //
3026
+
3027
+
3011
3028
  /**
3012
- Get the preferred insertion point for the given location, including
3029
+ Get the preferred insertion point for the given location, including
3013
3030
  an insertion preference of before, after or on the named index.
3014
-
3015
- You can implement this method in a subclass if you like to perform a
3016
- more efficient check. The default implementation will loop through the
3017
- item views looking for the first view to "switch sides" in the orientation
3031
+
3032
+ You can implement this method in a subclass if you like to perform a
3033
+ more efficient check. The default implementation will loop through the
3034
+ item views looking for the first view to "switch sides" in the orientation
3018
3035
  you specify.
3019
-
3036
+
3020
3037
  This method should return an array with two values. The first value is
3021
3038
  the insertion point index and the second value is the drop operation,
3022
- which should be one of SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON.
3023
-
3024
- The preferred drop operation passed in should be used as a hint as to
3025
- the type of operation the view would prefer to receive. If the
3026
- dropOperation is SC.DROP_ON, then you should return a DROP_ON mode if
3039
+ which should be one of SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON.
3040
+
3041
+ The preferred drop operation passed in should be used as a hint as to
3042
+ the type of operation the view would prefer to receive. If the
3043
+ dropOperation is SC.DROP_ON, then you should return a DROP_ON mode if
3027
3044
  possible. Otherwise, you should never return DROP_ON.
3028
-
3045
+
3029
3046
  For compatibility, you can also return just the insertion index. If you
3030
- do this, then the collction view will assume the drop operation is
3047
+ do this, then the collction view will assume the drop operation is
3031
3048
  SC.DROP_BEFORE.
3032
-
3033
- If an insertion is NOT allowed, you should return -1 as the insertion
3049
+
3050
+ If an insertion is NOT allowed, you should return -1 as the insertion
3034
3051
  point. In this case, the drop operation will be ignored.
3035
-
3052
+
3036
3053
  @param {Point} loc the mouse location.
3037
3054
  @param {DropOp} dropOperation the preferred drop operation.
3038
3055
  @returns {Array} format: [index, op]
3039
3056
  */
3040
- insertionIndexForLocation: function(loc, dropOperation) {
3041
- return -1;
3057
+ insertionIndexForLocation: function(loc, dropOperation) {
3058
+ return -1;
3042
3059
  },
3043
-
3060
+
3044
3061
  // ..........................................................
3045
3062
  // INTERNAL SUPPORT
3046
- //
3063
+ //
3047
3064
 
3048
3065
  /** @private - when we become visible, reload if needed. */
3049
3066
  _cv_isVisibleInWindowDidChange: function() {
@@ -3051,7 +3068,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3051
3068
  if (this._invalidIndexes) this.invokeOnce(this.reloadIfNeeded);
3052
3069
  if (this._invalidSelection) {
3053
3070
  this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
3054
- }
3071
+ }
3055
3072
  }
3056
3073
  }.observes('isVisibleInWindow'),
3057
3074
 
@@ -3063,16 +3080,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3063
3080
  collectionViewShouldSelectItem: function(view, item) {
3064
3081
  return this.get('isSelectable') ;
3065
3082
  },
3066
-
3083
+
3067
3084
  /** @private */
3068
3085
  _TMP_DIFF1: SC.IndexSet.create(),
3069
-
3086
+
3070
3087
  /** @private */
3071
3088
  _TMP_DIFF2: SC.IndexSet.create(),
3072
-
3089
+
3073
3090
  /** @private
3074
-
3075
- Whenever the nowShowing range changes, update the range observer on the
3091
+
3092
+ Whenever the nowShowing range changes, update the range observer on the
3076
3093
  content item and instruct the view to reload any indexes that are not in
3077
3094
  the previous nowShowing range.
3078
3095
 
@@ -3099,13 +3116,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3099
3116
  this.updateContentRangeObserver();
3100
3117
  this.reload(diff);
3101
3118
  }
3102
-
3119
+
3103
3120
  // cleanup tmp objects
3104
3121
  if (diff1) diff1.clear();
3105
3122
  if (diff2) diff2.clear();
3106
-
3123
+
3107
3124
  }.observes('nowShowing'),
3108
-
3125
+
3109
3126
  /** @private */
3110
3127
  init: function() {
3111
3128
  sc_super();
@@ -3115,7 +3132,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3115
3132
  if (this.content) this._cv_contentDidChange();
3116
3133
  if (this.selection) this._cv_selectionDidChange();
3117
3134
  },
3118
-
3135
+
3119
3136
  /** @private
3120
3137
  Become a drop target whenever reordering content is enabled.
3121
3138
  */
@@ -3125,11 +3142,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3125
3142
  SC.Drag.addDropTarget(this);
3126
3143
  }
3127
3144
  }.observes('canReorderContent'),
3128
-
3145
+
3129
3146
  /** @private
3130
3147
  Fires an action after a selection if enabled.
3131
-
3132
- if actOnSelect is YES, then try to invoke the action, passing the
3148
+
3149
+ if actOnSelect is YES, then try to invoke the action, passing the
3133
3150
  current selection (saved as a separate array so that a change in sel
3134
3151
  in the meantime will not be lost)
3135
3152
  */
@@ -3145,7 +3162,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3145
3162
  this._cv_actionTimer = this.invokeLater(this._cv_action, delay, view, ev, sel) ;
3146
3163
  }
3147
3164
  },
3148
-
3165
+
3149
3166
  /** @private
3150
3167
  Perform the action. Supports legacy behavior as well as newer style
3151
3168
  action dispatch.
@@ -3158,29 +3175,29 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
3158
3175
  if (action) {
3159
3176
  // if the action is a function, just call it
3160
3177
  if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt) ;
3161
-
3178
+
3162
3179
  // otherwise, use the new sendAction style
3163
3180
  var pane = this.get('pane') ;
3164
3181
  if (pane) {
3165
3182
  pane.rootResponder.sendAction(action, target, this, pane, context);
3166
3183
  }
3167
3184
  // SC.app.sendAction(action, target, this) ;
3168
-
3185
+
3169
3186
  // if no action is specified, then trigger the support action,
3170
3187
  // if supported.
3171
3188
  } else if (!view) {
3172
3189
  return ; // nothing to do
3173
-
3190
+
3174
3191
  // if the target view has its own internal action handler,
3175
3192
  // trigger that.
3176
3193
  } else if (SC.typeOf(view._action) == SC.T_FUNCTION) {
3177
3194
  return view._action(evt) ;
3178
-
3195
+
3179
3196
  // otherwise call the action method to support older styles.
3180
3197
  } else if (SC.typeOf(view.action) == SC.T_FUNCTION) {
3181
3198
  return view.action(evt) ;
3182
3199
  }
3183
3200
  }
3184
-
3185
-
3201
+
3202
+
3186
3203
  });