sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +12 -0
 - data/VERSION.yml +1 -1
 - data/bin/sc-docs +6 -1
 - data/lib/buildtasks/target.rake +1 -1
 - data/lib/frameworks/sproutcore/Buildfile +5 -1
 - data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
 - data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
 - data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
 - data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
 - data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
 - data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
 - data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
 - data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
 - data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
 - data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
 - data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
 - data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
 - data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
 - data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
 - data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
 - data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
 - data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
 - data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
 - data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
 - data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
 - data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
 - data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
 - data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
 - data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
 - data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
 - data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
 - data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
 - data/lib/sproutcore/builders/base.rb +5 -1
 - data/lib/sproutcore/builders/handlebars.rb +12 -1
 - data/lib/sproutcore/models/target.rb +1 -9
 - data/lib/sproutcore/rack/proxy.rb +238 -92
 - data/lib/sproutcore/tools/docs.rb +1 -7
 - data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
 - data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
 - data/spec/lib/builders/handlebars_spec.rb +10 -4
 - data/sproutcore.gemspec +3 -1
 - metadata +73 -44
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
 - data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
 
| 
         @@ -8,7 +8,13 @@ 
     | 
|
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            /*global module test htmlbody ok equals same stop start */
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            module("SC.AlertPane UI" 
     | 
| 
      
 11 
     | 
    
         
            +
            module("SC.AlertPane UI", {
         
     | 
| 
      
 12 
     | 
    
         
            +
              setup: function(){
         
     | 
| 
      
 13 
     | 
    
         
            +
                SC.TestDelegate = SC.Object.create();
         
     | 
| 
      
 14 
     | 
    
         
            +
              },
         
     | 
| 
      
 15 
     | 
    
         
            +
              teardown: function(){
         
     | 
| 
      
 16 
     | 
    
         
            +
                delete SC.TestDelegate;SC.Object.create()}
         
     | 
| 
      
 17 
     | 
    
         
            +
            });
         
     | 
| 
       12 
18 
     | 
    
         | 
| 
       13 
19 
     | 
    
         
             
            var pane ;
         
     | 
| 
       14 
20 
     | 
    
         | 
| 
         @@ -183,33 +189,38 @@ test("AlertPane.info with individual actions and targets for three buttons", fun 
     | 
|
| 
       183 
189 
     | 
    
         | 
| 
       184 
190 
     | 
    
         
             
              var clickValue = null;
         
     | 
| 
       185 
191 
     | 
    
         | 
| 
       186 
     | 
    
         
            -
               
     | 
| 
       187 
     | 
    
         
            -
                 
     | 
| 
       188 
     | 
    
         
            -
             
     | 
| 
       189 
     | 
    
         
            -
             
     | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
             
     | 
| 
       192 
     | 
    
         
            -
             
     | 
| 
       193 
     | 
    
         
            -
             
     | 
| 
       194 
     | 
    
         
            -
              
         
     | 
| 
       195 
     | 
    
         
            -
             
     | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
       197 
     | 
    
         
            -
             
     | 
| 
       198 
     | 
    
         
            -
             
     | 
| 
       199 
     | 
    
         
            -
             
     | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
       201 
     | 
    
         
            -
             
     | 
| 
       202 
     | 
    
         
            -
             
     | 
| 
       203 
     | 
    
         
            -
             
     | 
| 
       204 
     | 
    
         
            -
             
     | 
| 
       205 
     | 
    
         
            -
             
     | 
| 
      
 192 
     | 
    
         
            +
              SC.TestDelegate.didClickOK = function() {
         
     | 
| 
      
 193 
     | 
    
         
            +
                clickValue = 'OK';
         
     | 
| 
      
 194 
     | 
    
         
            +
              };
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
              SC.TestDelegate.didClickCancel = function() {
         
     | 
| 
      
 197 
     | 
    
         
            +
                clickValue = 'Cancel';
         
     | 
| 
      
 198 
     | 
    
         
            +
              };
         
     | 
| 
      
 199 
     | 
    
         
            +
             
     | 
| 
      
 200 
     | 
    
         
            +
              function showPane(){
         
     | 
| 
      
 201 
     | 
    
         
            +
                pane = SC.AlertPane.info({
         
     | 
| 
      
 202 
     | 
    
         
            +
                  message: 'AlertPane.message',
         
     | 
| 
      
 203 
     | 
    
         
            +
                  description: 'AlertPane.description',
         
     | 
| 
      
 204 
     | 
    
         
            +
                  caption: 'AlertPane.caption',
         
     | 
| 
      
 205 
     | 
    
         
            +
                  icon: 'sc-icon-tools-24',
         
     | 
| 
      
 206 
     | 
    
         
            +
                  buttons: [
         
     | 
| 
      
 207 
     | 
    
         
            +
                    { title: 'okButtonTitle', action: 'didClickOK', target: SC.TestDelegate },
         
     | 
| 
      
 208 
     | 
    
         
            +
                    { title: 'cancelButtonTitle', action: 'didClickCancel', target: 'SC.TestDelegate' },
         
     | 
| 
      
 209 
     | 
    
         
            +
                    { title: 'extraButtonTitle', action: function() { clickValue = 'Extra'; } }
         
     | 
| 
      
 210 
     | 
    
         
            +
                  ]
         
     | 
| 
      
 211 
     | 
    
         
            +
                });
         
     | 
| 
      
 212 
     | 
    
         
            +
                clickValue = null;
         
     | 
| 
      
 213 
     | 
    
         
            +
              }
         
     | 
| 
       206 
214 
     | 
    
         | 
| 
      
 215 
     | 
    
         
            +
              showPane();
         
     | 
| 
       207 
216 
     | 
    
         
             
              pane.dismiss(pane.get('button1'));
         
     | 
| 
       208 
217 
     | 
    
         
             
              equals(clickValue, 'OK', 'Action for the OK button was clicked');
         
     | 
| 
       209 
     | 
    
         
            -
             
     | 
| 
      
 218 
     | 
    
         
            +
             
     | 
| 
      
 219 
     | 
    
         
            +
              showPane();
         
     | 
| 
       210 
220 
     | 
    
         
             
              pane.dismiss(pane.get('button2'));
         
     | 
| 
       211 
221 
     | 
    
         
             
              equals(clickValue, 'Cancel', 'Action for the Cancel button was clicked');
         
     | 
| 
       212 
222 
     | 
    
         | 
| 
      
 223 
     | 
    
         
            +
              showPane();
         
     | 
| 
       213 
224 
     | 
    
         
             
              pane.dismiss(pane.get('button3'));
         
     | 
| 
       214 
225 
     | 
    
         
             
              equals(clickValue, 'Extra', 'Action for the Extra button was clicked');
         
     | 
| 
       215 
226 
     | 
    
         | 
| 
         @@ -7,4 +7,23 @@ 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            /*global module test htmlbody ok equals same stop start */
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            module(" 
     | 
| 
      
 10 
     | 
    
         
            +
            module("PanelPane - Methods");
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            function getViewCount() {
         
     | 
| 
      
 13 
     | 
    
         
            +
              var i = 0; for (key in SC.View.views) ++i;
         
     | 
| 
      
 14 
     | 
    
         
            +
              return i;
         
     | 
| 
      
 15 
     | 
    
         
            +
            }
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            test("PanelPane destroy", function() {
         
     | 
| 
      
 18 
     | 
    
         
            +
              var start = getViewCount();
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              var pane = SC.PanelPane.create({
         
     | 
| 
      
 21 
     | 
    
         
            +
                isModal: YES
         
     | 
| 
      
 22 
     | 
    
         
            +
              });
         
     | 
| 
      
 23 
     | 
    
         
            +
              pane.append();
         
     | 
| 
      
 24 
     | 
    
         
            +
              pane.remove();
         
     | 
| 
      
 25 
     | 
    
         
            +
              pane.destroy();
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              var end = getViewCount();
         
     | 
| 
      
 28 
     | 
    
         
            +
              equals(start, end, "No extra views lying about after calling .destroy");
         
     | 
| 
      
 29 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -13,15 +13,22 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
              module("SC.Checkbox", {
         
     | 
| 
       14 
14 
     | 
    
         
             
                setup: function() {
         
     | 
| 
       15 
15 
     | 
    
         
             
                  SC.RunLoop.begin();
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  // actions must be strings, and there must be a target. So, we need this dummy.
         
     | 
| 
      
 18 
     | 
    
         
            +
                  var act = SC.Object.create({
         
     | 
| 
      
 19 
     | 
    
         
            +
                    action: function() {
         
     | 
| 
      
 20 
     | 
    
         
            +
                      triggered = true;
         
     | 
| 
      
 21 
     | 
    
         
            +
                    }
         
     | 
| 
      
 22 
     | 
    
         
            +
                  });
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
       16 
24 
     | 
    
         
             
                  pane = SC.MainPane.create({
         
     | 
| 
       17 
25 
     | 
    
         
             
                    childViews: [
         
     | 
| 
       18 
26 
     | 
    
         
             
                      SC.CheckboxView.extend({
         
     | 
| 
       19 
27 
     | 
    
         
             
                        layout: { right: 20, bottom: 20, width: 100, height: 23 },
         
     | 
| 
       20 
28 
     | 
    
         
             
                        title: "First Name",
         
     | 
| 
       21 
29 
     | 
    
         
             
                        value: YES,
         
     | 
| 
       22 
     | 
    
         
            -
                         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
     | 
    
         
            -
                        }
         
     | 
| 
      
 30 
     | 
    
         
            +
                        target: act,
         
     | 
| 
      
 31 
     | 
    
         
            +
                        action: 'action'
         
     | 
| 
       25 
32 
     | 
    
         
             
                      })]
         
     | 
| 
       26 
33 
     | 
    
         
             
                  });
         
     | 
| 
       27 
34 
     | 
    
         
             
                  pane.append(); // make sure there is a layer...
         
     | 
| 
         @@ -66,11 +66,38 @@ function() { 
     | 
|
| 
       66 
66 
     | 
    
         
             
              ok(view0.$().hasClass('disabled'), 'should have disabled class');
         
     | 
| 
       67 
67 
     | 
    
         
             
            });
         
     | 
| 
       68 
68 
     | 
    
         | 
| 
       69 
     | 
    
         
            -
            test("isEnabled  
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
               
     | 
| 
       72 
     | 
    
         
            -
               
     | 
| 
       73 
     | 
    
         
            -
               
     | 
| 
       74 
     | 
    
         
            -
               
     | 
| 
       75 
     | 
    
         
            -
               
     | 
| 
      
 69 
     | 
    
         
            +
            test("isEnabled=NO isEditable=NO should add disabled attribute", function() {
         
     | 
| 
      
 70 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
      
 71 
     | 
    
         
            +
              view0.set('isEnabled', NO);
         
     | 
| 
      
 72 
     | 
    
         
            +
              view0.set('isEditable', NO);
         
     | 
| 
      
 73 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 74 
     | 
    
         
            +
              ok(view0.$input().attr('disabled'), 'should have disabled attribute');
         
     | 
| 
      
 75 
     | 
    
         
            +
              ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
         
     | 
| 
      
 76 
     | 
    
         
            +
            });
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
            test("isEnabled=NO isEditable=YES should add disabled attribute", function() {
         
     | 
| 
      
 79 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
      
 80 
     | 
    
         
            +
              view0.set('isEnabled', NO);
         
     | 
| 
      
 81 
     | 
    
         
            +
              view0.set('isEditable', YES);
         
     | 
| 
      
 82 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 83 
     | 
    
         
            +
              ok(view0.$input().attr('disabled'), 'should have disabled attribute');
         
     | 
| 
      
 84 
     | 
    
         
            +
              ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
         
     | 
| 
      
 85 
     | 
    
         
            +
            });
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            test("isEnabled=YES isEditable=NO should add readOnly attribute", function() {
         
     | 
| 
      
 88 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
      
 89 
     | 
    
         
            +
              view0.set('isEnabled', YES);
         
     | 
| 
      
 90 
     | 
    
         
            +
              view0.set('isEditable', NO);
         
     | 
| 
      
 91 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 92 
     | 
    
         
            +
              ok(!view0.$input().attr('disabled'), 'should not have disabled attribute');
         
     | 
| 
      
 93 
     | 
    
         
            +
              ok(view0.$input().attr('readOnly'), 'should have readOnly attribute');
         
     | 
| 
      
 94 
     | 
    
         
            +
            });
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
            test("isEnabled=YES isEditable=YES should not add disable or readOnly attribute", function() {
         
     | 
| 
      
 97 
     | 
    
         
            +
              SC.RunLoop.begin();
         
     | 
| 
      
 98 
     | 
    
         
            +
              view0.set('isEnabled', YES);
         
     | 
| 
      
 99 
     | 
    
         
            +
              view0.set('isEditable', YES);
         
     | 
| 
      
 100 
     | 
    
         
            +
              SC.RunLoop.end();
         
     | 
| 
      
 101 
     | 
    
         
            +
              ok(!view0.$input().attr('disabled'), 'should not have disabled attribute');
         
     | 
| 
      
 102 
     | 
    
         
            +
              ok(!view0.$input().attr('readOnly'), 'should not have readOnly attribute');
         
     | 
| 
       76 
103 
     | 
    
         
             
            });
         
     | 
| 
         @@ -676,9 +676,6 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       676 
676 
     | 
    
         
             
                } else if (!this._isFocused && (buttonBehavior!==SC.PUSH_BEHAVIOR)) {
         
     | 
| 
       677 
677 
     | 
    
         
             
                  this._isFocused = YES ;
         
     | 
| 
       678 
678 
     | 
    
         
             
                  this.becomeFirstResponder();
         
     | 
| 
       679 
     | 
    
         
            -
                  if (this.get('isVisibleInWindow')) {
         
     | 
| 
       680 
     | 
    
         
            -
                    this.get('layer').focus();
         
     | 
| 
       681 
     | 
    
         
            -
                  }
         
     | 
| 
       682 
679 
     | 
    
         
             
                }
         
     | 
| 
       683 
680 
     | 
    
         | 
| 
       684 
681 
     | 
    
         
             
                return YES;
         
     | 
| 
         @@ -731,9 +728,6 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       731 
728 
     | 
    
         
             
                } else if (!this._isFocused && (buttonBehavior!==SC.PUSH_BEHAVIOR)) {
         
     | 
| 
       732 
729 
     | 
    
         
             
                  this._isFocused = YES ;
         
     | 
| 
       733 
730 
     | 
    
         
             
                  this.becomeFirstResponder();
         
     | 
| 
       734 
     | 
    
         
            -
                  if (this.get('isVisibleInWindow')) {
         
     | 
| 
       735 
     | 
    
         
            -
                    this.$()[0].focus();
         
     | 
| 
       736 
     | 
    
         
            -
                  }
         
     | 
| 
       737 
731 
     | 
    
         
             
                }
         
     | 
| 
       738 
732 
     | 
    
         | 
| 
       739 
733 
     | 
    
         
             
                // don't want to do whatever default is...
         
     | 
| 
         @@ -774,16 +768,21 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       774 
768 
     | 
    
         
             
              /** @private */
         
     | 
| 
       775 
769 
     | 
    
         
             
              keyDown: function(evt) {
         
     | 
| 
       776 
770 
     | 
    
         
             
                // handle tab key
         
     | 
| 
      
 771 
     | 
    
         
            +
                 if(!this.get('isEnabled')) return YES;
         
     | 
| 
       777 
772 
     | 
    
         
             
                if (evt.which === 9 || evt.keyCode === 9) {
         
     | 
| 
       778 
773 
     | 
    
         
             
                  var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
         
     | 
| 
       779 
774 
     | 
    
         
             
                  if(view) view.becomeFirstResponder();
         
     | 
| 
       780 
775 
     | 
    
         
             
                  else evt.allowDefault();
         
     | 
| 
       781 
776 
     | 
    
         
             
                  return YES ; // handled
         
     | 
| 
       782 
777 
     | 
    
         
             
                }
         
     | 
| 
       783 
     | 
    
         
            -
                if (evt.which === 13) {
         
     | 
| 
      
 778 
     | 
    
         
            +
                if (evt.which === 13 || evt.which === 32) {
         
     | 
| 
       784 
779 
     | 
    
         
             
                  this.triggerActionAfterDelay(evt);
         
     | 
| 
       785 
780 
     | 
    
         
             
                  return YES ; // handled
         
     | 
| 
       786 
781 
     | 
    
         
             
                }
         
     | 
| 
      
 782 
     | 
    
         
            +
             
     | 
| 
      
 783 
     | 
    
         
            +
                // let other keys through to browser
         
     | 
| 
      
 784 
     | 
    
         
            +
                evt.allowDefault();
         
     | 
| 
      
 785 
     | 
    
         
            +
             
     | 
| 
       787 
786 
     | 
    
         
             
                return NO;
         
     | 
| 
       788 
787 
     | 
    
         
             
              },
         
     | 
| 
       789 
788 
     | 
    
         | 
| 
         @@ -834,7 +833,7 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       834 
833 
     | 
    
         
             
                var action = this.get('action'),
         
     | 
| 
       835 
834 
     | 
    
         
             
                    target = this.get('target') || null,
         
     | 
| 
       836 
835 
     | 
    
         
             
                    rootResponder = this.getPath('pane.rootResponder');
         
     | 
| 
       837 
     | 
    
         
            -
             
     | 
| 
      
 836 
     | 
    
         
            +
                    
         
     | 
| 
       838 
837 
     | 
    
         
             
                if (action) {
         
     | 
| 
       839 
838 
     | 
    
         
             
                  if (this._hasLegacyActionHandler()) {
         
     | 
| 
       840 
839 
     | 
    
         
             
                    // old school... V
         
     | 
| 
         @@ -845,7 +844,7 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       845 
844 
     | 
    
         
             
                      rootResponder.sendAction(action, target, this, this.get('pane'), null, this);
         
     | 
| 
       846 
845 
     | 
    
         
             
                    }
         
     | 
| 
       847 
846 
     | 
    
         
             
                  }
         
     | 
| 
       848 
     | 
    
         
            -
                }
         
     | 
| 
      
 847 
     | 
    
         
            +
                }    
         
     | 
| 
       849 
848 
     | 
    
         
             
              },
         
     | 
| 
       850 
849 
     | 
    
         | 
| 
       851 
850 
     | 
    
         
             
              /** @private */
         
     | 
| 
         @@ -869,12 +868,12 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       869 
868 
     | 
    
         
             
                if (action && (SC.typeOf(action) === SC.T_STRING) && (action.indexOf('.') != -1)) return true;
         
     | 
| 
       870 
869 
     | 
    
         
             
                return false;
         
     | 
| 
       871 
870 
     | 
    
         
             
              },
         
     | 
| 
       872 
     | 
    
         
            -
             
     | 
| 
      
 871 
     | 
    
         
            +
              
         
     | 
| 
       873 
872 
     | 
    
         
             
              /** @private */
         
     | 
| 
       874 
873 
     | 
    
         
             
              _triggerLegacyActionHandler: function( evt )
         
     | 
| 
       875 
874 
     | 
    
         
             
              {
         
     | 
| 
       876 
875 
     | 
    
         
             
                if (!this._hasLegacyActionHandler()) return false;
         
     | 
| 
       877 
     | 
    
         
            -
             
     | 
| 
      
 876 
     | 
    
         
            +
              
         
     | 
| 
       878 
877 
     | 
    
         
             
                var action = this.get('action');
         
     | 
| 
       879 
878 
     | 
    
         
             
                if (SC.typeOf(action) === SC.T_FUNCTION) this.action(evt);
         
     | 
| 
       880 
879 
     | 
    
         
             
                if (SC.typeOf(action) === SC.T_STRING) {
         
     | 
| 
         @@ -882,9 +881,9 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       882 
881 
     | 
    
         
             
                  this.action(evt);
         
     | 
| 
       883 
882 
     | 
    
         
             
                }
         
     | 
| 
       884 
883 
     | 
    
         
             
              },
         
     | 
| 
       885 
     | 
    
         
            -
             
     | 
| 
      
 884 
     | 
    
         
            +
              
         
     | 
| 
       886 
885 
     | 
    
         
             
              /** @private */
         
     | 
| 
       887 
     | 
    
         
            -
               
     | 
| 
      
 886 
     | 
    
         
            +
              didBecomeKeyResponderFrom: function(keyView) {
         
     | 
| 
       888 
887 
     | 
    
         
             
                // focus the text field.
         
     | 
| 
       889 
888 
     | 
    
         
             
                if (!this._isFocused) {
         
     | 
| 
       890 
889 
     | 
    
         
             
                  this._isFocused = YES ;
         
     | 
| 
         @@ -894,12 +893,12 @@ SC.ButtonView = SC.View.extend(SC.Control, 
     | 
|
| 
       894 
893 
     | 
    
         
             
                  }
         
     | 
| 
       895 
894 
     | 
    
         
             
                }
         
     | 
| 
       896 
895 
     | 
    
         
             
              },
         
     | 
| 
       897 
     | 
    
         
            -
             
     | 
| 
      
 896 
     | 
    
         
            +
              
         
     | 
| 
       898 
897 
     | 
    
         
             
              /** @private */
         
     | 
| 
       899 
898 
     | 
    
         
             
              willLoseKeyResponderTo: function(responder) {
         
     | 
| 
       900 
899 
     | 
    
         
             
                if (this._isFocused) this._isFocused = NO ;
         
     | 
| 
       901 
900 
     | 
    
         
             
              },
         
     | 
| 
       902 
     | 
    
         
            -
             
     | 
| 
      
 901 
     | 
    
         
            +
              
         
     | 
| 
       903 
902 
     | 
    
         
             
              /** @private */
         
     | 
| 
       904 
903 
     | 
    
         
             
              didAppendToDocument: function() {
         
     | 
| 
       905 
904 
     | 
    
         
             
                if(parseInt(SC.browser.msie, 0)===7 && this.get('useStaticLayout')){
         
     | 
| 
         @@ -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,15 +87,12 @@ 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 
     | 
    
         
            -
                 
     | 
| 
       96 
     | 
    
         
            -
                  return YES;
         
     | 
| 
       97 
     | 
    
         
            -
                }
         
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                var isOn = this.get('value') === this.get('toggleOnValue');
         
     | 
| 
       100 
     | 
    
         
            -
                this.set('value', isOn ? this.get('toggleOffValue') : this.get('toggleOnValue'));
         
     | 
| 
      
 95 
     | 
    
         
            +
                this._toggleValue();
         
     | 
| 
       101 
96 
     | 
    
         | 
| 
       102 
97 
     | 
    
         
             
                // fire action
         
     | 
| 
       103 
98 
     | 
    
         
             
                if (this.get('buttonBehavior') !== SC.HOLD_BEHAVIOR) {
         
     | 
| 
         @@ -105,8 +100,39 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout, 
     | 
|
| 
       105 
100 
     | 
    
         
             
                }
         
     | 
| 
       106 
101 
     | 
    
         | 
| 
       107 
102 
     | 
    
         
             
                return YES;
         
     | 
| 
      
 103 
     | 
    
         
            +
             
     | 
| 
       108 
104 
     | 
    
         
             
              },
         
     | 
| 
       109 
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
         
     | 
| 
      
 116 
     | 
    
         
            +
                }
         
     | 
| 
      
 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
         
     | 
| 
      
 127 
     | 
    
         
            +
                }
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
                // let other keys through to browser
         
     | 
