sproutcore 1.9.2 → 1.10.0.rc.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/VERSION.yml +2 -2
- data/bin/sc-build +12 -9
- data/bin/sc-build-number +12 -9
- data/bin/sc-docs +12 -15
- data/bin/sc-gen +12 -9
- data/bin/sc-init +12 -9
- data/bin/sc-manifest +12 -9
- data/bin/sc-server +12 -9
- data/bin/sproutcore +12 -9
- data/lib/frameworks/sproutcore/Buildfile +14 -17
- data/lib/frameworks/sproutcore/CHANGELOG.md +214 -3
- data/lib/frameworks/sproutcore/README.md +4 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/Buildfile +13 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps/greenhouse/README → apps/greenhouse/README.md} +1 -1
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/TODO +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/beautify.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/design.js +3 -3
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/file.js +3 -3
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/files.js +3 -3
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/layout.js +9 -9
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/library.js +23 -23
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/page.js +1 -1
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/property.js +1 -1
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/property_editor.js +2 -2
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/target.js +1 -1
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/targets.js +12 -12
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/controllers/view_configs.js +15 -15
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/core.js +14 -14
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/core_file.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/data_source.js +42 -42
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/app_page.js +45 -45
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/app-selector.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/button.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/dock.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/general.css +0 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/icons.css +5 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/main-page.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/menu.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/modal.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/picker.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/search.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/css/text-field.css +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/dialogs.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500.eot +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500.otf +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500.woff +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500_italic.eot +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500_italic.otf +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/fonts/museosans_500_italic.woff +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/app-selector/choose-app.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/app-selector/list-item-sel.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/active-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/regular-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/regular-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule-xl/regular-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/regular-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/regular-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/capsule/sel-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/active-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-sel-active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-sel-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/cap-sel-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/disabled-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/regular-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/regular-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/regular-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-active-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-disabled-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/dark/sel-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/active-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/disabled-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/regular-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/sel-active-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/sel-disabled-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/shared/sel-m.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/regular-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/regular-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-active-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-active-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-disabled-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-disabled-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/buttons/square/sel-r.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/actions-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/actions.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/inspector-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/inspector.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/library-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/library.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/projects-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/projects.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/run-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/run.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/save-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/icons/save.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/logos/greenhouse-l.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/logos/greenhouse-s.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/logos/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/main-bg.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/bottom-left.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/bottom-right.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/bottom.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/close-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/close.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/left.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/pointer-bottom.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/pointer-left.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/pointer-right.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/pointer-top.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/right.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/search-active.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/search.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/top-left.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/top-right.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/picker/top.png +0 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/images/sc-icon-sproutcore-16.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/images/toolbar-bg.png +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/inspectors.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/loading.rhtml +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/main_page.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/english.lproj/strings.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/fixtures/file.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/main.js +5 -5
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/mixins/drop_down.js +14 -14
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/models/design.js +4 -4
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/models/dir.js +12 -12
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/models/file.js +7 -9
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/models/target.js +12 -12
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/models/view_config.js +10 -10
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/resources/test_page.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/states/inspector.js +11 -11
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/states/library.js +10 -10
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/states/main.js +26 -25
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/states/modals.js +10 -10
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/states/ready.js +15 -15
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/controllers/design.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/controllers/designs.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/controllers/file.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/controllers/files.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/models/file.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/models/view_config.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/views/list_item.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/tests/views/plist_item.js +1 -5
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/theme.js +6 -6
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/anchor.js +43 -43
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/application_list_item.js +2 -2
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/event_blocker.js +7 -7
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/label_designer.js +0 -0
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/list_item.js +8 -8
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/plist_item.js +23 -23
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/simple_button.js +31 -31
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/tear_off_picker.js +12 -12
- data/lib/frameworks/sproutcore/{frameworks/experimental/apps → apps}/greenhouse/views/web.js +5 -5
- data/lib/frameworks/sproutcore/apps/media_examples/core.js +5 -6
- data/lib/frameworks/sproutcore/apps/media_examples/views/audio_view.js +16 -17
- data/lib/frameworks/sproutcore/apps/media_examples/views/camera_view.js +4 -5
- data/lib/frameworks/sproutcore/apps/media_examples/views/capabilities_view.js +17 -18
- data/lib/frameworks/sproutcore/apps/media_examples/views/microphone_view.js +4 -5
- data/lib/frameworks/sproutcore/apps/media_examples/views/video_view.js +18 -19
- data/lib/frameworks/sproutcore/apps/showcase/Buildfile +2 -2
- data/lib/frameworks/sproutcore/apps/showcase/README +1 -1
- data/lib/frameworks/sproutcore/apps/showcase/controllers/source_tree_controller.js +27 -7
- data/lib/frameworks/sproutcore/apps/showcase/core.js +6 -4
- data/lib/frameworks/sproutcore/apps/showcase/main.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/patch.diff +529 -0
- data/lib/frameworks/sproutcore/apps/showcase/resources/images/sproutcore-128.png +0 -0
- data/lib/frameworks/sproutcore/apps/showcase/resources/main_page.js +3 -2
- data/lib/frameworks/sproutcore/apps/showcase/resources/stylesheet.css +35 -16
- data/lib/frameworks/sproutcore/apps/showcase/resources/views_page.js +195 -10
- data/lib/frameworks/sproutcore/apps/showcase/system/views_item_content.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/theme.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/checkbox_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/date_field_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/disclosure_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/label_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/list_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/popup_button_views.js +3 -2
- data/lib/frameworks/sproutcore/apps/showcase/views/progress_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/radio_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/scroll_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/segmented_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/select_views.js +10 -9
- data/lib/frameworks/sproutcore/apps/showcase/views/slider_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/source_list_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/split_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/stacked_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/static_content_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/tab_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/text_field_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/toolbar_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/views_item_view.js +15 -6
- data/lib/frameworks/sproutcore/apps/showcase/views/views_list_view.js +5 -4
- data/lib/frameworks/sproutcore/apps/showcase/views/web_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/well_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/showcase/views/workspace_views.js +2 -1
- data/lib/frameworks/sproutcore/apps/statechart_routing/core.js +5 -5
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/login_page.js +15 -15
- data/lib/frameworks/sproutcore/apps/statechart_routing/resources/styles.css +3 -0
- data/lib/frameworks/sproutcore/apps/tests/controllers/source.js +11 -11
- data/lib/frameworks/sproutcore/apps/tests/controllers/target.js +6 -12
- data/lib/frameworks/sproutcore/apps/tests/controllers/targets.js +28 -33
- data/lib/frameworks/sproutcore/apps/tests/controllers/{detail.js → test.js} +14 -12
- data/lib/frameworks/sproutcore/apps/tests/controllers/tests.js +11 -15
- data/lib/frameworks/sproutcore/apps/tests/core.js +8 -113
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.css +9 -19
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/main_page.js +81 -92
- data/lib/frameworks/sproutcore/apps/tests/english.lproj/strings.js +3 -1
- data/lib/frameworks/sproutcore/apps/tests/main.js +8 -13
- data/lib/frameworks/sproutcore/apps/tests/statechart.js +268 -0
- data/lib/frameworks/sproutcore/apps/tests/views/offset_checkbox.js +4 -4
- data/lib/frameworks/sproutcore/apps/welcome/controllers/targets.js +16 -16
- data/lib/frameworks/sproutcore/apps/welcome/core.js +9 -9
- data/lib/frameworks/sproutcore/apps/welcome/english.lproj/images/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/apps/welcome/english.lproj/main_page.js +22 -25
- data/lib/frameworks/sproutcore/apps/welcome/main.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-startup-landscape.jpg b/data/lib/frameworks/sproutcore/design/Assorted → Images/sproutcore-startup-landscape.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-startup-landscape.png b/data/lib/frameworks/sproutcore/design/Assorted → Images/sproutcore-startup-landscape.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-startup-portrait.jpg b/data/lib/frameworks/sproutcore/design/Assorted → Images/sproutcore-startup-portrait.jpg +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-startup-portrait.png b/data/lib/frameworks/sproutcore/design/Assorted → Images/sproutcore-startup-portrait.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-startup.png b/data/lib/frameworks/sproutcore/design/Assorted → Images/sproutcore-startup.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +21 -7
- data/lib/frameworks/sproutcore/frameworks/ajax/tests/system/request.js +35 -2
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +142 -75
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +20 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/horizontal_stack_layout.js +283 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/child_view_layouts/vertical_stack_layout.js +284 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +64 -65
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/object.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +19 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/run_loop.js +10 -25
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/selection_support.js +12 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/body_overflow.js +53 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +30 -24
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +44 -40
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +5 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +105 -176
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane_statechart.js +50 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/protocols/view_transition_protocol.js +48 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/browser.js +225 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/core_query.js +54 -34
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/cursor.js +86 -71
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +35 -35
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/platform.js +283 -120
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/ready.js +36 -37
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +653 -435
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/responder.js +49 -42
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +422 -396
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +10 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +37 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils/rect.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +15 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/selection_support.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/cursor.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/platform.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/end.js +17 -17
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_attr.js +9 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_className.js +43 -43
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/helpers_style.js +4 -14
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/render_context/update.js +18 -30
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +78 -43
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/theme.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +4 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/append_remove.js +31 -15
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +47 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/firstResponder.js +32 -31
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/keyPane.js +23 -22
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/layout.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/sendEvent.js +17 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/animation.js +626 -211
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/border_frame_test.js +174 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/build.js +22 -20
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/childViewLayout_test.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -10
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertFrames.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createChildViews.js +10 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/createLayer.js +17 -12
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroy.js +60 -7
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/destroyLayer.js +19 -26
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +14 -13
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/enabled_states_test.js +341 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/findLayerInParentLayer.js +9 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/init.js +26 -16
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +28 -68
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/isVisible.js +35 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/isVisibleInWindow.js +93 -78
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +62 -64
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +69 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutChildViews.js +26 -21
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +129 -57
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +436 -238
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/removeChild.js +38 -44
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +14 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render_delegate_support.js +29 -20
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/replaceAllChildren_test.js +229 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/updateLayer.js +33 -95
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/viewDidResize.js +87 -39
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view_states_test.js +684 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +767 -625
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/acceleration.js +4 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +645 -77
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +218 -19
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +648 -321
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout_style.js +326 -534
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +120 -126
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/statechart.js +1526 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +18 -23
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +12 -94
- data/lib/frameworks/sproutcore/frameworks/core_tools/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_tools/data_source.js +19 -19
- data/lib/frameworks/sproutcore/frameworks/core_tools/models/target.js +43 -27
- data/lib/frameworks/sproutcore/frameworks/core_tools/models/test.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/core_tools/resources/icons.css +5 -0
- data/lib/frameworks/sproutcore/frameworks/core_tools/resources/sc-icon-sproutcore-16.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +41 -41
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +90 -90
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +31 -31
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +2 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +74 -48
- data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +11 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +187 -253
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/cascade.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/data_store.js +49 -9
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/single_attribute.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +236 -127
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/instance_management.js +107 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/createRecord.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/destroyRecord.js +12 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/loadRecord.js +42 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushChanges.js +20 -15
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/system/datetime.js +205 -92
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/core/tests/system/datetime.js +61 -25
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/resources/strings.js +39 -9
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +45 -1
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/tests/system/datetime.js +88 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/coders/design.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/coders/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/controllers/controllers.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/controllers/design.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/controllers/designs.js +19 -19
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/controllers/page_design.js +44 -44
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/controllers/page_files.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/css/css_rule.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/css/css_style.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/css/css_style_sheet.js +37 -37
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/button.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/label.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/object_designer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/tab.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/text_field.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/designers/view_designer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/css/designer.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/design_page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/high_light.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/controller.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/dock-bg.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/dock-item-bg.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/dock-item-divider.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/dock-item-sel-bg.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/dock-item-sel-divider.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/main-bg.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/page.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/pane.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/images/view.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/english.lproj/selection_handles.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/ext/binding.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/ext/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/ext/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/ext/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/mixins/button.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/mixins/snap_lines.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/tests/coders/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/tests/designers/view_designer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/views/designer_drop_target.js +36 -37
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/views/drawing.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/views/high_light.js +17 -17
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/views/page_item_view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/designer → designer}/views/selection_handles.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +51 -51
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view → desktop}/mixins/split_child.js +63 -52
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view → desktop}/mixins/split_thumb.js +64 -59
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +113 -112
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +182 -203
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +13 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +51 -29
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +513 -307
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +69 -217
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +31 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +15 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +2 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +25 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +29 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/popup_button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +19 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +14 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view → desktop}/render_delegates/split.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view → desktop}/render_delegates/split_divider.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/modal.css +2 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/panel.css +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +24 -98
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +446 -442
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +42 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/methods.js +19 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/menu/ui.js +26 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/palette/ui.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/pane_page.js +11 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/ui.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/methods.js +32 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/picker/ui.js +27 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/methods.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/select_button/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/sheet/ui.js +11 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/displayProperties.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/keyEquivalents.js +9 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/button/ui.js +23 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/ui.js +15 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/{mixins → views/collection}/collection_fast_path.js +18 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/content.js +46 -53
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/itemViewForContentIndex.js +101 -47
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/mouse.js +26 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/reload.js +89 -69
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/selection.js +27 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/collection/ui_diagram.js +32 -35
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +6 -11
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/disclosure/ui.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/drag_and_drop.js +103 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/grid/methods.js +76 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/image_button/ui.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/drag_and_drop.js +91 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/render.js +2 -17
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/rowHeightForContentIndex.js +70 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_alternatingrows.js +17 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_outline.js +10 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_row_heights.js +37 -30
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list/ui_simple.js +18 -20
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/list_item.js +115 -28
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/scroll/ui.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +37 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +194 -182
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select/ui.js +2 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/select_field/ui.js +18 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/separator.js +5 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/slider/methods.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view/tests → desktop/tests/views/split}/children.js +15 -15
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view/tests → desktop/tests/views/split}/dividers.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/methods.js +341 -45
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view/tests → desktop/tests/views/split}/split_child.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{experimental/frameworks/split_view/tests → desktop/tests/views/split}/split_thumb.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/split/ui.js +6 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/stacked/ui_comments.js +49 -52
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +23 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/toolbar/ui.js +2 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/web/ui.js +4 -5
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +47 -38
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +887 -740
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +68 -55
- data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +8 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +189 -167
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +55 -54
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +8 -4
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +145 -146
- data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +66 -66
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +40 -44
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +203 -200
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +11 -12
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +6 -13
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +87 -112
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +192 -179
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +23 -23
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +64 -64
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +56 -56
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +784 -714
- data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +21 -39
- data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +45 -41
- data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +4 -10
- data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +9 -47
- data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +40 -16
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +62 -50
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +0 -9
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +45 -45
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +16 -16
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +46 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphism/simple.js +16 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/render_delegates/desktop_scroller.js +12 -12
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/scroll_view/tests/scroll/ui.js +38 -40
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +20 -20
- data/lib/frameworks/sproutcore/frameworks/formatters/formatters/date_formatter.js +16 -16
- data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +26 -14
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +43 -43
- data/lib/frameworks/sproutcore/frameworks/foundation/debug/test-image.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +63 -41
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +60 -61
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +72 -72
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +142 -142
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/gesturable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +10 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/static_layout.js +36 -29
- data/lib/frameworks/sproutcore/frameworks/foundation/private/tree_item_observer.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/protocols/swap_transition_protocol.js +150 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +54 -29
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +23 -18
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +12 -11
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/benchmark.css +21 -20
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-128.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-256.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-32.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-48.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-512.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-64.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/label.css +5 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/app_cache.js +412 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/benchmark.js +2 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +11 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/text_selection.js +21 -21
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +8 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/controllers/tree/selection_support.js +33 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/delegates/inline_text_field/inline_text_field.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/content_display.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/control/displayProperties.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +49 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +29 -21
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/staticLayout.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/validatable/ui.js +8 -10
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/app_cache_test.js +81 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/image_queue.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/utils/pointInElement.js +0 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/methods.js +40 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/transition_test.js +143 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/container/ui.js +5 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +187 -84
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/label/ui.js +6 -41
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +51 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +11 -16
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/adjust_bounce_transition.js +80 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/adjust_smooth_transition.js +39 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/adjust_spring_transition.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/bounce_transition.js +211 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/fade_transition.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/pop_transition.js +82 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/scale_transition.js +54 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/slide_transition.js +140 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/spring_transition.js +203 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_dissolve_transition.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_fade_color_transition.js +81 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_move_in_transition.js +104 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_push_transition.js +181 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/transitions/swap_reveal_transition.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/container.js +483 -95
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +65 -65
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +111 -100
- data/lib/frameworks/sproutcore/frameworks/foundation/views/inline_text_field.js +30 -222
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +38 -24
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +74 -62
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-1.8.3-patched.js +9485 -0
- data/lib/frameworks/sproutcore/frameworks/media/media_capabilities.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/media/render_delegates/media_slider.js +20 -20
- data/lib/frameworks/sproutcore/frameworks/media/resources/video.css +18 -17
- data/lib/frameworks/sproutcore/frameworks/media/views/audio.js +19 -19
- data/lib/frameworks/sproutcore/frameworks/media/views/controls.js +10 -11
- data/lib/frameworks/sproutcore/frameworks/media/views/mini_controls.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/media/views/video.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/routing/system/routes.js +32 -21
- data/lib/frameworks/sproutcore/frameworks/routing/tests/system/routes.js +72 -53
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +164 -156
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +20 -20
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +145 -140
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/comparable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +393 -370
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1045 -999
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +41 -36
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_queue.js +10 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/private/observer_set.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +275 -205
- data/lib/frameworks/sproutcore/frameworks/runtime/system/function.js +27 -27
- data/lib/frameworks/sproutcore/frameworks/runtime/system/index_set.js +229 -193
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +186 -188
- data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +138 -65
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +11 -10
- data/lib/frameworks/sproutcore/frameworks/runtime/system/string.js +8 -4
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/tupleForPropertyPath.js +4 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +112 -23
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +71 -18
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/binding.js +97 -57
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/add.js +22 -22
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/index_set/infinite.js +184 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/observer_set.js +63 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/run_loop.js +73 -36
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/set.js +100 -25
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/string.js +7 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/debug/sequence_matcher.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/statechart/private/state_path_matcher.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/history_state.js +32 -32
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +449 -422
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state_route_handler_context.js +19 -19
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +612 -562
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/with_concurrent_states/basic.js +115 -62
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/state_transitioning/routing/without_concurrent_states/basic.js +145 -64
- data/lib/frameworks/sproutcore/frameworks/statechart/tests/statechart/respond_to_event.js +17 -1
- data/lib/frameworks/sproutcore/frameworks/table/views/table_head.js +30 -30
- data/lib/frameworks/sproutcore/frameworks/table/views/table_row.js +34 -34
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/bind.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/collection.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/ext/handlebars/view.js +3 -5
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/panes/template.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/template_view/tests/views/template/core.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/template_view/views/bindable_span.js +7 -7
- data/lib/frameworks/sproutcore/frameworks/template_view/views/template.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/template_view/views/template_collection.js +15 -21
- data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +4 -4
- data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +35 -35
- data/lib/frameworks/sproutcore/scripts/run_sc_server_master.sh +34 -0
- data/lib/frameworks/sproutcore/tests/phantomjs_runner.phantomjs +606 -0
- data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/PanelPane.opacity +0 -0
- data/lib/frameworks/sproutcore/themes/ace/designs/psds/panel/Pointers.opacity +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/active_button@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/normal_button@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/selected_active_button@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/ace/44px/selected_button@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/button/popup/select.css +3 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +18 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/panel/panel.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/panel/panel@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/panel.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/panel@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/picker.css +34 -14
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/pointers.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/pointers@2x.png +0 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +5 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +7 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +5 -4
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +6 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/toolbar/toolbar.css +7 -5
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +7 -7
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +37 -37
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +12 -12
- data/lib/sproutcore/helpers/static_helper.rb +35 -27
- data/sproutcore.gemspec +1 -0
- metadata +529 -451
- data/lib/frameworks/sproutcore/apps/showcase/resources/images/sproutcore-logo.png +0 -0
- data/lib/frameworks/sproutcore/apps/showcase/views/button_views.js +0 -55
- data/lib/frameworks/sproutcore/apps/showcase/views/container_views.js +0 -29
- data/lib/frameworks/sproutcore/apps/showcase/views/grid_views.js +0 -28
- data/lib/frameworks/sproutcore/apps/showcase/views/image_button_views.js +0 -22
- data/lib/frameworks/sproutcore/apps/showcase/views/image_views.js +0 -51
- data/lib/frameworks/sproutcore/apps/tests/states/no_targets.js +0 -26
- data/lib/frameworks/sproutcore/apps/tests/states/ready.js +0 -56
- data/lib/frameworks/sproutcore/apps/tests/states/ready_detail.js +0 -41
- data/lib/frameworks/sproutcore/apps/tests/states/ready_empty.js +0 -48
- data/lib/frameworks/sproutcore/apps/tests/states/ready_list.js +0 -41
- data/lib/frameworks/sproutcore/apps/tests/states/ready_loading.js +0 -44
- data/lib/frameworks/sproutcore/apps/tests/states/ready_no_tests.js +0 -31
- data/lib/frameworks/sproutcore/apps/tests/states/start.js +0 -39
- data/lib/frameworks/sproutcore/apps/welcome/tests/controllers/targets.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/animation/Buildfile +0 -3
- data/lib/frameworks/sproutcore/frameworks/animation/LICENSE +0 -25
- data/lib/frameworks/sproutcore/frameworks/animation/README.md +0 -79
- data/lib/frameworks/sproutcore/frameworks/animation/core.js +0 -1208
- data/lib/frameworks/sproutcore/frameworks/animation/tests/core.js +0 -152
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/parentViewDidChange.js +0 -67
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/prepareContext.js +0 -203
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/updateLayerLocation.js +0 -213
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +0 -163
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/mixins/border.js +0 -97
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/tests/methods.js +0 -312
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +0 -961
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split_divider.js +0 -40
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +0 -27
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore-logo.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/sproutcore.png +0 -0
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffer.js +0 -394
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-buffered.js +0 -133
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery-sc.js +0 -18
- data/lib/frameworks/sproutcore/frameworks/jquery/jquery.js +0 -8981
- data/lib/frameworks/sproutcore/frameworks/jquery/tests/set_class.js +0 -40
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/ace/picker.js +0 -0
@@ -8,20 +8,20 @@
|
|
8
8
|
/** @class
|
9
9
|
|
10
10
|
Represents a Checkbox Button.
|
11
|
-
|
11
|
+
|
12
12
|
The view is an `SC.ButtonView` put into toggle mode and with the 'theme' property
|
13
13
|
set to "checkbox".
|
14
|
-
|
14
|
+
|
15
15
|
Rendering
|
16
16
|
----------------------------
|
17
17
|
SC.ButtonView delegates its rendering to its theme. As the theme is set
|
18
18
|
to "checkbox", the way the checkbox renders (including DOM) will actually
|
19
19
|
be different than SC.ButtonView's.
|
20
|
-
|
20
|
+
|
21
21
|
@extends SC.ButtonView
|
22
22
|
@since SproutCore 1.0
|
23
23
|
*/
|
24
|
-
SC.CheckboxView = SC.ButtonView.extend(
|
24
|
+
SC.CheckboxView = SC.ButtonView.extend(
|
25
25
|
/** @scope SC.CheckboxView.prototype */ {
|
26
26
|
|
27
27
|
/**
|
@@ -41,7 +41,7 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
41
41
|
|
42
42
|
// no special theme for Checkbox; button defaults to 'square', so we have to stop that.
|
43
43
|
themeName: null,
|
44
|
-
|
44
|
+
|
45
45
|
/**
|
46
46
|
@type String
|
47
47
|
@default 'checkboxRenderDelegate'
|
@@ -50,42 +50,42 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
50
50
|
|
51
51
|
/**
|
52
52
|
Ellipsis is disabled by default to allow multiline text
|
53
|
-
|
53
|
+
|
54
54
|
@type Boolean
|
55
55
|
@default NO
|
56
56
|
*/
|
57
57
|
needsEllipsis: NO,
|
58
|
-
|
58
|
+
|
59
59
|
/**
|
60
|
-
`YES` if `
|
61
|
-
|
60
|
+
`YES` if `isEnabledInPane` is `YES`, `NO` otherwise
|
61
|
+
|
62
62
|
@type Boolean
|
63
63
|
@default NO
|
64
|
-
@observes
|
64
|
+
@observes isEnabledInPane
|
65
65
|
*/
|
66
66
|
acceptsFirstResponder: function() {
|
67
|
-
if (SC.FOCUS_ALL_CONTROLS) { return this.get('
|
67
|
+
if (SC.FOCUS_ALL_CONTROLS) { return this.get('isEnabledInPane'); }
|
68
68
|
return NO;
|
69
|
-
}.property('
|
70
|
-
|
69
|
+
}.property('isEnabledInPane'),
|
70
|
+
|
71
71
|
/** @private */
|
72
72
|
_toggleValue: function(){
|
73
73
|
var isOn = this.get('value') === this.get('toggleOnValue');
|
74
74
|
this.set('value', isOn ? this.get('toggleOffValue') : this.get('toggleOnValue'));
|
75
75
|
},
|
76
|
-
|
76
|
+
|
77
77
|
/** @private */
|
78
78
|
mouseDown: function(evt) {
|
79
|
-
if(!this.get('
|
79
|
+
if(!this.get('isEnabledInPane')) return YES;
|
80
80
|
this.set('isActive', YES);
|
81
81
|
this._isMouseDown = YES;
|
82
82
|
if (evt && this.get('acceptsFirstResponder')) evt.allowDefault();
|
83
83
|
return YES;
|
84
84
|
},
|
85
|
-
|
85
|
+
|
86
86
|
/** @private */
|
87
87
|
mouseUp: function(evt) {
|
88
|
-
if(!this.get('
|
88
|
+
if(!this.get('isEnabledInPane')) return YES;
|
89
89
|
|
90
90
|
this.set('isActive', NO);
|
91
91
|
this._isMouseDown = NO;
|
@@ -101,11 +101,11 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
101
101
|
return YES;
|
102
102
|
|
103
103
|
},
|
104
|
-
|
104
|
+
|
105
105
|
/** @private */
|
106
106
|
keyDown: function(evt) {
|
107
107
|
// handle tab key
|
108
|
-
if(!this.get('
|
108
|
+
if(!this.get('isEnabledInPane')) return YES;
|
109
109
|
|
110
110
|
if (evt.which === 9 || evt.keyCode === 9) {
|
111
111
|
var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
|
@@ -130,17 +130,17 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
|
|
130
130
|
|
131
131
|
return NO;
|
132
132
|
},
|
133
|
-
|
134
|
-
|
135
|
-
|
133
|
+
|
134
|
+
|
135
|
+
|
136
136
|
/** @private */
|
137
137
|
touchStart: function(evt) {
|
138
138
|
return this.mouseDown(evt);
|
139
139
|
},
|
140
|
-
|
140
|
+
|
141
141
|
/** @private */
|
142
142
|
touchEnd: function(evt) {
|
143
143
|
return this.mouseUp(evt);
|
144
144
|
}
|
145
|
-
|
145
|
+
|
146
146
|
});
|
@@ -5,7 +5,7 @@
|
|
5
5
|
// License: Licensed under MIT license (see license.js)
|
6
6
|
// ==========================================================================
|
7
7
|
|
8
|
-
sc_require('mixins/collection_view_delegate')
|
8
|
+
sc_require('mixins/collection_view_delegate');
|
9
9
|
sc_require('views/list_item');
|
10
10
|
|
11
11
|
/**
|
@@ -17,33 +17,40 @@ sc_require('views/list_item');
|
|
17
17
|
*/
|
18
18
|
SC.DRAG_REORDER = 0x0010;
|
19
19
|
|
20
|
-
/**
|
21
|
-
@static
|
22
|
-
@static
|
23
|
-
@default NO
|
24
|
-
*/
|
25
|
-
SC.BENCHMARK_RELOAD = NO;
|
26
|
-
|
27
|
-
/*
|
28
|
-
TODO Document SC.CollectionView
|
29
|
-
*/
|
30
|
-
|
31
20
|
/**
|
32
21
|
@class
|
33
22
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
To use
|
42
|
-
to an array of objects.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
23
|
+
This class renders a collection of views based on the items array set
|
24
|
+
as its content. You will not use this class directly as it does not
|
25
|
+
order the views in any manner. Instead you will want to subclass
|
26
|
+
SC.CollectionView or use one of its existing subclasses in SproutCore
|
27
|
+
such as SC.ListView, which renders items in a vertical list or SC.GridView,
|
28
|
+
which renders items in a grid.
|
29
|
+
|
30
|
+
To use a CollectionView subclass, just create the view and set the 'content'
|
31
|
+
property to an array of objects. The collection view will create instances of
|
32
|
+
the given exampleView class for each item in the array. You can also bind to
|
33
|
+
the selection property if you want to monitor the current selection.
|
34
|
+
|
35
|
+
# Extreme Performance
|
36
|
+
|
37
|
+
SC.CollectionView does not just naively render one view per item and
|
38
|
+
instead is aggressively optimized to allow for collections of
|
39
|
+
hundreds of thousands of items to perform as fast as only a few items. In
|
40
|
+
order to achieve this, first it only creates views and elements for the items
|
41
|
+
currently visible. Therefore, when overriding SC.CollectionView, it is
|
42
|
+
critically important to implement `contentIndexesInRect` which should return
|
43
|
+
only the indexes of those items that should appear within the visible rect.
|
44
|
+
By returning only the indexes that are visible, SC.CollectionView can represent
|
45
|
+
enormous collections with only a few views and elements.
|
46
|
+
|
47
|
+
The second optimization, is that SC.CollectionView will pool and reuse the
|
48
|
+
few views and elements that it does need to create. Creating and destroying
|
49
|
+
views incrementally hurts performance, so by reusing the same views over and
|
50
|
+
over, the view can much more quickly alter the set of visible views. As well,
|
51
|
+
inserting and removing elements from the DOM takes more time than simply
|
52
|
+
modifying the contents of the same elements over and over, which allows us to
|
53
|
+
leave the DOM tree untouched.
|
47
54
|
|
48
55
|
@extends SC.View
|
49
56
|
@extends SC.CollectionViewDelegate
|
@@ -62,9 +69,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
62
69
|
|
63
70
|
/**
|
64
71
|
@type Array
|
65
|
-
@default ['
|
72
|
+
@default ['isActive']
|
66
73
|
*/
|
67
|
-
displayProperties: ['
|
74
|
+
displayProperties: ['isActive'],
|
68
75
|
|
69
76
|
/**
|
70
77
|
@type String
|
@@ -85,7 +92,17 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
85
92
|
/**
|
86
93
|
If `YES`, uses the experimental fast `CollectionView` path.
|
87
94
|
|
95
|
+
*Note* The performance improvements in the experimental code have been
|
96
|
+
integrated directly into SC.CollectionView. If you have set this property
|
97
|
+
to true, you should set it to false and refer to the class documentation
|
98
|
+
explaining how to modify the performance boost behavior if necessary.
|
99
|
+
|
100
|
+
Generally, no modifications should be necessary and you should see an
|
101
|
+
immediate performance improvement in all collections, especially on
|
102
|
+
mobile devices.
|
103
|
+
|
88
104
|
@type Boolean
|
105
|
+
@deprecated Version 1.10
|
89
106
|
@default NO
|
90
107
|
*/
|
91
108
|
useFastPath: NO,
|
@@ -115,6 +132,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
115
132
|
/**
|
116
133
|
The current length of the content.
|
117
134
|
|
135
|
+
@readonly
|
118
136
|
@type Number
|
119
137
|
@default 0
|
120
138
|
*/
|
@@ -138,8 +156,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
138
156
|
@observes length
|
139
157
|
@observes clippingFrame
|
140
158
|
*/
|
141
|
-
nowShowing: function() {
|
142
|
-
|
159
|
+
nowShowing: function () {
|
160
|
+
// If there is an in-scroll clipping frame, use it.
|
161
|
+
var clippingFrame = this._inScrollClippingFrame || this.get('clippingFrame');
|
162
|
+
|
163
|
+
return this.computeNowShowing(clippingFrame);
|
143
164
|
}.property('length', 'clippingFrame').cacheable(),
|
144
165
|
|
145
166
|
/**
|
@@ -159,7 +180,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
159
180
|
Allow user to select content using the mouse and keyboard.
|
160
181
|
|
161
182
|
Set this property to `NO` to disallow the user from selecting items. If you
|
162
|
-
have items in your `selectedIndexes property, they will still be reflected
|
183
|
+
have items in your `selectedIndexes` property, they will still be reflected
|
163
184
|
visually.
|
164
185
|
|
165
186
|
@type Boolean
|
@@ -174,9 +195,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
174
195
|
Enable or disable the view.
|
175
196
|
|
176
197
|
The collection view will set the `isEnabled` property of its item views to
|
177
|
-
reflect the same view of this property. Whenever
|
198
|
+
reflect the same view of this property. Whenever `isEnabled` is false,
|
178
199
|
the collection view will also be not selectable or editable, regardless of
|
179
|
-
the settings for isEditable` & `isSelectable`.
|
200
|
+
the settings for `isEditable` & `isSelectable`.
|
180
201
|
|
181
202
|
@type Boolean
|
182
203
|
@default YES
|
@@ -189,11 +210,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
189
210
|
/**
|
190
211
|
Allow user to edit content views.
|
191
212
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
the `canReorderContent` and `canDeleteContent` and `isDropTarget`
|
196
|
-
properties.
|
213
|
+
Whenever `isEditable` is false, the user will not be able to reorder, add,
|
214
|
+
or delete items regardless of the `canReorderContent` and `canDeleteContent`
|
215
|
+
and `isDropTarget` properties.
|
197
216
|
|
198
217
|
@type Boolean
|
199
218
|
@default YES
|
@@ -206,10 +225,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
206
225
|
/**
|
207
226
|
Allow user to reorder items using drag and drop.
|
208
227
|
|
209
|
-
If true, the user
|
228
|
+
If true, the user can use drag and drop to reorder items in the list.
|
210
229
|
If you also accept drops, this will allow the user to drop items into
|
211
230
|
specific points in the list. Otherwise items will be added to the end.
|
212
231
|
|
232
|
+
When canReorderContent is true, item views will have the `isReorderable`
|
233
|
+
property set to true (if the `isEditable` is true on the collection).
|
234
|
+
|
213
235
|
@type Boolean
|
214
236
|
@default NO
|
215
237
|
*/
|
@@ -224,6 +246,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
224
246
|
If true the user will be allowed to delete selected items using the delete
|
225
247
|
key. Otherwise deletes will not be permitted.
|
226
248
|
|
249
|
+
When canDeleteContent is true, item views will have the `isDeletable`
|
250
|
+
property set to true (if the `isEditable` is true on the collection).
|
251
|
+
|
227
252
|
@type Boolean
|
228
253
|
@default NO
|
229
254
|
*/
|
@@ -237,6 +262,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
237
262
|
This will only work if isEditable is `YES` and the item view implements
|
238
263
|
the `beginEditing()` method.
|
239
264
|
|
265
|
+
When canEditContent is true, item views will have the `isEditable`
|
266
|
+
property set to true (if the `isEditable` is true on the collection).
|
267
|
+
|
240
268
|
@type Boolean
|
241
269
|
*/
|
242
270
|
canEditContent: NO,
|
@@ -308,12 +336,49 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
308
336
|
your own subclass for this property to display the type of content you
|
309
337
|
want.
|
310
338
|
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
339
|
+
The view you set here should understand the following properties, which
|
340
|
+
it can use to alter its display:
|
341
|
+
|
342
|
+
- `content` -- The content object from the content array your view should
|
343
|
+
display.
|
344
|
+
- `isEnabled` -- False if the view should appear disabled.
|
345
|
+
- `isSelected` -- True if the view should appear selected.
|
346
|
+
- `contentIndex` -- The current index of the view's content.
|
347
|
+
- `isEditable` -- True if the view should appear editable by clicking on it
|
348
|
+
or hitting the Return key.
|
349
|
+
- `isReorderable` -- True if the view should appear reorderable by dragging
|
350
|
+
it.
|
351
|
+
- `isDeletable` -- True if the view should appear deletable, by clicking on
|
352
|
+
a delete button within it or hitting the Delete key.
|
353
|
+
|
354
|
+
# Working with View and Element Pooling
|
355
|
+
|
356
|
+
As noted in the SC.CollectionView description above, by default the few
|
357
|
+
instances that are needed of the exampleView class will be created and then
|
358
|
+
reused. Reusing an exampleView means that the content, isSelected, isEnabled,
|
359
|
+
isEditable, isReorderable, isDeletable and contentIndex properties will be
|
360
|
+
updated as an existing view is pulled from the pool to be displayed.
|
361
|
+
|
362
|
+
If your custom exampleView class has trouble being reused, you may want to
|
363
|
+
implement the `sleepInPool` and `awakeFromPool` methods in your exampleView.
|
364
|
+
These two methods will be called on the view, one before it is pooled,
|
365
|
+
sleepInPool, and the other before it is unpooled, awakeFromPool. For
|
366
|
+
example, if your item views have images and there is a delay for new
|
367
|
+
images to appear, you may want to use sleepInPool to ensure the previous
|
368
|
+
image is unloaded so it doesn't appear momentarily while the new image loads.
|
369
|
+
|
370
|
+
Also, if the rendered output of your exampleView does not update properly you
|
371
|
+
can disable reuse of the layer by setting `isLayerReusable` to false. This
|
372
|
+
will reduce the performance of your collection though and it is recommended
|
373
|
+
that you instead look at ways to properly update the existing layer as the
|
374
|
+
content changes.
|
375
|
+
|
376
|
+
Finally, if you really don't want view or element reuse at all, you may
|
377
|
+
disable them both by setting `isReusable` to false in your exampleView class.
|
378
|
+
Your collection will still benefit greatly from incremental rendering, but
|
379
|
+
it will perform slightly less well than with optimal re-use.
|
380
|
+
|
381
|
+
# Event handling
|
317
382
|
|
318
383
|
In general you do not want your child views to actually respond to mouse
|
319
384
|
and keyboard events themselves. It is better to let the collection view
|
@@ -324,9 +389,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
324
389
|
to give it the chance to perform its own selection housekeeping.
|
325
390
|
|
326
391
|
@type SC.View
|
327
|
-
@default SC.
|
392
|
+
@default SC.View
|
328
393
|
*/
|
329
|
-
exampleView: SC.
|
394
|
+
exampleView: SC.View,
|
330
395
|
|
331
396
|
/**
|
332
397
|
If set, this key will be used to get the example view for a given
|
@@ -468,6 +533,15 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
468
533
|
// SUBCLASS METHODS
|
469
534
|
//
|
470
535
|
|
536
|
+
/**
|
537
|
+
Adjusts the layout of the view according to the computed layout. Call
|
538
|
+
this method to apply the computed layout to the view.
|
539
|
+
*/
|
540
|
+
adjustLayout: function () {
|
541
|
+
var layout = this.computeLayout();
|
542
|
+
if (layout) { this.adjust(layout); }
|
543
|
+
},
|
544
|
+
|
471
545
|
/**
|
472
546
|
Override to return the computed layout dimensions of the collection view.
|
473
547
|
You can omit any dimensions you don't care about setting in your
|
@@ -479,7 +553,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
479
553
|
|
480
554
|
@returns {Hash} layout properties
|
481
555
|
*/
|
482
|
-
computeLayout: function() {
|
556
|
+
computeLayout: function () {
|
483
557
|
return null;
|
484
558
|
},
|
485
559
|
|
@@ -492,7 +566,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
492
566
|
itemView
|
493
567
|
@returns {Hash} a view layout
|
494
568
|
*/
|
495
|
-
layoutForContentIndex: function(contentIndex) {
|
569
|
+
layoutForContentIndex: function (contentIndex) {
|
496
570
|
return null;
|
497
571
|
},
|
498
572
|
|
@@ -506,7 +580,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
506
580
|
@type SC.IndexSet
|
507
581
|
@observes length
|
508
582
|
*/
|
509
|
-
allContentIndexes: function() {
|
583
|
+
allContentIndexes: function () {
|
510
584
|
return SC.IndexSet.create(0, this.get('length')).freeze();
|
511
585
|
}.property('length').cacheable(),
|
512
586
|
|
@@ -521,7 +595,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
521
595
|
@param {Rect} rect the visible rect
|
522
596
|
@returns {SC.IndexSet} now showing indexes
|
523
597
|
*/
|
524
|
-
contentIndexesInRect: function(rect) {
|
598
|
+
contentIndexesInRect: function (rect) {
|
525
599
|
return null; // select all
|
526
600
|
},
|
527
601
|
|
@@ -534,8 +608,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
534
608
|
|
535
609
|
@returns {SC.IndexSet} new now showing range
|
536
610
|
*/
|
537
|
-
computeNowShowing: function() {
|
538
|
-
var r = this.contentIndexesInRect(
|
611
|
+
computeNowShowing: function (clippingFrame) {
|
612
|
+
var r = this.contentIndexesInRect(clippingFrame);
|
539
613
|
if (!r) r = this.get('allContentIndexes'); // default show all
|
540
614
|
|
541
615
|
// make sure the index set doesn't contain any indexes greater than the
|
@@ -543,7 +617,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
543
617
|
else {
|
544
618
|
var len = this.get('length'),
|
545
619
|
max = r.get('max');
|
546
|
-
if (max > len) r = r.copy().remove(len, max-len).freeze();
|
620
|
+
if (max > len) r = r.copy().remove(len, max - len).freeze();
|
547
621
|
}
|
548
622
|
|
549
623
|
return r;
|
@@ -567,7 +641,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
567
641
|
|
568
642
|
@returns {void}
|
569
643
|
*/
|
570
|
-
showInsertionPoint: function(itemView, dropOperation) {},
|
644
|
+
showInsertionPoint: function (itemView, dropOperation) {},
|
571
645
|
|
572
646
|
/**
|
573
647
|
Override to hide the insertion point when a drag ends.
|
@@ -583,7 +657,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
583
657
|
|
584
658
|
@returns {void}
|
585
659
|
*/
|
586
|
-
hideInsertionPoint: function() {},
|
660
|
+
hideInsertionPoint: function () {},
|
587
661
|
|
588
662
|
|
589
663
|
// ..........................................................
|
@@ -618,7 +692,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
618
692
|
@field
|
619
693
|
@type Object
|
620
694
|
*/
|
621
|
-
selectionDelegate: function() {
|
695
|
+
selectionDelegate: function () {
|
622
696
|
var del = this.get('delegate'), content = this.get('content');
|
623
697
|
return this.delegateFor('isCollectionViewDelegate', del, content);
|
624
698
|
}.property('delegate', 'content').cacheable(),
|
@@ -632,22 +706,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
632
706
|
@field
|
633
707
|
@type Object
|
634
708
|
*/
|
635
|
-
contentDelegate: function() {
|
709
|
+
contentDelegate: function () {
|
636
710
|
var del = this.get('delegate'), content = this.get('content');
|
637
711
|
return this.delegateFor('isCollectionContent', del, content);
|
638
712
|
}.property('delegate', 'content').cacheable(),
|
639
713
|
|
640
714
|
|
641
|
-
/** @private
|
642
|
-
A cache of the `contentGroupIndexes` value returned by the delegate. This
|
643
|
-
is frequently accessed and usually involves creating an `SC.IndexSet`
|
644
|
-
object, so it's worthwhile to cache.
|
645
|
-
*/
|
646
|
-
_contentGroupIndexes: function() {
|
647
|
-
return this.get('contentDelegate').contentGroupIndexes(this, this.get('content'));
|
648
|
-
}.property('contentDelegate', 'content').cacheable(),
|
649
|
-
|
650
|
-
|
651
715
|
// ..........................................................
|
652
716
|
// CONTENT CHANGES
|
653
717
|
//
|
@@ -667,7 +731,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
667
731
|
@param {SC.IndexSet} indexes affected indexes or null for all items
|
668
732
|
@returns {void}
|
669
733
|
*/
|
670
|
-
contentRangeDidChange: function(content, object, key, indexes) {
|
734
|
+
contentRangeDidChange: function (content, object, key, indexes) {
|
671
735
|
if (!object && (key === '[]')) {
|
672
736
|
this.notifyPropertyChange('_contentGroupIndexes');
|
673
737
|
this.reload(indexes); // note: if indexes == null, reloads all
|
@@ -690,7 +754,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
690
754
|
@param {SC.IndexSet} indexes the indexes in the content array affected
|
691
755
|
@returns {void}
|
692
756
|
*/
|
693
|
-
contentPropertyDidChange: function(target, key, indexes) {},
|
757
|
+
contentPropertyDidChange: function (target, key, indexes) {},
|
694
758
|
|
695
759
|
/**
|
696
760
|
Called whenever the view needs to updates its `contentRangeObserver` to
|
@@ -711,19 +775,21 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
711
775
|
|
712
776
|
@returns {void}
|
713
777
|
*/
|
714
|
-
updateContentRangeObserver: function() {
|
778
|
+
updateContentRangeObserver: function () {
|
715
779
|
var nowShowing = this.get('nowShowing'),
|
716
780
|
observer = this._cv_contentRangeObserver,
|
717
781
|
content = this.get('content');
|
718
782
|
|
719
|
-
if (!content) return
|
783
|
+
if (!content) return; // nothing to do
|
720
784
|
|
721
785
|
if (observer) {
|
722
786
|
content.updateRangeObserver(observer, nowShowing);
|
723
787
|
} else {
|
724
788
|
var func = this.contentRangeDidChange;
|
725
789
|
observer = content.addRangeObserver(nowShowing, this, func, null);
|
726
|
-
|
790
|
+
|
791
|
+
// Cache the range observer so we can clean it up later.
|
792
|
+
this._cv_contentRangeObserver = observer;
|
727
793
|
}
|
728
794
|
|
729
795
|
},
|
@@ -739,27 +805,27 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
739
805
|
|
740
806
|
@returns {void}
|
741
807
|
*/
|
742
|
-
removeContentRangeObserver: function() {
|
808
|
+
removeContentRangeObserver: function () {
|
743
809
|
var content = this.get('content'),
|
744
|
-
observer = this._cv_contentRangeObserver
|
810
|
+
observer = this._cv_contentRangeObserver;
|
745
811
|
|
746
812
|
if (observer) {
|
747
813
|
if (content) content.removeRangeObserver(observer);
|
748
|
-
this._cv_contentRangeObserver = null
|
814
|
+
this._cv_contentRangeObserver = null;
|
749
815
|
}
|
750
816
|
},
|
751
817
|
|
752
818
|
/**
|
753
819
|
Called whenever the content length changes. This will invalidate the
|
754
|
-
length property of the view itself causing the nowShowing to recompute
|
820
|
+
length property of the view itself causing the `nowShowing` to recompute
|
755
821
|
which will in turn update the UI accordingly.
|
756
822
|
|
757
823
|
@returns {void}
|
758
824
|
*/
|
759
|
-
contentLengthDidChange: function() {
|
825
|
+
contentLengthDidChange: function () {
|
760
826
|
var content = this.get('content');
|
761
827
|
this.set('length', content ? content.get('length') : 0);
|
762
|
-
this.
|
828
|
+
this.invokeOnce('adjustLayout');
|
763
829
|
},
|
764
830
|
|
765
831
|
/** @private
|
@@ -777,9 +843,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
777
843
|
- reload effected item views
|
778
844
|
- update layout for receiver
|
779
845
|
*/
|
780
|
-
_cv_contentDidChange: function() {
|
846
|
+
_cv_contentDidChange: function () {
|
781
847
|
var content = this.get('content'),
|
782
|
-
lfunc = this.contentLengthDidChange
|
848
|
+
lfunc = this.contentLengthDidChange;
|
783
849
|
|
784
850
|
if (content === this._content) return; // nothing to do
|
785
851
|
|
@@ -789,6 +855,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
789
855
|
this._content.removeObserver('length', this, lfunc);
|
790
856
|
}
|
791
857
|
|
858
|
+
// Destroy all pooled views.
|
859
|
+
if (this._pools) {
|
860
|
+
for (var key in this._pools) {
|
861
|
+
this._pools[key].invoke('destroy');
|
862
|
+
}
|
863
|
+
delete this._pools;
|
864
|
+
}
|
865
|
+
|
792
866
|
// cache
|
793
867
|
this._content = content;
|
794
868
|
|
@@ -800,7 +874,6 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
800
874
|
// notify all items changed
|
801
875
|
this.contentLengthDidChange();
|
802
876
|
this.contentRangeDidChange(content, null, '[]', null);
|
803
|
-
|
804
877
|
}.observes('content'),
|
805
878
|
|
806
879
|
// ..........................................................
|
@@ -813,6 +886,15 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
813
886
|
*/
|
814
887
|
_invalidIndexes: NO,
|
815
888
|
|
889
|
+
/** @private
|
890
|
+
We need to reload if isEnabled, isEditable, canEditContent, canReorderContent or
|
891
|
+
canDeleteContent change.
|
892
|
+
*/
|
893
|
+
_isEnabledDidChange: function () {
|
894
|
+
// Reload the nowShowing indexes.
|
895
|
+
this.reload();
|
896
|
+
}.observes('isEnabled', 'isEditable', 'canEditContent', 'canReorderContent', 'canDeleteContent'),
|
897
|
+
|
816
898
|
/**
|
817
899
|
Regenerates the item views for the content items at the specified indexes.
|
818
900
|
If you pass null instead of an index set, regenerates all item views.
|
@@ -828,20 +910,20 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
828
910
|
@param {SC.IndexSet} indexes
|
829
911
|
@returns {SC.CollectionView} receiver
|
830
912
|
*/
|
831
|
-
reload: function(indexes) {
|
832
|
-
var invalid = this._invalidIndexes
|
913
|
+
reload: function (indexes) {
|
914
|
+
var invalid = this._invalidIndexes;
|
833
915
|
if (indexes && invalid !== YES) {
|
834
916
|
if (invalid) invalid.add(indexes);
|
835
917
|
else invalid = this._invalidIndexes = indexes.clone();
|
836
918
|
|
837
919
|
}
|
838
920
|
else {
|
839
|
-
this._invalidIndexes = YES
|
921
|
+
this._invalidIndexes = YES; // force a total reload
|
840
922
|
}
|
841
923
|
|
842
924
|
if (this.get('isVisibleInWindow')) this.invokeOnce(this.reloadIfNeeded);
|
843
925
|
|
844
|
-
return this
|
926
|
+
return this;
|
845
927
|
},
|
846
928
|
|
847
929
|
/**
|
@@ -849,226 +931,75 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
849
931
|
You can call this method at any time to actually force the reload to
|
850
932
|
happen immediately if any item views need to be reloaded.
|
851
933
|
|
852
|
-
Note that this method will also invoke two other callback methods if you
|
853
|
-
define them on your subclass:
|
854
|
-
|
855
|
-
- *willReload()* is called just before the items are reloaded
|
856
|
-
- *didReload()* is called just after items are reloaded
|
857
|
-
|
858
|
-
You can use these two methods to setup and teardown caching, which may
|
859
|
-
reduce overall cost of a reload. Each method will be passed an index set
|
860
|
-
of items that are reloaded or null if all items are reloaded.
|
861
|
-
|
862
934
|
@returns {SC.CollectionView} receiver
|
863
935
|
*/
|
864
|
-
reloadIfNeeded: function() {
|
936
|
+
reloadIfNeeded: function () {
|
865
937
|
var invalid = this._invalidIndexes;
|
866
|
-
if (!invalid || !this.get('isVisibleInWindow')) return this
|
867
|
-
this._invalidIndexes = NO
|
938
|
+
if (!invalid || !this.get('isVisibleInWindow')) return this; // delay
|
939
|
+
this._invalidIndexes = NO;
|
868
940
|
|
869
|
-
var
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
nowShowing = this.get('nowShowing'),
|
874
|
-
itemViews = this._sc_itemViews,
|
875
|
-
containerView = this.get('containerView') || this,
|
876
|
-
exampleView, groupExampleView,
|
877
|
-
shouldReuseViews, shouldReuseGroupViews, shouldReuse,
|
878
|
-
viewsToRemove, viewsToRedraw, viewsToCreate,
|
879
|
-
views, idx, view, layer, parentNode, viewPool,
|
880
|
-
del, groupIndexes, isGroupView;
|
941
|
+
var len, existing,
|
942
|
+
nowShowing = this.get('nowShowing'),
|
943
|
+
itemViews = this._sc_itemViews || [],
|
944
|
+
idx;
|
881
945
|
|
882
946
|
// if the set is defined but it contains the entire nowShowing range, just
|
883
947
|
// replace
|
884
|
-
if (invalid.isIndexSet && invalid.contains(nowShowing)) invalid = YES
|
885
|
-
if (this.willReload) this.willReload(invalid === YES ? null : invalid);
|
886
|
-
|
887
|
-
|
888
|
-
// Up-front, figure out whether the view class (and, if applicable,
|
889
|
-
// group view class) is re-usable. If so, it's beneficial for us to
|
890
|
-
// first return all no-longer-needed views to the pool before allocating
|
891
|
-
// new ones, because that will maximize the potential for re-use.
|
892
|
-
exampleView = this.get('exampleView');
|
893
|
-
shouldReuseViews = exampleView ? exampleView.isReusableInCollections : NO;
|
894
|
-
groupExampleView = this.get('groupExampleView');
|
895
|
-
shouldReuseGroupViews = groupExampleView ? groupExampleView.isReusableInCollections : NO;
|
948
|
+
if (invalid.isIndexSet && invalid.contains(nowShowing)) invalid = YES;
|
896
949
|
|
897
950
|
// if an index set, just update indexes
|
898
951
|
if (invalid.isIndexSet) {
|
899
|
-
if (bench) {
|
900
|
-
SC.Benchmark.start(bench="%@#reloadIfNeeded (Partial)".fmt(this),YES);
|
901
|
-
}
|
902
|
-
|
903
|
-
// Each of these arrays holds indexes.
|
904
|
-
viewsToRemove = [];
|
905
|
-
viewsToRedraw = [];
|
906
|
-
viewsToCreate = [];
|
907
952
|
|
908
|
-
invalid
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
if
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
viewsToCreate.push(idx);
|
919
|
-
}
|
920
|
-
|
921
|
-
// if not nowShowing, then remove the item view if needed
|
922
|
-
} else if (existing && existing.parentView === containerView) {
|
923
|
-
viewsToRemove.push(idx);
|
953
|
+
// Go through the invalid indexes and determine if the matching views
|
954
|
+
// should be redrawn (exists and still showing), should be created (
|
955
|
+
// doesn't exist and now showing) or should be destroyed (exists and no
|
956
|
+
// longer showing).
|
957
|
+
invalid.forEach(function (idx) {
|
958
|
+
// Get the existing item view, if there is one.
|
959
|
+
existing = itemViews[idx];
|
960
|
+
if (existing) {
|
961
|
+
// Exists so remove it (may send to pool).
|
962
|
+
this._removeItemView(existing, idx);
|
924
963
|
}
|
925
|
-
},this);
|
926
964
|
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
for (i = 0, len = viewsToRemove.length; i < len; ++i) {
|
931
|
-
idx = viewsToRemove[i];
|
932
|
-
existing = itemViews ? itemViews[idx] : null;
|
933
|
-
delete itemViews[idx];
|
934
|
-
|
935
|
-
// If this view class is reusable, then add it back to the pool.
|
936
|
-
del = this.get('contentDelegate');
|
937
|
-
groupIndexes = this.get('_contentGroupIndexes');
|
938
|
-
isGroupView = groupIndexes && groupIndexes.contains(idx);
|
939
|
-
if (isGroupView) isGroupView = del.contentIndexIsGroup(this, content, idx);
|
940
|
-
shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
|
941
|
-
if (shouldReuse) {
|
942
|
-
viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
|
943
|
-
|
944
|
-
viewPool.push(existing);
|
945
|
-
|
946
|
-
// Because it's possible that we'll return this view to the pool
|
947
|
-
// and then immediately re-use it, there's the potential that the
|
948
|
-
// layer will not be correctly destroyed, because that support
|
949
|
-
// (built into removeChild) is coalesced at the runloop, and we
|
950
|
-
// will likely change the layerId when re-using the view. So
|
951
|
-
// we'll destroy the layer now.
|
952
|
-
existing.destroyLayer();
|
965
|
+
// Create it (may fetch from pool).
|
966
|
+
if (nowShowing.contains(idx)) {
|
967
|
+
this.itemViewForContentIndex(idx, YES);
|
953
968
|
}
|
954
|
-
|
955
|
-
// We don't want the old layer hanging around, even if we are going
|
956
|
-
// to reuse it.
|
957
|
-
// (Charles Jolley personally guarantees this code)
|
958
|
-
layer = existing.get('layer');
|
959
|
-
if (layer && layer.parentNode) layer.parentNode.removeChild(layer);
|
960
|
-
|
961
|
-
containerView.removeChild(existing);
|
962
|
-
if (!shouldReuse) existing.destroy();
|
963
|
-
}
|
964
|
-
|
965
|
-
// …then the redraws…
|
966
|
-
for (i = 0, len = viewsToRedraw.length; i < len; ++i) {
|
967
|
-
idx = viewsToRedraw[i];
|
968
|
-
existing = itemViews ? itemViews[idx] : null;
|
969
|
-
view = this.itemViewForContentIndex(idx, YES);
|
970
|
-
|
971
|
-
// if the existing view has a layer, remove it immediately from
|
972
|
-
// the parent. This is necessary because the old and new views
|
973
|
-
// will use the same layerId
|
974
|
-
existing.destroyLayer();
|
975
|
-
containerView.replaceChild(view, existing);
|
976
|
-
}
|
977
|
-
|
978
|
-
// …and finally the creations.
|
979
|
-
for (i = 0, len = viewsToCreate.length; i < len; ++i) {
|
980
|
-
idx = viewsToCreate[i];
|
981
|
-
view = this.itemViewForContentIndex(idx, YES);
|
982
|
-
containerView.insertBefore(view, null); // Equivalent to 'append()', but avoids one more function call
|
983
|
-
}
|
984
|
-
|
985
|
-
|
986
|
-
if (bench) SC.Benchmark.end(bench);
|
969
|
+
}, this);
|
987
970
|
|
988
971
|
// if set is NOT defined, replace entire content with nowShowing
|
989
972
|
} else {
|
990
|
-
if (bench) {
|
991
|
-
SC.Benchmark.start(bench="%@#reloadIfNeeded (Full)".fmt(this),YES);
|
992
|
-
}
|
993
973
|
|
994
|
-
//
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
// below is an optimized version of:
|
1002
|
-
//this.replaceAllChildren(views);
|
1003
|
-
containerView.beginPropertyChanges();
|
1004
|
-
// views = containerView.get('views');
|
1005
|
-
if (this.willRemoveAllChildren) this.willRemoveAllChildren() ;
|
1006
|
-
containerView.destroyLayer().removeAllChildren();
|
1007
|
-
|
1008
|
-
// For all previous views that can be re-used, return them to the pool.
|
1009
|
-
if (views) {
|
1010
|
-
for (i = 0, len = views.length; i < len; ++i) {
|
1011
|
-
view = views[i];
|
1012
|
-
isGroupView = view.get('isGroupView');
|
1013
|
-
shouldReuse = isGroupView ? shouldReuseGroupViews : shouldReuseViews;
|
1014
|
-
if (shouldReuse) {
|
1015
|
-
viewPool = isGroupView ? this._GROUP_VIEW_POOL : this._VIEW_POOL;
|
1016
|
-
|
1017
|
-
viewPool.push(view);
|
1018
|
-
|
1019
|
-
// Because it's possible that we'll return this view to the pool
|
1020
|
-
// and then immediately re-use it, there's the potential that the
|
1021
|
-
// layer will not be correctly destroyed, because that support
|
1022
|
-
// (built into removeChild) is coalesced at the runloop, and we
|
1023
|
-
// will likely change the layerId when re-using the view. So
|
1024
|
-
// we'll destroy the layer now.
|
1025
|
-
view.destroyLayer();
|
1026
|
-
} else {
|
1027
|
-
view.destroy();
|
1028
|
-
}
|
974
|
+
// Process the removals.
|
975
|
+
for (idx = 0, len = itemViews.length; idx < len; idx++) {
|
976
|
+
// Get the existing item view, if there is one.
|
977
|
+
existing = itemViews ? itemViews[idx] : null;
|
978
|
+
if (existing) {
|
979
|
+
this._removeItemView(existing, idx);
|
1029
980
|
}
|
1030
981
|
}
|
1031
982
|
|
1032
|
-
|
1033
983
|
// Only after the children are removed should we create the new views.
|
1034
|
-
// We do this in order to maximize the
|
984
|
+
// We do this in order to maximize the chance of re-use should the view
|
1035
985
|
// be marked as such.
|
1036
|
-
|
1037
|
-
|
1038
|
-
views.push(this.itemViewForContentIndex(idx, YES));
|
986
|
+
nowShowing.forEach(function (idx) {
|
987
|
+
this.itemViewForContentIndex(idx, YES);
|
1039
988
|
}, this);
|
1040
|
-
|
1041
|
-
|
1042
|
-
containerView.set('childViews', views); // quick swap
|
1043
|
-
containerView.replaceLayer();
|
1044
|
-
containerView.endPropertyChanges();
|
1045
|
-
|
1046
|
-
if (bench) SC.Benchmark.end(bench);
|
1047
|
-
|
1048
989
|
}
|
1049
990
|
|
1050
|
-
|
1051
|
-
if (layout) this.adjust(layout);
|
1052
|
-
if (this.didReload) this.didReload(invalid === YES ? null : invalid);
|
1053
|
-
|
1054
|
-
return this ;
|
991
|
+
return this;
|
1055
992
|
},
|
1056
993
|
|
1057
994
|
/** @private */
|
1058
995
|
_TMP_ATTRS: {},
|
1059
996
|
|
1060
997
|
/** @private */
|
1061
|
-
_COLLECTION_CLASS_NAMES: ['sc-collection-item'],
|
998
|
+
_COLLECTION_CLASS_NAMES: ['sc-collection-item', 'sc-item'],
|
1062
999
|
|
1063
1000
|
/** @private */
|
1064
1001
|
_GROUP_COLLECTION_CLASS_NAMES: ['sc-collection-item', 'sc-group-item'],
|
1065
1002
|
|
1066
|
-
/** @private */
|
1067
|
-
_VIEW_POOL: null,
|
1068
|
-
|
1069
|
-
/** @private */
|
1070
|
-
_GROUP_VIEW_POOL: null,
|
1071
|
-
|
1072
1003
|
/**
|
1073
1004
|
Returns the item view for the content object at the specified index. Call
|
1074
1005
|
this method instead of accessing child views directly whenever you need
|
@@ -1092,137 +1023,66 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1092
1023
|
@param {Boolean} rebuild internal use only
|
1093
1024
|
@returns {SC.View} instantiated view
|
1094
1025
|
*/
|
1095
|
-
itemViewForContentIndex: function(idx, rebuild) {
|
1096
|
-
var ret
|
1026
|
+
itemViewForContentIndex: function (idx, rebuild) {
|
1027
|
+
var ret,
|
1028
|
+
views;
|
1097
1029
|
|
1098
|
-
//
|
1099
|
-
|
1100
|
-
|
1101
|
-
if (!itemViews) {
|
1102
|
-
itemViews = this._sc_itemViews = [] ;
|
1103
|
-
}
|
1104
|
-
else if (!rebuild && (ret = itemViews[idx])) {
|
1105
|
-
return ret ;
|
1106
|
-
}
|
1030
|
+
// Initialize internal views cache.
|
1031
|
+
views = this._sc_itemViews;
|
1032
|
+
if (!views) { views = this._sc_itemViews = []; }
|
1107
1033
|
|
1108
|
-
//
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
// otherwise generate...
|
1119
|
-
|
1120
|
-
// first, determine the class to use
|
1121
|
-
isGroupView = groupIndexes && groupIndexes.contains(idx);
|
1122
|
-
if (isGroupView) isGroupView = del.contentIndexIsGroup(this, content,idx);
|
1123
|
-
if (isGroupView) {
|
1124
|
-
key = this.get('contentGroupExampleViewKey');
|
1125
|
-
if (key && item) E = item.get(key);
|
1126
|
-
if (!E) E = this.get('groupExampleView') || this.get('exampleView');
|
1127
|
-
viewPoolKey = '_GROUP_VIEW_POOL';
|
1128
|
-
} else {
|
1129
|
-
key = this.get('contentExampleViewKey');
|
1130
|
-
if (key && item) E = item.get(key);
|
1131
|
-
if (!E) E = this.get('exampleView');
|
1132
|
-
viewPoolKey = '_VIEW_POOL';
|
1034
|
+
// Use an existing view for this index if we have it and aren't rebuilding all.
|
1035
|
+
ret = views[idx];
|
1036
|
+
if (ret) {
|
1037
|
+
if (rebuild) {
|
1038
|
+
ret.destroy();
|
1039
|
+
ret = null;
|
1040
|
+
} else {
|
1041
|
+
return ret;
|
1042
|
+
}
|
1133
1043
|
}
|
1134
1044
|
|
1045
|
+
var attrs,
|
1046
|
+
containerView = this.get('containerView') || this,
|
1047
|
+
exampleView,
|
1048
|
+
pool,
|
1049
|
+
prototype;
|
1135
1050
|
|
1136
|
-
//
|
1137
|
-
|
1138
|
-
parentView = this.get('containerView') || this;
|
1139
|
-
layerId = this.layerIdFor(idx);
|
1140
|
-
isEnabled = del.contentIndexIsEnabled(this, content, idx);
|
1141
|
-
isSelected = del.contentIndexIsSelected(this, content, idx);
|
1142
|
-
outlineLevel = del.contentIndexOutlineLevel(this, content, idx);
|
1143
|
-
disclosureState = del.contentIndexDisclosureState(this, content, idx);
|
1144
|
-
isVisibleInWindow = this.isVisibleInWindow;
|
1145
|
-
layout = this.layoutForContentIndex(idx);
|
1146
|
-
|
1051
|
+
// Set up the attributes for the view.
|
1052
|
+
attrs = this._attrsForContentIndex(idx);
|
1147
1053
|
|
1148
1054
|
// If the view is reusable and there is an appropriate view inside the
|
1149
1055
|
// pool, simply reuse it to avoid having to create a new view.
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1056
|
+
exampleView = this._exampleViewForContentIndex(idx);
|
1057
|
+
prototype = exampleView.prototype;
|
1058
|
+
if (SC.none(prototype.isReusable) || prototype.isReusable) {
|
1059
|
+
pool = this._poolForExampleView(exampleView);
|
1154
1060
|
|
1155
1061
|
// Is there a view we can re-use?
|
1156
|
-
if (
|
1157
|
-
ret =
|
1158
|
-
|
1159
|
-
//
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
ret.
|
1167
|
-
|
1168
|
-
ret.set('isEnabled', isEnabled);
|
1169
|
-
ret.set('isSelected', isSelected);
|
1170
|
-
ret.set('outlineLevel', outlineLevel);
|
1171
|
-
ret.set('disclosureState', disclosureState);
|
1172
|
-
ret.set('isVisibleInWindow', isVisibleInWindow);
|
1173
|
-
|
1174
|
-
// TODO: In theory this shouldn't be needed, but without it, we
|
1175
|
-
// sometimes get errors when doing a full reload, because
|
1176
|
-
// 'childViews' contains the view but the parent is not set.
|
1177
|
-
// This implies a timing issue with the general flow of
|
1178
|
-
// collection view.
|
1179
|
-
ret.set('parentView', parentView);
|
1180
|
-
|
1181
|
-
// Since we re-use layerIds, we need to reset SproutCore's internal
|
1182
|
-
// mapping table.
|
1183
|
-
SC.View.views[layerId] = ret;
|
1184
|
-
|
1185
|
-
if (layout) {
|
1186
|
-
ret.set('layout', layout);
|
1187
|
-
}
|
1188
|
-
else {
|
1189
|
-
ret.set('layout', E.prototype.layout);
|
1062
|
+
if (pool.length > 0) {
|
1063
|
+
ret = pool.shift();
|
1064
|
+
|
1065
|
+
// Reconfigure the view.
|
1066
|
+
this._reconfigureItemView(ret, attrs);
|
1067
|
+
|
1068
|
+
// Awake the view.
|
1069
|
+
if (ret.awakeFromPool) { ret.awakeFromPool(this); }
|
1070
|
+
|
1071
|
+
// Recreate the layer if it was destroyed.
|
1072
|
+
if (!ret.get('_isRendered')) {
|
1073
|
+
ret.invokeOnce(ret._doRender);
|
1190
1074
|
}
|
1191
|
-
ret.set('content', item);
|
1192
|
-
ret.endPropertyChanges();
|
1193
1075
|
}
|
1194
1076
|
}
|
1195
1077
|
|
1196
1078
|
// If we weren't able to re-use a view, then create a new one.
|
1197
1079
|
if (!ret) {
|
1198
|
-
|
1199
|
-
|
1200
|
-
attrs.contentIndex = idx;
|
1201
|
-
attrs.content = item;
|
1202
|
-
attrs.owner = attrs.displayDelegate = this;
|
1203
|
-
attrs.parentView = parentView; // Same here; shouldn't be needed
|
1204
|
-
attrs.page = this.page;
|
1205
|
-
attrs.layerId = layerId;
|
1206
|
-
attrs.isEnabled = isEnabled;
|
1207
|
-
attrs.isSelected = isSelected;
|
1208
|
-
attrs.outlineLevel = outlineLevel;
|
1209
|
-
attrs.disclosureState = disclosureState;
|
1210
|
-
attrs.isGroupView = isGroupView;
|
1211
|
-
attrs.isVisibleInWindow = isVisibleInWindow;
|
1212
|
-
if (isGroupView) attrs.classNames = this._GROUP_COLLECTION_CLASS_NAMES;
|
1213
|
-
else attrs.classNames = this._COLLECTION_CLASS_NAMES;
|
1214
|
-
|
1215
|
-
if (layout) {
|
1216
|
-
attrs.layout = layout;
|
1217
|
-
} else {
|
1218
|
-
delete attrs.layout ;
|
1219
|
-
}
|
1220
|
-
|
1221
|
-
ret = this.createItemView(E, idx, attrs);
|
1080
|
+
ret = this.createItemView(exampleView, idx, attrs);
|
1081
|
+
containerView.insertBefore(ret, null); // Equivalent to 'append()', but avoids one more function call
|
1222
1082
|
}
|
1223
1083
|
|
1224
|
-
|
1225
|
-
return ret
|
1084
|
+
views[idx] = ret;
|
1085
|
+
return ret;
|
1226
1086
|
},
|
1227
1087
|
|
1228
1088
|
/**
|
@@ -1230,7 +1090,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1230
1090
|
|
1231
1091
|
@param {Object} object
|
1232
1092
|
*/
|
1233
|
-
itemViewForContentObject: function(object) {
|
1093
|
+
itemViewForContentObject: function (object) {
|
1234
1094
|
return this.itemViewForContentIndex(this.get('content').indexOf(object));
|
1235
1095
|
},
|
1236
1096
|
|
@@ -1253,7 +1113,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1253
1113
|
@param {Hash} attrs expected attributes
|
1254
1114
|
@returns {SC.View} item view instance
|
1255
1115
|
*/
|
1256
|
-
createItemView: function(exampleClass, idx, attrs) {
|
1116
|
+
createItemView: function (exampleClass, idx, attrs) {
|
1257
1117
|
return exampleClass.create(attrs);
|
1258
1118
|
},
|
1259
1119
|
|
@@ -1264,7 +1124,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1264
1124
|
@param {Number} idx the content index
|
1265
1125
|
@returns {String} layer id, must be suitable for use in HTML id attribute
|
1266
1126
|
*/
|
1267
|
-
layerIdFor: function(idx) {
|
1127
|
+
layerIdFor: function (idx) {
|
1268
1128
|
var ret = this._TMP_LAYERID;
|
1269
1129
|
ret[0] = SC.guidFor(this);
|
1270
1130
|
ret[1] = idx;
|
@@ -1272,21 +1132,21 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1272
1132
|
},
|
1273
1133
|
|
1274
1134
|
/**
|
1275
|
-
Extracts the content index from the passed
|
1135
|
+
Extracts the content index from the passed layerId. If the layer id does
|
1276
1136
|
not belong to the receiver or if no value could be extracted, returns NO.
|
1277
1137
|
|
1278
1138
|
@param {String} id the layer id
|
1279
1139
|
*/
|
1280
|
-
contentIndexForLayerId: function(id) {
|
1281
|
-
if (!id || !(id = id.toString())) return null
|
1140
|
+
contentIndexForLayerId: function (id) {
|
1141
|
+
if (!id || !(id = id.toString())) return null; // nothing to do
|
1282
1142
|
|
1283
1143
|
var base = this._baseLayerId;
|
1284
|
-
if (!base) base = this._baseLayerId = SC.guidFor(this)+"-";
|
1144
|
+
if (!base) base = this._baseLayerId = SC.guidFor(this) + "-";
|
1285
1145
|
|
1286
1146
|
// no match
|
1287
|
-
if ((id.length <= base.length) || (id.indexOf(base) !== 0)) return null
|
1288
|
-
var ret = Number(id.slice(id.lastIndexOf('-')+1));
|
1289
|
-
return isNaN(ret) ? null : ret
|
1147
|
+
if ((id.length <= base.length) || (id.indexOf(base) !== 0)) return null;
|
1148
|
+
var ret = Number(id.slice(id.lastIndexOf('-') + 1));
|
1149
|
+
return isNaN(ret) ? null : ret;
|
1290
1150
|
},
|
1291
1151
|
|
1292
1152
|
|
@@ -1303,29 +1163,27 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1303
1163
|
@param {SC.Event} evt An event
|
1304
1164
|
@returns {SC.View} the item view or null
|
1305
1165
|
*/
|
1306
|
-
itemViewForEvent: function(evt) {
|
1307
|
-
var responder = this.getPath('pane.rootResponder')
|
1308
|
-
if (!responder) return null
|
1166
|
+
itemViewForEvent: function (evt) {
|
1167
|
+
var responder = this.getPath('pane.rootResponder');
|
1168
|
+
if (!responder) return null; // fast path
|
1309
1169
|
|
1310
|
-
var
|
1311
|
-
baseLen = base.length,
|
1312
|
-
element = evt.target,
|
1170
|
+
var element = evt.target,
|
1313
1171
|
layer = this.get('layer'),
|
1314
1172
|
contentIndex = null,
|
1315
|
-
id
|
1173
|
+
id;
|
1316
1174
|
|
1317
1175
|
// walk up the element hierarchy until we find this or an element with an
|
1318
1176
|
// id matching the base guid (i.e. a collection item)
|
1319
1177
|
while (element && element !== document && element !== layer) {
|
1320
|
-
id = element ? SC.$(element).attr('id') : null
|
1178
|
+
id = element ? SC.$(element).attr('id') : null;
|
1321
1179
|
if (id && (contentIndex = this.contentIndexForLayerId(id)) !== null) {
|
1322
|
-
|
1180
|
+
break;
|
1323
1181
|
}
|
1324
|
-
element = element.parentNode
|
1182
|
+
element = element.parentNode;
|
1325
1183
|
}
|
1326
1184
|
|
1327
1185
|
// no matching element found?
|
1328
|
-
if (contentIndex===null || (element === layer)) {
|
1186
|
+
if (contentIndex === null || (element === layer)) {
|
1329
1187
|
element = layer = null; // avoid memory leaks
|
1330
1188
|
return null;
|
1331
1189
|
}
|
@@ -1333,7 +1191,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1333
1191
|
// okay, found the DOM node for the view, go ahead and create it
|
1334
1192
|
// first, find the contentIndex
|
1335
1193
|
if (contentIndex >= this.get('length')) {
|
1336
|
-
throw "layout for item view %@ was found when item view does not exist (%@)".fmt(id, this);
|
1194
|
+
throw new Error("layout for item view %@ was found when item view does not exist (%@)".fmt(id, this));
|
1337
1195
|
}
|
1338
1196
|
|
1339
1197
|
return this.itemViewForContentIndex(contentIndex);
|
@@ -1350,14 +1208,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1350
1208
|
@param {SC.IndexSet} indexes the indexes to expand
|
1351
1209
|
@returns {SC.CollectionView} receiver
|
1352
1210
|
*/
|
1353
|
-
expand: function(indexes) {
|
1211
|
+
expand: function (indexes) {
|
1354
1212
|
if (!indexes) return this; // nothing to do
|
1355
1213
|
var del = this.get('contentDelegate'),
|
1356
1214
|
content = this.get('content');
|
1357
1215
|
|
1358
|
-
indexes.forEach(function(i) {
|
1216
|
+
indexes.forEach(function (i) {
|
1359
1217
|
var state = del.contentIndexDisclosureState(this, content, i);
|
1360
|
-
if (state === SC.BRANCH_CLOSED) del.contentIndexExpand(this,content,i);
|
1218
|
+
if (state === SC.BRANCH_CLOSED) del.contentIndexExpand(this, content, i);
|
1361
1219
|
}, this);
|
1362
1220
|
return this;
|
1363
1221
|
},
|
@@ -1369,14 +1227,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1369
1227
|
@param {SC.IndexSet} indexes the indexes to expand
|
1370
1228
|
@returns {SC.CollectionView} receiver
|
1371
1229
|
*/
|
1372
|
-
collapse: function(indexes) {
|
1230
|
+
collapse: function (indexes) {
|
1373
1231
|
if (!indexes) return this; // nothing to do
|
1374
1232
|
var del = this.get('contentDelegate'),
|
1375
1233
|
content = this.get('content');
|
1376
1234
|
|
1377
|
-
indexes.forEach(function(i) {
|
1235
|
+
indexes.forEach(function (i) {
|
1378
1236
|
var state = del.contentIndexDisclosureState(this, content, i);
|
1379
|
-
if (state === SC.BRANCH_OPEN) del.contentIndexCollapse(this,content,i);
|
1237
|
+
if (state === SC.BRANCH_OPEN) del.contentIndexCollapse(this, content, i);
|
1380
1238
|
}, this);
|
1381
1239
|
return this;
|
1382
1240
|
},
|
@@ -1389,7 +1247,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1389
1247
|
Called whenever the selection object is changed to a new value. Begins
|
1390
1248
|
observing the selection for changes.
|
1391
1249
|
*/
|
1392
|
-
_cv_selectionDidChange: function() {
|
1250
|
+
_cv_selectionDidChange: function () {
|
1393
1251
|
var sel = this.get('selection'),
|
1394
1252
|
last = this._cv_selection,
|
1395
1253
|
func = this._cv_selectionContentDidChange;
|
@@ -1398,7 +1256,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1398
1256
|
if (last) last.removeObserver('[]', this, func);
|
1399
1257
|
if (sel) sel.addObserver('[]', this, func);
|
1400
1258
|
|
1401
|
-
this._cv_selection = sel
|
1259
|
+
this._cv_selection = sel;
|
1402
1260
|
this._cv_selectionContentDidChange();
|
1403
1261
|
}.observes('selection'),
|
1404
1262
|
|
@@ -1406,11 +1264,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1406
1264
|
Called whenever the selection object or its content changes. This will
|
1407
1265
|
repaint any items that changed their selection state.
|
1408
1266
|
*/
|
1409
|
-
_cv_selectionContentDidChange: function() {
|
1267
|
+
_cv_selectionContentDidChange: function () {
|
1410
1268
|
var sel = this.get('selection'),
|
1411
1269
|
last = this._cv_selindexes, // clone of last known indexes
|
1412
1270
|
content = this.get('content'),
|
1413
|
-
diff
|
1271
|
+
diff;
|
1414
1272
|
|
1415
1273
|
// save new last
|
1416
1274
|
this._cv_selindexes = sel ? sel.frozenCopy() : null;
|
@@ -1422,7 +1280,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1422
1280
|
if (sel && last) diff = sel.without(last).add(last.without(sel));
|
1423
1281
|
else diff = sel || last;
|
1424
1282
|
|
1425
|
-
if (diff && diff.get('length')>0) this.reloadSelectionIndexes(diff);
|
1283
|
+
if (diff && diff.get('length') > 0) this.reloadSelectionIndexes(diff);
|
1426
1284
|
},
|
1427
1285
|
|
1428
1286
|
/** @private
|
@@ -1441,19 +1299,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1441
1299
|
@param {SC.IndexSet} indexes affected indexes
|
1442
1300
|
@returns {SC.CollectionView} receiver
|
1443
1301
|
*/
|
1444
|
-
reloadSelectionIndexes: function(indexes) {
|
1445
|
-
var invalid = this._invalidSelection
|
1302
|
+
reloadSelectionIndexes: function (indexes) {
|
1303
|
+
var invalid = this._invalidSelection;
|
1446
1304
|
if (indexes && (invalid !== YES)) {
|
1447
|
-
if (invalid) { invalid.add(indexes)
|
1305
|
+
if (invalid) { invalid.add(indexes); }
|
1448
1306
|
else { invalid = this._invalidSelection = indexes.copy(); }
|
1449
1307
|
|
1450
|
-
} else this._invalidSelection = YES
|
1308
|
+
} else this._invalidSelection = YES; // force a total reload
|
1451
1309
|
|
1452
1310
|
if (this.get('isVisibleInWindow')) {
|
1453
1311
|
this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
|
1454
1312
|
}
|
1455
1313
|
|
1456
|
-
return this
|
1314
|
+
return this;
|
1457
1315
|
},
|
1458
1316
|
|
1459
1317
|
/**
|
@@ -1468,9 +1326,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1468
1326
|
|
1469
1327
|
@returns {SC.CollectionView} receiver
|
1470
1328
|
*/
|
1471
|
-
reloadSelectionIndexesIfNeeded: function() {
|
1329
|
+
reloadSelectionIndexesIfNeeded: function () {
|
1472
1330
|
var invalid = this._invalidSelection;
|
1473
|
-
if (!invalid || !this.get('isVisibleInWindow')) return this
|
1331
|
+
if (!invalid || !this.get('isVisibleInWindow')) return this;
|
1474
1332
|
|
1475
1333
|
var nowShowing = this.get('nowShowing'),
|
1476
1334
|
reload = this._invalidIndexes,
|
@@ -1481,7 +1339,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1481
1339
|
|
1482
1340
|
// fast path. if we are going to reload everything anyway, just forget
|
1483
1341
|
// about it. Also if we don't have a nowShowing, nothing to do.
|
1484
|
-
if (reload === YES || !nowShowing) return this
|
1342
|
+
if (reload === YES || !nowShowing) return this;
|
1485
1343
|
|
1486
1344
|
// if invalid is YES instead of index set, just reload everything
|
1487
1345
|
if (invalid === YES) invalid = nowShowing;
|
@@ -1490,13 +1348,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1490
1348
|
if (reload && reload.isIndexSet) invalid = invalid.without(reload);
|
1491
1349
|
|
1492
1350
|
// iterate through each item and set the isSelected state.
|
1493
|
-
invalid.forEach(function(idx) {
|
1351
|
+
invalid.forEach(function (idx) {
|
1494
1352
|
if (!nowShowing.contains(idx)) return; // not showing
|
1495
1353
|
var view = this.itemViewForContentIndex(idx, NO);
|
1496
1354
|
if (view) view.set('isSelected', sel ? sel.contains(content, idx) : NO);
|
1497
|
-
},this);
|
1355
|
+
}, this);
|
1498
1356
|
|
1499
|
-
return this
|
1357
|
+
return this;
|
1500
1358
|
},
|
1501
1359
|
|
1502
1360
|
/**
|
@@ -1509,13 +1367,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1509
1367
|
@param extend {Boolean} optionally extend the selection
|
1510
1368
|
@returns {SC.CollectionView} receiver
|
1511
1369
|
*/
|
1512
|
-
select: function(indexes, extend) {
|
1370
|
+
select: function (indexes, extend) {
|
1513
1371
|
var content = this.get('content'),
|
1514
1372
|
del = this.get('selectionDelegate'),
|
1515
1373
|
groupIndexes = this.get('_contentGroupIndexes'),
|
1516
1374
|
sel;
|
1517
1375
|
|
1518
|
-
if(!this.get('isSelectable') || !this.get('
|
1376
|
+
if (!this.get('isSelectable') || !this.get('isEnabledInPane')) return this;
|
1519
1377
|
|
1520
1378
|
// normalize
|
1521
1379
|
if (SC.typeOf(indexes) === SC.T_NUMBER) {
|
@@ -1523,16 +1381,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1523
1381
|
}
|
1524
1382
|
|
1525
1383
|
// if we are passed an empty index set or null, clear the selection.
|
1526
|
-
if (indexes && indexes.get('length')>0) {
|
1384
|
+
if (indexes && indexes.get('length') > 0) {
|
1527
1385
|
|
1528
1386
|
// first remove any group indexes - these can never be selected
|
1529
|
-
if (groupIndexes && groupIndexes.get('length')>0) {
|
1387
|
+
if (groupIndexes && groupIndexes.get('length') > 0) {
|
1530
1388
|
indexes = indexes.copy().remove(groupIndexes);
|
1531
1389
|
}
|
1532
1390
|
|
1533
1391
|
// give the delegate a chance to alter the items
|
1534
1392
|
indexes = del.collectionViewShouldSelectIndexes(this, indexes, extend);
|
1535
|
-
if (!indexes || indexes.get('length')===0) return this; // nothing to do
|
1393
|
+
if (!indexes || indexes.get('length') === 0) return this; // nothing to do
|
1536
1394
|
|
1537
1395
|
} else indexes = null;
|
1538
1396
|
|
@@ -1540,10 +1398,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1540
1398
|
if (extend && (sel = this.get('selection'))) sel = sel.copy();
|
1541
1399
|
else sel = SC.SelectionSet.create();
|
1542
1400
|
|
1543
|
-
if (indexes && indexes.get('length')>0) {
|
1401
|
+
if (indexes && indexes.get('length') > 0) {
|
1544
1402
|
|
1545
1403
|
// when selecting only one item, always select by content
|
1546
|
-
if (indexes.get('length')===1) {
|
1404
|
+
if (indexes.get('length') === 1) {
|
1547
1405
|
sel.addObject(content.objectAt(indexes.get('firstObject')));
|
1548
1406
|
|
1549
1407
|
// otherwise select an index range
|
@@ -1556,8 +1414,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1556
1414
|
if (!sel) sel = SC.SelectionSet.create(); // empty
|
1557
1415
|
|
1558
1416
|
// if we're not extending the selection, clear the selection anchor
|
1559
|
-
this._selectionAnchor = null
|
1560
|
-
this.set('selection', sel.freeze())
|
1417
|
+
this._selectionAnchor = null;
|
1418
|
+
this.set('selection', sel.freeze());
|
1561
1419
|
return this;
|
1562
1420
|
},
|
1563
1421
|
|
@@ -1567,13 +1425,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1567
1425
|
@param {Number|SC.IndexSet} indexes index or indexes to deselect
|
1568
1426
|
@returns {SC.CollectionView} receiver
|
1569
1427
|
*/
|
1570
|
-
deselect: function(indexes) {
|
1428
|
+
deselect: function (indexes) {
|
1571
1429
|
var sel = this.get('selection'),
|
1572
1430
|
content = this.get('content'),
|
1573
1431
|
del = this.get('selectionDelegate');
|
1574
1432
|
|
1575
|
-
if(!this.get('isSelectable') || !this.get('
|
1576
|
-
if (!sel || sel.get('length')===0) return this; // nothing to do
|
1433
|
+
if (!this.get('isSelectable') || !this.get('isEnabledInPane')) return this;
|
1434
|
+
if (!sel || sel.get('length') === 0) return this; // nothing to do
|
1577
1435
|
|
1578
1436
|
// normalize
|
1579
1437
|
if (SC.typeOf(indexes) === SC.T_NUMBER) {
|
@@ -1581,16 +1439,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1581
1439
|
}
|
1582
1440
|
|
1583
1441
|
// give the delegate a chance to alter the items
|
1584
|
-
indexes = del.collectionViewShouldDeselectIndexes(this, indexes)
|
1585
|
-
if (!indexes || indexes.get('length')===0) return this; // nothing to do
|
1442
|
+
indexes = del.collectionViewShouldDeselectIndexes(this, indexes);
|
1443
|
+
if (!indexes || indexes.get('length') === 0) return this; // nothing to do
|
1586
1444
|
|
1587
1445
|
// now merge change - note we expect sel && indexes to not be null
|
1588
1446
|
sel = sel.copy().remove(content, indexes);
|
1589
1447
|
sel = del.collectionViewSelectionForProposedSelection(this, sel);
|
1590
1448
|
if (!sel) sel = SC.SelectionSet.create(); // empty
|
1591
1449
|
|
1592
|
-
this.set('selection', sel.freeze())
|
1593
|
-
return this
|
1450
|
+
this.set('selection', sel.freeze());
|
1451
|
+
return this;
|
1594
1452
|
},
|
1595
1453
|
|
1596
1454
|
/** @private
|
@@ -1605,13 +1463,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1605
1463
|
@param {Number} bottom optional bottom of selection use as fallback
|
1606
1464
|
@returns {Number} next selectable index.
|
1607
1465
|
*/
|
1608
|
-
_findNextSelectableItemFromIndex: function(proposedIndex, bottom) {
|
1466
|
+
_findNextSelectableItemFromIndex: function (proposedIndex, bottom) {
|
1609
1467
|
var lim = this.get('length'),
|
1610
1468
|
range = SC.IndexSet.create(),
|
1611
|
-
content = this.get('content'),
|
1612
1469
|
del = this.get('selectionDelegate'),
|
1613
1470
|
groupIndexes = this.get('_contentGroupIndexes'),
|
1614
|
-
ret, sel
|
1471
|
+
ret, sel;
|
1615
1472
|
|
1616
1473
|
// fast path
|
1617
1474
|
if (!groupIndexes && (del.collectionViewShouldSelectIndexes === this.collectionViewShouldSelectIndexes)) {
|
@@ -1625,7 +1482,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1625
1482
|
if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
|
1626
1483
|
range.add(proposedIndex);
|
1627
1484
|
ret = del.collectionViewShouldSelectIndexes(this, range);
|
1628
|
-
if (ret && ret.get('length') >= 1) return proposedIndex
|
1485
|
+
if (ret && ret.get('length') >= 1) return proposedIndex;
|
1629
1486
|
range.remove(proposedIndex);
|
1630
1487
|
}
|
1631
1488
|
proposedIndex++;
|
@@ -1634,9 +1491,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1634
1491
|
// if nothing was found, return top of selection
|
1635
1492
|
if (bottom === undefined) {
|
1636
1493
|
sel = this.get('selection');
|
1637
|
-
bottom = sel ? sel.get('max') : -1
|
1494
|
+
bottom = sel ? sel.get('max') : -1;
|
1638
1495
|
}
|
1639
|
-
return bottom
|
1496
|
+
return bottom;
|
1640
1497
|
},
|
1641
1498
|
|
1642
1499
|
/** @private
|
@@ -1647,12 +1504,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1647
1504
|
@param {Integer} proposedIndex the desired index to select
|
1648
1505
|
@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.
|
1649
1506
|
*/
|
1650
|
-
_findPreviousSelectableItemFromIndex: function(proposedIndex, top) {
|
1507
|
+
_findPreviousSelectableItemFromIndex: function (proposedIndex, top) {
|
1651
1508
|
var range = SC.IndexSet.create(),
|
1652
|
-
content = this.get('content'),
|
1653
1509
|
del = this.get('selectionDelegate'),
|
1654
1510
|
groupIndexes = this.get('_contentGroupIndexes'),
|
1655
|
-
ret
|
1511
|
+
ret;
|
1656
1512
|
|
1657
1513
|
if (SC.none(proposedIndex)) proposedIndex = -1;
|
1658
1514
|
|
@@ -1668,7 +1524,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1668
1524
|
if (!groupIndexes || !groupIndexes.contains(proposedIndex)) {
|
1669
1525
|
range.add(proposedIndex);
|
1670
1526
|
ret = del.collectionViewShouldSelectIndexes(this, range);
|
1671
|
-
if (ret && ret.get('length') >= 1) return proposedIndex
|
1527
|
+
if (ret && ret.get('length') >= 1) return proposedIndex;
|
1672
1528
|
range.remove(proposedIndex);
|
1673
1529
|
}
|
1674
1530
|
proposedIndex--;
|
@@ -1677,10 +1533,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1677
1533
|
// if nothing was found, return top of selection
|
1678
1534
|
if (top === undefined) {
|
1679
1535
|
var sel = this.get('selection');
|
1680
|
-
top = sel ? sel.get('min') : -1
|
1536
|
+
top = sel ? sel.get('min') : -1;
|
1681
1537
|
}
|
1682
1538
|
if (SC.none(top)) top = -1;
|
1683
|
-
return top
|
1539
|
+
return top;
|
1684
1540
|
},
|
1685
1541
|
|
1686
1542
|
/**
|
@@ -1696,7 +1552,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1696
1552
|
selected. Defaults to 1
|
1697
1553
|
@returns {SC.CollectionView} receiver
|
1698
1554
|
*/
|
1699
|
-
selectPreviousItem: function(extend, numberOfItems) {
|
1555
|
+
selectPreviousItem: function (extend, numberOfItems) {
|
1700
1556
|
if (SC.none(numberOfItems)) numberOfItems = 1;
|
1701
1557
|
if (SC.none(extend)) extend = false;
|
1702
1558
|
|
@@ -1705,7 +1561,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1705
1561
|
if (sel) sel = sel.indexSetForSource(content);
|
1706
1562
|
|
1707
1563
|
var selTop = sel ? sel.get('min') : -1,
|
1708
|
-
selBottom = sel ? sel.get('max')-1 : -1,
|
1564
|
+
selBottom = sel ? sel.get('max') - 1 : -1,
|
1709
1565
|
anchor = this._selectionAnchor;
|
1710
1566
|
if (SC.none(anchor)) anchor = selTop;
|
1711
1567
|
|
@@ -1714,7 +1570,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1714
1570
|
|
1715
1571
|
// If the selBottom is after the anchor, then reduce the selection
|
1716
1572
|
if (selBottom > anchor) {
|
1717
|
-
selBottom = selBottom - numberOfItems
|
1573
|
+
selBottom = selBottom - numberOfItems;
|
1718
1574
|
|
1719
1575
|
// otherwise, select the previous item from the top
|
1720
1576
|
} else {
|
@@ -1722,29 +1578,29 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1722
1578
|
}
|
1723
1579
|
|
1724
1580
|
// Ensure we are not out of bounds
|
1725
|
-
if (SC.none(selTop) || (selTop < 0)) selTop = 0
|
1581
|
+
if (SC.none(selTop) || (selTop < 0)) selTop = 0;
|
1726
1582
|
if (!content.objectAt(selTop)) selTop = sel ? sel.get('min') : -1;
|
1727
|
-
if (selBottom < selTop) selBottom = selTop
|
1583
|
+
if (selBottom < selTop) selBottom = selTop;
|
1728
1584
|
|
1729
1585
|
// if not extending, just select the item previous to the selTop
|
1730
1586
|
} else {
|
1731
1587
|
selTop = this._findPreviousSelectableItemFromIndex(selTop - numberOfItems);
|
1732
|
-
if (SC.none(selTop) || (selTop < 0)) selTop = 0
|
1588
|
+
if (SC.none(selTop) || (selTop < 0)) selTop = 0;
|
1733
1589
|
if (!content.objectAt(selTop)) selTop = sel ? sel.get('min') : -1;
|
1734
|
-
selBottom = selTop
|
1735
|
-
anchor = null
|
1590
|
+
selBottom = selTop;
|
1591
|
+
anchor = null;
|
1736
1592
|
}
|
1737
1593
|
|
1738
|
-
var scrollToIndex = selTop
|
1594
|
+
var scrollToIndex = selTop;
|
1739
1595
|
|
1740
1596
|
// now build new selection
|
1741
|
-
sel = SC.IndexSet.create(selTop, selBottom+1-selTop);
|
1597
|
+
sel = SC.IndexSet.create(selTop, selBottom + 1 - selTop);
|
1742
1598
|
|
1743
1599
|
// ensure that the item is visible and set the selection
|
1744
|
-
this.scrollToContentIndex(scrollToIndex)
|
1745
|
-
this.select(sel)
|
1746
|
-
this._selectionAnchor = anchor
|
1747
|
-
return this
|
1600
|
+
this.scrollToContentIndex(scrollToIndex);
|
1601
|
+
this.select(sel);
|
1602
|
+
this._selectionAnchor = anchor;
|
1603
|
+
return this;
|
1748
1604
|
},
|
1749
1605
|
|
1750
1606
|
/**
|
@@ -1759,16 +1615,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1759
1615
|
selected. Defaults to 1.
|
1760
1616
|
@returns {SC.CollectionView} receiver
|
1761
1617
|
*/
|
1762
|
-
selectNextItem: function(extend, numberOfItems) {
|
1763
|
-
if (SC.none(numberOfItems)) numberOfItems = 1
|
1764
|
-
if (SC.none(extend)) extend = false
|
1618
|
+
selectNextItem: function (extend, numberOfItems) {
|
1619
|
+
if (SC.none(numberOfItems)) numberOfItems = 1;
|
1620
|
+
if (SC.none(extend)) extend = false;
|
1765
1621
|
|
1766
1622
|
var sel = this.get('selection'),
|
1767
1623
|
content = this.get('content');
|
1768
1624
|
if (sel) sel = sel.indexSetForSource(content);
|
1769
1625
|
|
1770
1626
|
var selTop = sel ? sel.get('min') : -1,
|
1771
|
-
selBottom = sel ? sel.get('max')-1 : -1,
|
1627
|
+
selBottom = sel ? sel.get('max') - 1 : -1,
|
1772
1628
|
anchor = this._selectionAnchor,
|
1773
1629
|
lim = this.get('length');
|
1774
1630
|
|
@@ -1779,7 +1635,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1779
1635
|
|
1780
1636
|
// If the selTop is before the anchor, then reduce the selection
|
1781
1637
|
if (selTop < anchor) {
|
1782
|
-
selTop = selTop + numberOfItems
|
1638
|
+
selTop = selTop + numberOfItems;
|
1783
1639
|
|
1784
1640
|
// otherwise, select the next item after the bottom
|
1785
1641
|
} else {
|
@@ -1787,34 +1643,34 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1787
1643
|
}
|
1788
1644
|
|
1789
1645
|
// Ensure we are not out of bounds
|
1790
|
-
if (selBottom >= lim) selBottom = lim-1;
|
1646
|
+
if (selBottom >= lim) selBottom = lim - 1;
|
1791
1647
|
|
1792
1648
|
// we also need to check that the item exists
|
1793
1649
|
if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
|
1794
1650
|
|
1795
1651
|
// and if top has eclipsed bottom, handle that too.
|
1796
|
-
if (selTop > selBottom) selTop = selBottom
|
1652
|
+
if (selTop > selBottom) selTop = selBottom;
|
1797
1653
|
|
1798
1654
|
// if not extending, just select the item next to the selBottom
|
1799
1655
|
} else {
|
1800
1656
|
selBottom = this._findNextSelectableItemFromIndex(selBottom + numberOfItems, selBottom);
|
1801
1657
|
|
1802
|
-
if (selBottom >= lim) selBottom = lim-1;
|
1658
|
+
if (selBottom >= lim) selBottom = lim - 1;
|
1803
1659
|
if (!content.objectAt(selBottom)) selBottom = sel ? sel.get('max') - 1 : -1;
|
1804
|
-
selTop = selBottom
|
1805
|
-
anchor = null
|
1660
|
+
selTop = selBottom;
|
1661
|
+
anchor = null;
|
1806
1662
|
}
|
1807
1663
|
|
1808
|
-
var scrollToIndex = selBottom
|
1664
|
+
var scrollToIndex = selBottom;
|
1809
1665
|
|
1810
1666
|
// now build new selection
|
1811
|
-
sel = SC.IndexSet.create(selTop, selBottom-selTop+1);
|
1667
|
+
sel = SC.IndexSet.create(selTop, selBottom - selTop + 1);
|
1812
1668
|
|
1813
1669
|
// ensure that the item is visible and set the selection
|
1814
|
-
this.scrollToContentIndex(scrollToIndex)
|
1815
|
-
this.select(sel)
|
1816
|
-
this._selectionAnchor = anchor
|
1817
|
-
return this
|
1670
|
+
this.scrollToContentIndex(scrollToIndex);
|
1671
|
+
this.select(sel);
|
1672
|
+
this._selectionAnchor = anchor;
|
1673
|
+
return this;
|
1818
1674
|
},
|
1819
1675
|
|
1820
1676
|
/**
|
@@ -1824,28 +1680,28 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1824
1680
|
|
1825
1681
|
@returns {Boolean} YES if deletion is possible.
|
1826
1682
|
*/
|
1827
|
-
deleteSelection: function() {
|
1683
|
+
deleteSelection: function () {
|
1828
1684
|
// perform some basic checks...
|
1829
|
-
if (!this.get('canDeleteContent')) return NO;
|
1685
|
+
if (!this.get('isEditable') || !this.get('canDeleteContent')) return NO;
|
1830
1686
|
|
1831
1687
|
var sel = this.get('selection'),
|
1832
1688
|
content = this.get('content'),
|
1833
1689
|
del = this.get('selectionDelegate'),
|
1834
|
-
indexes = sel&&content ? sel.indexSetForSource(content) : null;
|
1690
|
+
indexes = sel && content ? sel.indexSetForSource(content) : null;
|
1835
1691
|
|
1836
|
-
if (!content || !indexes || indexes.get('length') === 0) return NO
|
1692
|
+
if (!content || !indexes || indexes.get('length') === 0) return NO;
|
1837
1693
|
|
1838
1694
|
// let the delegate decide what to actually delete. If this returns an
|
1839
1695
|
// empty index set or null, just do nothing.
|
1840
1696
|
indexes = del.collectionViewShouldDeleteIndexes(this, indexes);
|
1841
|
-
if (!indexes || indexes.get('length') === 0) return NO
|
1697
|
+
if (!indexes || indexes.get('length') === 0) return NO;
|
1842
1698
|
|
1843
1699
|
// now have the delegate (or us) perform the deletion. The default
|
1844
1700
|
// delegate implementation just uses standard SC.Array methods to do the
|
1845
1701
|
// right thing.
|
1846
1702
|
del.collectionViewDeleteContent(this, this.get('content'), indexes);
|
1847
1703
|
|
1848
|
-
return YES
|
1704
|
+
return YES;
|
1849
1705
|
},
|
1850
1706
|
|
1851
1707
|
// ..........................................................
|
@@ -1858,9 +1714,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1858
1714
|
@param {Number} contentIndex The index of the item to scroll to
|
1859
1715
|
@returns {SC.CollectionView} receiver
|
1860
1716
|
*/
|
1861
|
-
scrollToContentIndex: function(contentIndex) {
|
1862
|
-
var itemView = this.itemViewForContentIndex(contentIndex)
|
1863
|
-
if (itemView) this.scrollToItemView(itemView)
|
1717
|
+
scrollToContentIndex: function (contentIndex) {
|
1718
|
+
var itemView = this.itemViewForContentIndex(contentIndex);
|
1719
|
+
if (itemView) this.scrollToItemView(itemView);
|
1864
1720
|
return this;
|
1865
1721
|
},
|
1866
1722
|
|
@@ -1871,9 +1727,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1871
1727
|
@param {SC.View} view The item view to scroll to
|
1872
1728
|
@returns {SC.CollectionView} receiver
|
1873
1729
|
*/
|
1874
|
-
scrollToItemView: function(view) {
|
1730
|
+
scrollToItemView: function (view) {
|
1875
1731
|
if (view) view.scrollToVisible();
|
1876
|
-
return this
|
1732
|
+
return this;
|
1877
1733
|
},
|
1878
1734
|
|
1879
1735
|
// ..........................................................
|
@@ -1881,84 +1737,84 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1881
1737
|
//
|
1882
1738
|
|
1883
1739
|
/** @private */
|
1884
|
-
keyDown: function(evt) {
|
1885
|
-
var ret = this.interpretKeyEvents(evt)
|
1886
|
-
return !ret ? NO : ret
|
1740
|
+
keyDown: function (evt) {
|
1741
|
+
var ret = this.interpretKeyEvents(evt);
|
1742
|
+
return !ret ? NO : ret;
|
1887
1743
|
},
|
1888
1744
|
|
1889
1745
|
/** @private */
|
1890
|
-
keyUp: function() { return true; },
|
1746
|
+
keyUp: function () { return true; },
|
1891
1747
|
|
1892
1748
|
/** @private
|
1893
1749
|
Handle space key event. Do action
|
1894
1750
|
*/
|
1895
|
-
insertText: function(chr, evt) {
|
1751
|
+
insertText: function (chr, evt) {
|
1896
1752
|
if (chr === ' ') {
|
1897
1753
|
var sel = this.get('selection');
|
1898
|
-
if (sel && sel.get('length')>0) {
|
1754
|
+
if (sel && sel.get('length') > 0) {
|
1899
1755
|
this.invokeLater(this._cv_action, 0, null, evt);
|
1900
1756
|
}
|
1901
|
-
return YES
|
1902
|
-
} else return NO
|
1757
|
+
return YES;
|
1758
|
+
} else return NO;
|
1903
1759
|
},
|
1904
1760
|
|
1905
1761
|
/** @private
|
1906
1762
|
Handle select all keyboard event.
|
1907
1763
|
*/
|
1908
|
-
selectAll: function(evt) {
|
1764
|
+
selectAll: function (evt) {
|
1909
1765
|
var content = this.get('content'),
|
1910
1766
|
sel = content ? SC.IndexSet.create(0, content.get('length')) : null;
|
1911
|
-
this.select(sel, NO)
|
1912
|
-
return YES
|
1767
|
+
this.select(sel, NO);
|
1768
|
+
return YES;
|
1913
1769
|
},
|
1914
1770
|
|
1915
1771
|
/** @private
|
1916
1772
|
Remove selection of any selected items.
|
1917
1773
|
*/
|
1918
|
-
deselectAll: function() {
|
1774
|
+
deselectAll: function () {
|
1919
1775
|
var content = this.get('content'),
|
1920
1776
|
sel = content ? SC.IndexSet.create(0, content.get('length')) : null;
|
1921
|
-
this.deselect(sel, NO)
|
1922
|
-
return YES
|
1777
|
+
this.deselect(sel, NO);
|
1778
|
+
return YES;
|
1923
1779
|
},
|
1924
1780
|
|
1925
1781
|
/** @private
|
1926
1782
|
Handle delete keyboard event.
|
1927
1783
|
*/
|
1928
|
-
deleteBackward: function(evt) {
|
1929
|
-
return this.deleteSelection()
|
1784
|
+
deleteBackward: function (evt) {
|
1785
|
+
return this.deleteSelection();
|
1930
1786
|
},
|
1931
1787
|
|
1932
1788
|
/** @private
|
1933
1789
|
Handle delete keyboard event.
|
1934
1790
|
*/
|
1935
|
-
deleteForward: function(evt) {
|
1936
|
-
return this.deleteSelection()
|
1791
|
+
deleteForward: function (evt) {
|
1792
|
+
return this.deleteSelection();
|
1937
1793
|
},
|
1938
1794
|
|
1939
1795
|
/** @private
|
1940
1796
|
Selects the same item on the next row or moves down one if itemsPerRow = 1
|
1941
1797
|
*/
|
1942
|
-
moveDown: function(sender, evt) {
|
1943
|
-
this.selectNextItem(false, this.get('itemsPerRow') || 1)
|
1798
|
+
moveDown: function (sender, evt) {
|
1799
|
+
this.selectNextItem(false, this.get('itemsPerRow') || 1);
|
1944
1800
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
1945
|
-
return true
|
1801
|
+
return true;
|
1946
1802
|
},
|
1947
1803
|
|
1948
1804
|
/** @private
|
1949
1805
|
Selects the same item on the next row or moves up one if itemsPerRow = 1
|
1950
1806
|
*/
|
1951
|
-
moveUp: function(sender, evt) {
|
1952
|
-
this.selectPreviousItem(false, this.get('itemsPerRow') || 1)
|
1807
|
+
moveUp: function (sender, evt) {
|
1808
|
+
this.selectPreviousItem(false, this.get('itemsPerRow') || 1);
|
1953
1809
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
1954
|
-
return true
|
1810
|
+
return true;
|
1955
1811
|
},
|
1956
1812
|
|
1957
1813
|
/** @private
|
1958
1814
|
Selects the previous item if itemsPerRow > 1. Otherwise does nothing.
|
1959
1815
|
If item is expandable, will collapse.
|
1960
1816
|
*/
|
1961
|
-
moveLeft: function(evt) {
|
1817
|
+
moveLeft: function (evt) {
|
1962
1818
|
// If the control key is down, this may be a browser shortcut and
|
1963
1819
|
// we should not handle the arrow key.
|
1964
1820
|
if (evt.ctrlKey || evt.metaKey) return NO;
|
@@ -1976,19 +1832,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1976
1832
|
// one item selected and the item is already collapsed or is a leaf
|
1977
1833
|
// node, then select the (expanded) parent element instead as a
|
1978
1834
|
// convenience to the user.
|
1979
|
-
if (
|
1980
|
-
var del
|
1835
|
+
if (indexes) {
|
1836
|
+
var del, // We'll load it lazily
|
1981
1837
|
selectParent = false,
|
1982
|
-
index
|
1838
|
+
index;
|
1983
1839
|
|
1984
|
-
if (
|
1840
|
+
if (indexes.get('length') === 1) {
|
1985
1841
|
index = indexes.get('firstObject');
|
1986
1842
|
del = this.get('contentDelegate');
|
1987
1843
|
var state = del.contentIndexDisclosureState(this, content, index);
|
1988
1844
|
if (state !== SC.BRANCH_OPEN) selectParent = true;
|
1989
1845
|
}
|
1990
1846
|
|
1991
|
-
if (
|
1847
|
+
if (selectParent) {
|
1992
1848
|
// TODO: PERFORMANCE: It would be great to have a function like
|
1993
1849
|
// SC.CollectionView.selectParentItem() or something similar
|
1994
1850
|
// for performance reasons. But since we don't currently
|
@@ -1996,20 +1852,20 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
1996
1852
|
// previous items until we find the first one with a outline
|
1997
1853
|
// level of one less than the selected item.
|
1998
1854
|
var desiredOutlineLevel = del.contentIndexOutlineLevel(this, content, index) - 1;
|
1999
|
-
if (
|
1855
|
+
if (desiredOutlineLevel >= 0) {
|
2000
1856
|
var parentIndex = -1;
|
2001
|
-
while (
|
1857
|
+
while (parentIndex < 0) {
|
2002
1858
|
var previousItemIndex = this._findPreviousSelectableItemFromIndex(index - 1);
|
2003
|
-
if (previousItemIndex < 0
|
1859
|
+
if (previousItemIndex < 0) return false; // Sanity-check.
|
2004
1860
|
index = previousItemIndex;
|
2005
1861
|
var outlineLevel = del.contentIndexOutlineLevel(this, content, index);
|
2006
|
-
if (
|
1862
|
+
if (outlineLevel === desiredOutlineLevel) {
|
2007
1863
|
parentIndex = previousItemIndex;
|
2008
1864
|
}
|
2009
1865
|
}
|
2010
1866
|
|
2011
1867
|
// If we found the parent, select it now.
|
2012
|
-
if (
|
1868
|
+
if (parentIndex !== -1) {
|
2013
1869
|
this.select(index);
|
2014
1870
|
}
|
2015
1871
|
}
|
@@ -2020,19 +1876,19 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2020
1876
|
}
|
2021
1877
|
}
|
2022
1878
|
|
2023
|
-
return true
|
1879
|
+
return true;
|
2024
1880
|
},
|
2025
1881
|
|
2026
1882
|
/** @private
|
2027
1883
|
Selects the next item if itemsPerRow > 1. Otherwise does nothing.
|
2028
1884
|
*/
|
2029
|
-
moveRight: function(evt) {
|
1885
|
+
moveRight: function (evt) {
|
2030
1886
|
// If the control key is down, this may be a browser shortcut and
|
2031
1887
|
// we should not handle the arrow key.
|
2032
1888
|
if (evt.ctrlKey || evt.metaKey) return NO;
|
2033
1889
|
|
2034
1890
|
if ((this.get('itemsPerRow') || 1) > 1) {
|
2035
|
-
this.selectNextItem(false, 1)
|
1891
|
+
this.selectNextItem(false, 1);
|
2036
1892
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
2037
1893
|
} else {
|
2038
1894
|
var sel = this.get('selection'),
|
@@ -2041,68 +1897,68 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2041
1897
|
if (indexes) this.expand(indexes);
|
2042
1898
|
}
|
2043
1899
|
|
2044
|
-
return true
|
1900
|
+
return true;
|
2045
1901
|
},
|
2046
1902
|
|
2047
1903
|
/** @private */
|
2048
|
-
moveDownAndModifySelection: function(sender, evt) {
|
2049
|
-
this.selectNextItem(true, this.get('itemsPerRow') || 1)
|
1904
|
+
moveDownAndModifySelection: function (sender, evt) {
|
1905
|
+
this.selectNextItem(true, this.get('itemsPerRow') || 1);
|
2050
1906
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
2051
|
-
return true
|
1907
|
+
return true;
|
2052
1908
|
},
|
2053
1909
|
|
2054
1910
|
/** @private */
|
2055
|
-
moveUpAndModifySelection: function(sender, evt) {
|
2056
|
-
this.selectPreviousItem(true, this.get('itemsPerRow') || 1)
|
1911
|
+
moveUpAndModifySelection: function (sender, evt) {
|
1912
|
+
this.selectPreviousItem(true, this.get('itemsPerRow') || 1);
|
2057
1913
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
2058
|
-
return true
|
1914
|
+
return true;
|
2059
1915
|
},
|
2060
1916
|
|
2061
1917
|
/** @private
|
2062
1918
|
Selects the previous item if itemsPerRow > 1. Otherwise does nothing.
|
2063
1919
|
*/
|
2064
|
-
moveLeftAndModifySelection: function(sender, evt) {
|
1920
|
+
moveLeftAndModifySelection: function (sender, evt) {
|
2065
1921
|
if ((this.get('itemsPerRow') || 1) > 1) {
|
2066
|
-
this.selectPreviousItem(true, 1)
|
1922
|
+
this.selectPreviousItem(true, 1);
|
2067
1923
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
2068
1924
|
}
|
2069
|
-
return true
|
1925
|
+
return true;
|
2070
1926
|
},
|
2071
1927
|
|
2072
1928
|
/** @private
|
2073
1929
|
Selects the next item if itemsPerRow > 1. Otherwise does nothing.
|
2074
1930
|
*/
|
2075
|
-
moveRightAndModifySelection: function(sender, evt) {
|
1931
|
+
moveRightAndModifySelection: function (sender, evt) {
|
2076
1932
|
if ((this.get('itemsPerRow') || 1) > 1) {
|
2077
|
-
this.selectNextItem(true, 1)
|
1933
|
+
this.selectNextItem(true, 1);
|
2078
1934
|
this._cv_performSelectAction(null, evt, this.ACTION_DELAY);
|
2079
1935
|
}
|
2080
|
-
return true
|
1936
|
+
return true;
|
2081
1937
|
},
|
2082
1938
|
|
2083
1939
|
/** @private
|
2084
1940
|
if content value is editable and we have one item selected, then edit.
|
2085
1941
|
otherwise, invoke action.
|
2086
1942
|
*/
|
2087
|
-
insertNewline: function(sender, evt) {
|
1943
|
+
insertNewline: function (sender, evt) {
|
2088
1944
|
var canEdit = this.get('isEditable') && this.get('canEditContent'),
|
2089
1945
|
sel, content, set, idx, itemView;
|
2090
1946
|
|
2091
1947
|
// first make sure we have a single item selected; get idx
|
2092
1948
|
if (canEdit) {
|
2093
|
-
sel = this.get('selection')
|
1949
|
+
sel = this.get('selection');
|
2094
1950
|
content = this.get('content');
|
2095
1951
|
if (sel && sel.get('length') === 1) {
|
2096
1952
|
set = sel.indexSetForSource(content);
|
2097
1953
|
idx = set ? set.get('min') : -1;
|
2098
|
-
canEdit = idx>=0;
|
1954
|
+
canEdit = idx >= 0;
|
2099
1955
|
}
|
2100
1956
|
}
|
2101
1957
|
|
2102
1958
|
// next find itemView and ensure it supports editing
|
2103
1959
|
if (canEdit) {
|
2104
1960
|
itemView = this.itemViewForContentIndex(idx);
|
2105
|
-
canEdit = itemView && SC.typeOf(itemView.beginEditing)===SC.T_FUNCTION;
|
1961
|
+
canEdit = itemView && SC.typeOf(itemView.beginEditing) === SC.T_FUNCTION;
|
2106
1962
|
}
|
2107
1963
|
|
2108
1964
|
// ok, we can edit..
|
@@ -2113,24 +1969,24 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2113
1969
|
|
2114
1970
|
// invoke action
|
2115
1971
|
} else {
|
2116
|
-
this.invokeLater(this._cv_action, 0, itemView, null)
|
1972
|
+
this.invokeLater(this._cv_action, 0, itemView, null);
|
2117
1973
|
}
|
2118
1974
|
|
2119
|
-
return YES
|
1975
|
+
return YES; // always handle
|
2120
1976
|
},
|
2121
1977
|
|
2122
|
-
insertTab: function(evt) {
|
1978
|
+
insertTab: function (evt) {
|
2123
1979
|
var view = this.get('nextValidKeyView');
|
2124
1980
|
if (view) view.becomeFirstResponder();
|
2125
1981
|
else evt.allowDefault();
|
2126
|
-
return YES
|
1982
|
+
return YES; // handled
|
2127
1983
|
},
|
2128
1984
|
|
2129
|
-
insertBacktab: function(evt) {
|
1985
|
+
insertBacktab: function (evt) {
|
2130
1986
|
var view = this.get('previousValidKeyView');
|
2131
1987
|
if (view) view.becomeFirstResponder();
|
2132
1988
|
else evt.allowDefault();
|
2133
|
-
return YES
|
1989
|
+
return YES; // handled
|
2134
1990
|
},
|
2135
1991
|
|
2136
1992
|
// ..........................................................
|
@@ -2148,9 +2004,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2148
2004
|
@param ev {Event} the mouse down event
|
2149
2005
|
@returns {Boolean} Usually YES.
|
2150
2006
|
*/
|
2151
|
-
mouseDown: function(ev) {
|
2007
|
+
mouseDown: function (ev) {
|
2152
2008
|
var content = this.get('content');
|
2153
2009
|
|
2010
|
+
// Fast path!
|
2154
2011
|
if (!content) return this.get('isSelectable');
|
2155
2012
|
|
2156
2013
|
var itemView = this.itemViewForEvent(ev),
|
@@ -2158,21 +2015,21 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2158
2015
|
info, anchor, sel, isSelected, modifierKeyPressed, didSelect = NO,
|
2159
2016
|
allowsMultipleSel = content.get('allowsMultipleSelection');
|
2160
2017
|
|
2161
|
-
if (!this.get('
|
2018
|
+
if (!this.get('isEnabledInPane')) return contentIndex > -1;
|
2162
2019
|
|
2163
|
-
if(!this.get('isSelectable')) return NO;
|
2020
|
+
if (!this.get('isSelectable')) return NO;
|
2164
2021
|
|
2165
2022
|
// become first responder if possible.
|
2166
|
-
this.becomeFirstResponder()
|
2023
|
+
this.becomeFirstResponder();
|
2167
2024
|
|
2168
2025
|
// Toggle the selection if selectOnMouseDown is true
|
2169
2026
|
if (this.get('useToggleSelection')) {
|
2170
2027
|
if (this.get('selectOnMouseDown')) {
|
2171
|
-
if (!itemView) return
|
2028
|
+
if (!itemView) return; // do nothing when clicked outside of elements
|
2172
2029
|
|
2173
2030
|
// determine if item is selected. If so, then go on.
|
2174
|
-
sel = this.get('selection')
|
2175
|
-
isSelected = sel && sel.containsObject(itemView.get('content'))
|
2031
|
+
sel = this.get('selection');
|
2032
|
+
isSelected = sel && sel.containsObject(itemView.get('content'));
|
2176
2033
|
|
2177
2034
|
if (isSelected) {
|
2178
2035
|
this.deselect(contentIndex);
|
@@ -2197,7 +2054,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2197
2054
|
// childItems... unless we do not allow empty selections, set it to empty.
|
2198
2055
|
if (!itemView) {
|
2199
2056
|
if (this.get('allowDeselectAll')) this.select(null, false);
|
2200
|
-
return YES
|
2057
|
+
return YES;
|
2201
2058
|
}
|
2202
2059
|
|
2203
2060
|
// collection some basic setup info
|
@@ -2212,7 +2069,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2212
2069
|
};
|
2213
2070
|
|
2214
2071
|
isSelected = sel ? sel.contains(contentIndex) : NO;
|
2215
|
-
info.modifierKeyPressed = modifierKeyPressed = ev.ctrlKey || ev.metaKey
|
2072
|
+
info.modifierKeyPressed = modifierKeyPressed = ev.ctrlKey || ev.metaKey;
|
2216
2073
|
|
2217
2074
|
|
2218
2075
|
// holding down a modifier key while clicking a selected item should
|
@@ -2224,8 +2081,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2224
2081
|
// from the last selected item
|
2225
2082
|
} else if (ev.shiftKey && sel && sel.get('length') > 0 && allowsMultipleSel) {
|
2226
2083
|
sel = this._findSelectionExtendedByShift(sel, contentIndex);
|
2227
|
-
anchor = this._selectionAnchor
|
2228
|
-
this.select(sel)
|
2084
|
+
anchor = this._selectionAnchor;
|
2085
|
+
this.select(sel);
|
2229
2086
|
this._selectionAnchor = anchor; //save the anchor
|
2230
2087
|
|
2231
2088
|
// If no modifier key was pressed, then clicking on the selected item
|
@@ -2237,14 +2094,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2237
2094
|
// item, adding it to the current selection if a modifier key was pressed.
|
2238
2095
|
} else {
|
2239
2096
|
|
2240
|
-
if((ev.shiftKey || modifierKeyPressed) && !allowsMultipleSel){
|
2097
|
+
if ((ev.shiftKey || modifierKeyPressed) && !allowsMultipleSel) {
|
2241
2098
|
this.select(null, false);
|
2242
2099
|
}
|
2243
2100
|
|
2244
2101
|
if (this.get("selectOnMouseDown")) {
|
2245
2102
|
this.select(contentIndex, modifierKeyPressed);
|
2246
2103
|
} else {
|
2247
|
-
info.shouldSelect = contentIndex >= 0
|
2104
|
+
info.shouldSelect = contentIndex >= 0;
|
2248
2105
|
}
|
2249
2106
|
}
|
2250
2107
|
|
@@ -2255,37 +2112,43 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2255
2112
|
},
|
2256
2113
|
|
2257
2114
|
/** @private */
|
2258
|
-
mouseUp: function(ev) {
|
2115
|
+
mouseUp: function (ev) {
|
2259
2116
|
var view = this.itemViewForEvent(ev),
|
2260
2117
|
info = this.mouseDownInfo,
|
2261
|
-
content = this.get('content')
|
2262
|
-
|
2263
|
-
|
2264
|
-
|
2118
|
+
content = this.get('content');
|
2119
|
+
|
2120
|
+
// Fast path!
|
2121
|
+
if (!content) {
|
2122
|
+
this._cleanupMouseDown();
|
2123
|
+
return true;
|
2124
|
+
}
|
2265
2125
|
|
2266
|
-
|
2126
|
+
var contentIndex = view ? view.get('contentIndex') : -1,
|
2127
|
+
sel, isSelected, canEdit, itemView, idx,
|
2128
|
+
allowsMultipleSel = content.get('allowsMultipleSelection');
|
2267
2129
|
|
2268
|
-
if(!this.get('
|
2130
|
+
if (!this.get('isEnabledInPane')) return contentIndex > -1;
|
2131
|
+
if (!this.get('isSelectable')) return NO;
|
2269
2132
|
|
2270
2133
|
if (this.get('useToggleSelection')) {
|
2271
2134
|
// Return if clicked outside of elements or if toggle was handled by mouseDown
|
2272
2135
|
if (!view || this.get('selectOnMouseDown')) return NO;
|
2273
2136
|
|
2274
2137
|
// determine if item is selected. If so, then go on.
|
2275
|
-
sel = this.get('selection')
|
2276
|
-
isSelected = sel && sel.containsObject(view.get('content'))
|
2138
|
+
sel = this.get('selection');
|
2139
|
+
isSelected = sel && sel.containsObject(view.get('content'));
|
2277
2140
|
|
2278
2141
|
if (isSelected) {
|
2279
|
-
this.deselect(contentIndex)
|
2142
|
+
this.deselect(contentIndex);
|
2280
2143
|
} else if (!allowsMultipleSel) {
|
2281
|
-
this.select(contentIndex, NO)
|
2144
|
+
this.select(contentIndex, NO);
|
2282
2145
|
} else {
|
2283
|
-
this.select(contentIndex, YES)
|
2146
|
+
this.select(contentIndex, YES);
|
2284
2147
|
}
|
2285
2148
|
|
2286
|
-
} else if(info) {
|
2149
|
+
} else if (info) {
|
2287
2150
|
idx = info.contentIndex;
|
2288
|
-
contentIndex = (view) ? view.get('contentIndex') : -1
|
2151
|
+
contentIndex = (view) ? view.get('contentIndex') : -1;
|
2289
2152
|
|
2290
2153
|
// this will be set if the user simply clicked on an unselected item and
|
2291
2154
|
// selectOnMouseDown was NO.
|
@@ -2302,33 +2165,33 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2302
2165
|
if (info.shouldReselect) {
|
2303
2166
|
|
2304
2167
|
// - contentValueIsEditable is true
|
2305
|
-
canEdit = this.get('isEditable') && this.get('canEditContent')
|
2168
|
+
canEdit = this.get('isEditable') && this.get('canEditContent');
|
2306
2169
|
|
2307
2170
|
// - the user clicked on an item that was already selected
|
2308
2171
|
// ^ this is the only way shouldReset is set to YES
|
2309
2172
|
|
2310
2173
|
// - is the only item selected
|
2311
2174
|
if (canEdit) {
|
2312
|
-
sel = this.get('selection')
|
2175
|
+
sel = this.get('selection');
|
2313
2176
|
canEdit = sel && (sel.get('length') === 1);
|
2314
2177
|
}
|
2315
2178
|
|
2316
2179
|
// - the item view responds to contentHitTest() and returns YES.
|
2317
2180
|
// - the item view responds to beginEditing and returns YES.
|
2318
2181
|
if (canEdit) {
|
2319
|
-
itemView = this.itemViewForContentIndex(idx)
|
2320
|
-
canEdit = itemView && (!itemView.contentHitTest || itemView.contentHitTest(ev))
|
2321
|
-
canEdit = (canEdit && itemView.beginEditing) ? itemView.beginEditing() : NO
|
2182
|
+
itemView = this.itemViewForContentIndex(idx);
|
2183
|
+
canEdit = itemView && (!itemView.contentHitTest || itemView.contentHitTest(ev));
|
2184
|
+
canEdit = (canEdit && itemView.beginEditing) ? itemView.beginEditing() : NO;
|
2322
2185
|
}
|
2323
2186
|
|
2324
2187
|
// if cannot edit, schedule a reselect (but give doubleClick a chance)
|
2325
2188
|
if (!canEdit) {
|
2326
|
-
if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate()
|
2327
|
-
this._cv_reselectTimer = this.invokeLater(this.select, 300, idx, false)
|
2189
|
+
if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate();
|
2190
|
+
this._cv_reselectTimer = this.invokeLater(this.select, 300, idx, false);
|
2328
2191
|
}
|
2329
2192
|
}
|
2330
2193
|
|
2331
|
-
this._cleanupMouseDown()
|
2194
|
+
this._cleanupMouseDown();
|
2332
2195
|
}
|
2333
2196
|
|
2334
2197
|
// handle actions on editing
|
@@ -2338,12 +2201,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2338
2201
|
},
|
2339
2202
|
|
2340
2203
|
/** @private */
|
2341
|
-
_cleanupMouseDown: function() {
|
2204
|
+
_cleanupMouseDown: function () {
|
2342
2205
|
|
2343
2206
|
// delete items explicitly to avoid leaks on IE
|
2344
2207
|
var info = this.mouseDownInfo, key;
|
2345
2208
|
if (info) {
|
2346
|
-
for(key in info) {
|
2209
|
+
for (key in info) {
|
2347
2210
|
if (!info.hasOwnProperty(key)) continue;
|
2348
2211
|
delete info[key];
|
2349
2212
|
}
|
@@ -2352,27 +2215,27 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2352
2215
|
},
|
2353
2216
|
|
2354
2217
|
/** @private */
|
2355
|
-
mouseMoved: function(ev) {
|
2218
|
+
mouseMoved: function (ev) {
|
2356
2219
|
var view = this.itemViewForEvent(ev),
|
2357
|
-
last = this._lastHoveredItem
|
2220
|
+
last = this._lastHoveredItem;
|
2358
2221
|
|
2359
2222
|
// handle hover events.
|
2360
2223
|
if (view !== last) {
|
2361
2224
|
if (last && last.mouseExited) last.mouseExited(ev);
|
2362
2225
|
if (view && view.mouseEntered) view.mouseEntered(ev);
|
2363
2226
|
}
|
2364
|
-
this._lastHoveredItem = view
|
2227
|
+
this._lastHoveredItem = view;
|
2365
2228
|
|
2366
2229
|
if (view && view.mouseMoved) view.mouseMoved(ev);
|
2367
2230
|
return YES;
|
2368
2231
|
},
|
2369
2232
|
|
2370
2233
|
/** @private */
|
2371
|
-
mouseExited: function(ev) {
|
2372
|
-
var view = this._lastHoveredItem
|
2373
|
-
this._lastHoveredItem = null
|
2374
|
-
if (view && view.mouseExited) view.mouseExited(ev)
|
2375
|
-
return YES
|
2234
|
+
mouseExited: function (ev) {
|
2235
|
+
var view = this._lastHoveredItem;
|
2236
|
+
this._lastHoveredItem = null;
|
2237
|
+
if (view && view.mouseExited) view.mouseExited(ev);
|
2238
|
+
return YES;
|
2376
2239
|
},
|
2377
2240
|
|
2378
2241
|
// ..........................................................
|
@@ -2380,14 +2243,14 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2380
2243
|
//
|
2381
2244
|
|
2382
2245
|
/** @private */
|
2383
|
-
touchStart: function(touch, evt) {
|
2246
|
+
touchStart: function (touch, evt) {
|
2384
2247
|
var itemView = this.itemViewForEvent(touch),
|
2385
2248
|
contentIndex = itemView ? itemView.get('contentIndex') : -1;
|
2386
2249
|
|
2387
|
-
if (!this.get('
|
2250
|
+
if (!this.get('isEnabledInPane')) return contentIndex > -1;
|
2388
2251
|
|
2389
2252
|
// become first responder if possible.
|
2390
|
-
this.becomeFirstResponder()
|
2253
|
+
this.becomeFirstResponder();
|
2391
2254
|
|
2392
2255
|
this._touchSelectedView = itemView;
|
2393
2256
|
|
@@ -2403,8 +2266,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2403
2266
|
},
|
2404
2267
|
|
2405
2268
|
/** @private */
|
2406
|
-
touchesDragged: function(evt, touches) {
|
2407
|
-
touches.forEach(function(touch){
|
2269
|
+
touchesDragged: function (evt, touches) {
|
2270
|
+
touches.forEach(function (touch) {
|
2408
2271
|
if (
|
2409
2272
|
Math.abs(touch.pageX - touch.startX) > 5 ||
|
2410
2273
|
Math.abs(touch.pageY - touch.startY) > 5
|
@@ -2417,7 +2280,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2417
2280
|
},
|
2418
2281
|
|
2419
2282
|
/** @private */
|
2420
|
-
touchEnd: function(touch) {
|
2283
|
+
touchEnd: function (touch) {
|
2421
2284
|
/*
|
2422
2285
|
TODO [CC] We should be using itemViewForEvent here, but because
|
2423
2286
|
ListItemView re-renders itself once isSelected is called
|
@@ -2430,7 +2293,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2430
2293
|
contentIndex = itemView ? itemView.get('contentIndex') : -1,
|
2431
2294
|
isSelected = NO, sel;
|
2432
2295
|
|
2433
|
-
if (!this.get('
|
2296
|
+
if (!this.get('isEnabledInPane')) return contentIndex > -1;
|
2434
2297
|
|
2435
2298
|
// Remove fake selection in case our contentIndex is -1, a select event will add it back
|
2436
2299
|
if (itemView) { itemView.set('isSelected', NO); }
|
@@ -2455,7 +2318,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2455
2318
|
},
|
2456
2319
|
|
2457
2320
|
/** @private */
|
2458
|
-
touchCancelled: function(evt) {
|
2321
|
+
touchCancelled: function (evt) {
|
2459
2322
|
// Remove fake selection
|
2460
2323
|
if (this._touchSelectedView) {
|
2461
2324
|
this._touchSelectedView.set('isSelected', NO);
|
@@ -2464,44 +2327,41 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2464
2327
|
},
|
2465
2328
|
|
2466
2329
|
/** @private */
|
2467
|
-
_findSelectionExtendedByShift: function(sel, contentIndex) {
|
2330
|
+
_findSelectionExtendedByShift: function (sel, contentIndex) {
|
2468
2331
|
|
2469
2332
|
// fast path. if we don't have a selection, just select index
|
2470
|
-
if (!sel || sel.get('length')===0) {
|
2333
|
+
if (!sel || sel.get('length') === 0) {
|
2471
2334
|
return SC.IndexSet.create(contentIndex);
|
2472
2335
|
}
|
2473
2336
|
|
2474
2337
|
// if we do have a selection, then figure out how to extend it.
|
2475
|
-
var
|
2476
|
-
|
2477
|
-
|
2478
|
-
max = sel.get('max')-1,
|
2479
|
-
info = this.mouseDownInfo,
|
2480
|
-
anchor = this._selectionAnchor ;
|
2338
|
+
var min = sel.get('min'),
|
2339
|
+
max = sel.get('max') - 1,
|
2340
|
+
anchor = this._selectionAnchor;
|
2481
2341
|
if (SC.none(anchor)) anchor = -1;
|
2482
2342
|
|
2483
2343
|
// clicked before the current selection set... extend it's beginning...
|
2484
2344
|
if (contentIndex < min) {
|
2485
2345
|
min = contentIndex;
|
2486
|
-
if (anchor<0) this._selectionAnchor = anchor = max; //anchor at end
|
2346
|
+
if (anchor < 0) this._selectionAnchor = anchor = max; //anchor at end
|
2487
2347
|
|
2488
2348
|
// clicked after the current selection set... extend it's ending...
|
2489
2349
|
} else if (contentIndex > max) {
|
2490
2350
|
max = contentIndex;
|
2491
|
-
if (anchor<0) this._selectionAnchor = anchor = min; // anchor at start
|
2351
|
+
if (anchor < 0) this._selectionAnchor = anchor = min; // anchor at start
|
2492
2352
|
|
2493
2353
|
// clicked inside the selection set... need to determine where the last
|
2494
2354
|
// selection was and use that as an anchor.
|
2495
2355
|
} else if (contentIndex >= min && contentIndex <= max) {
|
2496
|
-
if (anchor<0) this._selectionAnchor = anchor = min; //anchor at start
|
2356
|
+
if (anchor < 0) this._selectionAnchor = anchor = min; //anchor at start
|
2497
2357
|
|
2498
|
-
if (contentIndex === anchor) min = max = contentIndex
|
2358
|
+
if (contentIndex === anchor) min = max = contentIndex;
|
2499
2359
|
else if (contentIndex > anchor) {
|
2500
2360
|
min = anchor;
|
2501
|
-
max = contentIndex
|
2361
|
+
max = contentIndex;
|
2502
2362
|
} else if (contentIndex < anchor) {
|
2503
2363
|
min = contentIndex;
|
2504
|
-
max = anchor
|
2364
|
+
max = anchor;
|
2505
2365
|
}
|
2506
2366
|
}
|
2507
2367
|
|
@@ -2521,8 +2381,8 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2521
2381
|
@field
|
2522
2382
|
@type String
|
2523
2383
|
*/
|
2524
|
-
reorderDataType: function() {
|
2525
|
-
return 'SC.CollectionView.Reorder.'+SC.guidFor(this)
|
2384
|
+
reorderDataType: function () {
|
2385
|
+
return 'SC.CollectionView.Reorder.' + SC.guidFor(this);
|
2526
2386
|
}.property().cacheable(),
|
2527
2387
|
|
2528
2388
|
/**
|
@@ -2568,7 +2428,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2568
2428
|
- the dragDataTypes property returns a non-empty array
|
2569
2429
|
- a mouse down event was saved by the mouseDown method.
|
2570
2430
|
*/
|
2571
|
-
mouseDragged: function(
|
2431
|
+
mouseDragged: function (evt) {
|
2572
2432
|
var del = this.get('selectionDelegate'),
|
2573
2433
|
content = this.get('content'),
|
2574
2434
|
sel = this.get('selection'),
|
@@ -2577,13 +2437,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2577
2437
|
dragContent, dragDataTypes, dragView;
|
2578
2438
|
|
2579
2439
|
// if the mouse down event was cleared, there is nothing to do; return.
|
2580
|
-
if (!info || info.contentIndex<0) return YES
|
2440
|
+
if (!info || info.contentIndex < 0) return YES;
|
2581
2441
|
|
2582
2442
|
// Don't do anything unless the user has been dragging for 123msec
|
2583
|
-
if ((Date.now() - info.at) < 123) return YES
|
2443
|
+
if ((Date.now() - info.at) < 123) return YES;
|
2584
2444
|
|
2585
2445
|
// OK, they must be serious, decide if a drag will be allowed.
|
2586
|
-
if (del.collectionViewShouldBeginDrag(this)) {
|
2446
|
+
if (this.get('isEditable') && del.collectionViewShouldBeginDrag(this)) {
|
2587
2447
|
|
2588
2448
|
// First, get the selection to drag. Drag an array of selected
|
2589
2449
|
// items appearing in this collection, in the order of the
|
@@ -2598,9 +2458,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2598
2458
|
} else dragContent = sel ? sel.indexSetForSource(content) : null;
|
2599
2459
|
|
2600
2460
|
// remove any group indexes. groups cannot be dragged.
|
2601
|
-
if (dragContent && groupIndexes && groupIndexes.get('length')>0) {
|
2461
|
+
if (dragContent && groupIndexes && groupIndexes.get('length') > 0) {
|
2602
2462
|
dragContent = dragContent.copy().remove(groupIndexes);
|
2603
|
-
if (dragContent.get('length')===0) dragContent = null;
|
2463
|
+
if (dragContent.get('length') === 0) dragContent = null;
|
2604
2464
|
else dragContent.freeze();
|
2605
2465
|
}
|
2606
2466
|
|
@@ -2608,7 +2468,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2608
2468
|
else dragContent = dragContent.frozenCopy(); // so it doesn't change
|
2609
2469
|
|
2610
2470
|
dragContent = { content: content, indexes: dragContent };
|
2611
|
-
this.set('dragContent', dragContent)
|
2471
|
+
this.set('dragContent', dragContent);
|
2612
2472
|
|
2613
2473
|
// Get the set of data types supported by the delegate. If this returns
|
2614
2474
|
// a null or empty array and reordering content is not also supported
|
@@ -2621,9 +2481,6 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2621
2481
|
dragView = del.collectionViewDragViewFor(this, dragContent.indexes);
|
2622
2482
|
if (!dragView) dragView = this._cv_dragViewFor(dragContent.indexes);
|
2623
2483
|
|
2624
|
-
// Make sure the dragView has created its layer.
|
2625
|
-
dragView.createLayer();
|
2626
|
-
|
2627
2484
|
// Initiate the drag
|
2628
2485
|
SC.Drag.start({
|
2629
2486
|
event: info.event,
|
@@ -2637,13 +2494,13 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2637
2494
|
|
2638
2495
|
// Also use this opportunity to clean up since mouseUp won't
|
2639
2496
|
// get called.
|
2640
|
-
this._cleanupMouseDown()
|
2641
|
-
this._lastInsertionIndex = null
|
2497
|
+
this._cleanupMouseDown();
|
2498
|
+
this._lastInsertionIndex = null;
|
2642
2499
|
|
2643
2500
|
// Drag was not allowed by the delegate, so bail.
|
2644
|
-
} else this.set('dragContent', null)
|
2501
|
+
} else this.set('dragContent', null);
|
2645
2502
|
|
2646
|
-
return YES
|
2503
|
+
return YES;
|
2647
2504
|
}
|
2648
2505
|
},
|
2649
2506
|
|
@@ -2651,12 +2508,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2651
2508
|
Compute a default drag view by grabbing the raw layers and inserting them
|
2652
2509
|
into a drag view.
|
2653
2510
|
*/
|
2654
|
-
_cv_dragViewFor: function(dragContent) {
|
2511
|
+
_cv_dragViewFor: function (dragContent) {
|
2655
2512
|
// find only the indexes that are in both dragContent and nowShowing.
|
2656
2513
|
var indexes = this.get('nowShowing').without(dragContent),
|
2657
2514
|
dragLayer = this.get('layer').cloneNode(false),
|
2658
2515
|
view = SC.View.create({ layer: dragLayer, parentView: this }),
|
2659
|
-
height=0, layout;
|
2516
|
+
height = 0, layout;
|
2660
2517
|
|
2661
2518
|
indexes = this.get('nowShowing').without(indexes);
|
2662
2519
|
|
@@ -2665,7 +2522,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2665
2522
|
.css('border', 'none')
|
2666
2523
|
.css('top', 0).css('left', 0);
|
2667
2524
|
|
2668
|
-
indexes.forEach(function(i) {
|
2525
|
+
indexes.forEach(function (i) {
|
2669
2526
|
var itemView = this.itemViewForContentIndex(i),
|
2670
2527
|
isSelected, layer;
|
2671
2528
|
|
@@ -2685,18 +2542,18 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2685
2542
|
if (layer) {
|
2686
2543
|
dragLayer.appendChild(layer);
|
2687
2544
|
layout = itemView.get('layout');
|
2688
|
-
if(layout.height+layout.top>height){
|
2689
|
-
height = layout.height+layout.top;
|
2545
|
+
if (layout.height + layout.top > height) {
|
2546
|
+
height = layout.height + layout.top;
|
2690
2547
|
}
|
2691
2548
|
}
|
2692
2549
|
layer = null;
|
2693
2550
|
|
2694
2551
|
}, this);
|
2695
2552
|
// we don't want to show the scrollbars, resize the dragview'
|
2696
|
-
view.set('layout', {height:height});
|
2553
|
+
view.set('layout', { height: height });
|
2697
2554
|
|
2698
2555
|
dragLayer = null;
|
2699
|
-
return view
|
2556
|
+
return view;
|
2700
2557
|
},
|
2701
2558
|
|
2702
2559
|
|
@@ -2708,11 +2565,11 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2708
2565
|
@field
|
2709
2566
|
@type Array
|
2710
2567
|
*/
|
2711
|
-
dragDataTypes: function() {
|
2568
|
+
dragDataTypes: function () {
|
2712
2569
|
// consult delegate.
|
2713
2570
|
var del = this.get('selectionDelegate'),
|
2714
2571
|
ret = del.collectionViewDragDataTypes(this),
|
2715
|
-
key
|
2572
|
+
key;
|
2716
2573
|
|
2717
2574
|
if (this.get('canReorderContent')) {
|
2718
2575
|
ret = ret ? ret.copy() : [];
|
@@ -2728,12 +2585,12 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2728
2585
|
this method will consult the collection view delegate if one has been
|
2729
2586
|
provided. It also respects the canReorderContent method.
|
2730
2587
|
*/
|
2731
|
-
dragDataForType: function(drag, dataType) {
|
2588
|
+
dragDataForType: function (drag, dataType) {
|
2732
2589
|
|
2733
2590
|
// if this is a reorder, then return drag content.
|
2734
2591
|
if (this.get('canReorderContent')) {
|
2735
2592
|
if (dataType === this.get('reorderDataType')) {
|
2736
|
-
return this.get('dragContent')
|
2593
|
+
return this.get('dragContent');
|
2737
2594
|
}
|
2738
2595
|
}
|
2739
2596
|
|
@@ -2754,7 +2611,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2754
2611
|
@param {SC.Event} evt the event triggering this change, if available
|
2755
2612
|
@returns {Number} logical OR'd mask of allowed drag operations.
|
2756
2613
|
*/
|
2757
|
-
computeDragOperations: function(drag, evt) {
|
2614
|
+
computeDragOperations: function (drag, evt) {
|
2758
2615
|
// the proposed drag operation is DRAG_REORDER only if we can reorder
|
2759
2616
|
// content and the drag contains reorder content.
|
2760
2617
|
var op = SC.DRAG_NONE,
|
@@ -2762,15 +2619,15 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2762
2619
|
|
2763
2620
|
if (this.get('canReorderContent')) {
|
2764
2621
|
if (drag.get('dataTypes').indexOf(this.get('reorderDataType')) >= 0) {
|
2765
|
-
op = SC.DRAG_REORDER
|
2622
|
+
op = SC.DRAG_REORDER;
|
2766
2623
|
}
|
2767
2624
|
}
|
2768
2625
|
|
2769
2626
|
// Now pass this onto the delegate.
|
2770
2627
|
op = del.collectionViewComputeDragOperations(this, drag, op);
|
2771
|
-
if (op & SC.DRAG_REORDER) op = SC.DRAG_MOVE
|
2628
|
+
if (op & SC.DRAG_REORDER) op = SC.DRAG_MOVE;
|
2772
2629
|
|
2773
|
-
return op
|
2630
|
+
return op;
|
2774
2631
|
},
|
2775
2632
|
|
2776
2633
|
/** @private
|
@@ -2783,7 +2640,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2783
2640
|
@param {Number} dragOp allowed drag operation mask
|
2784
2641
|
Returns three params: [drop index, drop operation, allowed drag ops]
|
2785
2642
|
*/
|
2786
|
-
_computeDropOperationState: function(drag, evt, dragOp) {
|
2643
|
+
_computeDropOperationState: function (drag, evt, dragOp) {
|
2787
2644
|
// get the insertion index for this location. This can be computed
|
2788
2645
|
// by a subclass using whatever method. This method is not expected to
|
2789
2646
|
// do any data validation, just to map the location to an insertion
|
@@ -2799,10 +2656,10 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2799
2656
|
|
2800
2657
|
// get the computed insertion index and possibly drop operation.
|
2801
2658
|
// prefer to drop ON.
|
2802
|
-
var idx = this.insertionIndexForLocation(loc, SC.DROP_ON)
|
2659
|
+
var idx = this.insertionIndexForLocation(loc, SC.DROP_ON);
|
2803
2660
|
if (SC.typeOf(idx) === SC.T_ARRAY) {
|
2804
|
-
dropOp = idx[1]
|
2805
|
-
idx = idx[0]
|
2661
|
+
dropOp = idx[1]; // order matters here
|
2662
|
+
idx = idx[0];
|
2806
2663
|
}
|
2807
2664
|
|
2808
2665
|
// if the return drop operation is DROP_ON, then just check it with the
|
@@ -2813,25 +2670,25 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2813
2670
|
|
2814
2671
|
// Now save the insertion index and the dropOp. This may be changed by
|
2815
2672
|
// the collection delegate.
|
2816
|
-
this.set('proposedInsertionIndex', idx)
|
2817
|
-
this.set('proposedDropOperation', dropOp)
|
2818
|
-
tmp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp)
|
2819
|
-
idx = this.get('proposedInsertionIndex')
|
2820
|
-
dropOp = this.get('proposedDropOperation')
|
2821
|
-
this._dropInsertionIndex = this._dropOperation = null
|
2673
|
+
this.set('proposedInsertionIndex', idx);
|
2674
|
+
this.set('proposedDropOperation', dropOp);
|
2675
|
+
tmp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp);
|
2676
|
+
idx = this.get('proposedInsertionIndex');
|
2677
|
+
dropOp = this.get('proposedDropOperation');
|
2678
|
+
this._dropInsertionIndex = this._dropOperation = null;
|
2822
2679
|
|
2823
2680
|
// The delegate is OK with a drop on also, so just return.
|
2824
|
-
if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp]
|
2681
|
+
if (tmp !== SC.DRAG_NONE) return [idx, dropOp, tmp];
|
2825
2682
|
|
2826
2683
|
// The delegate is NOT OK with a drop on, try to get the insertion
|
2827
2684
|
// index again, but this time prefer SC.DROP_BEFORE, then let the
|
2828
2685
|
// rest of the method run...
|
2829
2686
|
else {
|
2830
|
-
dropOp = SC.DROP_BEFORE
|
2831
|
-
idx = this.insertionIndexForLocation(loc, SC.DROP_BEFORE)
|
2687
|
+
dropOp = SC.DROP_BEFORE;
|
2688
|
+
idx = this.insertionIndexForLocation(loc, SC.DROP_BEFORE);
|
2832
2689
|
if (SC.typeOf(idx) === SC.T_ARRAY) {
|
2833
|
-
dropOp = idx[1]
|
2834
|
-
idx = idx[0]
|
2690
|
+
dropOp = idx[1]; // order matters here
|
2691
|
+
idx = idx[0];
|
2835
2692
|
}
|
2836
2693
|
}
|
2837
2694
|
}
|
@@ -2842,20 +2699,20 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2842
2699
|
// content.
|
2843
2700
|
if ((idx >= 0) && canReorder && (dropOp !== SC.DROP_ON)) {
|
2844
2701
|
|
2845
|
-
objects = drag.dataForType(this.get('reorderDataType'))
|
2702
|
+
objects = drag.dataForType(this.get('reorderDataType'));
|
2846
2703
|
if (objects) {
|
2847
|
-
content = this.get('content')
|
2704
|
+
content = this.get('content');
|
2848
2705
|
|
2849
2706
|
// if the insertion index is in between two items in the drag itself,
|
2850
2707
|
// then this is not allowed. Either use the last insertion index or
|
2851
2708
|
// find the first index that is not in between selections. Stop when
|
2852
2709
|
// we get to the beginning.
|
2853
2710
|
if (dropOp === SC.DROP_BEFORE) {
|
2854
|
-
isPreviousInDrag = objects.indexes.contains(idx-1);
|
2711
|
+
isPreviousInDrag = objects.indexes.contains(idx - 1);
|
2855
2712
|
isNextInDrag = objects.indexes.contains(idx);
|
2856
2713
|
} else {
|
2857
2714
|
isPreviousInDrag = objects.indexes.contains(idx);
|
2858
|
-
isNextInDrag = objects.indexes.contains(idx-1);
|
2715
|
+
isNextInDrag = objects.indexes.contains(idx - 1);
|
2859
2716
|
}
|
2860
2717
|
|
2861
2718
|
if (isPreviousInDrag && isNextInDrag) {
|
@@ -2866,26 +2723,26 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2866
2723
|
len = content ? content.get('length') : 0;
|
2867
2724
|
while ((idx < len) && objects.indexes.contains(idx)) idx++;
|
2868
2725
|
}
|
2869
|
-
} else idx = this._lastInsertionIndex
|
2726
|
+
} else idx = this._lastInsertionIndex;
|
2870
2727
|
}
|
2871
2728
|
|
2872
2729
|
// If we found a valid insertion point to reorder at, then set the op
|
2873
2730
|
// to custom DRAG_REORDER.
|
2874
|
-
if (idx >= 0) dragOp = SC.DRAG_REORDER
|
2731
|
+
if (idx >= 0) dragOp = SC.DRAG_REORDER;
|
2875
2732
|
}
|
2876
2733
|
}
|
2877
2734
|
|
2878
2735
|
// Now save the insertion index and the dropOp. This may be changed by
|
2879
2736
|
// the collection delegate.
|
2880
|
-
this.set('proposedInsertionIndex', idx)
|
2881
|
-
this.set('proposedDropOperation', dropOp)
|
2882
|
-
dragOp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp)
|
2883
|
-
idx = this.get('proposedInsertionIndex')
|
2884
|
-
dropOp = this.get('proposedDropOperation')
|
2885
|
-
this._dropInsertionIndex = this._dropOperation = null
|
2737
|
+
this.set('proposedInsertionIndex', idx);
|
2738
|
+
this.set('proposedDropOperation', dropOp);
|
2739
|
+
dragOp = del.collectionViewValidateDragOperation(this, drag, dragOp, idx, dropOp);
|
2740
|
+
idx = this.get('proposedInsertionIndex');
|
2741
|
+
dropOp = this.get('proposedDropOperation');
|
2742
|
+
this._dropInsertionIndex = this._dropOperation = null;
|
2886
2743
|
|
2887
2744
|
// return generated state
|
2888
|
-
return [idx, dropOp, dragOp]
|
2745
|
+
return [idx, dropOp, dragOp];
|
2889
2746
|
},
|
2890
2747
|
|
2891
2748
|
/**
|
@@ -2897,7 +2754,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2897
2754
|
@param {SC.Drag} drag The drag that was updated
|
2898
2755
|
@param {SC.Event} evt The event for the drag
|
2899
2756
|
*/
|
2900
|
-
dragUpdated: function(drag, evt) {
|
2757
|
+
dragUpdated: function (drag, evt) {
|
2901
2758
|
var op = drag.get('allowedDragOperations'),
|
2902
2759
|
state = this._computeDropOperationState(drag, evt, op),
|
2903
2760
|
idx = state[0], dropOp = state[1], dragOp = state[2];
|
@@ -2906,15 +2763,15 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2906
2763
|
// point
|
2907
2764
|
if (dragOp !== SC.DRAG_NONE) {
|
2908
2765
|
if ((this._lastInsertionIndex !== idx) || (this._lastDropOperation !== dropOp)) {
|
2909
|
-
var itemView = this.itemViewForContentIndex(idx)
|
2910
|
-
this.showInsertionPoint(itemView, dropOp)
|
2766
|
+
var itemView = this.itemViewForContentIndex(idx);
|
2767
|
+
this.showInsertionPoint(itemView, dropOp);
|
2911
2768
|
}
|
2912
2769
|
|
2913
|
-
this._lastInsertionIndex = idx
|
2914
|
-
this._lastDropOperation = dropOp
|
2770
|
+
this._lastInsertionIndex = idx;
|
2771
|
+
this._lastDropOperation = dropOp;
|
2915
2772
|
} else {
|
2916
|
-
this.hideInsertionPoint()
|
2917
|
-
this._lastInsertionIndex = this._lastDropOperation = null
|
2773
|
+
this.hideInsertionPoint();
|
2774
|
+
this._lastInsertionIndex = this._lastDropOperation = null;
|
2918
2775
|
}
|
2919
2776
|
|
2920
2777
|
// Normalize drag operation to the standard kinds accepted by the drag
|
@@ -2922,13 +2779,22 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2922
2779
|
return (dragOp & SC.DRAG_REORDER) ? SC.DRAG_MOVE : dragOp;
|
2923
2780
|
},
|
2924
2781
|
|
2782
|
+
/**
|
2783
|
+
Implements the SC.DropTarget protocol. Hides any visible insertion
|
2784
|
+
point and clears some cached values.
|
2785
|
+
*/
|
2786
|
+
dragExited: function () {
|
2787
|
+
this.hideInsertionPoint();
|
2788
|
+
this._lastInsertionIndex = this._lastDropOperation = null;
|
2789
|
+
},
|
2790
|
+
|
2925
2791
|
/**
|
2926
2792
|
Implements the SC.DropTarget protocol. Hides any visible insertion
|
2927
2793
|
point and clears some cached values.
|
2928
2794
|
*/
|
2929
|
-
|
2930
|
-
this.hideInsertionPoint()
|
2931
|
-
this._lastInsertionIndex = this._lastDropOperation = null
|
2795
|
+
dragEnded: function () {
|
2796
|
+
this.hideInsertionPoint();
|
2797
|
+
this._lastInsertionIndex = this._lastDropOperation = null;
|
2932
2798
|
},
|
2933
2799
|
|
2934
2800
|
/**
|
@@ -2936,7 +2802,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2936
2802
|
|
2937
2803
|
@returns {Boolean} YES
|
2938
2804
|
*/
|
2939
|
-
acceptDragOperation: function(drag, op) {
|
2805
|
+
acceptDragOperation: function (drag, op) {
|
2940
2806
|
return YES;
|
2941
2807
|
},
|
2942
2808
|
|
@@ -2949,7 +2815,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2949
2815
|
@param {Number} op The drag operation to perform
|
2950
2816
|
@return {Number} The operation performed
|
2951
2817
|
*/
|
2952
|
-
performDragOperation: function(drag, op) {
|
2818
|
+
performDragOperation: function (drag, op) {
|
2953
2819
|
// Get the correct insertion point, drop operation, etc.
|
2954
2820
|
var state = this._computeDropOperationState(drag, null, op),
|
2955
2821
|
idx = state[0], dropOp = state[1], dragOp = state[2],
|
@@ -2959,32 +2825,32 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2959
2825
|
// The dragOp is the kinds of ops allowed. The drag operation must
|
2960
2826
|
// be included in that set.
|
2961
2827
|
if (dragOp & SC.DRAG_REORDER) {
|
2962
|
-
op = (op & SC.DRAG_MOVE) ? SC.DRAG_REORDER : SC.DRAG_NONE
|
2963
|
-
} else op = op & dragOp
|
2828
|
+
op = (op & SC.DRAG_MOVE) ? SC.DRAG_REORDER : SC.DRAG_NONE;
|
2829
|
+
} else op = op & dragOp;
|
2964
2830
|
|
2965
2831
|
// If no allowed drag operation could be found, just return.
|
2966
2832
|
if (op === SC.DRAG_NONE) return op;
|
2967
2833
|
|
2968
2834
|
// Some operation is allowed through, give the delegate a chance to
|
2969
2835
|
// handle it.
|
2970
|
-
performed = del.collectionViewPerformDragOperation(this, drag, op, idx, dropOp)
|
2836
|
+
performed = del.collectionViewPerformDragOperation(this, drag, op, idx, dropOp);
|
2971
2837
|
|
2972
2838
|
// If the delegate did not handle the drag (i.e. returned SC.DRAG_NONE),
|
2973
2839
|
// and the op type is REORDER, then do the reorder here.
|
2974
2840
|
if ((performed === SC.DRAG_NONE) && (op & SC.DRAG_REORDER)) {
|
2975
2841
|
|
2976
|
-
data = drag.dataForType(this.get('reorderDataType'))
|
2977
|
-
if (!data) return SC.DRAG_NONE
|
2842
|
+
data = drag.dataForType(this.get('reorderDataType'));
|
2843
|
+
if (!data) return SC.DRAG_NONE;
|
2978
2844
|
|
2979
|
-
content = this.get('content')
|
2845
|
+
content = this.get('content');
|
2980
2846
|
|
2981
2847
|
// check for special case - inserting BEFORE ourself...
|
2982
2848
|
// in this case just pretend the move happened since it's a no-op
|
2983
2849
|
// anyway
|
2984
2850
|
indexes = data.indexes;
|
2985
|
-
if (indexes.get('length')===1) {
|
2851
|
+
if (indexes.get('length') === 1) {
|
2986
2852
|
if (((dropOp === SC.DROP_BEFORE) || (dropOp === SC.DROP_AFTER)) &&
|
2987
|
-
(indexes.get('min')===idx)) return SC.DRAG_MOVE;
|
2853
|
+
(indexes.get('min') === idx)) return SC.DRAG_MOVE;
|
2988
2854
|
}
|
2989
2855
|
|
2990
2856
|
content.beginPropertyChanges(); // suspend notifications
|
@@ -2993,9 +2859,9 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
2993
2859
|
// added again later.
|
2994
2860
|
objects = [];
|
2995
2861
|
shift = 0;
|
2996
|
-
data.indexes.forEach(function(i) {
|
2997
|
-
objects.push(content.objectAt(i-shift));
|
2998
|
-
content.removeAt(i-shift);
|
2862
|
+
data.indexes.forEach(function (i) {
|
2863
|
+
objects.push(content.objectAt(i - shift));
|
2864
|
+
content.removeAt(i - shift);
|
2999
2865
|
shift++;
|
3000
2866
|
if (i < idx) idx--;
|
3001
2867
|
}, this);
|
@@ -3007,7 +2873,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3007
2873
|
content.endPropertyChanges(); // restart notifications
|
3008
2874
|
|
3009
2875
|
// make the op into its actual value
|
3010
|
-
op = SC.DRAG_MOVE
|
2876
|
+
op = SC.DRAG_MOVE;
|
3011
2877
|
}
|
3012
2878
|
|
3013
2879
|
return op;
|
@@ -3019,7 +2885,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3019
2885
|
|
3020
2886
|
@param {SC.View} view
|
3021
2887
|
*/
|
3022
|
-
collectionViewShouldBeginDrag: function(view) {
|
2888
|
+
collectionViewShouldBeginDrag: function (view) {
|
3023
2889
|
return this.get('canReorderContent');
|
3024
2890
|
},
|
3025
2891
|
|
@@ -3058,31 +2924,79 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3058
2924
|
@param {DropOp} dropOperation the preferred drop operation.
|
3059
2925
|
@returns {Array} format: [index, op]
|
3060
2926
|
*/
|
3061
|
-
insertionIndexForLocation: function(loc, dropOperation) {
|
2927
|
+
insertionIndexForLocation: function (loc, dropOperation) {
|
3062
2928
|
return -1;
|
3063
2929
|
},
|
3064
2930
|
|
2931
|
+
// ..........................................................
|
2932
|
+
// SCROLLING
|
2933
|
+
//
|
2934
|
+
|
2935
|
+
/** @private SC.ScrollView */
|
2936
|
+
touchScrollDidStart: function () {
|
2937
|
+
var clippingFrame = this.get('clippingFrame');
|
2938
|
+
|
2939
|
+
// Create the in-scroll clipping frame that will be used while touch scrolling.
|
2940
|
+
this._inScrollClippingFrame = {
|
2941
|
+
x: clippingFrame.x,
|
2942
|
+
y: clippingFrame.y,
|
2943
|
+
width: clippingFrame.width,
|
2944
|
+
height: clippingFrame.height
|
2945
|
+
};
|
2946
|
+
},
|
2947
|
+
|
2948
|
+
/** @private SC.ScrollView */
|
2949
|
+
touchScrollDidChange: function (left, top) {
|
2950
|
+
// Fast path! Don't try to update too soon.
|
2951
|
+
if (Date.now() - this._lastTouchScrollTime < 30) { return; }
|
2952
|
+
|
2953
|
+
var inScrollClippingFrame = this._inScrollClippingFrame;
|
2954
|
+
|
2955
|
+
// Update the in-scroll clipping frame with the new values.
|
2956
|
+
inScrollClippingFrame.x = left;
|
2957
|
+
inScrollClippingFrame.y = top;
|
2958
|
+
|
2959
|
+
// Indicate that nowShowing should be re-computed (this will use the
|
2960
|
+
// in-scroll clipping frame when it does).
|
2961
|
+
this.notifyPropertyChange('nowShowing');
|
2962
|
+
this.invokeOnce('_cv_nowShowingDidChange');
|
2963
|
+
|
2964
|
+
// Track the last time we updated.
|
2965
|
+
this._lastTouchScrollTime = Date.now();
|
2966
|
+
},
|
2967
|
+
|
2968
|
+
/** @private SC.ScrollView */
|
2969
|
+
touchScrollDidEnd: function () {
|
2970
|
+
// Clean up so that the regular clippingFrame is used again.
|
2971
|
+
this._inScrollClippingFrame = null;
|
2972
|
+
},
|
2973
|
+
|
3065
2974
|
// ..........................................................
|
3066
2975
|
// INTERNAL SUPPORT
|
3067
2976
|
//
|
3068
2977
|
|
3069
|
-
/** @private - when we become visible, reload if needed. */
|
3070
|
-
|
3071
|
-
if (this.
|
3072
|
-
|
3073
|
-
|
3074
|
-
this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
|
3075
|
-
}
|
2978
|
+
/** @private - when we are about to become visible, reload if needed. */
|
2979
|
+
willShowInDocument: function () {
|
2980
|
+
if (this._invalidIndexes) this.invokeOnce(this.reloadIfNeeded);
|
2981
|
+
if (this._invalidSelection) {
|
2982
|
+
this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
|
3076
2983
|
}
|
3077
|
-
}
|
2984
|
+
},
|
3078
2985
|
|
2986
|
+
/** @private - when we are added, reload if needed. */
|
2987
|
+
didAppendToDocument: function () {
|
2988
|
+
if (this._invalidIndexes) this.invokeOnce(this.reloadIfNeeded);
|
2989
|
+
if (this._invalidSelection) {
|
2990
|
+
this.invokeOnce(this.reloadSelectionIndexesIfNeeded);
|
2991
|
+
}
|
2992
|
+
},
|
3079
2993
|
|
3080
2994
|
/**
|
3081
2995
|
Default delegate method implementation, returns YES if isSelectable
|
3082
2996
|
is also true.
|
3083
2997
|
*/
|
3084
|
-
collectionViewShouldSelectItem: function(view, item) {
|
3085
|
-
return this.get('isSelectable')
|
2998
|
+
collectionViewShouldSelectItem: function (view, item) {
|
2999
|
+
return this.get('isSelectable');
|
3086
3000
|
},
|
3087
3001
|
|
3088
3002
|
/** @private */
|
@@ -3098,7 +3012,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3098
3012
|
the previous nowShowing range.
|
3099
3013
|
|
3100
3014
|
*/
|
3101
|
-
_cv_nowShowingDidChange: function() {
|
3015
|
+
_cv_nowShowingDidChange: function () {
|
3102
3016
|
var nowShowing = this.get('nowShowing'),
|
3103
3017
|
last = this._sccv_lastNowShowing,
|
3104
3018
|
diff, diff1, diff2;
|
@@ -3111,7 +3025,7 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3111
3025
|
diff1 = this._TMP_DIFF1.add(last).remove(nowShowing);
|
3112
3026
|
diff2 = this._TMP_DIFF2.add(nowShowing).remove(last);
|
3113
3027
|
diff = diff1.add(diff2);
|
3114
|
-
} else diff = last || nowShowing
|
3028
|
+
} else diff = last || nowShowing;
|
3115
3029
|
}
|
3116
3030
|
|
3117
3031
|
// if nowShowing has actually changed, then update
|
@@ -3128,19 +3042,35 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3128
3042
|
}.observes('nowShowing'),
|
3129
3043
|
|
3130
3044
|
/** @private */
|
3131
|
-
init: function() {
|
3132
|
-
|
3133
|
-
|
3134
|
-
|
3135
|
-
|
3136
|
-
|
3137
|
-
|
3045
|
+
init: function () {
|
3046
|
+
sc_super();
|
3047
|
+
|
3048
|
+
if (this.useFastPath) {
|
3049
|
+
//@if(debug)
|
3050
|
+
// Deprecation warning for those that were using SC.CollectionFastPath.
|
3051
|
+
SC.warn("Developer Warning: SC.CollectionView `useFastPath` has been deprecated. The performance improvements have been integrated directly into SC.CollectionView as the default behavior. Please disable the useFastPath property and refer to the SC.CollectionView documentation for more information.");
|
3052
|
+
//@endif
|
3053
|
+
this.mixin(SC.CollectionFastPath);
|
3054
|
+
}
|
3055
|
+
|
3056
|
+
//@if(debug)
|
3057
|
+
if (this.willReload || this.didReload) {
|
3058
|
+
// Deprecation warning for willReload and didReload. These don't seem to serve any purpose.
|
3059
|
+
SC.warn("Developer Warning: SC.CollectionView no longer calls willReload and didReload on its subclasses because it includes item view and layer pooling in itself by default.");
|
3060
|
+
}
|
3061
|
+
//@endif
|
3062
|
+
|
3063
|
+
if (this.get('canReorderContent')) this._cv_canReorderContentDidChange();
|
3064
|
+
this._sccv_lastNowShowing = this.get('nowShowing').clone();
|
3065
|
+
|
3066
|
+
if (this.content) this._cv_contentDidChange();
|
3067
|
+
if (this.selection) this._cv_selectionDidChange();
|
3138
3068
|
},
|
3139
3069
|
|
3140
3070
|
/** @private
|
3141
3071
|
Become a drop target whenever reordering content is enabled.
|
3142
3072
|
*/
|
3143
|
-
_cv_canReorderContentDidChange: function() {
|
3073
|
+
_cv_canReorderContentDidChange: function () {
|
3144
3074
|
if (this.get('canReorderContent')) {
|
3145
3075
|
if (!this.get('isDropTarget')) this.set('isDropTarget', YES);
|
3146
3076
|
SC.Drag.addDropTarget(this);
|
@@ -3154,16 +3084,16 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3154
3084
|
current selection (saved as a separate array so that a change in sel
|
3155
3085
|
in the meantime will not be lost)
|
3156
3086
|
*/
|
3157
|
-
_cv_performSelectAction: function(view, ev, delay, clickCount) {
|
3087
|
+
_cv_performSelectAction: function (view, ev, delay, clickCount) {
|
3158
3088
|
var sel;
|
3159
|
-
if (delay === undefined) delay = 0
|
3089
|
+
if (delay === undefined) delay = 0;
|
3160
3090
|
if (clickCount === undefined) clickCount = 1;
|
3161
|
-
if ((clickCount>1) || this.get('actOnSelect')) {
|
3162
|
-
if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate()
|
3091
|
+
if ((clickCount > 1) || this.get('actOnSelect')) {
|
3092
|
+
if (this._cv_reselectTimer) this._cv_reselectTimer.invalidate();
|
3163
3093
|
sel = this.get('selection');
|
3164
3094
|
sel = sel ? sel.toArray() : [];
|
3165
3095
|
if (this._cv_actionTimer) this._cv_actionTimer.invalidate();
|
3166
|
-
this._cv_actionTimer = this.invokeLater(this._cv_action, delay, view, ev, sel)
|
3096
|
+
this._cv_actionTimer = this.invokeLater(this._cv_action, delay, view, ev, sel);
|
3167
3097
|
}
|
3168
3098
|
},
|
3169
3099
|
|
@@ -3171,36 +3101,253 @@ SC.CollectionView = SC.View.extend(SC.CollectionViewDelegate, SC.CollectionConte
|
|
3171
3101
|
Perform the action. Supports legacy behavior as well as newer style
|
3172
3102
|
action dispatch.
|
3173
3103
|
*/
|
3174
|
-
_cv_action: function(view, evt, context) {
|
3104
|
+
_cv_action: function (view, evt, context) {
|
3175
3105
|
var action = this.get('action');
|
3176
3106
|
var target = this.get('target') || null;
|
3177
3107
|
|
3178
3108
|
this._cv_actionTimer = null;
|
3179
3109
|
if (action) {
|
3180
3110
|
// if the action is a function, just call it
|
3181
|
-
if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt)
|
3111
|
+
if (SC.typeOf(action) === SC.T_FUNCTION) return this.action(view, evt);
|
3182
3112
|
|
3183
3113
|
// otherwise, use the new sendAction style
|
3184
|
-
var pane = this.get('pane')
|
3114
|
+
var pane = this.get('pane');
|
3185
3115
|
if (pane) {
|
3186
3116
|
pane.rootResponder.sendAction(action, target, this, pane, context);
|
3187
3117
|
}
|
3188
|
-
// SC.app.sendAction(action, target, this) ;
|
3189
3118
|
|
3190
3119
|
// if no action is specified, then trigger the support action,
|
3191
3120
|
// if supported.
|
3192
3121
|
} else if (!view) {
|
3193
|
-
return
|
3122
|
+
return; // nothing to do
|
3194
3123
|
|
3195
3124
|
// if the target view has its own internal action handler,
|
3196
3125
|
// trigger that.
|
3197
3126
|
} else if (SC.typeOf(view._action) == SC.T_FUNCTION) {
|
3198
|
-
return view._action(evt)
|
3127
|
+
return view._action(evt);
|
3199
3128
|
|
3200
3129
|
// otherwise call the action method to support older styles.
|
3201
3130
|
} else if (SC.typeOf(view.action) == SC.T_FUNCTION) {
|
3202
|
-
return view.action(evt)
|
3131
|
+
return view.action(evt);
|
3203
3132
|
}
|
3133
|
+
},
|
3134
|
+
|
3135
|
+
_attrsForContentIndex: function (idx) {
|
3136
|
+
var attrs = this._TMP_ATTRS,
|
3137
|
+
del = this.get('contentDelegate'),
|
3138
|
+
items = this.get('content'),
|
3139
|
+
isGroupView = this._contentIndexIsGroup(idx),
|
3140
|
+
isEditable = this.get('isEditable') && this.get('canEditContent'),
|
3141
|
+
isReorderable = this.get('isEditable') && this.get('canReorderContent'),
|
3142
|
+
isDeletable = this.get('isEditable') && this.get('canDeleteContent'),
|
3143
|
+
isEnabled = del.contentIndexIsEnabled(this, items, idx),
|
3144
|
+
isSelected = del.contentIndexIsSelected(this, items, idx),
|
3145
|
+
outlineLevel = del.contentIndexOutlineLevel(this, items, idx),
|
3146
|
+
disclosureState = del.contentIndexDisclosureState(this, items, idx);
|
3147
|
+
|
3148
|
+
attrs.contentIndex = idx;
|
3149
|
+
attrs.content = items.objectAt(idx);
|
3150
|
+
attrs.disclosureState = disclosureState;
|
3151
|
+
attrs.isEnabled = isEnabled;
|
3152
|
+
attrs.isEditable = isEditable;
|
3153
|
+
attrs.isReorderable = isReorderable;
|
3154
|
+
attrs.isDeletable = isDeletable;
|
3155
|
+
attrs.isSelected = isSelected;
|
3156
|
+
attrs.isGroupView = isGroupView;
|
3157
|
+
attrs.layerId = this.layerIdFor(idx);
|
3158
|
+
attrs.owner = attrs.displayDelegate = this;
|
3159
|
+
attrs.page = this.page;
|
3160
|
+
attrs.outlineLevel = outlineLevel;
|
3161
|
+
|
3162
|
+
if (isGroupView) attrs.classNames = this._GROUP_COLLECTION_CLASS_NAMES;
|
3163
|
+
else attrs.classNames = this._COLLECTION_CLASS_NAMES;
|
3164
|
+
|
3165
|
+
attrs.layout = this.layoutForContentIndex(idx);
|
3166
|
+
if (!attrs.layout) { attrs.layout = SC.View.prototype.layout; }
|
3167
|
+
|
3168
|
+
return attrs;
|
3169
|
+
},
|
3170
|
+
|
3171
|
+
/** @private
|
3172
|
+
A cache of the `contentGroupIndexes` value returned by the delegate. This
|
3173
|
+
is frequently accessed and usually involves creating an `SC.IndexSet`
|
3174
|
+
object, so it's worthwhile to cache.
|
3175
|
+
*/
|
3176
|
+
_contentGroupIndexes: function () {
|
3177
|
+
return this.get('contentDelegate').contentGroupIndexes(this, this.get('content'));
|
3178
|
+
}.property('contentDelegate').cacheable(),
|
3179
|
+
|
3180
|
+
/** @private
|
3181
|
+
Rather than calling contentIndexIsGroup on the delegate each time, first
|
3182
|
+
check if there are even any contentGroupIndexes.
|
3183
|
+
*/
|
3184
|
+
_contentIndexIsGroup: function (idx) {
|
3185
|
+
var groupIndexes = this.get('_contentGroupIndexes');
|
3186
|
+
|
3187
|
+
// If there are groupIndexes and the given index is within them, check
|
3188
|
+
// with the delegate.
|
3189
|
+
if (groupIndexes && groupIndexes.contains(idx)) {
|
3190
|
+
var del = this.get('contentDelegate'),
|
3191
|
+
items = this.get('content');
|
3192
|
+
|
3193
|
+
return del.contentIndexIsGroup(this, items, idx);
|
3194
|
+
} else {
|
3195
|
+
return false;
|
3196
|
+
}
|
3197
|
+
},
|
3198
|
+
|
3199
|
+
/** @private
|
3200
|
+
Determines the example view for a content index.
|
3201
|
+
*/
|
3202
|
+
_exampleViewForContentIndex: function (idx) {
|
3203
|
+
var key,
|
3204
|
+
ExampleView,
|
3205
|
+
items = this.get('content'),
|
3206
|
+
item = items.objectAt(idx);
|
3207
|
+
|
3208
|
+
if (this._contentIndexIsGroup(idx)) {
|
3209
|
+
// so, if it is indeed a group view, we go that route to get the example view
|
3210
|
+
key = this.get('contentGroupExampleViewKey');
|
3211
|
+
if (key && item) ExampleView = item.get(key);
|
3212
|
+
if (!ExampleView) ExampleView = this.get('groupExampleView') || this.get('exampleView');
|
3213
|
+
} else {
|
3214
|
+
// otherwise, we go through the normal example view
|
3215
|
+
key = this.get('contentExampleViewKey');
|
3216
|
+
if (key && item) ExampleView = item.get(key);
|
3217
|
+
if (!ExampleView) ExampleView = this.get('exampleView');
|
3218
|
+
}
|
3219
|
+
|
3220
|
+
return ExampleView;
|
3221
|
+
},
|
3222
|
+
|
3223
|
+
/** @private
|
3224
|
+
Returns the pool for a given example view.
|
3225
|
+
|
3226
|
+
The pool is calculated based on the guid for the example view class.
|
3227
|
+
|
3228
|
+
@param {SC.View} exampleView
|
3229
|
+
*/
|
3230
|
+
_poolForExampleView: function (exampleView) {
|
3231
|
+
var poolKey = SC.guidFor(exampleView);
|
3232
|
+
if (!this._pools) { this._pools = {}; }
|
3233
|
+
if (!this._pools[poolKey]) this._pools[poolKey] = [];
|
3234
|
+
return this._pools[poolKey];
|
3235
|
+
},
|
3236
|
+
|
3237
|
+
/** @private
|
3238
|
+
Override to compute the hidden layout of the itemView for the content at the
|
3239
|
+
specified idnex. This layout will be applied when it is moved to the
|
3240
|
+
pool for reuse and should be completely outside the visible portion
|
3241
|
+
of the collection.
|
3242
|
+
|
3243
|
+
By default this layout is determined using the normal layout for the item.
|
3244
|
+
If the regular layout has a height, the pooled layout will be one height
|
3245
|
+
off the top (for top positioned) or off the bottom (for bottom positioned)
|
3246
|
+
and if the regular layout has a width, the pooled layout will be one
|
3247
|
+
width off the left (for left positioned) or off the right (for right
|
3248
|
+
positioned).
|
3249
|
+
|
3250
|
+
@param Number contentIndex the index of the item in the content
|
3251
|
+
@returns Object a view layout
|
3252
|
+
*/
|
3253
|
+
_poolLayoutForContentIndex: function (contentIndex) {
|
3254
|
+
var layout = this.layoutForContentIndex(contentIndex);
|
3255
|
+
|
3256
|
+
if (layout && layout.height) {
|
3257
|
+
if (layout.top) { layout.top = -layout.height; }
|
3258
|
+
else { layout.bottom = -layout.height; }
|
3259
|
+
} else if (layout && layout.width) {
|
3260
|
+
if (layout.left) { layout.left = -layout.width; }
|
3261
|
+
else { layout.right = -layout.width; }
|
3262
|
+
} else {
|
3263
|
+
// There is not really a valid layout for a collection. Just shape it and
|
3264
|
+
// place it out of view.
|
3265
|
+
layout = { left: -100, width: 100, top: -100, height: 100 };
|
3266
|
+
}
|
3267
|
+
|
3268
|
+
return layout;
|
3269
|
+
},
|
3270
|
+
|
3271
|
+
/** @private
|
3272
|
+
Configures an existing item view with new attributes.
|
3273
|
+
|
3274
|
+
@param {SC.View} itemView
|
3275
|
+
@param {Hash} attrs
|
3276
|
+
*/
|
3277
|
+
_reconfigureItemView: function (itemView, attrs) {
|
3278
|
+
itemView.beginPropertyChanges();
|
3279
|
+
itemView.set('content', attrs.content);
|
3280
|
+
itemView.set('contentIndex', attrs.contentIndex);
|
3281
|
+
itemView.set('isEnabled', attrs.isEnabled);
|
3282
|
+
itemView.set('isEditable', attrs.isEditable);
|
3283
|
+
itemView.set('isReorderable', attrs.isReorderable);
|
3284
|
+
itemView.set('isDeletable', attrs.isDeletable);
|
3285
|
+
itemView.set('isSelected', attrs.isSelected);
|
3286
|
+
itemView.set('layerId', attrs.layerId);
|
3287
|
+
itemView.set('layout', attrs.layout);
|
3288
|
+
itemView.set('outlineLevel', attrs.outlineLevel);
|
3289
|
+
itemView.set('disclosureState', attrs.disclosureState);
|
3290
|
+
itemView.endPropertyChanges();
|
3291
|
+
},
|
3292
|
+
|
3293
|
+
/** @private
|
3294
|
+
Removes the item view, pooling it for re-use if possible.
|
3295
|
+
*/
|
3296
|
+
_removeItemView: function (itemView, idx) {
|
3297
|
+
var exampleView,
|
3298
|
+
items = this.get('content'),
|
3299
|
+
layout,
|
3300
|
+
pool,
|
3301
|
+
prototype,
|
3302
|
+
wasPooled = false;
|
3303
|
+
|
3304
|
+
// Don't pool views whose content has changed, because if the example
|
3305
|
+
// view used is different than the new content, we would pool the wrong
|
3306
|
+
// type of view.
|
3307
|
+
if (items && itemView.get('content') === items.objectAt(idx)) {
|
3308
|
+
|
3309
|
+
exampleView = this._exampleViewForContentIndex(idx);
|
3310
|
+
if (SC.none(exampleView.prototype.isReusable) || exampleView.prototype.isReusable) {
|
3311
|
+
// If the exampleView is reusable, send the view to its pool.
|
3312
|
+
pool = this._poolForExampleView(exampleView);
|
3313
|
+
|
3314
|
+
//@if(debug)
|
3315
|
+
// Add a bit of developer support if they are migrating over from SC.CollectionFastPath
|
3316
|
+
if (itemView.hibernateInPool) {
|
3317
|
+
SC.error("Developer Error: Item views that want to do clean up before being pooled should implement sleepInPool not hibernateInPool. This will be temporarily fixed up for development mode only, but must be changed before production.");
|
3318
|
+
itemView.sleepInPool = itemView.hibernateInPool;
|
3319
|
+
}
|
3320
|
+
//@endif
|
3321
|
+
|
3322
|
+
// Give the view a chance to do some clean up before sleeping.
|
3323
|
+
if (itemView.sleepInPool) { itemView.sleepInPool(this); }
|
3324
|
+
|
3325
|
+
pool.push(itemView);
|
3326
|
+
|
3327
|
+
// If the exampleView's layer isn't reusable, destroy it.
|
3328
|
+
prototype = exampleView.prototype;
|
3329
|
+
if (!SC.none(prototype.isLayerReusable) && !prototype.isLayerReusable) {
|
3330
|
+
itemView.destroyLayer();
|
3331
|
+
} else {
|
3332
|
+
// If the layer is sticking around, be sure to move it out of view.
|
3333
|
+
layout = this._poolLayoutForContentIndex(idx);
|
3334
|
+
itemView.set('layout', layout);
|
3335
|
+
}
|
3336
|
+
|
3337
|
+
// Ensure that the id of views in the pool don't clash with ids that
|
3338
|
+
// are used outside of it.
|
3339
|
+
itemView.set('layerId', SC.generateGuid(null, 'pool-'));
|
3340
|
+
|
3341
|
+
wasPooled = true;
|
3342
|
+
}
|
3343
|
+
}
|
3344
|
+
|
3345
|
+
if (!wasPooled) {
|
3346
|
+
itemView.destroy();
|
3347
|
+
}
|
3348
|
+
|
3349
|
+
// Remove the cached view (can still exist in the pool)
|
3350
|
+
delete this._sc_itemViews[idx];
|
3204
3351
|
}
|
3205
3352
|
|
3206
3353
|
|