| 
      
 130 
     | 
    
         
            +
                evt.allowDefault();
         
     | 
| 
      
 131 
     | 
    
         
            +
             
     | 
| 
      
 132 
     | 
    
         
            +
                return NO;
         
     | 
| 
      
 133 
     | 
    
         
            +
              },
         
     | 
| 
      
 134 
     | 
    
         
            +
              
         
     | 
| 
      
 135 
     | 
    
         
            +
              
         
     | 
| 
       110 
136 
     | 
    
         | 
| 
       111 
137 
     | 
    
         
             
              /** @private */
         
     | 
| 
       112 
138 
     | 
    
         
             
              touchStart: function(evt) {
         
     | 
| 
         @@ -118,4 +144,4 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout, 
     | 
|
| 
       118 
144 
     | 
    
         
             
                return this.mouseUp(evt);
         
     | 
| 
       119 
145 
     | 
    
         
             
              }
         
     | 
| 
       120 
146 
     | 
    
         | 
| 
       121 
     | 
    
         
            -
            }) 
     | 
| 
      
 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}  
     | 
| 
      
 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,24 +2097,24 @@ 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 
     | 
    
         | 
| 
         @@ -2134,23 +2134,23 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2134 
2134 
     | 
    
         | 
| 
       2135 
2135 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       2136 
2136 
     | 
    
         
             
              // MOUSE EVENTS
         
     | 
| 
       2137 
     | 
    
         
            -
              // 
     | 
| 
       2138 
     | 
    
         
            -
             
     | 
| 
      
 2137 
     | 
    
         
            +
              //
         
     | 
| 
      
 2138 
     | 
    
         
            +
             
     | 
| 
       2139 
2139 
     | 
    
         
             
              /** @private
         
     | 
| 
       2140 
     | 
    
         
            -
                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
         
     | 
| 
       2141 
2141 
     | 
    
         
             
                children.
         
     | 
| 
       2142 
     | 
    
         
            -
             
     | 
| 
      
 2142 
     | 
    
         
            +
             
     | 
| 
       2143 
2143 
     | 
    
         
             
                The default implementation of this method can handle a wide variety
         
     | 
| 
       2144 
2144 
     | 
    
         
             
                of user behaviors depending on how you have configured the various
         
     | 
| 
       2145 
2145 
     | 
    
         
             
                options for the collection view.
         
     | 
| 
       2146 
     | 
    
         
            -
             
     | 
| 
      
 2146 
     | 
    
         
            +
             
     | 
| 
       2147 
2147 
     | 
    
         
             
                @param ev {Event} the mouse down event
         
     | 
| 
       2148 
2148 
     | 
    
         
             
                @returns {Boolean} Usually YES.
         
     | 
| 
       2149 
2149 
     | 
    
         
             
              */
         
     | 
| 
       2150 
2150 
     | 
    
         
             
              mouseDown: function(ev) {
         
     | 
| 
       2151 
2151 
     | 
    
         
             
                var itemView      = this.itemViewForEvent(ev),
         
     | 
| 
       2152 
2152 
     | 
    
         
             
                    content       = this.get('content'),
         
     | 
| 
       2153 
     | 
    
         
            -
                    contentIndex  = itemView ? itemView.get('contentIndex') : -1, 
     | 
| 
      
 2153 
     | 
    
         
            +
                    contentIndex  = itemView ? itemView.get('contentIndex') : -1,
         
     | 
| 
       2154 
2154 
     | 
    
         
             
                    info, anchor, sel, isSelected, modifierKeyPressed, didSelect = NO,
         
     | 
| 
       2155 
2155 
     | 
    
         
             
                    allowsMultipleSel = content.get('allowsMultipleSelection');
         
     | 
| 
       2156 
2156 
     | 
    
         | 
| 
         @@ -2159,15 +2159,15 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2159 
2159 
     | 
    
         
             
                if(!this.get('isSelectable')) return NO;
         
     | 
| 
       2160 
2160 
     | 
    
         | 
| 
       2161 
2161 
     | 
    
         
             
                info = this.mouseDownInfo = {
         
     | 
| 
       2162 
     | 
    
         
            -
                  event:        ev, 
     | 
| 
      
 2162 
     | 
    
         
            +
                  event:        ev,
         
     | 
| 
       2163 
2163 
     | 
    
         
             
                  itemView:     itemView,
         
     | 
| 
       2164 
2164 
     | 
    
         
             
                  contentIndex: contentIndex,
         
     | 
| 
       2165 
2165 
     | 
    
         
             
                  at:           Date.now()
         
     | 
| 
       2166 
2166 
     | 
    
         
             
                };
         
     | 
| 
       2167 
     | 
    
         
            -
             
     | 
| 
      
 2167 
     | 
    
         
            +
             
     | 
| 
       2168 
2168 
     | 
    
         
             
                // become first responder if possible.
         
     | 
| 
       2169 
2169 
     | 
    
         
             
                this.becomeFirstResponder() ;
         
     | 
| 
       2170 
     | 
    
         
            -
             
     | 
| 
      
 2170 
     | 
    
         
            +
             
     | 
| 
       2171 
2171 
     | 
    
         
             
                // Toggle the selection if selectOnMouseDown is true
         
     | 
| 
       2172 
2172 
     | 
    
         
             
                if (this.get('useToggleSelection')) {
         
     | 
| 
       2173 
2173 
     | 
    
         
             
                  if (this.get('selectOnMouseDown')) {
         
     | 
| 
         @@ -2186,32 +2186,32 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2186 
2186 
     | 
    
         
             
                      this.select(contentIndex, YES);
         
     | 
| 
       2187 
2187 
     | 
    
         
             
                      didSelect = YES;
         
     | 
| 
       2188 
2188 
     | 
    
         
             
                    }
         
     | 
| 
       2189 
     | 
    
         
            -
             
     | 
| 
      
 2189 
     | 
    
         
            +
             
     | 
| 
       2190 
2190 
     | 
    
         
             
                    if (didSelect && this.get('actOnSelect')) {
         
     | 
| 
       2191 
2191 
     | 
    
         
             
                      // handle actions on editing
         
     | 
| 
       2192 
2192 
     | 
    
         
             
                      this._cv_performSelectAction(itemView, ev);
         
     | 
| 
       2193 
2193 
     | 
    
         
             
                    }
         
     | 
| 
       2194 
2194 
     | 
    
         
             
                  }
         
     | 
| 
       2195 
     | 
    
         
            -
             
     | 
| 
      
 2195 
     | 
    
         
            +
             
     | 
| 
       2196 
2196 
     | 
    
         
             
                  return YES;
         
     | 
| 
       2197 
2197 
     | 
    
         
             
                }
         
     | 
| 
       2198 
     | 
    
         
            -
             
     | 
| 
       2199 
     | 
    
         
            -
                // 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
         
     | 
| 
       2200 
2200 
     | 
    
         
             
                // childItems... unless we do not allow empty selections, set it to empty.
         
     | 
| 
       2201 
2201 
     | 
    
         
             
                if (!itemView) {
         
     | 
| 
       2202 
2202 
     | 
    
         
             
                  if (this.get('allowDeselectAll')) this.select(null, false);
         
     | 
| 
       2203 
2203 
     | 
    
         
             
                  return YES ;
         
     | 
| 
       2204 
2204 
     | 
    
         
             
                }
         
     | 
| 
       2205 
     | 
    
         
            -
             
     | 
| 
      
 2205 
     | 
    
         
            +
             
     | 
| 
       2206 
2206 
     | 
    
         
             
                // collection some basic setup info
         
     | 
| 
       2207 
2207 
     | 
    
         
             
                sel = this.get('selection');
         
     | 
| 
       2208 
2208 
     | 
    
         
             
                if (sel) sel = sel.indexSetForSource(content);
         
     | 
| 
       2209 
     | 
    
         
            -
             
     | 
| 
      
 2209 
     | 
    
         
            +
             
     | 
| 
       2210 
2210 
     | 
    
         
             
                isSelected = sel ? sel.contains(contentIndex) : NO;
         
     | 
| 
       2211 
2211 
     | 
    
         
             
                info.modifierKeyPressed = modifierKeyPressed = ev.ctrlKey || ev.metaKey ;
         
     | 
| 
       2212 
     | 
    
         
            -
             
     | 
| 
       2213 
     | 
    
         
            -
             
     | 
| 
       2214 
     | 
    
         
            -
                // 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
         
     | 
| 
       2215 
2215 
     | 
    
         
             
                // deselect that item...deselect and bail.
         
     | 
| 
       2216 
2216 
     | 
    
         
             
                if (modifierKeyPressed && isSelected) {
         
     | 
| 
       2217 
2217 
     | 
    
         
             
                  info.shouldDeselect = contentIndex >= 0;
         
     | 
| 
         @@ -2220,36 +2220,36 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2220 
2220 
     | 
    
         
             
                // from the last selected item
         
     | 
| 
       2221 
2221 
     | 
    
         
             
                } else if (ev.shiftKey && sel && sel.get('length') > 0 && allowsMultipleSel) {
         
     | 
| 
       2222 
2222 
     | 
    
         
             
                  sel = this._findSelectionExtendedByShift(sel, contentIndex);
         
     | 
| 
       2223 
     | 
    
         
            -
                  anchor = this._selectionAnchor ; 
     | 
| 
      
 2223 
     | 
    
         
            +
                  anchor = this._selectionAnchor ;
         
     | 
| 
       2224 
2224 
     | 
    
         
             
                  this.select(sel) ;
         
     | 
| 
       2225 
2225 
     | 
    
         
             
                  this._selectionAnchor = anchor; //save the anchor
         
     | 
| 
       2226 
     | 
    
         
            -
             
     | 
| 
       2227 
     | 
    
         
            -
                // 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
         
     | 
| 
       2228 
2228 
     | 
    
         
             
                // should clear the selection and reselect only the clicked on item.
         
     | 
| 
       2229 
2229 
     | 
    
         
             
                } else if (!modifierKeyPressed && isSelected) {
         
     | 
| 
       2230 
2230 
     | 
    
         
             
                  info.shouldReselect = contentIndex >= 0;
         
     | 
| 
       2231 
     | 
    
         
            -
             
     | 
| 
       2232 
     | 
    
         
            -
                // Otherwise, if selecting on mouse down,  simply select the clicked on 
     | 
| 
      
 2231 
     | 
    
         
            +
             
     | 
| 
      
 2232 
     | 
    
         
            +
                // Otherwise, if selecting on mouse down,  simply select the clicked on
         
     | 
| 
       2233 
2233 
     | 
    
         
             
                // item, adding it to the current selection if a modifier key was pressed.
         
     | 
| 
       2234 
2234 
     | 
    
         
             
                } else {
         
     | 
| 
       2235 
     | 
    
         
            -
             
     | 
| 
      
 2235 
     | 
    
         
            +
             
     | 
| 
       2236 
2236 
     | 
    
         
             
                  if((ev.shiftKey || modifierKeyPressed) && !allowsMultipleSel){
         
     | 
| 
       2237 
2237 
     | 
    
         
             
                    this.select(null, false);
         
     | 
| 
       2238 
2238 
     | 
    
         
             
                  }
         
     | 
| 
       2239 
     | 
    
         
            -
             
     | 
| 
      
 2239 
     | 
    
         
            +
             
     | 
| 
       2240 
2240 
     | 
    
         
             
                  if (this.get("selectOnMouseDown")) {
         
     | 
| 
       2241 
2241 
     | 
    
         
             
                    this.select(contentIndex, modifierKeyPressed);
         
     | 
| 
       2242 
2242 
     | 
    
         
             
                  } else {
         
     | 
| 
       2243 
2243 
     | 
    
         
             
                    info.shouldSelect = contentIndex >= 0 ;
         
     | 
| 
       2244 
2244 
     | 
    
         
             
                  }
         
     | 
| 
       2245 
2245 
     | 
    
         
             
                }
         
     | 
| 
       2246 
     | 
    
         
            -
             
     | 
| 
      
 2246 
     | 
    
         
            +
             
     | 
| 
       2247 
2247 
     | 
    
         
             
                // saved for extend by shift ops.
         
     | 
| 
       2248 
2248 
     | 
    
         
             
                info.previousContentIndex = contentIndex;
         
     | 
| 
       2249 
     | 
    
         
            -
             
     | 
| 
      
 2249 
     | 
    
         
            +
             
     | 
| 
       2250 
2250 
     | 
    
         
             
                return YES;
         
     | 
| 
       2251 
2251 
     | 
    
         
             
              },
         
     | 
| 
       2252 
     | 
    
         
            -
             
     | 
| 
      
 2252 
     | 
    
         
            +
             
     | 
| 
       2253 
2253 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2254 
2254 
     | 
    
         
             
              mouseUp: function(ev) {
         
     | 
| 
       2255 
2255 
     | 
    
         
             
                var view = this.itemViewForEvent(ev),
         
     | 
| 
         @@ -2266,11 +2266,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2266 
2266 
     | 
    
         
             
                if (this.get('useToggleSelection')) {
         
     | 
| 
       2267 
2267 
     | 
    
         
             
                  // Return if clicked outside of elements or if toggle was handled by mouseDown
         
     | 
| 
       2268 
2268 
     | 
    
         
             
                  if (!view || this.get('selectOnMouseDown')) return NO;
         
     | 
| 
       2269 
     | 
    
         
            -
             
     | 
| 
      
 2269 
     | 
    
         
            +
             
     | 
| 
       2270 
2270 
     | 
    
         
             
                  // determine if item is selected. If so, then go on.
         
     | 
| 
       2271 
2271 
     | 
    
         
             
                  sel = this.get('selection') ;
         
     | 
| 
       2272 
2272 
     | 
    
         
             
                  isSelected = sel && sel.containsObject(view.get('content')) ;
         
     | 
| 
       2273 
     | 
    
         
            -
             
     | 
| 
      
 2273 
     | 
    
         
            +
             
     | 
| 
       2274 
2274 
     | 
    
         
             
                  if (isSelected) {
         
     | 
| 
       2275 
2275 
     | 
    
         
             
                    this.deselect(contentIndex) ;
         
     | 
| 
       2276 
2276 
     | 
    
         
             
                  } else if (!allowsMultipleSel) {
         
     | 
| 
         @@ -2278,37 +2278,37 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2278 
2278 
     | 
    
         
             
                  } else {
         
     | 
| 
       2279 
2279 
     | 
    
         
             
                    this.select(contentIndex, YES) ;
         
     | 
| 
       2280 
2280 
     | 
    
         
             
                  }
         
     | 
| 
       2281 
     | 
    
         
            -
             
     | 
| 
      
 2281 
     | 
    
         
            +
             
     | 
| 
       2282 
2282 
     | 
    
         
             
                } else if(info) {
         
     | 
| 
       2283 
2283 
     | 
    
         
             
                  idx = info.contentIndex;
         
     | 
| 
       2284 
2284 
     | 
    
         
             
                  contentIndex = (view) ? view.get('contentIndex') : -1 ;
         
     | 
| 
       2285 
     | 
    
         
            -
             
     | 
| 
       2286 
     | 
    
         
            -
                  // 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
         
     | 
| 
       2287 
2287 
     | 
    
         
             
                  // selectOnMouseDown was NO.
         
     | 
| 
       2288 
2288 
     | 
    
         
             
                  if (info.shouldSelect) this.select(idx, info.modifierKeyPressed);
         
     | 
| 
       2289 
     | 
    
         
            -
             
     | 
| 
      
 2289 
     | 
    
         
            +
             
     | 
| 
       2290 
2290 
     | 
    
         
             
                  // This is true if the user clicked on a selected item with a modifier
         
     | 
| 
       2291 
2291 
     | 
    
         
             
                  // key pressed.
         
     | 
| 
       2292 
2292 
     | 
    
         
             
                  if (info.shouldDeselect) this.deselect(idx);
         
     | 
| 
       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 
     | 
| 
      
 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
         
     | 
| 
       2297 
2297 
     | 
    
         
             
                  // selection and reselect the clicked on item.
         
     | 
| 
       2298 
2298 
     | 
    
         
             
                  if (info.shouldReselect) {
         
     | 
| 
       2299 
     | 
    
         
            -
             
     | 
| 
      
 2299 
     | 
    
         
            +
             
     | 
| 
       2300 
2300 
     | 
    
         
             
                    // - contentValueIsEditable is true
         
     | 
| 
       2301 
2301 
     | 
    
         
             
                    canEdit = this.get('isEditable') && this.get('canEditContent') ;
         
     | 
| 
       2302 
     | 
    
         
            -
             
     | 
| 
      
 2302 
     | 
    
         
            +
             
     | 
| 
       2303 
2303 
     | 
    
         
             
                    // - the user clicked on an item that was already selected
         
     | 
| 
       2304 
2304 
     | 
    
         
             
                    //   ^ this is the only way shouldReset is set to YES
         
     | 
| 
       2305 
     | 
    
         
            -
             
     | 
| 
      
 2305 
     | 
    
         
            +
             
     | 
| 
       2306 
2306 
     | 
    
         
             
                    // - is the only item selected
         
     | 
| 
       2307 
2307 
     | 
    
         
             
                    if (canEdit) {
         
     | 
| 
       2308 
2308 
     | 
    
         
             
                      sel = this.get('selection') ;
         
     | 
| 
       2309 
2309 
     | 
    
         
             
                      canEdit = sel && (sel.get('length') === 1);
         
     | 
| 
       2310 
2310 
     | 
    
         
             
                    }
         
     | 
| 
       2311 
     | 
    
         
            -
             
     | 
| 
      
 2311 
     | 
    
         
            +
             
     | 
| 
       2312 
2312 
     | 
    
         
             
                    // - the item view responds to contentHitTest() and returns YES.
         
     | 
| 
       2313 
2313 
     | 
    
         
             
                    // - the item view responds to beginEditing and returns YES.
         
     | 
| 
       2314 
2314 
     | 
    
         
             
                    if (canEdit) {
         
     | 
| 
         @@ -2316,26 +2316,26 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2316 
2316 
     | 
    
         
             
                      canEdit = itemView && (!itemView.contentHitTest || itemView.contentHitTest(ev)) ;
         
     | 
| 
       2317 
2317 
     | 
    
         
             
                      canEdit = (canEdit && itemView.beginEditing) ? itemView.beginEditing() : NO ;
         
     | 
| 
       2318 
2318 
     | 
    
         
             
                    }
         
     | 
| 
       2319 
     | 
    
         
            -
             
     | 
| 
      
 2319 
     | 
    
         
            +
             
     | 
| 
       2320 
2320 
     | 
    
         
             
                    // if cannot edit, schedule a reselect (but give doubleClick a chance)
         
     | 
| 
       2321 
2321 
     | 
    
         
             
                    if (!canEdit) {
         
     | 
| 
       2322 
2322 
     | 
    
         
             
                      if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate() ;
         
     | 
| 
       2323 
2323 
     | 
    
         
             
                      this._cv_reselectTimer = this.invokeLater(this.select, 300, idx, false) ;
         
     | 
| 
       2324 
2324 
     | 
    
         
             
                    }
         
     | 
| 
       2325 
2325 
     | 
    
         
             
                  }
         
     | 
| 
       2326 
     | 
    
         
            -
             
     | 
| 
      
 2326 
     | 
    
         
            +
             
     | 
| 
       2327 
2327 
     | 
    
         
             
                  this._cleanupMouseDown() ;
         
     | 
| 
       2328 
2328 
     | 
    
         
             
                }
         
     | 
| 
       2329 
2329 
     | 
    
         | 
| 
       2330 
2330 
     | 
    
         
             
                // handle actions on editing
         
     | 
| 
       2331 
2331 
     | 
    
         
             
                this._cv_performSelectAction(view, ev, 0, ev.clickCount);
         
     | 
| 
       2332 
     | 
    
         
            -
             
     | 
| 
      
 2332 
     | 
    
         
            +
             
     | 
| 
       2333 
2333 
     | 
    
         
             
                return NO;  // bubble event to allow didDoubleClick to be called...
         
     | 
| 
       2334 
2334 
     | 
    
         
             
              },
         
     | 
| 
       2335 
     | 
    
         
            -
             
     | 
| 
      
 2335 
     | 
    
         
            +
             
     | 
| 
       2336 
2336 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2337 
2337 
     | 
    
         
             
              _cleanupMouseDown: function() {
         
     | 
| 
       2338 
     | 
    
         
            -
             
     | 
| 
      
 2338 
     | 
    
         
            +
             
     | 
| 
       2339 
2339 
     | 
    
         
             
                // delete items explicitly to avoid leaks on IE
         
     | 
| 
       2340 
2340 
     | 
    
         
             
                var info = this.mouseDownInfo, key;
         
     | 
| 
       2341 
2341 
     | 
    
         
             
                if (info) {
         
     | 
| 
         @@ -2346,10 +2346,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2346 
2346 
     | 
    
         
             
                }
         
     | 
| 
       2347 
2347 
     | 
    
         
             
                this.mouseDownInfo = null;
         
     | 
| 
       2348 
2348 
     | 
    
         
             
              },
         
     | 
| 
       2349 
     | 
    
         
            -
             
     | 
| 
      
 2349 
     | 
    
         
            +
             
     | 
| 
       2350 
2350 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2351 
2351 
     | 
    
         
             
              mouseMoved: function(ev) {
         
     | 
| 
       2352 
     | 
    
         
            -
                var view = this.itemViewForEvent(ev), 
     | 
| 
      
 2352 
     | 
    
         
            +
                var view = this.itemViewForEvent(ev),
         
     | 
| 
       2353 
2353 
     | 
    
         
             
                    last = this._lastHoveredItem ;
         
     | 
| 
       2354 
2354 
     | 
    
         | 
| 
       2355 
2355 
     | 
    
         
             
                // handle hover events.
         
     | 
| 
         @@ -2362,7 +2362,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2362 
2362 
     | 
    
         
             
                if (view && view.mouseMoved) view.mouseMoved(ev);
         
     | 
| 
       2363 
2363 
     | 
    
         
             
                return YES;
         
     | 
| 
       2364 
2364 
     | 
    
         
             
              },
         
     | 
| 
       2365 
     | 
    
         
            -
             
     | 
| 
      
 2365 
     | 
    
         
            +
             
     | 
| 
       2366 
2366 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2367 
2367 
     | 
    
         
             
              mouseExited: function(ev) {
         
     | 
| 
       2368 
2368 
     | 
    
         
             
                var view = this._lastHoveredItem ;
         
     | 
| 
         @@ -2370,11 +2370,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2370 
2370 
     | 
    
         
             
                if (view && view.mouseExited) view.mouseExited(ev) ;
         
     | 
| 
       2371 
2371 
     | 
    
         
             
                return YES ;
         
     | 
| 
       2372 
2372 
     | 
    
         
             
              },
         
     | 
| 
       2373 
     | 
    
         
            -
             
     | 
| 
      
 2373 
     | 
    
         
            +
             
     | 
| 
       2374 
2374 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       2375 
2375 
     | 
    
         
             
              // TOUCH EVENTS
         
     | 
| 
       2376 
2376 
     | 
    
         
             
              //
         
     | 
| 
       2377 
     | 
    
         
            -
             
     | 
| 
      
 2377 
     | 
    
         
            +
             
     | 
| 
       2378 
2378 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2379 
2379 
     | 
    
         
             
              touchStart: function(touch, evt) {
         
     | 
| 
       2380 
2380 
     | 
    
         
             
                var itemView = this.itemViewForEvent(touch),
         
     | 
| 
         @@ -2385,14 +2385,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2385 
2385 
     | 
    
         
             
                // become first responder if possible.
         
     | 
| 
       2386 
2386 
     | 
    
         
             
                this.becomeFirstResponder() ;
         
     | 
| 
       2387 
2387 
     | 
    
         | 
| 
      
 2388 
     | 
    
         
            +
                this._touchSelectedView = itemView;
         
     | 
| 
      
 2389 
     | 
    
         
            +
             
     | 
| 
       2388 
2390 
     | 
    
         
             
                if (!this.get('useToggleSelection')) {
         
     | 
| 
       2389 
2391 
     | 
    
         
             
                  // We're faking the selection visually here
         
     | 
| 
       2390 
2392 
     | 
    
         
             
                  // Only track this if we added a selection so we can remove it later
         
     | 
| 
       2391 
2393 
     | 
    
         
             
                  if (itemView && !itemView.get('isSelected')) {
         
     | 
| 
       2392 
2394 
     | 
    
         
             
                    itemView.set('isSelected', YES);
         
     | 
| 
       2393 
     | 
    
         
            -
                    this._touchSelectedView = itemView;
         
     | 
| 
       2394 
     | 
    
         
            -
                  } else {
         
     | 
| 
       2395 
     | 
    
         
            -
                    this._touchSelectedView = null;
         
     | 
| 
       2396 
2395 
     | 
    
         
             
                  }
         
     | 
| 
       2397 
2396 
     | 
    
         
             
                }
         
     | 
| 
       2398 
2397 
     | 
    
         | 
| 
         @@ -2462,12 +2461,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2462 
2461 
     | 
    
         | 
| 
       2463 
2462 
     | 
    
         
             
              /** @private */
         
     | 
| 
       2464 
2463 
     | 
    
         
             
              _findSelectionExtendedByShift: function(sel, contentIndex) {
         
     | 
| 
       2465 
     | 
    
         
            -
             
     | 
| 
      
 2464 
     | 
    
         
            +
             
     | 
| 
       2466 
2465 
     | 
    
         
             
                // fast path.  if we don't have a selection, just select index
         
     | 
| 
       2467 
2466 
     | 
    
         
             
                if (!sel || sel.get('length')===0) {
         
     | 
| 
       2468 
2467 
     | 
    
         
             
                  return SC.IndexSet.create(contentIndex);
         
     | 
| 
       2469 
2468 
     | 
    
         
             
                }
         
     | 
| 
       2470 
     | 
    
         
            -
             
     | 
| 
      
 2469 
     | 
    
         
            +
             
     | 
| 
       2471 
2470 
     | 
    
         
             
                // if we do have a selection, then figure out how to extend it.
         
     | 
| 
       2472 
2471 
     | 
    
         
             
                var content = this.get('content'),
         
     | 
| 
       2473 
2472 
     | 
    
         
             
                    lim     = content.get('length')-1,
         
     | 
| 
         @@ -2481,17 +2480,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2481 
2480 
     | 
    
         
             
                if (contentIndex < min) {
         
     | 
| 
       2482 
2481 
     | 
    
         
             
                  min = contentIndex;
         
     | 
| 
       2483 
2482 
     | 
    
         
             
                  if (anchor<0) this._selectionAnchor = anchor = max; //anchor at end
         
     | 
| 
       2484 
     | 
    
         
            -
             
     | 
| 
      
 2483 
     | 
    
         
            +
             
     | 
| 
       2485 
2484 
     | 
    
         
             
                // clicked after the current selection set... extend it's ending...
         
     | 
| 
       2486 
2485 
     | 
    
         
             
                } else if (contentIndex > max) {
         
     | 
| 
       2487 
2486 
     | 
    
         
             
                  max = contentIndex;
         
     | 
| 
       2488 
2487 
     | 
    
         
             
                  if (anchor<0) this._selectionAnchor = anchor = min; // anchor at start
         
     | 
| 
       2489 
     | 
    
         
            -
             
     | 
| 
      
 2488 
     | 
    
         
            +
             
     | 
| 
       2490 
2489 
     | 
    
         
             
                // clicked inside the selection set... need to determine where the last
         
     | 
| 
       2491 
2490 
     | 
    
         
             
                // selection was and use that as an anchor.
         
     | 
| 
       2492 
2491 
     | 
    
         
             
                } else if (contentIndex >= min && contentIndex <= max) {
         
     | 
| 
       2493 
2492 
     | 
    
         
             
                  if (anchor<0) this._selectionAnchor = anchor = min; //anchor at start
         
     | 
| 
       2494 
     | 
    
         
            -
             
     | 
| 
      
 2493 
     | 
    
         
            +
             
     | 
| 
       2495 
2494 
     | 
    
         
             
                  if (contentIndex === anchor) min = max = contentIndex ;
         
     | 
| 
       2496 
2495 
     | 
    
         
             
                  else if (contentIndex > anchor) {
         
     | 
| 
       2497 
2496 
     | 
    
         
             
                    min = anchor;
         
     | 
| 
         @@ -2504,62 +2503,62 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2504 
2503 
     | 
    
         | 
| 
       2505 
2504 
     | 
    
         
             
                return SC.IndexSet.create(min, max - min + 1);
         
     | 
| 
       2506 
2505 
     | 
    
         
             
              },
         
     | 
| 
       2507 
     | 
    
         
            -
             
     | 
| 
      
 2506 
     | 
    
         
            +
             
     | 
| 
       2508 
2507 
     | 
    
         
             
              // ......................................
         
     | 
| 
       2509 
2508 
     | 
    
         
             
              // DRAG AND DROP SUPPORT
         
     | 
| 
       2510 
2509 
     | 
    
         
             
              //
         
     | 
| 
       2511 
2510 
     | 
    
         | 
| 
       2512 
2511 
     | 
    
         
             
              /**
         
     | 
| 
       2513 
2512 
     | 
    
         
             
                When reordering its content, the collection view will store its reorder
         
     | 
| 
       2514 
     | 
    
         
            -
                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
         
     | 
| 
       2515 
2514 
     | 
    
         
             
                collection view instance.  You can use this data type to detect reorders
         
     | 
| 
       2516 
2515 
     | 
    
         
             
                if necessary.
         
     | 
| 
       2517 
     | 
    
         
            -
             
     | 
| 
      
 2516 
     | 
    
         
            +
             
     | 
| 
       2518 
2517 
     | 
    
         
             
                @field
         
     | 
| 
       2519 
2518 
     | 
    
         
             
                @type String
         
     | 
| 
       2520 
2519 
     | 
    
         
             
              */
         
     | 
| 
       2521 
2520 
     | 
    
         
             
              reorderDataType: function() {
         
     | 
| 
       2522 
2521 
     | 
    
         
             
                return 'SC.CollectionView.Reorder.'+SC.guidFor(this) ;
         
     | 
| 
       2523 
2522 
     | 
    
         
             
              }.property().cacheable(),
         
     | 
| 
       2524 
     | 
    
         
            -
             
     | 
| 
      
 2523 
     | 
    
         
            +
             
     | 
| 
       2525 
2524 
     | 
    
         
             
              /**
         
     | 
| 
       2526 
     | 
    
         
            -
                This property is set to the IndexSet of content objects that are the 
     | 
| 
       2527 
     | 
    
         
            -
                subject of a drag whenever a drag is initiated on the collection view. 
     | 
| 
       2528 
     | 
    
         
            -
                You can consult this property when implementing your collection view 
     | 
| 
       2529 
     | 
    
         
            -
                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
         
     | 
| 
       2530 
2529 
     | 
    
         
             
                code.
         
     | 
| 
       2531 
2530 
     | 
    
         | 
| 
       2532 
2531 
     | 
    
         
             
                @type SC.IndexSet
         
     | 
| 
       2533 
2532 
     | 
    
         
             
                @default null
         
     | 
| 
       2534 
2533 
     | 
    
         
             
              */
         
     | 
| 
       2535 
2534 
     | 
    
         
             
              dragContent: null,
         
     | 
| 
       2536 
     | 
    
         
            -
             
     | 
| 
      
 2535 
     | 
    
         
            +
             
     | 
| 
       2537 
2536 
     | 
    
         
             
              /**
         
     | 
| 
       2538 
2537 
     | 
    
         
             
                This property is set to the proposed insertion index during a call to
         
     | 
| 
       2539 
     | 
    
         
            -
                collectionViewValidateDragOperation().  Your delegate implementations can 
     | 
| 
       2540 
     | 
    
         
            -
                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
         
     | 
| 
       2541 
2540 
     | 
    
         
             
                location.
         
     | 
| 
       2542 
     | 
    
         
            -
             
     | 
| 
      
 2541 
     | 
    
         
            +
             
     | 
| 
       2543 
2542 
     | 
    
         
             
                @type Number
         
     | 
| 
       2544 
2543 
     | 
    
         
             
                @default null
         
     | 
| 
       2545 
2544 
     | 
    
         
             
              */
         
     | 
| 
       2546 
2545 
     | 
    
         
             
              proposedInsertionIndex: null,
         
     | 
| 
       2547 
     | 
    
         
            -
             
     | 
| 
      
 2546 
     | 
    
         
            +
             
     | 
| 
       2548 
2547 
     | 
    
         
             
              /**
         
     | 
| 
       2549 
2548 
     | 
    
         
             
                This property is set to the proposed drop operation during a call to
         
     | 
| 
       2550 
     | 
    
         
            -
                collectionViewValidateDragOperation().  Your delegate implementations can 
     | 
| 
       2551 
     | 
    
         
            -
                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
         
     | 
| 
       2552 
2551 
     | 
    
         
             
                operation.
         
     | 
| 
       2553 
     | 
    
         
            -
             
     | 
| 
      
 2552 
     | 
    
         
            +
             
     | 
| 
       2554 
2553 
     | 
    
         
             
                @type Number
         
     | 
| 
       2555 
2554 
     | 
    
         
             
                @default null
         
     | 
| 
       2556 
2555 
     | 
    
         
             
              */
         
     | 
| 
       2557 
2556 
     | 
    
         
             
              proposedDropOperation: null,
         
     | 
| 
       2558 
     | 
    
         
            -
             
     | 
| 
      
 2557 
     | 
    
         
            +
             
     | 
| 
       2559 
2558 
     | 
    
         
             
              /** @private
         
     | 
| 
       2560 
2559 
     | 
    
         
             
                mouseDragged event handler.  Initiates a drag if the following conditions
         
     | 
| 
       2561 
2560 
     | 
    
         
             
                are met:
         
     | 
| 
       2562 
     | 
    
         
            -
             
     | 
| 
      
 2561 
     | 
    
         
            +
             
     | 
| 
       2563 
2562 
     | 
    
         
             
                - collectionViewShouldBeginDrag() returns YES *OR*
         
     | 
| 
       2564 
2563 
     | 
    
         
             
                - the above method is not implemented and canReorderContent is true.
         
     | 
| 
       2565 
2564 
     | 
    
         
             
                - the dragDataTypes property returns a non-empty array
         
     | 
| 
         @@ -2572,55 +2571,55 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2572 
2571 
     | 
    
         
             
                    info    = this.mouseDownInfo,
         
     | 
| 
       2573 
2572 
     | 
    
         
             
                    groupIndexes = this.get('_contentGroupIndexes'),
         
     | 
| 
       2574 
2573 
     | 
    
         
             
                    dragContent, dragDataTypes, dragView;
         
     | 
| 
       2575 
     | 
    
         
            -
             
     | 
| 
      
 2574 
     | 
    
         
            +
             
     | 
| 
       2576 
2575 
     | 
    
         
             
                // if the mouse down event was cleared, there is nothing to do; return.
         
     | 
| 
       2577 
2576 
     | 
    
         
             
                if (!info || info.contentIndex<0) return YES ;
         
     | 
| 
       2578 
     | 
    
         
            -
             
     | 
| 
      
 2577 
     | 
    
         
            +
             
     | 
| 
       2579 
2578 
     | 
    
         
             
                // Don't do anything unless the user has been dragging for 123msec
         
     | 
| 
       2580 
2579 
     | 
    
         
             
                if ((Date.now() - info.at) < 123) return YES ;
         
     | 
| 
       2581 
     | 
    
         
            -
             
     | 
| 
      
 2580 
     | 
    
         
            +
             
     | 
| 
       2582 
2581 
     | 
    
         
             
                // OK, they must be serious, decide if a drag will be allowed.
         
     | 
| 
       2583 
2582 
     | 
    
         
             
                if (del.collectionViewShouldBeginDrag(this)) {
         
     | 
| 
       2584 
     | 
    
         
            -
             
     | 
| 
      
 2583 
     | 
    
         
            +
             
     | 
| 
       2585 
2584 
     | 
    
         
             
                  // First, get the selection to drag.  Drag an array of selected
         
     | 
| 
       2586 
     | 
    
         
            -
                  // items appearing in this collection, in the order of the 
     | 
| 
      
 2585 
     | 
    
         
            +
                  // items appearing in this collection, in the order of the
         
     | 
| 
       2587 
2586 
     | 
    
         
             
                  // collection.
         
     | 
| 
       2588 
2587 
     | 
    
         
             
                  //
         
     | 
| 
       2589 
     | 
    
         
            -
                  // Compute the dragContent - the indexes we will be dragging. 
     | 
| 
       2590 
     | 
    
         
            -
                  // 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
         
     | 
| 
       2591 
2590 
     | 
    
         
             
                  // updated to whatever the user clicked.  Instead use
         
     | 
| 
       2592 
2591 
     | 
    
         
             
                  // mouse down content.
         
     | 
| 
       2593 
2592 
     | 
    
         
             
                  if (!this.get("selectOnMouseDown")) {
         
     | 
| 
       2594 
2593 
     | 
    
         
             
                    dragContent = SC.IndexSet.create(info.contentIndex);
         
     | 
| 
       2595 
2594 
     | 
    
         
             
                  } else dragContent = sel ? sel.indexSetForSource(content) : null;
         
     | 
| 
       2596 
     | 
    
         
            -
             
     | 
| 
      
 2595 
     | 
    
         
            +
             
     | 
| 
       2597 
2596 
     | 
    
         
             
                  // remove any group indexes.  groups cannot be dragged.
         
     | 
| 
       2598 
2597 
     | 
    
         
             
                  if (dragContent && groupIndexes && groupIndexes.get('length')>0) {
         
     | 
| 
       2599 
2598 
     | 
    
         
             
                    dragContent = dragContent.copy().remove(groupIndexes);
         
     | 
| 
       2600 
2599 
     | 
    
         
             
                    if (dragContent.get('length')===0) dragContent = null;
         
     | 
| 
       2601 
2600 
     | 
    
         
             
                    else dragContent.freeze();
         
     | 
| 
       2602 
2601 
     | 
    
         
             
                  }
         
     | 
| 
       2603 
     | 
    
         
            -
             
     | 
| 
      
 2602 
     | 
    
         
            +
             
     | 
| 
       2604 
2603 
     | 
    
         
             
                  if (!dragContent) return YES; // nothing to drag
         
     | 
| 
       2605 
2604 
     | 
    
         
             
                  else dragContent = dragContent.frozenCopy(); // so it doesn't change
         
     | 
| 
       2606 
     | 
    
         
            -
             
     | 
| 
      
 2605 
     | 
    
         
            +
             
     | 
| 
       2607 
2606 
     | 
    
         
             
                  dragContent = { content: content, indexes: dragContent };
         
     | 
| 
       2608 
2607 
     | 
    
         
             
                  this.set('dragContent', dragContent) ;
         
     | 
| 
       2609 
     | 
    
         
            -
             
     | 
| 
      
 2608 
     | 
    
         
            +
             
     | 
| 
       2610 
2609 
     | 
    
         
             
                  // Get the set of data types supported by the delegate.  If this returns
         
     | 
| 
       2611 
2610 
     | 
    
         
             
                  // a null or empty array and reordering content is not also supported
         
     | 
| 
       2612 
2611 
     | 
    
         
             
                  // then do not start the drag.
         
     | 
| 
       2613 
2612 
     | 
    
         
             
                  dragDataTypes = this.get('dragDataTypes');
         
     | 
| 
       2614 
2613 
     | 
    
         
             
                  if (dragDataTypes && dragDataTypes.get('length') > 0) {
         
     | 
| 
       2615 
     | 
    
         
            -
             
     | 
| 
       2616 
     | 
    
         
            -
                    // Build the drag view to use for the ghost drag.  This 
     | 
| 
      
 2614 
     | 
    
         
            +
             
     | 
| 
      
 2615 
     | 
    
         
            +
                    // Build the drag view to use for the ghost drag.  This
         
     | 
| 
       2617 
2616 
     | 
    
         
             
                    // should essentially contain any visible drag items.
         
     | 
| 
       2618 
2617 
     | 
    
         
             
                    dragView = del.collectionViewDragViewFor(this, dragContent.indexes);
         
     | 
| 
       2619 
2618 
     | 
    
         
             
                    if (!dragView) dragView = this._cv_dragViewFor(dragContent.indexes);
         
     | 
| 
       2620 
     | 
    
         
            -
             
     | 
| 
      
 2619 
     | 
    
         
            +
             
     | 
| 
       2621 
2620 
     | 
    
         
             
                    // Make sure the dragView has created its layer.
         
     | 
| 
       2622 
2621 
     | 
    
         
             
                    dragView.createLayer();
         
     | 
| 
       2623 
     | 
    
         
            -
             
     | 
| 
      
 2622 
     | 
    
         
            +
             
     | 
| 
       2624 
2623 
     | 
    
         
             
                    // Initiate the drag
         
     | 
| 
       2625 
2624 
     | 
    
         
             
                    SC.Drag.start({
         
     | 
| 
       2626 
2625 
     | 
    
         
             
                      event: info.event,
         
     | 
| 
         @@ -2630,16 +2629,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2630 
2629 
     | 
    
         
             
                      ghostActsLikeCursor: del.ghostActsLikeCursor,
         
     | 
| 
       2631 
2630 
     | 
    
         
             
                      slideBack: YES,
         
     | 
| 
       2632 
2631 
     | 
    
         
             
                      dataSource: this
         
     | 
| 
       2633 
     | 
    
         
            -
                    }); 
     | 
| 
      
 2632 
     | 
    
         
            +
                    });
         
     | 
| 
       2634 
2633 
     | 
    
         | 
| 
       2635 
     | 
    
         
            -
                    // Also use this opportunity to clean up since mouseUp won't 
     | 
| 
      
 2634 
     | 
    
         
            +
                    // Also use this opportunity to clean up since mouseUp won't
         
     | 
| 
       2636 
2635 
     | 
    
         
             
                    // get called.
         
     | 
| 
       2637 
2636 
     | 
    
         
             
                    this._cleanupMouseDown() ;
         
     | 
| 
       2638 
2637 
     | 
    
         
             
                    this._lastInsertionIndex = null ;
         
     | 
| 
       2639 
     | 
    
         
            -
             
     | 
| 
      
 2638 
     | 
    
         
            +
             
     | 
| 
       2640 
2639 
     | 
    
         
             
                  // Drag was not allowed by the delegate, so bail.
         
     | 
| 
       2641 
2640 
     | 
    
         
             
                  } else this.set('dragContent', null) ;
         
     | 
| 
       2642 
     | 
    
         
            -
             
     | 
| 
      
 2641 
     | 
    
         
            +
             
     | 
| 
       2643 
2642 
     | 
    
         
             
                  return YES ;
         
     | 
| 
       2644 
2643 
     | 
    
         
             
                }
         
     | 
| 
       2645 
2644 
     | 
    
         
             
              },
         
     | 
| 
         @@ -2661,20 +2660,20 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2661 
2660 
     | 
    
         
             
                SC.$(dragLayer).css('backgroundColor', 'transparent')
         
     | 
| 
       2662 
2661 
     | 
    
         
             
                  .css('border', 'none')
         
     | 
| 
       2663 
2662 
     | 
    
         
             
                  .css('top', 0).css('left', 0);
         
     | 
| 
       2664 
     | 
    
         
            -
             
     | 
| 
      
 2663 
     | 
    
         
            +
             
     | 
| 
       2665 
2664 
     | 
    
         
             
                indexes.forEach(function(i) {
         
     | 
| 
       2666 
2665 
     | 
    
         
             
                  var itemView = this.itemViewForContentIndex(i),
         
     | 
| 
       2667 
2666 
     | 
    
         
             
                      isSelected, layer;
         
     | 
| 
       2668 
     | 
    
         
            -
             
     | 
| 
       2669 
     | 
    
         
            -
                  // render item view without isSelected state. 
     | 
| 
      
 2667 
     | 
    
         
            +
             
     | 
| 
      
 2668 
     | 
    
         
            +
                  // render item view without isSelected state.
         
     | 
| 
       2670 
2669 
     | 
    
         
             
                  if (itemView) {
         
     | 
| 
       2671 
2670 
     | 
    
         
             
                    isSelected = itemView.get('isSelected');
         
     | 
| 
       2672 
2671 
     | 
    
         
             
                    itemView.set('isSelected', NO);
         
     | 
| 
       2673 
     | 
    
         
            -
             
     | 
| 
      
 2672 
     | 
    
         
            +
             
     | 
| 
       2674 
2673 
     | 
    
         
             
                    itemView.updateLayerIfNeeded();
         
     | 
| 
       2675 
2674 
     | 
    
         
             
                    layer = itemView.get('layer');
         
     | 
| 
       2676 
2675 
     | 
    
         
             
                    if (layer) layer = layer.cloneNode(true);
         
     | 
| 
       2677 
     | 
    
         
            -
             
     | 
| 
      
 2676 
     | 
    
         
            +
             
     | 
| 
       2678 
2677 
     | 
    
         
             
                    itemView.set('isSelected', isSelected);
         
     | 
| 
       2679 
2678 
     | 
    
         
             
                    itemView.updateLayerIfNeeded();
         
     | 
| 
       2680 
2679 
     | 
    
         
             
                  }
         
     | 
| 
         @@ -2687,7 +2686,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2687 
2686 
     | 
    
         
             
                    }
         
     | 
| 
       2688 
2687 
     | 
    
         
             
                  }
         
     | 
| 
       2689 
2688 
     | 
    
         
             
                  layer = null;
         
     | 
| 
       2690 
     | 
    
         
            -
             
     | 
| 
      
 2689 
     | 
    
         
            +
             
     | 
| 
       2691 
2690 
     | 
    
         
             
                }, this);
         
     | 
| 
       2692 
2691 
     | 
    
         
             
                // we don't want to show the scrollbars, resize the dragview'
         
     | 
| 
       2693 
2692 
     | 
    
         
             
                view.set('layout', {height:height});
         
     | 
| 
         @@ -2696,12 +2695,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2696 
2695 
     | 
    
         
             
                return view ;
         
     | 
| 
       2697 
2696 
     | 
    
         
             
              },
         
     | 
| 
       2698 
2697 
     | 
    
         | 
| 
       2699 
     | 
    
         
            -
             
     | 
| 
      
 2698 
     | 
    
         
            +
             
     | 
| 
       2700 
2699 
     | 
    
         
             
              /**
         
     | 
| 
       2701 
2700 
     | 
    
         
             
                Implements the drag data source protocol for the collection view.  This
         
     | 
| 
       2702 
2701 
     | 
    
         
             
                property will consult the collection view delegate if one is provided. It
         
     | 
| 
       2703 
2702 
     | 
    
         
             
                will also do the right thing if you have set canReorderContent to YES.
         
     | 
| 
       2704 
     | 
    
         
            -
             
     | 
| 
      
 2703 
     | 
    
         
            +
             
     | 
| 
       2705 
2704 
     | 
    
         
             
                @field
         
     | 
| 
       2706 
2705 
     | 
    
         
             
                @type Array
         
     | 
| 
       2707 
2706 
     | 
    
         
             
              */
         
     | 
| 
         @@ -2716,37 +2715,37 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2716 
2715 
     | 
    
         
             
                  key = this.get('reorderDataType');
         
     | 
| 
       2717 
2716 
     | 
    
         
             
                  if (ret.indexOf(key) < 0) ret.push(key);
         
     | 
| 
       2718 
2717 
     | 
    
         
             
                }
         
     | 
| 
       2719 
     | 
    
         
            -
             
     | 
| 
      
 2718 
     | 
    
         
            +
             
     | 
| 
       2720 
2719 
     | 
    
         
             
                return ret ? ret : [];
         
     | 
| 
       2721 
2720 
     | 
    
         
             
              }.property(),
         
     | 
| 
       2722 
     | 
    
         
            -
             
     | 
| 
      
 2721 
     | 
    
         
            +
             
     | 
| 
       2723 
2722 
     | 
    
         
             
              /**
         
     | 
| 
       2724 
2723 
     | 
    
         
             
                Implements the drag data source protocol method. The implementation of
         
     | 
| 
       2725 
2724 
     | 
    
         
             
                this method will consult the collection view delegate if one has been
         
     | 
| 
       2726 
     | 
    
         
            -
                provided.  It also respects the  
     | 
| 
      
 2725 
     | 
    
         
            +
                provided.  It also respects the canReorderContent method.
         
     | 
| 
       2727 
2726 
     | 
    
         
             
              */
         
     | 
| 
       2728 
2727 
     | 
    
         
             
              dragDataForType: function(drag, dataType) {
         
     | 
| 
       2729 
     | 
    
         
            -
             
     | 
| 
      
 2728 
     | 
    
         
            +
             
     | 
| 
       2730 
2729 
     | 
    
         
             
                // if this is a reorder, then return drag content.
         
     | 
| 
       2731 
2730 
     | 
    
         
             
                if (this.get('canReorderContent')) {
         
     | 
| 
       2732 
2731 
     | 
    
         
             
                  if (dataType === this.get('reorderDataType')) {
         
     | 
| 
       2733 
2732 
     | 
    
         
             
                    return this.get('dragContent') ;
         
     | 
| 
       2734 
2733 
     | 
    
         
             
                  }
         
     | 
| 
       2735 
2734 
     | 
    
         
             
                }
         
     | 
| 
       2736 
     | 
    
         
            -
             
     | 
| 
      
 2735 
     | 
    
         
            +
             
     | 
| 
       2737 
2736 
     | 
    
         
             
                // otherwise, just pass along to the delegate
         
     | 
| 
       2738 
2737 
     | 
    
         
             
                var del = this.get('selectionDelegate');
         
     | 
| 
       2739 
2738 
     | 
    
         
             
                return del.collectionViewDragDataForType(this, drag, dataType);
         
     | 
| 
       2740 
2739 
     | 
    
         
             
              },
         
     | 
| 
       2741 
     | 
    
         
            -
             
     | 
| 
      
 2740 
     | 
    
         
            +
             
     | 
| 
       2742 
2741 
     | 
    
         
             
              /**
         
     | 
| 
       2743 
2742 
     | 
    
         
             
                Implements the SC.DropTarget interface.  The default implementation will
         
     | 
| 
       2744 
2743 
     | 
    
         
             
                consult the collection view delegate, if you implement those methods.
         
     | 
| 
       2745 
     | 
    
         
            -
             
     | 
| 
       2746 
     | 
    
         
            -
                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
         
     | 
| 
       2747 
2746 
     | 
    
         
             
                return value will be stored on the drag object as allowedDragOperations,
         
     | 
| 
       2748 
2747 
     | 
    
         
             
                possibly further constrained by the drag source.
         
     | 
| 
       2749 
     | 
    
         
            -
             
     | 
| 
      
 2748 
     | 
    
         
            +
             
     | 
| 
       2750 
2749 
     | 
    
         
             
                @param {SC.Drag} drag the drag object
         
     | 
| 
       2751 
2750 
     | 
    
         
             
                @param {SC.Event} evt the event triggering this change, if available
         
     | 
| 
       2752 
2751 
     | 
    
         
             
                @returns {Number} logical OR'd mask of allowed drag operations.
         
     | 
| 
         @@ -2762,17 +2761,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2762 
2761 
     | 
    
         
             
                    op = SC.DRAG_REORDER ;
         
     | 
| 
       2763 
2762 
     | 
    
         
             
                  }
         
     | 
| 
       2764 
2763 
     | 
    
         
             
                }
         
     | 
| 
       2765 
     | 
    
         
            -
             
     | 
| 
      
 2764 
     | 
    
         
            +
             
     | 
| 
       2766 
2765 
     | 
    
         
             
                // Now pass this onto the delegate.
         
     | 
| 
       2767 
2766 
     | 
    
         
             
                op = del.collectionViewComputeDragOperations(this, drag, op);
         
     | 
| 
       2768 
2767 
     | 
    
         
             
                if (op & SC.DRAG_REORDER) op = SC.DRAG_MOVE ;
         
     | 
| 
       2769 
     | 
    
         
            -
             
     | 
| 
      
 2768 
     | 
    
         
            +
             
     | 
| 
       2770 
2769 
     | 
    
         
             
                return op ;
         
     | 
| 
       2771 
2770 
     | 
    
         
             
              },
         
     | 
| 
       2772 
     | 
    
         
            -
             
     | 
| 
      
 2771 
     | 
    
         
            +
             
     | 
| 
       2773 
2772 
     | 
    
         
             
              /** @private
         
     | 
| 
       2774 
2773 
     | 
    
         
             
                Determines the allowed drop operation insertion point, operation type,
         
     | 
| 
       2775 
     | 
    
         
            -
                and the drag operation to be performed.  Used by dragUpdated() and 
     | 
| 
      
 2774 
     | 
    
         
            +
                and the drag operation to be performed.  Used by dragUpdated() and
         
     | 
| 
       2776 
2775 
     | 
    
         
             
                performDragOperation().
         
     | 
| 
       2777 
2776 
     | 
    
         | 
| 
       2778 
2777 
     | 
    
         
             
                @param {SC.Drag} drag the drag object
         
     | 
| 
         @@ -2783,17 +2782,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2783 
2782 
     | 
    
         
             
              _computeDropOperationState: function(drag, evt, dragOp) {
         
     | 
| 
       2784 
2783 
     | 
    
         
             
                // get the insertion index for this location.  This can be computed
         
     | 
| 
       2785 
2784 
     | 
    
         
             
                // by a subclass using whatever method.  This method is not expected to
         
     | 
| 
       2786 
     | 
    
         
            -
                // 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
         
     | 
| 
       2787 
2786 
     | 
    
         
             
                // index.
         
     | 
| 
       2788 
2787 
     | 
    
         
             
                var loc    = this.convertFrameFromView(drag.get('location'), null),
         
     | 
| 
       2789 
2788 
     | 
    
         
             
                    dropOp = SC.DROP_BEFORE,
         
     | 
| 
       2790 
2789 
     | 
    
         
             
                    del    = this.get('selectionDelegate'),
         
     | 
| 
       2791 
2790 
     | 
    
         
             
                    canReorder = this.get('canReorderContent'),
         
     | 
| 
       2792 
2791 
     | 
    
         
             
                    objects, content, isPreviousInDrag, isNextInDrag, len, tmp;
         
     | 
| 
       2793 
     | 
    
         
            -
             
     | 
| 
       2794 
     | 
    
         
            -
                // 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
         
     | 
| 
       2795 
2794 
     | 
    
         
             
                // supported by view.
         
     | 
| 
       2796 
     | 
    
         
            -
             
     | 
| 
      
 2795 
     | 
    
         
            +
             
     | 
| 
       2797 
2796 
     | 
    
         
             
                // get the computed insertion index and possibly drop operation.
         
     | 
| 
       2798 
2797 
     | 
    
         
             
                // prefer to drop ON.
         
     | 
| 
       2799 
2798 
     | 
    
         
             
                var idx = this.insertionIndexForLocation(loc, SC.DROP_ON) ;
         
     | 
| 
         @@ -2801,13 +2800,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2801 
2800 
     | 
    
         
             
                  dropOp = idx[1] ; // order matters here
         
     | 
| 
       2802 
2801 
     | 
    
         
             
                  idx = idx[0] ;
         
     | 
| 
       2803 
2802 
     | 
    
         
             
                }
         
     | 
| 
       2804 
     | 
    
         
            -
             
     | 
| 
      
 2803 
     | 
    
         
            +
             
     | 
| 
       2805 
2804 
     | 
    
         
             
                // if the return drop operation is DROP_ON, then just check it with the
         
     | 
| 
       2806 
2805 
     | 
    
         
             
                // delegate method.  If the delegate method does not support dropping on,
         
     | 
| 
       2807 
2806 
     | 
    
         
             
                // then it will return DRAG_NONE, in which case we will try again with
         
     | 
| 
       2808 
2807 
     | 
    
         
             
                // drop before.
         
     | 
| 
       2809 
2808 
     | 
    
         
             
                if (dropOp === SC.DROP_ON) {
         
     | 
| 
       2810 
     | 
    
         
            -
             
     | 
| 
      
 2809 
     | 
    
         
            +
             
     | 
| 
       2811 
2810 
     | 
    
         
             
                  // Now save the insertion index and the dropOp.  This may be changed by
         
     | 
| 
       2812 
2811 
     | 
    
         
             
                  // the collection delegate.
         
     | 
| 
       2813 
2812 
     | 
    
         
             
                  this.set('proposedInsertionIndex', idx) ;
         
     | 
| 
         @@ -2819,9 +2818,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2819 
2818 
     | 
    
         | 
| 
       2820 
2819 
     | 
    
         
             
                  // The delegate is OK with a drop on also, so just return.
         
     | 
| 
       2821 
2820 
     | 
    
         
             
                  if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp] ;
         
     | 
| 
       2822 
     | 
    
         
            -
             
     | 
| 
      
 2821 
     | 
    
         
            +
             
     | 
| 
       2823 
2822 
     | 
    
         
             
                  // The delegate is NOT OK with a drop on, try to get the insertion
         
     | 
| 
       2824 
     | 
    
         
            -
                  // 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
         
     | 
| 
       2825 
2824 
     | 
    
         
             
                  // rest of the method run...
         
     | 
| 
       2826 
2825 
     | 
    
         
             
                  else {
         
     | 
| 
       2827 
2826 
     | 
    
         
             
                    dropOp = SC.DROP_BEFORE ;
         
     | 
| 
         @@ -2832,19 +2831,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2832 
2831 
     | 
    
         
             
                    }
         
     | 
| 
       2833 
2832 
     | 
    
         
             
                  }
         
     | 
| 
       2834 
2833 
     | 
    
         
             
                }
         
     | 
| 
       2835 
     | 
    
         
            -
             
     | 
| 
      
 2834 
     | 
    
         
            +
             
     | 
| 
       2836 
2835 
     | 
    
         
             
                // if this is a reorder drag, set the proposed op to SC.DRAG_REORDER and
         
     | 
| 
       2837 
2836 
     | 
    
         
             
                // validate the insertion point.  This only works if the insertion point
         
     | 
| 
       2838 
     | 
    
         
            -
                // 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
         
     | 
| 
       2839 
2838 
     | 
    
         
             
                // content.
         
     | 
| 
       2840 
2839 
     | 
    
         
             
                if ((idx >= 0) && canReorder && (dropOp !== SC.DROP_ON)) {
         
     | 
| 
       2841 
     | 
    
         
            -
             
     | 
| 
      
 2840 
     | 
    
         
            +
             
     | 
| 
       2842 
2841 
     | 
    
         
             
                  objects = drag.dataForType(this.get('reorderDataType')) ;
         
     | 
| 
       2843 
2842 
     | 
    
         
             
                  if (objects) {
         
     | 
| 
       2844 
2843 
     | 
    
         
             
                    content = this.get('content') ;
         
     | 
| 
       2845 
     | 
    
         
            -
             
     | 
| 
       2846 
     | 
    
         
            -
                    // if the insertion index is in between two items in the drag itself, 
     | 
| 
       2847 
     | 
    
         
            -
                    // 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
         
     | 
| 
       2848 
2847 
     | 
    
         
             
                    // find the first index that is not in between selections.  Stop when
         
     | 
| 
       2849 
2848 
     | 
    
         
             
                    // we get to the beginning.
         
     | 
| 
       2850 
2849 
     | 
    
         
             
                    if (dropOp === SC.DROP_BEFORE) {
         
     | 
| 
         @@ -2854,7 +2853,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2854 
2853 
     | 
    
         
             
                      isPreviousInDrag = objects.indexes.contains(idx);
         
     | 
| 
       2855 
2854 
     | 
    
         
             
                      isNextInDrag     = objects.indexes.contains(idx-1);
         
     | 
| 
       2856 
2855 
     | 
    
         
             
                    }
         
     | 
| 
       2857 
     | 
    
         
            -
             
     | 
| 
      
 2856 
     | 
    
         
            +
             
     | 
| 
       2858 
2857 
     | 
    
         
             
                    if (isPreviousInDrag && isNextInDrag) {
         
     | 
| 
       2859 
2858 
     | 
    
         
             
                      if (SC.none(this._lastInsertionIndex)) {
         
     | 
| 
       2860 
2859 
     | 
    
         
             
                        if (dropOp === SC.DROP_BEFORE) {
         
     | 
| 
         @@ -2865,7 +2864,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2865 
2864 
     | 
    
         
             
                        }
         
     | 
| 
       2866 
2865 
     | 
    
         
             
                      } else idx = this._lastInsertionIndex ;
         
     | 
| 
       2867 
2866 
     | 
    
         
             
                    }
         
     | 
| 
       2868 
     | 
    
         
            -
             
     | 
| 
      
 2867 
     | 
    
         
            +
             
     | 
| 
       2869 
2868 
     | 
    
         
             
                    // If we found a valid insertion point to reorder at, then set the op
         
     | 
| 
       2870 
2869 
     | 
    
         
             
                    // to custom DRAG_REORDER.
         
     | 
| 
       2871 
2870 
     | 
    
         
             
                    if (idx >= 0) dragOp = SC.DRAG_REORDER ;
         
     | 
| 
         @@ -2880,17 +2879,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2880 
2879 
     | 
    
         
             
                idx = this.get('proposedInsertionIndex') ;
         
     | 
| 
       2881 
2880 
     | 
    
         
             
                dropOp = this.get('proposedDropOperation') ;
         
     | 
| 
       2882 
2881 
     | 
    
         
             
                this._dropInsertionIndex = this._dropOperation = null ;
         
     | 
| 
       2883 
     | 
    
         
            -
             
     | 
| 
      
 2882 
     | 
    
         
            +
             
     | 
| 
       2884 
2883 
     | 
    
         
             
                // return generated state
         
     | 
| 
       2885 
2884 
     | 
    
         
             
                return [idx, dropOp, dragOp] ;
         
     | 
| 
       2886 
2885 
     | 
    
         
             
              },
         
     | 
| 
       2887 
     | 
    
         
            -
             
     | 
| 
       2888 
     | 
    
         
            -
              /** 
     | 
| 
      
 2886 
     | 
    
         
            +
             
     | 
| 
      
 2887 
     | 
    
         
            +
              /**
         
     | 
| 
       2889 
2888 
     | 
    
         
             
                Implements the SC.DropTarget interface.  The default implementation will
         
     | 
| 
       2890 
2889 
     | 
    
         
             
                determine the drop location and then consult the collection view delegate
         
     | 
| 
       2891 
2890 
     | 
    
         
             
                if you implement those methods.  Otherwise it will handle reordering
         
     | 
| 
       2892 
2891 
     | 
    
         
             
                content on its own.
         
     | 
| 
       2893 
     | 
    
         
            -
             
     | 
| 
      
 2892 
     | 
    
         
            +
             
     | 
| 
       2894 
2893 
     | 
    
         
             
                @param {SC.Drag} drag The drag that was updated
         
     | 
| 
       2895 
2894 
     | 
    
         
             
                @param {SC.Event} evt The event for the drag
         
     | 
| 
       2896 
2895 
     | 
    
         
             
              */
         
     | 
| 
         @@ -2898,50 +2897,50 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2898 
2897 
     | 
    
         
             
                var op     = drag.get('allowedDragOperations'),
         
     | 
| 
       2899 
2898 
     | 
    
         
             
                    state  = this._computeDropOperationState(drag, evt, op),
         
     | 
| 
       2900 
2899 
     | 
    
         
             
                    idx    = state[0], dropOp = state[1], dragOp = state[2];
         
     | 
| 
       2901 
     | 
    
         
            -
             
     | 
| 
       2902 
     | 
    
         
            -
                // if the insertion index or dropOp have changed, update the insertion 
     | 
| 
      
 2900 
     | 
    
         
            +
             
     | 
| 
      
 2901 
     | 
    
         
            +
                // if the insertion index or dropOp have changed, update the insertion
         
     | 
| 
       2903 
2902 
     | 
    
         
             
                // point
         
     | 
| 
       2904 
2903 
     | 
    
         
             
                if (dragOp !== SC.DRAG_NONE) {
         
     | 
| 
       2905 
2904 
     | 
    
         
             
                  if ((this._lastInsertionIndex !== idx) || (this._lastDropOperation !== dropOp)) {
         
     | 
| 
       2906 
2905 
     | 
    
         
             
                    var itemView = this.itemViewForContentIndex(idx) ;
         
     | 
| 
       2907 
2906 
     | 
    
         
             
                    this.showInsertionPoint(itemView, dropOp) ;
         
     | 
| 
       2908 
2907 
     | 
    
         
             
                  }
         
     | 
| 
       2909 
     | 
    
         
            -
             
     | 
| 
      
 2908 
     | 
    
         
            +
             
     | 
| 
       2910 
2909 
     | 
    
         
             
                  this._lastInsertionIndex = idx ;
         
     | 
| 
       2911 
2910 
     | 
    
         
             
                  this._lastDropOperation = dropOp ;
         
     | 
| 
       2912 
2911 
     | 
    
         
             
                } else {
         
     | 
| 
       2913 
2912 
     | 
    
         
             
                  this.hideInsertionPoint() ;
         
     | 
| 
       2914 
2913 
     | 
    
         
             
                  this._lastInsertionIndex = this._lastDropOperation = null ;
         
     | 
| 
       2915 
2914 
     | 
    
         
             
                }
         
     | 
| 
       2916 
     | 
    
         
            -
             
     | 
| 
       2917 
     | 
    
         
            -
                // Normalize drag operation to the standard kinds accepted by the drag 
     | 
| 
      
 2915 
     | 
    
         
            +
             
     | 
| 
      
 2916 
     | 
    
         
            +
                // Normalize drag operation to the standard kinds accepted by the drag
         
     | 
| 
       2918 
2917 
     | 
    
         
             
                // system.
         
     | 
| 
       2919 
     | 
    
         
            -
                return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp; 
     | 
| 
      
 2918 
     | 
    
         
            +
                return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
         
     | 
| 
       2920 
2919 
     | 
    
         
             
              },
         
     | 
| 
       2921 
     | 
    
         
            -
             
     | 
| 
      
 2920 
     | 
    
         
            +
             
     | 
| 
       2922 
2921 
     | 
    
         
             
              /**
         
     | 
| 
       2923 
     | 
    
         
            -
                Implements the SC.DropTarget protocol.  Hides any visible insertion 
     | 
| 
      
 2922 
     | 
    
         
            +
                Implements the SC.DropTarget protocol.  Hides any visible insertion
         
     | 
| 
       2924 
2923 
     | 
    
         
             
                point and clears some cached values.
         
     | 
| 
       2925 
2924 
     | 
    
         
             
              */
         
     | 
| 
       2926 
2925 
     | 
    
         
             
              dragExited: function() {
         
     | 
| 
       2927 
2926 
     | 
    
         
             
                this.hideInsertionPoint() ;
         
     | 
| 
       2928 
2927 
     | 
    
         
             
                this._lastInsertionIndex = this._lastDropOperation = null ;
         
     | 
| 
       2929 
2928 
     | 
    
         
             
              },
         
     | 
| 
       2930 
     | 
    
         
            -
             
     | 
| 
      
 2929 
     | 
    
         
            +
             
     | 
| 
       2931 
2930 
     | 
    
         
             
              /**
         
     | 
| 
       2932 
2931 
     | 
    
         
             
                Implements the SC.DropTarget protocol.
         
     | 
| 
       2933 
     | 
    
         
            -
             
     | 
| 
      
 2932 
     | 
    
         
            +
             
     | 
| 
       2934 
2933 
     | 
    
         
             
                @returns {Boolean} YES
         
     | 
| 
       2935 
2934 
     | 
    
         
             
              */
         
     | 
| 
       2936 
2935 
     | 
    
         
             
              acceptDragOperation: function(drag, op) {
         
     | 
| 
       2937 
2936 
     | 
    
         
             
                return YES;
         
     | 
| 
       2938 
2937 
     | 
    
         
             
              },
         
     | 
| 
       2939 
     | 
    
         
            -
             
     | 
| 
      
 2938 
     | 
    
         
            +
             
     | 
| 
       2940 
2939 
     | 
    
         
             
              /**
         
     | 
| 
       2941 
2940 
     | 
    
         
             
                Implements the SC.DropTarget protocol. Consults the collection view
         
     | 
| 
       2942 
     | 
    
         
            -
                delegate to actually perform the operation unless the operation is 
     | 
| 
      
 2941 
     | 
    
         
            +
                delegate to actually perform the operation unless the operation is
         
     | 
| 
       2943 
2942 
     | 
    
         
             
                reordering content.
         
     | 
| 
       2944 
     | 
    
         
            -
             
     | 
| 
      
 2943 
     | 
    
         
            +
             
     | 
| 
       2945 
2944 
     | 
    
         
             
                @param {SC.Drag} drag The drag to perform the operation on
         
     | 
| 
       2946 
2945 
     | 
    
         
             
                @param {Number} op The drag operation to perform
         
     | 
| 
       2947 
2946 
     | 
    
         
             
                @return {Number} The operation performed
         
     | 
| 
         @@ -2952,51 +2951,51 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       2952 
2951 
     | 
    
         
             
                    idx   = state[0], dropOp = state[1], dragOp = state[2],
         
     | 
| 
       2953 
2952 
     | 
    
         
             
                    del   = this.get('selectionDelegate'),
         
     | 
| 
       2954 
2953 
     | 
    
         
             
                    performed, objects, data, content, shift, indexes;
         
     | 
| 
       2955 
     | 
    
         
            -
             
     | 
| 
       2956 
     | 
    
         
            -
                // 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
         
     | 
| 
       2957 
2956 
     | 
    
         
             
                // be included in that set.
         
     | 
| 
       2958 
2957 
     | 
    
         
             
                if (dragOp & SC.DRAG_REORDER) {
         
     | 
| 
       2959 
2958 
     | 
    
         
             
                  op = (op & SC.DRAG_MOVE) ? SC.DRAG_REORDER : SC.DRAG_NONE ;
         
     | 
| 
       2960 
2959 
     | 
    
         
             
                } else op = op & dragOp ;
         
     | 
| 
       2961 
     | 
    
         
            -
             
     | 
| 
      
 2960 
     | 
    
         
            +
             
     | 
| 
       2962 
2961 
     | 
    
         
             
                // If no allowed drag operation could be found, just return.
         
     | 
| 
       2963 
2962 
     | 
    
         
             
                if (op === SC.DRAG_NONE) return op;
         
     | 
| 
       2964 
     | 
    
         
            -
             
     | 
| 
      
 2963 
     | 
    
         
            +
             
     | 
| 
       2965 
2964 
     | 
    
         
             
                // Some operation is allowed through, give the delegate a chance to
         
     | 
| 
       2966 
2965 
     | 
    
         
             
                // handle it.
         
     | 
| 
       2967 
2966 
     | 
    
         
             
                performed = del.collectionViewPerformDragOperation(this, drag, op, idx, dropOp) ;
         
     | 
| 
       2968 
     | 
    
         
            -
             
     | 
| 
      
 2967 
     | 
    
         
            +
             
     | 
| 
       2969 
2968 
     | 
    
         
             
                // If the delegate did not handle the drag (i.e. returned SC.DRAG_NONE),
         
     | 
| 
       2970 
2969 
     | 
    
         
             
                // and the op type is REORDER, then do the reorder here.
         
     | 
| 
       2971 
2970 
     | 
    
         
             
                if ((performed === SC.DRAG_NONE) && (op & SC.DRAG_REORDER)) {
         
     | 
| 
       2972 
     | 
    
         
            -
             
     | 
| 
      
 2971 
     | 
    
         
            +
             
     | 
| 
       2973 
2972 
     | 
    
         
             
                  data = drag.dataForType(this.get('reorderDataType')) ;
         
     | 
| 
       2974 
2973 
     | 
    
         
             
                  if (!data) return SC.DRAG_NONE ;
         
     | 
| 
       2975 
     | 
    
         
            -
             
     | 
| 
      
 2974 
     | 
    
         
            +
             
     | 
| 
       2976 
2975 
     | 
    
         
             
                  content = this.get('content') ;
         
     | 
| 
       2977 
     | 
    
         
            -
             
     | 
| 
      
 2976 
     | 
    
         
            +
             
     | 
| 
       2978 
2977 
     | 
    
         
             
                  // check for special case - inserting BEFORE ourself...
         
     | 
| 
       2979 
     | 
    
         
            -
                  // 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
         
     | 
| 
       2980 
2979 
     | 
    
         
             
                  // anyway
         
     | 
| 
       2981 
2980 
     | 
    
         
             
                  indexes = data.indexes;
         
     | 
| 
       2982 
2981 
     | 
    
         
             
                  if (indexes.get('length')===1) {
         
     | 
| 
       2983 
2982 
     | 
    
         
             
                    if (((dropOp === SC.DROP_BEFORE) || (dropOp === SC.DROP_AFTER)) &&
         
     | 
| 
       2984 
2983 
     | 
    
         
             
                        (indexes.get('min')===idx)) return SC.DRAG_MOVE;
         
     | 
| 
       2985 
2984 
     | 
    
         
             
                  }
         
     | 
| 
       2986 
     | 
    
         
            -
             
     | 
| 
      
 2985 
     | 
    
         
            +
             
     | 
| 
       2987 
2986 
     | 
    
         
             
                  content.beginPropertyChanges(); // suspend notifications
         
     | 
| 
       2988 
2987 
     | 
    
         | 
| 
       2989 
     | 
    
         
            -
                  // 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
         
     | 
| 
       2990 
2989 
     | 
    
         
             
                  // added again later.
         
     | 
| 
       2991 
2990 
     | 
    
         
             
                  objects = [];
         
     | 
| 
       2992 
2991 
     | 
    
         
             
                  shift = 0;
         
     | 
| 
       2993 
     | 
    
         
            -
                  data.indexes.forEach(function(i) { 
     | 
| 
      
 2992 
     | 
    
         
            +
                  data.indexes.forEach(function(i) {
         
     | 
| 
       2994 
2993 
     | 
    
         
             
                    objects.push(content.objectAt(i-shift));
         
     | 
| 
       2995 
2994 
     | 
    
         
             
                    content.removeAt(i-shift);
         
     | 
| 
       2996 
2995 
     | 
    
         
             
                    shift++;
         
     | 
| 
       2997 
2996 
     | 
    
         
             
                    if (i < idx) idx--;
         
     | 
| 
       2998 
2997 
     | 
    
         
             
                  }, this);
         
     | 
| 
       2999 
     | 
    
         
            -
             
     | 
| 
      
 2998 
     | 
    
         
            +
             
     | 
| 
       3000 
2999 
     | 
    
         
             
                  // now insert objects into new insertion locaiton
         
     | 
| 
       3001 
3000 
     | 
    
         
             
                  if (dropOp === SC.DROP_AFTER) idx++;
         
     | 
| 
       3002 
3001 
     | 
    
         
             
                  content.replace(idx, 0, objects, dropOp);
         
     | 
| 
         @@ -3006,62 +3005,62 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3006 
3005 
     | 
    
         
             
                  // make the op into its actual value
         
     | 
| 
       3007 
3006 
     | 
    
         
             
                  op = SC.DRAG_MOVE ;
         
     | 
| 
       3008 
3007 
     | 
    
         
             
                }
         
     | 
| 
       3009 
     | 
    
         
            -
             
     | 
| 
       3010 
     | 
    
         
            -
                return op; 
     | 
| 
      
 3008 
     | 
    
         
            +
             
     | 
| 
      
 3009 
     | 
    
         
            +
                return op;
         
     | 
| 
       3011 
3010 
     | 
    
         
             
              },
         
     | 
| 
       3012 
     | 
    
         
            -
             
     | 
| 
      
 3011 
     | 
    
         
            +
             
     | 
| 
       3013 
3012 
     | 
    
         
             
              /**
         
     | 
| 
       3014 
3013 
     | 
    
         
             
                Default delegate method implementation, returns YES if canReorderContent
         
     | 
| 
       3015 
3014 
     | 
    
         
             
                is also true.
         
     | 
| 
       3016 
     | 
    
         
            -
             
     | 
| 
      
 3015 
     | 
    
         
            +
             
     | 
| 
       3017 
3016 
     | 
    
         
             
                @param {SC.View} view
         
     | 
| 
       3018 
3017 
     | 
    
         
             
              */
         
     | 
| 
       3019 
3018 
     | 
    
         
             
              collectionViewShouldBeginDrag: function(view) {
         
     | 
| 
       3020 
3019 
     | 
    
         
             
                return this.get('canReorderContent');
         
     | 
| 
       3021 
3020 
     | 
    
         
             
              },
         
     | 
| 
       3022 
3021 
     | 
    
         | 
| 
       3023 
     | 
    
         
            -
             
     | 
| 
      
 3022 
     | 
    
         
            +
             
     | 
| 
       3024 
3023 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       3025 
3024 
     | 
    
         
             
              // INSERTION POINT
         
     | 
| 
       3026 
     | 
    
         
            -
              // 
     | 
| 
       3027 
     | 
    
         
            -
             
     | 
| 
       3028 
     | 
    
         
            -
             
     | 
| 
      
 3025 
     | 
    
         
            +
              //
         
     | 
| 
      
 3026 
     | 
    
         
            +
             
     | 
| 
      
 3027 
     | 
    
         
            +
             
     | 
| 
       3029 
3028 
     | 
    
         
             
              /**
         
     | 
| 
       3030 
     | 
    
         
            -
                Get the preferred insertion point for the given location, including 
     | 
| 
      
 3029 
     | 
    
         
            +
                Get the preferred insertion point for the given location, including
         
     | 
| 
       3031 
3030 
     | 
    
         
             
                an insertion preference of before, after or on the named index.
         
     | 
| 
       3032 
     | 
    
         
            -
             
     | 
| 
       3033 
     | 
    
         
            -
                You can implement this method in a subclass if you like to perform a 
     | 
| 
       3034 
     | 
    
         
            -
                more efficient check.  The default implementation will loop through the 
     | 
| 
       3035 
     | 
    
         
            -
                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
         
     | 
| 
       3036 
3035 
     | 
    
         
             
                you specify.
         
     | 
| 
       3037 
     | 
    
         
            -
             
     | 
| 
      
 3036 
     | 
    
         
            +
             
     | 
| 
       3038 
3037 
     | 
    
         
             
                This method should return an array with two values.  The first value is
         
     | 
| 
       3039 
3038 
     | 
    
         
             
                the insertion point index and the second value is the drop operation,
         
     | 
| 
       3040 
     | 
    
         
            -
                which should be one of SC.DROP_BEFORE, SC.DROP_AFTER, or SC.DROP_ON. 
     | 
| 
       3041 
     | 
    
         
            -
             
     | 
| 
       3042 
     | 
    
         
            -
                The preferred drop operation passed in should be used as a hint as to 
     | 
| 
       3043 
     | 
    
         
            -
                the type of operation the view would prefer to receive. If the 
     | 
| 
       3044 
     | 
    
         
            -
                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
         
     | 
| 
       3045 
3044 
     | 
    
         
             
                possible.  Otherwise, you should never return DROP_ON.
         
     | 
| 
       3046 
     | 
    
         
            -
             
     | 
| 
      
 3045 
     | 
    
         
            +
             
     | 
| 
       3047 
3046 
     | 
    
         
             
                For compatibility, you can also return just the insertion index.  If you
         
     | 
| 
       3048 
     | 
    
         
            -
                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
         
     | 
| 
       3049 
3048 
     | 
    
         
             
                SC.DROP_BEFORE.
         
     | 
| 
       3050 
     | 
    
         
            -
             
     | 
| 
       3051 
     | 
    
         
            -
                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
         
     | 
| 
       3052 
3051 
     | 
    
         
             
                point.  In this case, the drop operation will be ignored.
         
     | 
| 
       3053 
     | 
    
         
            -
             
     | 
| 
      
 3052 
     | 
    
         
            +
             
     | 
| 
       3054 
3053 
     | 
    
         
             
                @param {Point} loc the mouse location.
         
     | 
| 
       3055 
3054 
     | 
    
         
             
                @param {DropOp} dropOperation the preferred drop operation.
         
     | 
| 
       3056 
3055 
     | 
    
         
             
                @returns {Array} format: [index, op]
         
     | 
| 
       3057 
3056 
     | 
    
         
             
              */
         
     | 
| 
       3058 
     | 
    
         
            -
              insertionIndexForLocation: function(loc, dropOperation) { 
     | 
| 
       3059 
     | 
    
         
            -
                return -1; 
     | 
| 
      
 3057 
     | 
    
         
            +
              insertionIndexForLocation: function(loc, dropOperation) {
         
     | 
| 
      
 3058 
     | 
    
         
            +
                return -1;
         
     | 
| 
       3060 
3059 
     | 
    
         
             
              },
         
     | 
| 
       3061 
     | 
    
         
            -
             
     | 
| 
      
 3060 
     | 
    
         
            +
             
     | 
| 
       3062 
3061 
     | 
    
         
             
              // ..........................................................
         
     | 
| 
       3063 
3062 
     | 
    
         
             
              // INTERNAL SUPPORT
         
     | 
| 
       3064 
     | 
    
         
            -
              // 
     | 
| 
      
 3063 
     | 
    
         
            +
              //
         
     | 
| 
       3065 
3064 
     | 
    
         | 
| 
       3066 
3065 
     | 
    
         
             
              /** @private - when we become visible, reload if needed. */
         
     | 
| 
       3067 
3066 
     | 
    
         
             
              _cv_isVisibleInWindowDidChange: function() {
         
     | 
| 
         @@ -3069,7 +3068,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3069 
3068 
     | 
    
         
             
                  if (this._invalidIndexes) this.invokeOnce(this.reloadIfNeeded);
         
     | 
| 
       3070 
3069 
     | 
    
         
             
                  if (this._invalidSelection) {
         
     | 
| 
       3071 
3070 
     | 
    
         
             
                    this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
         
     | 
| 
       3072 
     | 
    
         
            -
                  } 
     | 
| 
      
 3071 
     | 
    
         
            +
                  }
         
     | 
| 
       3073 
3072 
     | 
    
         
             
                }
         
     | 
| 
       3074 
3073 
     | 
    
         
             
              }.observes('isVisibleInWindow'),
         
     | 
| 
       3075 
3074 
     | 
    
         | 
| 
         @@ -3081,16 +3080,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3081 
3080 
     | 
    
         
             
              collectionViewShouldSelectItem: function(view, item) {
         
     | 
| 
       3082 
3081 
     | 
    
         
             
                return this.get('isSelectable') ;
         
     | 
| 
       3083 
3082 
     | 
    
         
             
              },
         
     | 
| 
       3084 
     | 
    
         
            -
             
     | 
| 
      
 3083 
     | 
    
         
            +
             
     | 
| 
       3085 
3084 
     | 
    
         
             
              /** @private */
         
     | 
| 
       3086 
3085 
     | 
    
         
             
              _TMP_DIFF1: SC.IndexSet.create(),
         
     | 
| 
       3087 
     | 
    
         
            -
             
     | 
| 
      
 3086 
     | 
    
         
            +
             
     | 
| 
       3088 
3087 
     | 
    
         
             
              /** @private */
         
     | 
| 
       3089 
3088 
     | 
    
         
             
              _TMP_DIFF2: SC.IndexSet.create(),
         
     | 
| 
       3090 
     | 
    
         
            -
             
     | 
| 
      
 3089 
     | 
    
         
            +
             
     | 
| 
       3091 
3090 
     | 
    
         
             
              /** @private
         
     | 
| 
       3092 
     | 
    
         
            -
             
     | 
| 
       3093 
     | 
    
         
            -
                Whenever the nowShowing range changes, update the range observer on the 
     | 
| 
      
 3091 
     | 
    
         
            +
             
     | 
| 
      
 3092 
     | 
    
         
            +
                Whenever the nowShowing range changes, update the range observer on the
         
     | 
| 
       3094 
3093 
     | 
    
         
             
                content item and instruct the view to reload any indexes that are not in
         
     | 
| 
       3095 
3094 
     | 
    
         
             
                the previous nowShowing range.
         
     | 
| 
       3096 
3095 
     | 
    
         | 
| 
         @@ -3117,13 +3116,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3117 
3116 
     | 
    
         
             
                  this.updateContentRangeObserver();
         
     | 
| 
       3118 
3117 
     | 
    
         
             
                  this.reload(diff);
         
     | 
| 
       3119 
3118 
     | 
    
         
             
                }
         
     | 
| 
       3120 
     | 
    
         
            -
             
     | 
| 
      
 3119 
     | 
    
         
            +
             
     | 
| 
       3121 
3120 
     | 
    
         
             
                // cleanup tmp objects
         
     | 
| 
       3122 
3121 
     | 
    
         
             
                if (diff1) diff1.clear();
         
     | 
| 
       3123 
3122 
     | 
    
         
             
                if (diff2) diff2.clear();
         
     | 
| 
       3124 
     | 
    
         
            -
             
     | 
| 
      
 3123 
     | 
    
         
            +
             
     | 
| 
       3125 
3124 
     | 
    
         
             
              }.observes('nowShowing'),
         
     | 
| 
       3126 
     | 
    
         
            -
             
     | 
| 
      
 3125 
     | 
    
         
            +
             
     | 
| 
       3127 
3126 
     | 
    
         
             
              /** @private */
         
     | 
| 
       3128 
3127 
     | 
    
         
             
              init: function() {
         
     | 
| 
       3129 
3128 
     | 
    
         
             
                 sc_super();
         
     | 
| 
         @@ -3133,7 +3132,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3133 
3132 
     | 
    
         
             
                 if (this.content) this._cv_contentDidChange();
         
     | 
| 
       3134 
3133 
     | 
    
         
             
                 if (this.selection) this._cv_selectionDidChange();
         
     | 
| 
       3135 
3134 
     | 
    
         
             
              },
         
     | 
| 
       3136 
     | 
    
         
            -
             
     | 
| 
      
 3135 
     | 
    
         
            +
             
     | 
| 
       3137 
3136 
     | 
    
         
             
              /** @private
         
     | 
| 
       3138 
3137 
     | 
    
         
             
                Become a drop target whenever reordering content is enabled.
         
     | 
| 
       3139 
3138 
     | 
    
         
             
              */
         
     | 
| 
         @@ -3143,11 +3142,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3143 
3142 
     | 
    
         
             
                  SC.Drag.addDropTarget(this);
         
     | 
| 
       3144 
3143 
     | 
    
         
             
                }
         
     | 
| 
       3145 
3144 
     | 
    
         
             
              }.observes('canReorderContent'),
         
     | 
| 
       3146 
     | 
    
         
            -
             
     | 
| 
      
 3145 
     | 
    
         
            +
             
     | 
| 
       3147 
3146 
     | 
    
         
             
              /** @private
         
     | 
| 
       3148 
3147 
     | 
    
         
             
                Fires an action after a selection if enabled.
         
     | 
| 
       3149 
     | 
    
         
            -
             
     | 
| 
       3150 
     | 
    
         
            -
                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
         
     | 
| 
       3151 
3150 
     | 
    
         
             
                current selection (saved as a separate array so that a change in sel
         
     | 
| 
       3152 
3151 
     | 
    
         
             
                in the meantime will not be lost)
         
     | 
| 
       3153 
3152 
     | 
    
         
             
              */
         
     | 
| 
         @@ -3163,7 +3162,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3163 
3162 
     | 
    
         
             
                  this._cv_actionTimer = this.invokeLater(this._cv_action, delay, view, ev, sel) ;
         
     | 
| 
       3164 
3163 
     | 
    
         
             
                }
         
     | 
| 
       3165 
3164 
     | 
    
         
             
              },
         
     | 
| 
       3166 
     | 
    
         
            -
             
     | 
| 
      
 3165 
     | 
    
         
            +
             
     | 
| 
       3167 
3166 
     | 
    
         
             
              /** @private
         
     | 
| 
       3168 
3167 
     | 
    
         
             
                Perform the action.  Supports legacy behavior as well as newer style
         
     | 
| 
       3169 
3168 
     | 
    
         
             
                action dispatch.
         
     | 
| 
         @@ -3176,29 +3175,29 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte 
     | 
|
| 
       3176 
3175 
     | 
    
         
             
                if (action) {
         
     | 
| 
       3177 
3176 
     | 
    
         
             
                  // if the action is a function, just call it
         
     | 
| 
       3178 
3177 
     | 
    
         
             
                  if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt) ;
         
     | 
| 
       3179 
     | 
    
         
            -
             
     | 
| 
      
 3178 
     | 
    
         
            +
             
     | 
| 
       3180 
3179 
     | 
    
         
             
                  // otherwise, use the new sendAction style
         
     | 
| 
       3181 
3180 
     | 
    
         
             
                  var pane = this.get('pane') ;
         
     | 
| 
       3182 
3181 
     | 
    
         
             
                  if (pane) {
         
     | 
| 
       3183 
3182 
     | 
    
         
             
                    pane.rootResponder.sendAction(action, target, this, pane, context);
         
     | 
| 
       3184 
3183 
     | 
    
         
             
                  }
         
     | 
| 
       3185 
3184 
     | 
    
         
             
                  // SC.app.sendAction(action, target, this) ;
         
     | 
| 
       3186 
     | 
    
         
            -
             
     | 
| 
      
 3185 
     | 
    
         
            +
             
     | 
| 
       3187 
3186 
     | 
    
         
             
                // if no action is specified, then trigger the support action,
         
     | 
| 
       3188 
3187 
     | 
    
         
             
                // if supported.
         
     | 
| 
       3189 
3188 
     | 
    
         
             
                } else if (!view) {
         
     | 
| 
       3190 
3189 
     | 
    
         
             
                  return ; // nothing to do
         
     | 
| 
       3191 
     | 
    
         
            -
             
     | 
| 
      
 3190 
     | 
    
         
            +
             
     | 
| 
       3192 
3191 
     | 
    
         
             
                // if the target view has its own internal action handler,
         
     | 
| 
       3193 
3192 
     | 
    
         
             
                // trigger that.
         
     | 
| 
       3194 
3193 
     | 
    
         
             
                } else if (SC.typeOf(view._action) == SC.T_FUNCTION) {
         
     | 
| 
       3195 
3194 
     | 
    
         
             
                  return view._action(evt) ;
         
     | 
| 
       3196 
     | 
    
         
            -
             
     | 
| 
      
 3195 
     | 
    
         
            +
             
     | 
| 
       3197 
3196 
     | 
    
         
             
                // otherwise call the action method to support older styles.
         
     | 
| 
       3198 
3197 
     | 
    
         
             
                } else if (SC.typeOf(view.action) == SC.T_FUNCTION) {
         
     | 
| 
       3199 
3198 
     | 
    
         
             
                  return view.action(evt) ;
         
     | 
| 
       3200 
3199 
     | 
    
         
             
                }
         
     | 
| 
       3201 
3200 
     | 
    
         
             
              }
         
     | 
| 
       3202 
     | 
    
         
            -
             
     | 
| 
       3203 
     | 
    
         
            -
             
     | 
| 
      
 3201 
     | 
    
         
            +
             
     | 
| 
      
 3202 
     | 
    
         
            +
             
     | 
| 
       3204 
3203 
     | 
    
         
             
            });
         
     |