sproutcore 1.9.2 → 1.10.0.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
/**
|
|
10
10
|
Standard Error that should be raised when you try to modify a frozen object.
|
|
11
11
|
|
|
12
|
-
@
|
|
12
|
+
@type Error
|
|
13
13
|
*/
|
|
14
14
|
SC.FROZEN_ERROR = new Error("Cannot modify a frozen object");
|
|
15
15
|
|
|
@@ -75,7 +75,7 @@ SC.Freezable = /** @scope SC.Freezable.prototype */ {
|
|
|
75
75
|
/**
|
|
76
76
|
Walk like a duck.
|
|
77
77
|
|
|
78
|
-
@
|
|
78
|
+
@type Boolean
|
|
79
79
|
*/
|
|
80
80
|
isFreezable: YES,
|
|
81
81
|
|
|
@@ -83,7 +83,7 @@ SC.Freezable = /** @scope SC.Freezable.prototype */ {
|
|
|
83
83
|
Set to YES when the object is frozen. Use this property to detect whether
|
|
84
84
|
your object is frozen or not.
|
|
85
85
|
|
|
86
|
-
@
|
|
86
|
+
@type Boolean
|
|
87
87
|
*/
|
|
88
88
|
isFrozen: NO,
|
|
89
89
|
|
|
@@ -9,15 +9,13 @@ sc_require('ext/function');
|
|
|
9
9
|
sc_require('private/observer_set');
|
|
10
10
|
sc_require('private/chain_observer');
|
|
11
11
|
|
|
12
|
-
/*globals logChange */
|
|
13
|
-
|
|
14
12
|
/**
|
|
15
13
|
Set to YES to have all observing activity logged to the SC.Logger. This
|
|
16
14
|
should be used for debugging only.
|
|
17
15
|
|
|
18
|
-
@
|
|
16
|
+
@type Boolean
|
|
19
17
|
*/
|
|
20
|
-
SC.LOG_OBSERVERS = NO
|
|
18
|
+
SC.LOG_OBSERVERS = NO;
|
|
21
19
|
|
|
22
20
|
SC.OBSERVES_HANDLER_ADD = 0;
|
|
23
21
|
SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
@@ -48,13 +46,13 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
|
48
46
|
To use KVO, just use the KVO-aware methods get() and set() to access
|
|
49
47
|
properties instead of accessing properties directly. Instead of writing:
|
|
50
48
|
|
|
51
|
-
var aName = contact.firstName
|
|
52
|
-
contact.firstName = 'Charles'
|
|
49
|
+
var aName = contact.firstName;
|
|
50
|
+
contact.firstName = 'Charles';
|
|
53
51
|
|
|
54
52
|
use:
|
|
55
53
|
|
|
56
|
-
var aName = contact.get('firstName')
|
|
57
|
-
contact.set('firstName', 'Charles')
|
|
54
|
+
var aName = contact.get('firstName');
|
|
55
|
+
contact.set('firstName', 'Charles');
|
|
58
56
|
|
|
59
57
|
get() and set() work just like the normal "dot operators" provided by
|
|
60
58
|
JavaScript but they provide you with much more power, including not only
|
|
@@ -68,10 +66,10 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
|
68
66
|
example:
|
|
69
67
|
|
|
70
68
|
SC.Object.create({
|
|
71
|
-
valueObserver: function() {
|
|
69
|
+
valueObserver: function () {
|
|
72
70
|
// Executes whenever the "Value" property changes
|
|
73
71
|
}.observes('value')
|
|
74
|
-
})
|
|
72
|
+
});
|
|
75
73
|
|
|
76
74
|
Although this is the most common way to add an observer, this capability is
|
|
77
75
|
actually built into the SC.Object class on top of two methods defined in
|
|
@@ -81,7 +79,7 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
|
81
79
|
|
|
82
80
|
To add an observer for a property, just call:
|
|
83
81
|
|
|
84
|
-
object.addObserver('propertyKey', targetObject, targetAction)
|
|
82
|
+
object.addObserver('propertyKey', targetObject, targetAction);
|
|
85
83
|
|
|
86
84
|
This will call the 'targetAction' method on the targetObject to be called
|
|
87
85
|
whenever the value of the propertyKey changes.
|
|
@@ -93,7 +91,7 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
|
93
91
|
however you can accept certain arguments when writing generic observers.
|
|
94
92
|
An observer function can have the following arguments:
|
|
95
93
|
|
|
96
|
-
propertyObserver(target, key, value, revision)
|
|
94
|
+
propertyObserver(target, key, value, revision);
|
|
97
95
|
|
|
98
96
|
- *target* - This is the object whose value changed. Usually this.
|
|
99
97
|
- *key* - The key of the value that changed
|
|
@@ -114,18 +112,18 @@ SC.OBSERVES_HANDLER_REMOVE = 1;
|
|
|
114
112
|
changes:
|
|
115
113
|
|
|
116
114
|
|
|
117
|
-
automaticallyNotifiesObserversFor: function(key) {
|
|
118
|
-
return (key === 'balance') ? NO : sc_super()
|
|
115
|
+
automaticallyNotifiesObserversFor: function (key) {
|
|
116
|
+
return (key === 'balance') ? NO : sc_super();
|
|
119
117
|
},
|
|
120
118
|
|
|
121
|
-
balance: function(key, value) {
|
|
122
|
-
var balance = this._balance
|
|
119
|
+
balance: function (key, value) {
|
|
120
|
+
var balance = this._balance;
|
|
123
121
|
if ((value !== undefined) && (balance !== value)) {
|
|
124
|
-
this.propertyWillChange(key)
|
|
125
|
-
balance = this._balance = value
|
|
126
|
-
this.propertyDidChange(key)
|
|
122
|
+
this.propertyWillChange(key);
|
|
123
|
+
balance = this._balance = value;
|
|
124
|
+
this.propertyDidChange(key);
|
|
127
125
|
}
|
|
128
|
-
return balance
|
|
126
|
+
return balance;
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
|
|
@@ -143,7 +141,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
143
141
|
/**
|
|
144
142
|
Walk like that ol' duck
|
|
145
143
|
|
|
146
|
-
@
|
|
144
|
+
@type Boolean
|
|
147
145
|
*/
|
|
148
146
|
isObservable: YES,
|
|
149
147
|
|
|
@@ -160,7 +158,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
160
158
|
@param {String} key the key that is changing
|
|
161
159
|
@returns {Boolean} YES if automatic notification should occur.
|
|
162
160
|
*/
|
|
163
|
-
automaticallyNotifiesObserversFor: function(key) {
|
|
161
|
+
automaticallyNotifiesObserversFor: function (key) {
|
|
164
162
|
return YES;
|
|
165
163
|
},
|
|
166
164
|
|
|
@@ -184,7 +182,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
184
182
|
Computed properties are methods defined with the property() modifier
|
|
185
183
|
declared at the end, such as:
|
|
186
184
|
|
|
187
|
-
fullName: function() {
|
|
185
|
+
fullName: function () {
|
|
188
186
|
return this.getEach('firstName', 'lastName').compact().join(' ');
|
|
189
187
|
}.property('firstName', 'lastName')
|
|
190
188
|
|
|
@@ -205,17 +203,17 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
205
203
|
@returns {Object} the property value or undefined.
|
|
206
204
|
|
|
207
205
|
*/
|
|
208
|
-
get: function(key) {
|
|
209
|
-
var ret = this[key], cache
|
|
206
|
+
get: function (key) {
|
|
207
|
+
var ret = this[key], cache;
|
|
210
208
|
if (ret === undefined) {
|
|
211
|
-
return this.unknownProperty(key)
|
|
209
|
+
return this.unknownProperty(key);
|
|
212
210
|
} else if (ret && ret.isProperty) {
|
|
213
211
|
if (ret.isCacheable) {
|
|
214
|
-
cache = this._kvo_cache
|
|
212
|
+
cache = this._kvo_cache;
|
|
215
213
|
if (!cache) cache = this._kvo_cache = {};
|
|
216
|
-
return (cache[ret.cacheKey] !== undefined) ? cache[ret.cacheKey] : (cache[ret.cacheKey] = ret.call(this,key))
|
|
217
|
-
} else return ret.call(this,key);
|
|
218
|
-
} else return ret
|
|
214
|
+
return (cache[ret.cacheKey] !== undefined) ? cache[ret.cacheKey] : (cache[ret.cacheKey] = ret.call(this, key));
|
|
215
|
+
} else return ret.call(this, key);
|
|
216
|
+
} else return ret;
|
|
219
217
|
},
|
|
220
218
|
|
|
221
219
|
/**
|
|
@@ -267,16 +265,16 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
267
265
|
@param {Object} value the value to set or null.
|
|
268
266
|
@returns {SC.Observable}
|
|
269
267
|
*/
|
|
270
|
-
set: function(key, value) {
|
|
268
|
+
set: function (key, value) {
|
|
271
269
|
var func = this[key],
|
|
272
270
|
notify = this.automaticallyNotifiesObserversFor(key),
|
|
273
271
|
ret = value,
|
|
274
|
-
cachedep, cache, idx, dfunc
|
|
272
|
+
cachedep, cache, idx, dfunc;
|
|
275
273
|
|
|
276
|
-
if(value === undefined && SC.typeOf(key) === SC.T_HASH) {
|
|
274
|
+
if (value === undefined && SC.typeOf(key) === SC.T_HASH) {
|
|
277
275
|
var hash = key;
|
|
278
276
|
|
|
279
|
-
for(key in hash) {
|
|
277
|
+
for (key in hash) {
|
|
280
278
|
if (!hash.hasOwnProperty(key)) continue;
|
|
281
279
|
this.set(key, hash[key]);
|
|
282
280
|
}
|
|
@@ -292,13 +290,13 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
292
290
|
// note that if cachdep is set to null is means we figure out it has no
|
|
293
291
|
// cached dependencies already. this is different from undefined.
|
|
294
292
|
cachedep = this._kvo_cachedep;
|
|
295
|
-
if (!cachedep || (cachedep = cachedep[key])===undefined) {
|
|
293
|
+
if (!cachedep || (cachedep = cachedep[key]) === undefined) {
|
|
296
294
|
cachedep = this._kvo_computeCachedDependentsFor(key);
|
|
297
295
|
}
|
|
298
296
|
|
|
299
297
|
if (cachedep) {
|
|
300
298
|
idx = cachedep.length;
|
|
301
|
-
while(--idx>=0) {
|
|
299
|
+
while (--idx >= 0) {
|
|
302
300
|
dfunc = cachedep[idx];
|
|
303
301
|
cache[dfunc.cacheKey] = cache[dfunc.lastSetValueKey] = undefined;
|
|
304
302
|
}
|
|
@@ -311,29 +309,29 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
311
309
|
if (func.isVolatile || !cache || (cache[func.lastSetValueKey] !== value)) {
|
|
312
310
|
if (!cache) cache = this._kvo_cache = {};
|
|
313
311
|
|
|
314
|
-
cache[func.lastSetValueKey] = value
|
|
315
|
-
if (notify) this.propertyWillChange(key)
|
|
316
|
-
ret = func.call(this,key,value)
|
|
312
|
+
cache[func.lastSetValueKey] = value;
|
|
313
|
+
if (notify) this.propertyWillChange(key);
|
|
314
|
+
ret = func.call(this, key, value);
|
|
317
315
|
|
|
318
316
|
// update cached value
|
|
319
|
-
if (func.isCacheable) cache[func.cacheKey] = ret
|
|
320
|
-
if (notify) this.propertyDidChange(key, ret, YES)
|
|
317
|
+
if (func.isCacheable) cache[func.cacheKey] = ret;
|
|
318
|
+
if (notify) this.propertyDidChange(key, ret, YES);
|
|
321
319
|
}
|
|
322
320
|
|
|
323
321
|
} else if (func === undefined) {
|
|
324
|
-
if (notify) this.propertyWillChange(key)
|
|
325
|
-
this.unknownProperty(key,value)
|
|
326
|
-
if (notify) this.propertyDidChange(key, ret)
|
|
322
|
+
if (notify) this.propertyWillChange(key);
|
|
323
|
+
this.unknownProperty(key, value);
|
|
324
|
+
if (notify) this.propertyDidChange(key, ret);
|
|
327
325
|
|
|
328
326
|
} else {
|
|
329
327
|
if (this[key] !== value) {
|
|
330
|
-
if (notify) this.propertyWillChange(key)
|
|
331
|
-
ret = this[key] = value
|
|
332
|
-
if (notify) this.propertyDidChange(key, ret)
|
|
328
|
+
if (notify) this.propertyWillChange(key);
|
|
329
|
+
ret = this[key] = value;
|
|
330
|
+
if (notify) this.propertyDidChange(key, ret);
|
|
333
331
|
}
|
|
334
332
|
}
|
|
335
333
|
|
|
336
|
-
return this
|
|
334
|
+
return this;
|
|
337
335
|
},
|
|
338
336
|
|
|
339
337
|
/**
|
|
@@ -347,9 +345,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
347
345
|
@param {Object} value The value if called as a setter, undefined if called as a getter.
|
|
348
346
|
@returns {Object} The new value for key.
|
|
349
347
|
*/
|
|
350
|
-
unknownProperty: function(key,value) {
|
|
351
|
-
if (
|
|
352
|
-
return value
|
|
348
|
+
unknownProperty: function (key, value) {
|
|
349
|
+
if (value !== undefined) { this[key] = value; }
|
|
350
|
+
return value;
|
|
353
351
|
},
|
|
354
352
|
|
|
355
353
|
/**
|
|
@@ -364,7 +362,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
364
362
|
|
|
365
363
|
@returns {SC.Observable}
|
|
366
364
|
*/
|
|
367
|
-
beginPropertyChanges: function() {
|
|
365
|
+
beginPropertyChanges: function () {
|
|
368
366
|
this._kvo_changeLevel = (this._kvo_changeLevel || 0) + 1;
|
|
369
367
|
return this;
|
|
370
368
|
},
|
|
@@ -381,13 +379,13 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
381
379
|
|
|
382
380
|
@returns {SC.Observable}
|
|
383
381
|
*/
|
|
384
|
-
endPropertyChanges: function() {
|
|
385
|
-
this._kvo_changeLevel = (this._kvo_changeLevel || 1) - 1
|
|
382
|
+
endPropertyChanges: function () {
|
|
383
|
+
this._kvo_changeLevel = (this._kvo_changeLevel || 1) - 1;
|
|
386
384
|
var level = this._kvo_changeLevel, changes = this._kvo_changes;
|
|
387
|
-
if ((level<=0) && changes && (changes.length>0) && !SC.Observers.isObservingSuspended) {
|
|
388
|
-
this._notifyPropertyObservers()
|
|
385
|
+
if ((level <= 0) && changes && (changes.length > 0) && !SC.Observers.isObservingSuspended) {
|
|
386
|
+
this._notifyPropertyObservers();
|
|
389
387
|
}
|
|
390
|
-
return this
|
|
388
|
+
return this;
|
|
391
389
|
},
|
|
392
390
|
|
|
393
391
|
/**
|
|
@@ -406,8 +404,8 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
406
404
|
@param {String} key The property key that is about to change.
|
|
407
405
|
@returns {SC.Observable}
|
|
408
406
|
*/
|
|
409
|
-
propertyWillChange: function(key) {
|
|
410
|
-
return this
|
|
407
|
+
propertyWillChange: function (key) {
|
|
408
|
+
return this;
|
|
411
409
|
},
|
|
412
410
|
|
|
413
411
|
/**
|
|
@@ -428,7 +426,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
428
426
|
@param {Boolean} _keepCache Private property
|
|
429
427
|
@returns {SC.Observable}
|
|
430
428
|
*/
|
|
431
|
-
propertyDidChange: function(key,value, _keepCache) {
|
|
429
|
+
propertyDidChange: function (key, value, _keepCache) {
|
|
432
430
|
this._kvo_revision = (this._kvo_revision || 0) + 1;
|
|
433
431
|
var level = this._kvo_changeLevel || 0,
|
|
434
432
|
cachedep, idx, dfunc, func,
|
|
@@ -444,7 +442,7 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
444
442
|
if (keyChains) {
|
|
445
443
|
this.beginPropertyChanges();
|
|
446
444
|
keyChains = SC.clone(keyChains);
|
|
447
|
-
keyChains.forEach(function(chain) {
|
|
445
|
+
keyChains.forEach(function (chain) {
|
|
448
446
|
// Invalidate the property that depends on the changed key.
|
|
449
447
|
chain.notifyPropertyDidChange();
|
|
450
448
|
});
|
|
@@ -457,9 +455,9 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
457
455
|
|
|
458
456
|
// clear any cached value
|
|
459
457
|
if (!_keepCache) {
|
|
460
|
-
func = this[key]
|
|
458
|
+
func = this[key];
|
|
461
459
|
if (func && func.isProperty) {
|
|
462
|
-
cache[func.cacheKey] = cache[func.lastSetValueKey] = undefined
|
|
460
|
+
cache[func.cacheKey] = cache[func.lastSetValueKey] = undefined;
|
|
463
461
|
}
|
|
464
462
|
}
|
|
465
463
|
|
|
@@ -467,13 +465,13 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
467
465
|
// if there are any dependent keys and they use caching, then clear the
|
|
468
466
|
// cache. This is the same code as is in set. It is inlined for perf.
|
|
469
467
|
cachedep = this._kvo_cachedep;
|
|
470
|
-
if (!cachedep || (cachedep = cachedep[key])===undefined) {
|
|
468
|
+
if (!cachedep || (cachedep = cachedep[key]) === undefined) {
|
|
471
469
|
cachedep = this._kvo_computeCachedDependentsFor(key);
|
|
472
470
|
}
|
|
473
471
|
|
|
474
472
|
if (cachedep) {
|
|
475
473
|
idx = cachedep.length;
|
|
476
|
-
while(--idx>=0) {
|
|
474
|
+
while (--idx >= 0) {
|
|
477
475
|
dfunc = cachedep[idx];
|
|
478
476
|
cache[dfunc.cacheKey] = cache[dfunc.lastSetValueKey] = undefined;
|
|
479
477
|
}
|
|
@@ -484,19 +482,19 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
484
482
|
// save in the change set if queuing changes
|
|
485
483
|
var suspended = SC.Observers.isObservingSuspended;
|
|
486
484
|
if ((level > 0) || suspended) {
|
|
487
|
-
var changes = this._kvo_changes
|
|
488
|
-
if (!changes) changes = this._kvo_changes = SC.CoreSet.create()
|
|
489
|
-
changes.add(key)
|
|
485
|
+
var changes = this._kvo_changes;
|
|
486
|
+
if (!changes) changes = this._kvo_changes = SC.CoreSet.create();
|
|
487
|
+
changes.add(key);
|
|
490
488
|
|
|
491
489
|
if (suspended) {
|
|
492
|
-
if (log) SC.Logger.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES,this));
|
|
493
|
-
SC.Observers.objectHasPendingChanges(this)
|
|
490
|
+
if (log) SC.Logger.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES, this));
|
|
491
|
+
SC.Observers.objectHasPendingChanges(this);
|
|
494
492
|
}
|
|
495
493
|
|
|
496
494
|
// otherwise notify property observers immediately
|
|
497
|
-
} else this._notifyPropertyObservers(key)
|
|
495
|
+
} else this._notifyPropertyObservers(key);
|
|
498
496
|
|
|
499
|
-
return this
|
|
497
|
+
return this;
|
|
500
498
|
},
|
|
501
499
|
|
|
502
500
|
// ..........................................
|
|
@@ -519,1051 +517,1099 @@ SC.Observable = /** @scope SC.Observable.prototype */{
|
|
|
519
517
|
@param {Array|String} dependentKeys one or more dependent keys
|
|
520
518
|
@returns {Object} this
|
|
521
519
|
*/
|
|
522
|
-
registerDependentKey: function(key, dependentKeys) {
|
|
520
|
+
registerDependentKey: function (key, dependentKeys) {
|
|
523
521
|
var dependents = this._kvo_dependents,
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
522
|
+
// chainDependents = this._kvo_chain_dependents,
|
|
523
|
+
keys, idx, lim, dep, queue;
|
|
524
|
+
|
|
525
|
+
// normalize input.
|
|
526
|
+
if (typeof dependentKeys === "object" && (dependentKeys instanceof Array)) {
|
|
527
|
+
keys = dependentKeys;
|
|
528
|
+
lim = 0;
|
|
529
|
+
} else {
|
|
530
|
+
keys = arguments;
|
|
531
|
+
lim = 1;
|
|
532
|
+
}
|
|
533
|
+
idx = keys.length;
|
|
534
|
+
|
|
535
|
+
// define dependents if not defined already.
|
|
536
|
+
if (!dependents) this._kvo_dependents = dependents = {};
|
|
537
|
+
|
|
538
|
+
// for each key, build array of dependents, add this key...
|
|
539
|
+
// note that we ignore the first argument since it is the key...
|
|
540
|
+
while (--idx >= lim) {
|
|
541
|
+
dep = keys[idx];
|
|
542
|
+
|
|
543
|
+
if (dep.indexOf('.') >= 0) {
|
|
544
|
+
SC._PropertyChain.createChain(dep, this, key).activate();
|
|
532
545
|
} else {
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
// define dependents if not defined already.
|
|
539
|
-
if (!dependents) this._kvo_dependents = dependents = {} ;
|
|
540
|
-
|
|
541
|
-
// for each key, build array of dependents, add this key...
|
|
542
|
-
// note that we ignore the first argument since it is the key...
|
|
543
|
-
while(--idx >= lim) {
|
|
544
|
-
dep = keys[idx] ;
|
|
545
|
-
|
|
546
|
-
if (dep.indexOf('.') >= 0) {
|
|
547
|
-
SC._PropertyChain.createChain(dep, this, key).activate();
|
|
548
|
-
} else {
|
|
549
|
-
// add dependent key to dependents array of key it depends on
|
|
550
|
-
queue = dependents[dep] ;
|
|
551
|
-
if (!queue) { queue = dependents[dep] = [] ; }
|
|
552
|
-
queue.push(key) ;
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
},
|
|
556
|
-
|
|
557
|
-
/** @private
|
|
558
|
-
Register a property chain so that dependent keys can be invalidated
|
|
559
|
-
when a property on this object changes.
|
|
560
|
-
|
|
561
|
-
@param {String} property the property on this object that invalidates the chain
|
|
562
|
-
@param {SC._PropertyChain} chain the chain to notify
|
|
563
|
-
*/
|
|
564
|
-
registerDependentKeyWithChain: function(property, chain) {
|
|
565
|
-
var chains = this._chainsFor(property), next;
|
|
566
|
-
chains.add(chain);
|
|
567
|
-
},
|
|
568
|
-
|
|
569
|
-
/** @private
|
|
570
|
-
Removes a property chain from the object.
|
|
571
|
-
|
|
572
|
-
@param {String} property the property on this object that invalidates the chain
|
|
573
|
-
@param {SC._PropertyChain} chain the chain to notify
|
|
574
|
-
*/
|
|
575
|
-
removeDependentKeyWithChain: function(property, chain) {
|
|
576
|
-
var chains = this._chainsFor(property), next;
|
|
577
|
-
chains.remove(chain);
|
|
578
|
-
|
|
579
|
-
if (chains.get('length') === 0) {
|
|
580
|
-
delete this._kvo_property_chains[property];
|
|
581
|
-
}
|
|
582
|
-
},
|
|
583
|
-
|
|
584
|
-
/** @private
|
|
585
|
-
Returns an instance of SC.CoreSet in which to save SC._PropertyChains.
|
|
586
|
-
|
|
587
|
-
@param {String} property the property associated with the SC._PropertyChain
|
|
588
|
-
@returns {SC.CoreSet}
|
|
589
|
-
*/
|
|
590
|
-
_chainsFor: function(property) {
|
|
591
|
-
this._kvo_property_chains = this._kvo_property_chains || {};
|
|
592
|
-
var chains = this._kvo_property_chains[property] || SC.CoreSet.create();
|
|
593
|
-
this._kvo_property_chains[property] = chains;
|
|
594
|
-
|
|
595
|
-
return chains;
|
|
596
|
-
},
|
|
597
|
-
|
|
598
|
-
/** @private
|
|
599
|
-
|
|
600
|
-
Helper method used by computeCachedDependents. Just loops over the
|
|
601
|
-
array of dependent keys. If the passed function is cacheable, it will
|
|
602
|
-
be added to the queue. Also, recursively call on each keys dependent
|
|
603
|
-
keys.
|
|
604
|
-
|
|
605
|
-
@param {Array} queue the queue to add functions to
|
|
606
|
-
@param {Array} keys the array of dependent keys for this key
|
|
607
|
-
@param {Hash} dependents the _kvo_dependents cache
|
|
608
|
-
@param {SC.Set} seen already seen keys
|
|
609
|
-
@returns {void}
|
|
610
|
-
*/
|
|
611
|
-
_kvo_addCachedDependents: function(queue, keys, dependents, seen) {
|
|
612
|
-
var idx = keys.length,
|
|
613
|
-
func, key, deps ;
|
|
614
|
-
|
|
615
|
-
while(--idx >= 0) {
|
|
616
|
-
key = keys[idx];
|
|
617
|
-
seen.add(key);
|
|
618
|
-
|
|
619
|
-
// if the value for this key is a computed property, then add it to the
|
|
620
|
-
// set if it is cacheable, and process any of its dependent keys also.
|
|
621
|
-
func = this[key];
|
|
622
|
-
if (func && (func instanceof Function) && func.isProperty) {
|
|
623
|
-
if (func.isCacheable) queue.push(func); // handle this func
|
|
624
|
-
if ((deps = dependents[key]) && deps.length>0) { // and any dependents
|
|
625
|
-
this._kvo_addCachedDependents(queue, deps, dependents, seen);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
546
|
+
// add dependent key to dependents array of key it depends on
|
|
547
|
+
queue = dependents[dep];
|
|
548
|
+
if (!queue) { queue = dependents[dep] = []; }
|
|
549
|
+
queue.push(key);
|
|
628
550
|
}
|
|
551
|
+
}
|
|
552
|
+
},
|
|
629
553
|
|
|
630
|
-
|
|
554
|
+
/** @private
|
|
555
|
+
Register a property chain so that dependent keys can be invalidated
|
|
556
|
+
when a property on this object changes.
|
|
631
557
|
|
|
632
|
-
|
|
558
|
+
@param {String} property the property on this object that invalidates the chain
|
|
559
|
+
@param {SC._PropertyChain} chain the chain to notify
|
|
560
|
+
*/
|
|
561
|
+
registerDependentKeyWithChain: function (property, chain) {
|
|
562
|
+
var chains = this._chainsFor(property);
|
|
563
|
+
chains.add(chain);
|
|
564
|
+
},
|
|
633
565
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
cached property directly or indirectly affected.
|
|
566
|
+
/** @private
|
|
567
|
+
Removes a property chain from the object.
|
|
637
568
|
|
|
638
|
-
|
|
569
|
+
@param {String} property the property on this object that invalidates the chain
|
|
570
|
+
@param {SC._PropertyChain} chain the chain to notify
|
|
571
|
+
*/
|
|
572
|
+
removeDependentKeyWithChain: function (property, chain) {
|
|
573
|
+
var chains = this._chainsFor(property);
|
|
574
|
+
chains.remove(chain);
|
|
639
575
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
var cached = this._kvo_cachedep,
|
|
645
|
-
dependents = this._kvo_dependents,
|
|
646
|
-
keys = dependents ? dependents[key] : null,
|
|
647
|
-
queue, seen ;
|
|
648
|
-
if (!cached) cached = this._kvo_cachedep = {};
|
|
576
|
+
if (chains.get('length') === 0) {
|
|
577
|
+
delete this._kvo_property_chains[property];
|
|
578
|
+
}
|
|
579
|
+
},
|
|
649
580
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (!keys || keys.length===0) return cached[key] = null;
|
|
581
|
+
/** @private
|
|
582
|
+
Returns an instance of SC.CoreSet in which to save SC._PropertyChains.
|
|
653
583
|
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
584
|
+
@param {String} property the property associated with the SC._PropertyChain
|
|
585
|
+
@returns {SC.CoreSet}
|
|
586
|
+
*/
|
|
587
|
+
_chainsFor: function (property) {
|
|
588
|
+
this._kvo_property_chains = this._kvo_property_chains || {};
|
|
589
|
+
var chains = this._kvo_property_chains[property] || SC.CoreSet.create();
|
|
590
|
+
this._kvo_property_chains[property] = chains;
|
|
661
591
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
},
|
|
592
|
+
return chains;
|
|
593
|
+
},
|
|
665
594
|
|
|
666
|
-
|
|
667
|
-
// OBSERVERS
|
|
668
|
-
//
|
|
595
|
+
/** @private
|
|
669
596
|
|
|
670
|
-
|
|
671
|
-
|
|
597
|
+
Helper method used by computeCachedDependents. Just loops over the
|
|
598
|
+
array of dependent keys. If the passed function is cacheable, it will
|
|
599
|
+
be added to the queue. Also, recursively call on each keys dependent
|
|
600
|
+
keys.
|
|
672
601
|
|
|
673
|
-
|
|
602
|
+
@param {Array} queue the queue to add functions to
|
|
603
|
+
@param {Array} keys the array of dependent keys for this key
|
|
604
|
+
@param {Hash} dependents the _kvo_dependents cache
|
|
605
|
+
@param {SC.Set} seen already seen keys
|
|
606
|
+
@returns {void}
|
|
607
|
+
*/
|
|
608
|
+
_kvo_addCachedDependents: function (queue, keys, dependents, seen) {
|
|
609
|
+
var idx = keys.length,
|
|
610
|
+
func, key, deps;
|
|
674
611
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
ret = this[kvoKey] = (type === undefined) ? [] : type.create();
|
|
679
|
-
this._kvo_cloned[kvoKey] = YES ;
|
|
612
|
+
while (--idx >= 0) {
|
|
613
|
+
key = keys[idx];
|
|
614
|
+
seen.add(key);
|
|
680
615
|
|
|
681
|
-
// if
|
|
682
|
-
//
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
616
|
+
// if the value for this key is a computed property, then add it to the
|
|
617
|
+
// set if it is cacheable, and process any of its dependent keys also.
|
|
618
|
+
func = this[key];
|
|
619
|
+
if (func && (func instanceof Function) && func.isProperty) {
|
|
620
|
+
if (func.isCacheable) queue.push(func); // handle this func
|
|
621
|
+
if ((deps = dependents[key]) && deps.length > 0) { // and any dependents
|
|
622
|
+
this._kvo_addCachedDependents(queue, deps, dependents, seen);
|
|
623
|
+
}
|
|
686
624
|
}
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
},
|
|
687
628
|
|
|
688
|
-
|
|
689
|
-
},
|
|
629
|
+
/** @private
|
|
690
630
|
|
|
691
|
-
|
|
692
|
-
|
|
631
|
+
Called by set() whenever it needs to determine which cached dependent
|
|
632
|
+
keys to clear. Recursively searches dependent keys to determine all
|
|
633
|
+
cached property directly or indirectly affected.
|
|
693
634
|
|
|
694
|
-
|
|
635
|
+
The return value is also saved for future reference
|
|
695
636
|
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
637
|
+
@param {String} key the key to compute
|
|
638
|
+
@returns {Array}
|
|
639
|
+
*/
|
|
640
|
+
_kvo_computeCachedDependentsFor: function (key) {
|
|
641
|
+
var cached = this._kvo_cachedep,
|
|
642
|
+
dependents = this._kvo_dependents,
|
|
643
|
+
keys = dependents ? dependents[key] : null,
|
|
644
|
+
queue, seen;
|
|
645
|
+
if (!cached) cached = this._kvo_cachedep = {};
|
|
646
|
+
|
|
647
|
+
// if there are no dependent keys, then just set and return null to avoid
|
|
648
|
+
// this mess again.
|
|
649
|
+
if (!keys || keys.length === 0) return cached[key] = null;
|
|
650
|
+
|
|
651
|
+
// there are dependent keys, so we need to do the work to find out if
|
|
652
|
+
// any of them or their dependent keys are cached.
|
|
653
|
+
queue = cached[key] = [];
|
|
654
|
+
seen = SC._TMP_SEEN_SET = (SC._TMP_SEEN_SET || SC.CoreSet.create());
|
|
655
|
+
seen.add(key);
|
|
656
|
+
this._kvo_addCachedDependents(queue, keys, dependents, seen);
|
|
657
|
+
seen.clear(); // reset
|
|
658
|
+
|
|
659
|
+
if (queue.length === 0) queue = cached[key] = null; // turns out nothing
|
|
660
|
+
return queue;
|
|
661
|
+
},
|
|
700
662
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
with different context parameters, your observer will only be called once
|
|
705
|
-
with the last context you passed.
|
|
663
|
+
// ..........................................
|
|
664
|
+
// OBSERVERS
|
|
665
|
+
//
|
|
706
666
|
|
|
707
|
-
|
|
708
|
-
|
|
667
|
+
_kvo_for: function (kvoKey, type) {
|
|
668
|
+
var ret = this[kvoKey];
|
|
709
669
|
|
|
710
|
-
|
|
711
|
-
you do not pass a "context" parameter:
|
|
670
|
+
if (!this._kvo_cloned) this._kvo_cloned = {};
|
|
712
671
|
|
|
713
|
-
|
|
672
|
+
// if the item does not exist, create it. Unless type is passed,
|
|
673
|
+
// assume array.
|
|
674
|
+
if (!ret) {
|
|
675
|
+
ret = this[kvoKey] = (type === undefined) ? [] : type.create();
|
|
676
|
+
this._kvo_cloned[kvoKey] = YES;
|
|
714
677
|
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
678
|
+
// if item does exist but has not been cloned, then clone it. Note
|
|
679
|
+
// that all types must implement copy().0
|
|
680
|
+
} else if (!this._kvo_cloned[kvoKey]) {
|
|
681
|
+
ret = this[kvoKey] = ret.copy();
|
|
682
|
+
this._kvo_cloned[kvoKey] = YES;
|
|
683
|
+
}
|
|
719
684
|
|
|
720
|
-
|
|
721
|
-
|
|
685
|
+
return ret;
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
Adds an observer on a property.
|
|
722
690
|
|
|
723
|
-
|
|
691
|
+
This is the core method used to register an observer for a property.
|
|
724
692
|
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
693
|
+
Once you call this method, anytime the key's value is set, your observer
|
|
694
|
+
will be notified. Note that the observers are triggered anytime the
|
|
695
|
+
value is set, regardless of whether it has actually changed. Your
|
|
696
|
+
observer should be prepared to handle that.
|
|
729
697
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
*/
|
|
736
|
-
addObserver: function(key, target, method, context) {
|
|
737
|
-
var kvoKey, chain, chains, observers;
|
|
698
|
+
You can also pass an optional context parameter to this method. The
|
|
699
|
+
context will be passed to your observer method whenever it is triggered.
|
|
700
|
+
Note that if you add the same target/method pair on a key multiple times
|
|
701
|
+
with different context parameters, your observer will only be called once
|
|
702
|
+
with the last context you passed.
|
|
738
703
|
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
method = target; target = this ;
|
|
742
|
-
}
|
|
743
|
-
if (!target) target = this ;
|
|
704
|
+
Observer Methods
|
|
705
|
+
---
|
|
744
706
|
|
|
745
|
-
|
|
746
|
-
|
|
707
|
+
Observer methods you pass should generally have the following signature if
|
|
708
|
+
you do not pass a "context" parameter:
|
|
747
709
|
|
|
748
|
-
|
|
749
|
-
key = key.toString() ;
|
|
750
|
-
if (key.indexOf('.') >= 0) {
|
|
710
|
+
fooDidChange: function (sender, key, value, rev);
|
|
751
711
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
chain.masterMethod = method ;
|
|
712
|
+
The sender is the object that changed. The key is the property that
|
|
713
|
+
changes. The value property is currently reserved and unused. The rev
|
|
714
|
+
is the last property revision of the object when it changed, which you can
|
|
715
|
+
use to detect if the key value has really changed or not.
|
|
757
716
|
|
|
758
|
-
|
|
759
|
-
|
|
717
|
+
If you pass a "context" parameter, the context will be passed before the
|
|
718
|
+
revision like so:
|
|
760
719
|
|
|
761
|
-
|
|
762
|
-
} else {
|
|
720
|
+
fooDidChange: function (sender, key, value, context, rev);
|
|
763
721
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
this.get(key) ;
|
|
769
|
-
}
|
|
722
|
+
Usually you will not need the value, context or revision parameters at
|
|
723
|
+
the end. In this case, it is common to write observer methods that take
|
|
724
|
+
only a sender and key value as parameters or, if you aren't interested in
|
|
725
|
+
any of these values, to write an observer that has no parameters at all.
|
|
770
726
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
727
|
+
@param {String} key the key to observer
|
|
728
|
+
@param {Object} target the target object to invoke
|
|
729
|
+
@param {String|Function} method the method to invoke.
|
|
730
|
+
@param {Object} context optional context
|
|
731
|
+
@returns {SC.Object} self
|
|
732
|
+
*/
|
|
733
|
+
addObserver: function (key, target, method, context) {
|
|
734
|
+
var kvoKey, chain;
|
|
776
735
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
736
|
+
// normalize. if a function is passed to target, make it the method.
|
|
737
|
+
if (method === undefined) {
|
|
738
|
+
method = target;
|
|
739
|
+
target = this;
|
|
740
|
+
}
|
|
741
|
+
if (!target) target = this;
|
|
742
|
+
|
|
743
|
+
if (typeof method === "string") method = target[method];
|
|
744
|
+
if (!method) throw new Error("You must pass a method to addObserver()");
|
|
745
|
+
|
|
746
|
+
// Normalize key...
|
|
747
|
+
key = key.toString();
|
|
748
|
+
if (key.indexOf('.') >= 0) {
|
|
780
749
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
750
|
+
// create the chain and save it for later so we can tear it down if
|
|
751
|
+
// needed.
|
|
752
|
+
chain = SC._ChainObserver.createChain(this, key, target, method, context);
|
|
753
|
+
chain.masterTarget = target;
|
|
754
|
+
chain.masterMethod = method;
|
|
785
755
|
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
@param {String|Function} method the method to invoke.
|
|
789
|
-
@returns {SC.Observable} receiver
|
|
790
|
-
*/
|
|
791
|
-
removeObserver: function(key, target, method) {
|
|
756
|
+
// Save in set for chain observers.
|
|
757
|
+
this._kvo_for(SC.keyFor('_kvo_chains', key)).push(chain);
|
|
792
758
|
|
|
793
|
-
|
|
759
|
+
// Create observers if needed...
|
|
760
|
+
} else {
|
|
794
761
|
|
|
795
|
-
//
|
|
796
|
-
|
|
797
|
-
|
|
762
|
+
// Special case to support reduced properties. If the property
|
|
763
|
+
// key begins with '@' and its value is unknown, then try to get its
|
|
764
|
+
// value. This will configure the dependent keys if needed.
|
|
765
|
+
if ((this[key] === undefined) && (key.indexOf('@') === 0)) {
|
|
766
|
+
this.get(key);
|
|
798
767
|
}
|
|
799
|
-
if (!target) target = this ;
|
|
800
768
|
|
|
801
|
-
if (
|
|
802
|
-
|
|
769
|
+
if (target === this) target = null; // use null for observers only.
|
|
770
|
+
kvoKey = SC.keyFor('_kvo_observers', key);
|
|
771
|
+
this._kvo_for(kvoKey, SC.ObserverSet).add(target, method, context);
|
|
772
|
+
this._kvo_for('_kvo_observed_keys', SC.CoreSet).add(key);
|
|
773
|
+
}
|
|
803
774
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
775
|
+
if (this.didAddObserver) this.didAddObserver(key, target, method);
|
|
776
|
+
return this;
|
|
777
|
+
},
|
|
807
778
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
779
|
+
/**
|
|
780
|
+
Remove an observer you have previously registered on this object. Pass
|
|
781
|
+
the same key, target, and method you passed to addObserver() and your
|
|
782
|
+
target will no longer receive notifications.
|
|
783
|
+
|
|
784
|
+
@param {String} key the key to observer
|
|
785
|
+
@param {Object} target the target object to invoke
|
|
786
|
+
@param {String|Function} method the method to invoke.
|
|
787
|
+
@returns {SC.Observable} receiver
|
|
788
|
+
*/
|
|
789
|
+
removeObserver: function (key, target, method) {
|
|
811
790
|
|
|
812
|
-
|
|
813
|
-
chains = this._kvo_for(kvoKey) ;
|
|
791
|
+
var kvoKey, chains, chain, observers, idx;
|
|
814
792
|
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
}
|
|
793
|
+
// normalize. if a function is passed to target, make it the method.
|
|
794
|
+
if (method === undefined) {
|
|
795
|
+
method = target;
|
|
796
|
+
target = this;
|
|
797
|
+
}
|
|
798
|
+
if (!target) target = this;
|
|
824
799
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
800
|
+
if (typeof method === "string") method = target[method];
|
|
801
|
+
if (!method) throw new Error("You must pass a method to removeObserver()");
|
|
802
|
+
|
|
803
|
+
// if the key contains a '.', this is a chained observer.
|
|
804
|
+
key = key.toString();
|
|
805
|
+
if (key.indexOf('.') >= 0) {
|
|
806
|
+
|
|
807
|
+
// try to find matching chains
|
|
808
|
+
kvoKey = SC.keyFor('_kvo_chains', key);
|
|
809
|
+
if (chains = this[kvoKey]) {
|
|
810
|
+
|
|
811
|
+
// if chains have not been cloned yet, do so now.
|
|
812
|
+
chains = this._kvo_for(kvoKey);
|
|
813
|
+
|
|
814
|
+
// remove any chains
|
|
815
|
+
idx = chains.length;
|
|
816
|
+
while (--idx >= 0) {
|
|
817
|
+
chain = chains[idx];
|
|
818
|
+
if (chain && (chain.masterTarget === target) && (chain.masterMethod === method)) {
|
|
819
|
+
chains[idx] = chain.destroyChain();
|
|
835
820
|
}
|
|
836
821
|
}
|
|
837
822
|
}
|
|
838
823
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
@param {String} key key to check
|
|
850
|
-
@returns {Boolean}
|
|
851
|
-
*/
|
|
852
|
-
hasObserverFor: function(key) {
|
|
853
|
-
SC.Observers.flush(this) ; // hookup as many observers as possible.
|
|
854
|
-
|
|
855
|
-
var observers = this[SC.keyFor('_kvo_observers', key)],
|
|
856
|
-
locals = this[SC.keyFor('_kvo_local', key)],
|
|
857
|
-
members ;
|
|
858
|
-
|
|
859
|
-
if (locals && locals.length>0) return YES ;
|
|
860
|
-
if (observers && observers.getMembers().length > 0) return YES ;
|
|
861
|
-
return NO ;
|
|
862
|
-
},
|
|
863
|
-
|
|
864
|
-
/**
|
|
865
|
-
This method will register any observers and computed properties saved on
|
|
866
|
-
the object. Normally you do not need to call this method yourself. It
|
|
867
|
-
is invoked automatically just before property notifications are sent and
|
|
868
|
-
from the init() method of SC.Object. You may choose to call this
|
|
869
|
-
from your own initialization method if you are using SC.Observable in
|
|
870
|
-
a non-SC.Object-based object.
|
|
871
|
-
|
|
872
|
-
This method looks for several private variables, which you can setup,
|
|
873
|
-
to initialize:
|
|
874
|
-
|
|
875
|
-
- _observers: this should contain an array of key names for observers
|
|
876
|
-
you need to configure.
|
|
877
|
-
|
|
878
|
-
- _bindings: this should contain an array of key names that configure
|
|
879
|
-
bindings.
|
|
880
|
-
|
|
881
|
-
- _properties: this should contain an array of key names for computed
|
|
882
|
-
properties.
|
|
883
|
-
|
|
884
|
-
@returns {Object} this
|
|
885
|
-
*/
|
|
886
|
-
initObservable: function() {
|
|
887
|
-
if (this._observableInited) return ;
|
|
888
|
-
this._observableInited = YES ;
|
|
889
|
-
|
|
890
|
-
var loc, keys, key, value, observer, propertyPaths, propertyPathsLength,
|
|
891
|
-
len, ploc, path, dotIndex, root, propertyKey, keysLen;
|
|
892
|
-
|
|
893
|
-
// Loop through observer functions and register them
|
|
894
|
-
if (keys = this._observers) {
|
|
895
|
-
len = keys.length ;
|
|
896
|
-
for(loc=0;loc<len;loc++) {
|
|
897
|
-
key = keys[loc]; observer = this[key] ;
|
|
898
|
-
propertyPaths = observer.propertyPaths ;
|
|
899
|
-
propertyPathsLength = (propertyPaths) ? propertyPaths.length : 0 ;
|
|
900
|
-
for(ploc=0;ploc<propertyPathsLength;ploc++) {
|
|
901
|
-
path = propertyPaths[ploc] ;
|
|
902
|
-
this.addObservesHandler(observer, path);
|
|
903
|
-
}
|
|
824
|
+
// otherwise, just like a normal observer.
|
|
825
|
+
} else {
|
|
826
|
+
if (target === this) target = null; // use null for observers only.
|
|
827
|
+
kvoKey = SC.keyFor('_kvo_observers', key);
|
|
828
|
+
if (observers = this[kvoKey]) {
|
|
829
|
+
// if observers have not been cloned yet, do so now
|
|
830
|
+
observers = this._kvo_for(kvoKey);
|
|
831
|
+
observers.remove(target, method);
|
|
832
|
+
if (observers.getMembers().length === 0) {
|
|
833
|
+
this._kvo_for('_kvo_observed_keys', SC.CoreSet).remove(key);
|
|
904
834
|
}
|
|
905
835
|
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
if (this.didRemoveObserver) this.didRemoveObserver(key, target, method);
|
|
839
|
+
return this;
|
|
840
|
+
},
|
|
841
|
+
|
|
842
|
+
/**
|
|
843
|
+
Returns YES if the object currently has observers registered for a
|
|
844
|
+
particular key. You can use this method to potentially defer performing
|
|
845
|
+
an expensive action until someone begins observing a particular property
|
|
846
|
+
on the object.
|
|
847
|
+
|
|
848
|
+
@param {String} key key to check
|
|
849
|
+
@returns {Boolean}
|
|
850
|
+
*/
|
|
851
|
+
hasObserverFor: function (key) {
|
|
852
|
+
SC.Observers.flush(this); // hookup as many observers as possible.
|
|
853
|
+
|
|
854
|
+
var observers = this[SC.keyFor('_kvo_observers', key)],
|
|
855
|
+
locals = this[SC.keyFor('_kvo_local', key)];
|
|
906
856
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
857
|
+
if (locals && locals.length > 0) return YES;
|
|
858
|
+
if (observers && observers.getMembers().length > 0) return YES;
|
|
859
|
+
return NO;
|
|
860
|
+
},
|
|
861
|
+
|
|
862
|
+
/**
|
|
863
|
+
This method will register any observers and computed properties saved on
|
|
864
|
+
the object. Normally you do not need to call this method yourself. It
|
|
865
|
+
is invoked automatically just before property notifications are sent and
|
|
866
|
+
from the init() method of SC.Object. You may choose to call this
|
|
867
|
+
from your own initialization method if you are using SC.Observable in
|
|
868
|
+
a non-SC.Object-based object.
|
|
869
|
+
|
|
870
|
+
This method looks for several private variables, which you can setup,
|
|
871
|
+
to initialize:
|
|
872
|
+
|
|
873
|
+
- _observers: this should contain an array of key names for observers
|
|
874
|
+
you need to configure.
|
|
875
|
+
|
|
876
|
+
- _bindings: this should contain an array of key names that configure
|
|
877
|
+
bindings.
|
|
878
|
+
|
|
879
|
+
- _properties: this should contain an array of key names for computed
|
|
880
|
+
properties.
|
|
881
|
+
|
|
882
|
+
@returns {Object} this
|
|
883
|
+
*/
|
|
884
|
+
initObservable: function () {
|
|
885
|
+
if (this._observableInited) return;
|
|
886
|
+
this._observableInited = YES;
|
|
887
|
+
|
|
888
|
+
var loc, keys, key, value, observer, propertyPaths, propertyPathsLength,
|
|
889
|
+
len, ploc, path, propertyKey, keysLen;
|
|
890
|
+
|
|
891
|
+
// Loop through observer functions and register them
|
|
892
|
+
if (keys = this._observers) {
|
|
893
|
+
len = keys.length;
|
|
894
|
+
for (loc = 0; loc < len; loc++) {
|
|
895
|
+
key = keys[loc];
|
|
896
|
+
observer = this[key];
|
|
897
|
+
propertyPaths = observer.propertyPaths;
|
|
898
|
+
propertyPathsLength = (propertyPaths) ? propertyPaths.length : 0;
|
|
899
|
+
for (ploc = 0 ; ploc < propertyPathsLength; ploc++) {
|
|
900
|
+
path = propertyPaths[ploc];
|
|
901
|
+
this.addObservesHandler(observer, path);
|
|
915
902
|
}
|
|
916
903
|
}
|
|
904
|
+
}
|
|
917
905
|
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
906
|
+
// Add Bindings
|
|
907
|
+
this.bindings = []; // will be filled in by the bind() method.
|
|
908
|
+
if (keys = this._bindings) {
|
|
909
|
+
for (loc = 0, keysLen = keys.length; loc < keysLen; loc++) {
|
|
910
|
+
// get propertyKey
|
|
911
|
+
key = keys[loc];
|
|
912
|
+
value = this[key];
|
|
913
|
+
propertyKey = key.slice(0, -7); // contentBinding => content
|
|
914
|
+
|
|
915
|
+
// Replace the short form property with the new binding object.
|
|
916
|
+
this[key] = this.bind(propertyKey, value);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
923
919
|
|
|
924
|
-
|
|
925
|
-
|
|
920
|
+
// Add Properties
|
|
921
|
+
if (keys = this._properties) {
|
|
922
|
+
for (loc = 0, keysLen = keys.length; loc < keysLen; loc++) {
|
|
923
|
+
key = keys[loc];
|
|
924
|
+
if (value = this[key]) {
|
|
926
925
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
926
|
+
// activate cacheable only if needed for perf reasons
|
|
927
|
+
if (value.isCacheable) this._kvo_cacheable = YES;
|
|
928
|
+
|
|
929
|
+
// register dependent keys
|
|
930
|
+
if (value.dependentKeys && (value.dependentKeys.length > 0)) {
|
|
931
|
+
this.registerDependentKey(key, value.dependentKeys);
|
|
931
932
|
}
|
|
932
933
|
}
|
|
933
934
|
}
|
|
935
|
+
}
|
|
934
936
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
delete this._properties;
|
|
939
|
-
},
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
Will add an observes handler to this object for a given property path.
|
|
943
|
-
|
|
944
|
-
In most cases, the path provided is relative to this object. However,
|
|
945
|
-
if the path begins with a captial character then the path is considered
|
|
946
|
-
relative to the window object.
|
|
947
|
-
|
|
948
|
-
@param {Function} observer the function on this object that will be
|
|
949
|
-
notified of changes
|
|
950
|
-
@param {String} path a property path string
|
|
951
|
-
@return {Object} returns this
|
|
952
|
-
*/
|
|
953
|
-
addObservesHandler: function(observer, path) {
|
|
954
|
-
this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD, observer, path);
|
|
955
|
-
return this;
|
|
956
|
-
},
|
|
957
|
-
|
|
958
|
-
/**
|
|
959
|
-
Will remove an observes handler from this object for a given property path.
|
|
960
|
-
|
|
961
|
-
In most cases, the path provided is relative to this object. However,
|
|
962
|
-
if the path begins with a captial character then the path is considered
|
|
963
|
-
relative to the window object.
|
|
964
|
-
|
|
965
|
-
@param {Function} observer the function on this object that will be
|
|
966
|
-
notified of changes
|
|
967
|
-
@param {String} path a property path string
|
|
968
|
-
@return {Object} returns this
|
|
969
|
-
*/
|
|
970
|
-
removeObservesHandler: function(observer, path) {
|
|
971
|
-
this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE, observer, path);
|
|
972
|
-
return this;
|
|
973
|
-
},
|
|
974
|
-
|
|
975
|
-
/** @private
|
|
976
|
-
|
|
977
|
-
Used to either add or remove an observer handler on this object
|
|
978
|
-
for a given property path.
|
|
979
|
-
|
|
980
|
-
In most cases, the path provided is relative to this object. However,
|
|
981
|
-
if the path begins with a captial character then the path is considered
|
|
982
|
-
relative to the window object.
|
|
983
|
-
|
|
984
|
-
You must supply an action that is to be performed by this method. The
|
|
985
|
-
action can either be `SC.OBSERVES_HANDLER_ADD` or `SC.OBSERVES_HANDLER_REMOVE`.
|
|
986
|
-
|
|
987
|
-
@param {Function} observer the function on this object that will be
|
|
988
|
-
notified of changes
|
|
989
|
-
@param {String} path a property path string
|
|
990
|
-
@param {String} path a dot-notation property path string
|
|
991
|
-
*/
|
|
992
|
-
_configureObservesHandler: function(action, observer, path) {
|
|
993
|
-
var dotIndex, root;
|
|
994
|
-
|
|
995
|
-
switch (action) {
|
|
996
|
-
case SC.OBSERVES_HANDLER_ADD:
|
|
997
|
-
action = "addObserver"; break;
|
|
998
|
-
case SC.OBSERVES_HANDLER_REMOVE:
|
|
999
|
-
action = "removeObserver"; break;
|
|
1000
|
-
default:
|
|
1001
|
-
throw "invalid action provided: " + action;
|
|
1002
|
-
}
|
|
937
|
+
// Clean up these properties once they have been used.
|
|
938
|
+
delete this._bindings;
|
|
939
|
+
delete this._properties;
|
|
1003
940
|
|
|
1004
|
-
|
|
941
|
+
return this;
|
|
942
|
+
},
|
|
1005
943
|
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
} else if (path.indexOf('*') === 0) {
|
|
1009
|
-
this[action](path.slice(1), this, observer);
|
|
1010
|
-
} else {
|
|
1011
|
-
root = null;
|
|
1012
|
-
|
|
1013
|
-
if (dotIndex === 0) {
|
|
1014
|
-
root = this; path = path.slice(1);
|
|
1015
|
-
} else if (dotIndex === 4 && path.slice(0, 5) === 'this.') {
|
|
1016
|
-
root = this; path = path.slice(5);
|
|
1017
|
-
} else if (dotIndex < 0 && path.length === 4 && path === 'this') {
|
|
1018
|
-
root = this; path = '';
|
|
1019
|
-
} else if (dotIndex > 0 && path[0] === path.charAt(0).toLowerCase()) {
|
|
1020
|
-
// if the first character for the given path is lower case
|
|
1021
|
-
// then we assume the path is relative to this
|
|
1022
|
-
root = this;
|
|
1023
|
-
}
|
|
944
|
+
/**
|
|
945
|
+
This method will destroy the observable.
|
|
1024
946
|
|
|
1025
|
-
|
|
947
|
+
@returns {Object} this
|
|
948
|
+
*/
|
|
949
|
+
destroyObservable: function () {
|
|
950
|
+
var key, keys,
|
|
951
|
+
len,
|
|
952
|
+
observer,
|
|
953
|
+
path,
|
|
954
|
+
propertyPaths,
|
|
955
|
+
propertyPathsLength;
|
|
956
|
+
|
|
957
|
+
// Destroy bindings
|
|
958
|
+
this.bindings.invoke('destroy');
|
|
959
|
+
delete this.bindings;
|
|
960
|
+
|
|
961
|
+
// Loop through observer functions and remove them
|
|
962
|
+
if (keys = this._observers) {
|
|
963
|
+
len = keys.length;
|
|
964
|
+
for (var loc = 0; loc < len; loc++) {
|
|
965
|
+
key = keys[loc];
|
|
966
|
+
observer = this[key];
|
|
967
|
+
propertyPaths = observer.propertyPaths;
|
|
968
|
+
propertyPathsLength = (propertyPaths) ? propertyPaths.length : 0;
|
|
969
|
+
|
|
970
|
+
for (var ploc = 0; ploc < propertyPathsLength; ploc++) {
|
|
971
|
+
path = propertyPaths[ploc];
|
|
972
|
+
this.removeObservesHandler(observer, path);
|
|
973
|
+
}
|
|
1026
974
|
}
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
delete this._observers;
|
|
978
|
+
|
|
979
|
+
return this;
|
|
980
|
+
},
|
|
981
|
+
|
|
982
|
+
/**
|
|
983
|
+
Will add an observes handler to this object for a given property path.
|
|
984
|
+
|
|
985
|
+
In most cases, the path provided is relative to this object. However,
|
|
986
|
+
if the path begins with a capital character then the path is considered
|
|
987
|
+
relative to the window object.
|
|
988
|
+
|
|
989
|
+
@param {Function} observer the function on this object that will be
|
|
990
|
+
notified of changes
|
|
991
|
+
@param {String} path a property path string
|
|
992
|
+
@return {Object} returns this
|
|
993
|
+
*/
|
|
994
|
+
addObservesHandler: function (observer, path) {
|
|
995
|
+
this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD, observer, path);
|
|
996
|
+
return this;
|
|
997
|
+
},
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
Will remove an observes handler from this object for a given property path.
|
|
1001
|
+
|
|
1002
|
+
In most cases, the path provided is relative to this object. However,
|
|
1003
|
+
if the path begins with a capital character then the path is considered
|
|
1004
|
+
relative to the window object.
|
|
1005
|
+
|
|
1006
|
+
@param {Function} observer the function on this object that will be
|
|
1007
|
+
notified of changes
|
|
1008
|
+
@param {String} path a property path string
|
|
1009
|
+
@return {Object} returns this
|
|
1010
|
+
*/
|
|
1011
|
+
removeObservesHandler: function (observer, path) {
|
|
1012
|
+
this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE, observer, path);
|
|
1013
|
+
return this;
|
|
1014
|
+
},
|
|
1015
|
+
|
|
1016
|
+
/** @private
|
|
1017
|
+
|
|
1018
|
+
Used to either add or remove an observer handler on this object
|
|
1019
|
+
for a given property path.
|
|
1020
|
+
|
|
1021
|
+
In most cases, the path provided is relative to this object. However,
|
|
1022
|
+
if the path begins with a capital character then the path is considered
|
|
1023
|
+
relative to the window object.
|
|
1024
|
+
|
|
1025
|
+
You must supply an action that is to be performed by this method. The
|
|
1026
|
+
action can either be `SC.OBSERVES_HANDLER_ADD` or `SC.OBSERVES_HANDLER_REMOVE`.
|
|
1027
|
+
|
|
1028
|
+
@param {Function} observer the function on this object that will be
|
|
1029
|
+
notified of changes
|
|
1030
|
+
@param {String} path a property path string
|
|
1031
|
+
@param {String} path a dot-notation property path string
|
|
1032
|
+
*/
|
|
1033
|
+
_configureObservesHandler: function (action, observer, path) {
|
|
1034
|
+
var dotIndex, root;
|
|
1035
|
+
|
|
1036
|
+
switch (action) {
|
|
1037
|
+
case SC.OBSERVES_HANDLER_ADD:
|
|
1038
|
+
action = "addObserver";
|
|
1039
|
+
break;
|
|
1040
|
+
case SC.OBSERVES_HANDLER_REMOVE:
|
|
1041
|
+
action = "removeObserver";
|
|
1042
|
+
break;
|
|
1043
|
+
default:
|
|
1044
|
+
throw new Error("invalid action provided: " + action);
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
dotIndex = path.indexOf('.');
|
|
1048
|
+
|
|
1049
|
+
if (dotIndex < 0) {
|
|
1050
|
+
this[action](path, this, observer);
|
|
1051
|
+
} else if (path.indexOf('*') === 0) {
|
|
1052
|
+
this[action](path.slice(1), this, observer);
|
|
1053
|
+
} else {
|
|
1054
|
+
root = null;
|
|
1055
|
+
|
|
1056
|
+
if (dotIndex === 0) {
|
|
1057
|
+
root = this;
|
|
1058
|
+
path = path.slice(1);
|
|
1059
|
+
} else if (dotIndex === 4 && path.slice(0, 5) === 'this.') {
|
|
1060
|
+
root = this;
|
|
1061
|
+
path = path.slice(5);
|
|
1062
|
+
} else if (dotIndex < 0 && path.length === 4 && path === 'this') {
|
|
1063
|
+
root = this;
|
|
1064
|
+
path = '';
|
|
1065
|
+
} else if (dotIndex > 0 && path[0] === path.charAt(0).toLowerCase()) {
|
|
1066
|
+
// if the first character for the given path is lower case
|
|
1067
|
+
// then we assume the path is relative to this
|
|
1068
|
+
root = this;
|
|
1063
1069
|
}
|
|
1064
1070
|
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
// prevent notifications from being sent until complete
|
|
1069
|
-
this._kvo_changeLevel = (this._kvo_changeLevel || 0) + 1;
|
|
1070
|
-
|
|
1071
|
-
// keep sending notifications as long as there are changes
|
|
1072
|
-
while(((changes = this._kvo_changes) && (changes.length > 0)) || key) {
|
|
1073
|
-
|
|
1074
|
-
// increment revision
|
|
1075
|
-
rev = ++this.propertyRevision ;
|
|
1076
|
-
|
|
1077
|
-
// save the current set of changes and swap out the kvo_changes so that
|
|
1078
|
-
// any set() calls by observers will be saved in a new set.
|
|
1079
|
-
if (!changes) changes = SC.CoreSet.create() ;
|
|
1080
|
-
this._kvo_changes = null ;
|
|
1081
|
-
|
|
1082
|
-
// Add the passed key to the changes set. If a '*' was passed, then
|
|
1083
|
-
// add all keys in the observers to the set...
|
|
1084
|
-
// once finished, clear the key so the loop will end.
|
|
1085
|
-
if (key === '*') {
|
|
1086
|
-
changes.add('*') ;
|
|
1087
|
-
changes.addEach(this._kvo_for('_kvo_observed_keys', SC.CoreSet));
|
|
1088
|
-
|
|
1089
|
-
} else if (key) changes.add(key) ;
|
|
1090
|
-
|
|
1091
|
-
// Now go through the set and add all dependent keys...
|
|
1092
|
-
if (dependents = this._kvo_dependents) {
|
|
1093
|
-
|
|
1094
|
-
// NOTE: each time we loop, we check the changes length, this
|
|
1095
|
-
// way any dependent keys added to the set will also be evaluated...
|
|
1096
|
-
for(idx=0;idx<changes.length;idx++) {
|
|
1097
|
-
key = changes[idx] ;
|
|
1098
|
-
keys = dependents[key] ;
|
|
1099
|
-
|
|
1100
|
-
// for each dependent key, add to set of changes. Also, if key
|
|
1101
|
-
// value is a cacheable property, clear the cached value...
|
|
1102
|
-
if (keys && (loc = keys.length)) {
|
|
1103
|
-
if (log) {
|
|
1104
|
-
SC.Logger.log("%@...including dependent keys for %@: %@".fmt(spaces, key, keys));
|
|
1105
|
-
}
|
|
1106
|
-
cache = this._kvo_cache;
|
|
1107
|
-
if (!cache) cache = this._kvo_cache = {};
|
|
1108
|
-
while(--loc >= 0) {
|
|
1109
|
-
changes.add(key = keys[loc]);
|
|
1110
|
-
if (func = this[key]) {
|
|
1111
|
-
this[func.cacheKey] = undefined;
|
|
1112
|
-
cache[func.cacheKey] = cache[func.lastSetValueKey] = undefined;
|
|
1113
|
-
} // if (func=)
|
|
1114
|
-
} // while (--loc)
|
|
1115
|
-
} // if (keys &&
|
|
1116
|
-
} // for(idx...
|
|
1117
|
-
} // if (dependents...)
|
|
1118
|
-
|
|
1119
|
-
// now iterate through all changed keys and notify observers.
|
|
1120
|
-
while(changes.length > 0) {
|
|
1121
|
-
key = changes.pop() ; // the changed key
|
|
1122
|
-
|
|
1123
|
-
// find any observers and notify them...
|
|
1124
|
-
observers = this[SC.keyFor('_kvo_observers', key)];
|
|
1125
|
-
|
|
1126
|
-
if (observers) {
|
|
1127
|
-
// We need to clone the 'members' structure here in case any of the
|
|
1128
|
-
// observers we're about to notify happen to remove observers for
|
|
1129
|
-
// this key, which would mutate the structure underneath us.
|
|
1130
|
-
// (Cloning it rather than mutating gives us a clear policy: if you
|
|
1131
|
-
// were registered as an observer at the time notification begins,
|
|
1132
|
-
// you will be notified, regardless of whether you're removed as an
|
|
1133
|
-
// observer during that round of notification. Similarly, if you're
|
|
1134
|
-
// added as an observer during the notification round by another
|
|
1135
|
-
// observer, you will not be notified until the next time.)
|
|
1136
|
-
members = SC.clone(observers.getMembers()) ;
|
|
1137
|
-
membersLength = members.length ;
|
|
1138
|
-
for(memberLoc=0;memberLoc < membersLength; memberLoc++) {
|
|
1139
|
-
member = members[memberLoc] ;
|
|
1140
|
-
|
|
1141
|
-
if (member[3] === rev) continue ; // skip notified items.
|
|
1142
|
-
|
|
1143
|
-
if(!member[1]) SC.Logger.log(member);
|
|
1144
|
-
|
|
1145
|
-
target = member[0] || this;
|
|
1146
|
-
method = member[1] ;
|
|
1147
|
-
context = member[2];
|
|
1148
|
-
member[3] = rev;
|
|
1149
|
-
|
|
1150
|
-
if (log) SC.Logger.log('%@...firing observer on %@ for key "%@"'.fmt(spaces, target, key));
|
|
1151
|
-
if (context !== undefined) {
|
|
1152
|
-
method.call(target, this, key, null, context, rev);
|
|
1153
|
-
} else {
|
|
1154
|
-
method.call(target, this, key, null, rev) ;
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1071
|
+
SC.Observers[action](path, this, observer, root);
|
|
1072
|
+
}
|
|
1073
|
+
},
|
|
1158
1074
|
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1075
|
+
// ..........................................
|
|
1076
|
+
// NOTIFICATION
|
|
1077
|
+
//
|
|
1078
|
+
|
|
1079
|
+
/**
|
|
1080
|
+
Returns an array with all of the observers registered for the specified
|
|
1081
|
+
key. This is intended for debugging purposes only. You generally do not
|
|
1082
|
+
want to rely on this method for production code.
|
|
1083
|
+
|
|
1084
|
+
@param {String} key the key to evaluate
|
|
1085
|
+
@returns {Array} array of Observer objects, describing the observer.
|
|
1086
|
+
*/
|
|
1087
|
+
observersForKey: function (key) {
|
|
1088
|
+
SC.Observers.flush(this); // hookup as many observers as possible.
|
|
1089
|
+
|
|
1090
|
+
var observers = this[SC.keyFor('_kvo_observers', key)];
|
|
1091
|
+
return observers ? observers.getMembers() : [];
|
|
1092
|
+
},
|
|
1093
|
+
|
|
1094
|
+
// this private method actually notifies the observers for any keys in the
|
|
1095
|
+
// observer queue. If you pass a key it will be added to the queue.
|
|
1096
|
+
_notifyPropertyObservers: function (key) {
|
|
1097
|
+
if (!this._observableInited) this.initObservable();
|
|
1098
|
+
|
|
1099
|
+
SC.Observers.flush(this); // hookup as many observers as possible.
|
|
1100
|
+
|
|
1101
|
+
var log = SC.LOG_OBSERVERS && this.LOG_OBSERVING !== NO,
|
|
1102
|
+
observers, changes, dependents, starObservers, idx, keys, rev,
|
|
1103
|
+
members, membersLength, member, memberLoc, target, method, loc, func,
|
|
1104
|
+
context, spaces, cache;
|
|
1105
|
+
|
|
1106
|
+
if (log) {
|
|
1107
|
+
spaces = SC.KVO_SPACES = (SC.KVO_SPACES || '') + ' ';
|
|
1108
|
+
SC.Logger.log('%@%@: notifying observers after change to key "%@"'.fmt(spaces, this, key));
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
// Get any starObservers -- they will be notified of all changes.
|
|
1112
|
+
starObservers = this['_kvo_observers_*'];
|
|
1113
|
+
|
|
1114
|
+
// prevent notifications from being sent until complete
|
|
1115
|
+
this._kvo_changeLevel = (this._kvo_changeLevel || 0) + 1;
|
|
1116
|
+
|
|
1117
|
+
// keep sending notifications as long as there are changes
|
|
1118
|
+
while (((changes = this._kvo_changes) && (changes.length > 0)) || key) {
|
|
1119
|
+
|
|
1120
|
+
// increment revision
|
|
1121
|
+
rev = ++this.propertyRevision;
|
|
1122
|
+
|
|
1123
|
+
// save the current set of changes and swap out the kvo_changes so that
|
|
1124
|
+
// any set() calls by observers will be saved in a new set.
|
|
1125
|
+
if (!changes) changes = SC.CoreSet.create();
|
|
1126
|
+
this._kvo_changes = null;
|
|
1127
|
+
|
|
1128
|
+
// Add the passed key to the changes set. If a '*' was passed, then
|
|
1129
|
+
// add all keys in the observers to the set...
|
|
1130
|
+
// once finished, clear the key so the loop will end.
|
|
1131
|
+
if (key === '*') {
|
|
1132
|
+
changes.add('*');
|
|
1133
|
+
changes.addEach(this._kvo_for('_kvo_observed_keys', SC.CoreSet));
|
|
1134
|
+
|
|
1135
|
+
} else if (key) changes.add(key);
|
|
1136
|
+
|
|
1137
|
+
// Now go through the set and add all dependent keys...
|
|
1138
|
+
if (dependents = this._kvo_dependents) {
|
|
1139
|
+
|
|
1140
|
+
// NOTE: each time we loop, we check the changes length, this
|
|
1141
|
+
// way any dependent keys added to the set will also be evaluated...
|
|
1142
|
+
for (idx = 0; idx < changes.length; idx++) {
|
|
1143
|
+
key = changes[idx];
|
|
1144
|
+
keys = dependents[key];
|
|
1145
|
+
|
|
1146
|
+
// for each dependent key, add to set of changes. Also, if key
|
|
1147
|
+
// value is a cacheable property, clear the cached value...
|
|
1148
|
+
if (keys && (loc = keys.length)) {
|
|
1149
|
+
if (log) {
|
|
1150
|
+
SC.Logger.log("%@...including dependent keys for %@: %@".fmt(spaces, key, keys));
|
|
1151
|
+
}
|
|
1152
|
+
cache = this._kvo_cache;
|
|
1153
|
+
if (!cache) cache = this._kvo_cache = {};
|
|
1154
|
+
while (--loc >= 0) {
|
|
1155
|
+
changes.add(key = keys[loc]);
|
|
1156
|
+
if (func = this[key]) {
|
|
1157
|
+
this[func.cacheKey] = undefined;
|
|
1158
|
+
cache[func.cacheKey] = cache[func.lastSetValueKey] = undefined;
|
|
1159
|
+
} // if (func=)
|
|
1160
|
+
} // while (--loc)
|
|
1161
|
+
} // if (keys &&
|
|
1162
|
+
} // for(idx...
|
|
1163
|
+
} // if (dependents...)
|
|
1164
|
+
|
|
1165
|
+
// now iterate through all changed keys and notify observers.
|
|
1166
|
+
while (changes.length > 0) {
|
|
1167
|
+
key = changes.pop(); // the changed key
|
|
1168
|
+
|
|
1169
|
+
// find any observers and notify them...
|
|
1170
|
+
observers = this[SC.keyFor('_kvo_observers', key)];
|
|
1171
|
+
|
|
1172
|
+
if (observers) {
|
|
1173
|
+
// We need to clone the 'members' structure here in case any of the
|
|
1174
|
+
// observers we're about to notify happen to remove observers for
|
|
1175
|
+
// this key, which would mutate the structure underneath us.
|
|
1176
|
+
// (Cloning it rather than mutating gives us a clear policy: if you
|
|
1177
|
+
// were registered as an observer at the time notification begins,
|
|
1178
|
+
// you will be notified, regardless of whether you're removed as an
|
|
1179
|
+
// observer during that round of notification. Similarly, if you're
|
|
1180
|
+
// added as an observer during the notification round by another
|
|
1181
|
+
// observer, you will not be notified until the next time.)
|
|
1182
|
+
members = SC.clone(observers.getMembers());
|
|
1183
|
+
membersLength = members.length;
|
|
1184
|
+
for (memberLoc = 0; memberLoc < membersLength; memberLoc++) {
|
|
1185
|
+
member = members[memberLoc];
|
|
1186
|
+
|
|
1187
|
+
if (member[3] === rev) continue; // skip notified items.
|
|
1188
|
+
|
|
1189
|
+
if (!member[1]) SC.Logger.log(member);
|
|
1190
|
+
|
|
1191
|
+
target = member[0] || this;
|
|
1192
|
+
method = member[1];
|
|
1193
|
+
context = member[2];
|
|
1194
|
+
member[3] = rev;
|
|
1195
|
+
|
|
1196
|
+
if (log) SC.Logger.log('%@...firing observer on %@ for key "%@"'.fmt(spaces, target, key));
|
|
1197
|
+
if (context !== undefined) {
|
|
1198
|
+
method.call(target, this, key, null, context, rev);
|
|
1199
|
+
} else {
|
|
1200
|
+
method.call(target, this, key, null, rev);
|
|
1174
1201
|
}
|
|
1175
1202
|
}
|
|
1203
|
+
}
|
|
1176
1204
|
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
if (log) SC.Logger.log('%@...firing
|
|
1190
|
-
|
|
1191
|
-
method.call(target, this, key, null, context, rev);
|
|
1192
|
-
} else {
|
|
1193
|
-
method.call(target, this, key, null, rev) ;
|
|
1194
|
-
}
|
|
1205
|
+
// look for local observers. Local observers are added by SC.Object
|
|
1206
|
+
// as an optimization to avoid having to add observers for every
|
|
1207
|
+
// instance when you are just observing your local object.
|
|
1208
|
+
members = this[SC.keyFor('_kvo_local', key)];
|
|
1209
|
+
if (members) {
|
|
1210
|
+
// Note: Since, unlike above, we don't expect local observers to be
|
|
1211
|
+
// removed in general, we will not clone 'members'.
|
|
1212
|
+
membersLength = members.length;
|
|
1213
|
+
for (memberLoc = 0; memberLoc < membersLength; memberLoc++) {
|
|
1214
|
+
member = members[memberLoc];
|
|
1215
|
+
method = this[member]; // try to find observer function
|
|
1216
|
+
if (method) {
|
|
1217
|
+
if (log) SC.Logger.log('%@...firing local observer %@.%@ for key "%@"'.fmt(spaces, this, member, key));
|
|
1218
|
+
method.call(this, this, key, null, rev);
|
|
1195
1219
|
}
|
|
1196
1220
|
}
|
|
1221
|
+
}
|
|
1197
1222
|
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1223
|
+
// if there are starObservers, do the same thing for them
|
|
1224
|
+
if (starObservers && key !== '*') {
|
|
1225
|
+
// We clone the structure per the justification, above, for regular
|
|
1226
|
+
// observers.
|
|
1227
|
+
members = SC.clone(starObservers.getMembers());
|
|
1228
|
+
membersLength = members.length;
|
|
1229
|
+
for (memberLoc = 0; memberLoc < membersLength; memberLoc++) {
|
|
1230
|
+
member = members[memberLoc];
|
|
1231
|
+
target = member[0] || this;
|
|
1232
|
+
method = member[1];
|
|
1233
|
+
context = member[2];
|
|
1234
|
+
|
|
1235
|
+
if (log) SC.Logger.log('%@...firing * observer on %@ for key "%@"'.fmt(spaces, target, key));
|
|
1236
|
+
if (context !== undefined) {
|
|
1237
|
+
method.call(target, this, key, null, context, rev);
|
|
1238
|
+
} else {
|
|
1239
|
+
method.call(target, this, key, null, rev);
|
|
1240
|
+
}
|
|
1202
1241
|
}
|
|
1203
|
-
}
|
|
1242
|
+
}
|
|
1204
1243
|
|
|
1205
|
-
//
|
|
1206
|
-
if (
|
|
1244
|
+
// if there is a default property observer, call that also
|
|
1245
|
+
if (this.propertyObserver) {
|
|
1246
|
+
if (log) SC.Logger.log('%@...firing %@.propertyObserver for key "%@"'.fmt(spaces, this, key));
|
|
1247
|
+
this.propertyObserver(this, key, null, rev);
|
|
1248
|
+
}
|
|
1249
|
+
} // while(changes.length>0)
|
|
1207
1250
|
|
|
1208
|
-
|
|
1209
|
-
|
|
1251
|
+
// changes set should be empty. release it for reuse
|
|
1252
|
+
if (changes) changes.destroy();
|
|
1210
1253
|
|
|
1211
|
-
|
|
1254
|
+
// key is no longer needed; clear it to avoid infinite loops
|
|
1255
|
+
key = null;
|
|
1212
1256
|
|
|
1213
|
-
|
|
1214
|
-
this._kvo_changeLevel = (this._kvo_changeLevel || 1) - 1;
|
|
1257
|
+
} // while (changes)
|
|
1215
1258
|
|
|
1216
|
-
|
|
1259
|
+
// done with loop, reduce change level so that future sets can resume
|
|
1260
|
+
this._kvo_changeLevel = (this._kvo_changeLevel || 1) - 1;
|
|
1217
1261
|
|
|
1218
|
-
|
|
1219
|
-
},
|
|
1262
|
+
if (log) SC.KVO_SPACES = spaces.slice(0, -2);
|
|
1220
1263
|
|
|
1221
|
-
//
|
|
1222
|
-
|
|
1223
|
-
//
|
|
1264
|
+
return YES; // finished successfully
|
|
1265
|
+
},
|
|
1224
1266
|
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1267
|
+
// ..........................................
|
|
1268
|
+
// BINDINGS
|
|
1269
|
+
//
|
|
1228
1270
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
@returns {SC.Binding} new binding instance
|
|
1233
|
-
*/
|
|
1234
|
-
bind: function(toKey, target, method) {
|
|
1271
|
+
/**
|
|
1272
|
+
Manually add a new binding to an object. This is the same as doing
|
|
1273
|
+
the more familiar propertyBinding: 'property.path' approach.
|
|
1235
1274
|
|
|
1236
|
-
|
|
1275
|
+
@param {String} toKey the key to bind to
|
|
1276
|
+
@param {Object} target target or property path to bind from
|
|
1277
|
+
@param {String|Function} method method for target to bind from
|
|
1278
|
+
@returns {SC.Binding} new binding instance
|
|
1279
|
+
*/
|
|
1280
|
+
bind: function (toKey, target, method) {
|
|
1281
|
+
var binding, pathType;
|
|
1237
1282
|
|
|
1238
|
-
|
|
1239
|
-
|
|
1283
|
+
// normalize...
|
|
1284
|
+
if (method !== undefined) target = [target, method];
|
|
1240
1285
|
|
|
1241
|
-
|
|
1286
|
+
pathType = typeof target;
|
|
1242
1287
|
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1288
|
+
// if a string or array (i.e. tuple) is passed, convert this into a
|
|
1289
|
+
// binding. If a binding default was provided, use that.
|
|
1290
|
+
if (pathType === "string" || (pathType === "object" && (target instanceof Array))) {
|
|
1291
|
+
binding = this[toKey + 'BindingDefault'] || SC.Binding;
|
|
1292
|
+
binding = binding.beget().from(target);
|
|
1293
|
+
} else {
|
|
1294
|
+
// If a binding object was provided, clone it so that it gets
|
|
1295
|
+
// connected again if the original example binding was already
|
|
1296
|
+
// connected.
|
|
1297
|
+
binding = target.beget();
|
|
1298
|
+
}
|
|
1254
1299
|
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1300
|
+
// finish configuring the binding and then connect it.
|
|
1301
|
+
binding = binding.to(toKey, this).connect();
|
|
1302
|
+
this.bindings.push(binding);
|
|
1258
1303
|
|
|
1259
|
-
|
|
1260
|
-
|
|
1304
|
+
return binding;
|
|
1305
|
+
},
|
|
1261
1306
|
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1307
|
+
/**
|
|
1308
|
+
didChangeFor allows you to determine if a property has changed since the
|
|
1309
|
+
last time the method was called. You must pass a unique context as the
|
|
1310
|
+
first parameter (so didChangeFor can identify which method is calling it),
|
|
1311
|
+
followed by a list of keys that should be checked for changes.
|
|
1312
|
+
|
|
1313
|
+
For example, in your render method you might pass the following context:
|
|
1314
|
+
if (this.didChangeFor('render','height','width')) {
|
|
1315
|
+
// Only render if changed
|
|
1316
|
+
}
|
|
1267
1317
|
|
|
1268
|
-
|
|
1269
|
-
if (this.didChangeFor('render','height','width')) {
|
|
1270
|
-
// Only render if changed
|
|
1271
|
-
}
|
|
1318
|
+
In your view's update method, you might instead pass 'update':
|
|
1272
1319
|
|
|
1273
|
-
|
|
1320
|
+
if (this.didChangeFor('update', 'height', 'width')) {
|
|
1321
|
+
// Only update height and width properties
|
|
1322
|
+
}
|
|
1274
1323
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1324
|
+
This method works by comparing property revision counts. Every time a
|
|
1325
|
+
property changes, an internal counter is incremented. When didChangeFor is
|
|
1326
|
+
invoked, the current revision count of the property is compared to the
|
|
1327
|
+
revision count from the last time this method was called.
|
|
1278
1328
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
// yes, check the value with the last seen value
|
|
1312
|
-
value = this.get(key) ;
|
|
1313
|
-
if (seenValues[key] !== value) {
|
|
1314
|
-
ret = true ; // did change!
|
|
1315
|
-
seenValues[key] = value;
|
|
1316
|
-
}
|
|
1329
|
+
@param {String|Object} context a unique identifier
|
|
1330
|
+
@param {String…} propertyNames one or more property names
|
|
1331
|
+
*/
|
|
1332
|
+
didChangeFor: function (context) {
|
|
1333
|
+
var valueCache, revisionCache, seenValues, seenRevisions, ret,
|
|
1334
|
+
currentRevision, idx, key, value;
|
|
1335
|
+
context = SC.hashFor(context); // get a hash key we can use in caches.
|
|
1336
|
+
|
|
1337
|
+
// setup caches...
|
|
1338
|
+
valueCache = this._kvo_didChange_valueCache;
|
|
1339
|
+
if (!valueCache) valueCache = this._kvo_didChange_valueCache = {};
|
|
1340
|
+
revisionCache = this._kvo_didChange_revisionCache;
|
|
1341
|
+
if (!revisionCache) revisionCache = this._kvo_didChange_revisionCache = {};
|
|
1342
|
+
|
|
1343
|
+
// get the cache of values and revisions already seen in this context
|
|
1344
|
+
seenValues = valueCache[context] || {};
|
|
1345
|
+
seenRevisions = revisionCache[context] || {};
|
|
1346
|
+
|
|
1347
|
+
// prepare too loop!
|
|
1348
|
+
ret = false;
|
|
1349
|
+
currentRevision = this._kvo_revision || 0;
|
|
1350
|
+
idx = arguments.length;
|
|
1351
|
+
while (--idx >= 1) { // NB: loop only to 1 to ignore context arg.
|
|
1352
|
+
key = arguments[idx];
|
|
1353
|
+
|
|
1354
|
+
// has the kvo revision changed since the last time we did this?
|
|
1355
|
+
if (seenRevisions[key] != currentRevision) {
|
|
1356
|
+
// yes, check the value with the last seen value
|
|
1357
|
+
value = this.get(key);
|
|
1358
|
+
if (seenValues[key] !== value) {
|
|
1359
|
+
ret = true; // did change!
|
|
1360
|
+
seenValues[key] = value;
|
|
1317
1361
|
}
|
|
1318
|
-
seenRevisions[key] = currentRevision;
|
|
1319
1362
|
}
|
|
1363
|
+
seenRevisions[key] = currentRevision;
|
|
1364
|
+
}
|
|
1320
1365
|
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
NOTE: By default, the set() method will not set the value unless it has
|
|
1332
|
-
changed. However, this check can skipped by setting .property().idempotent(NO)
|
|
1333
|
-
setIfChanged() may be useful in this case.
|
|
1334
|
-
|
|
1335
|
-
@param {String|Hash} key the key to change
|
|
1336
|
-
@param {Object} value the value to change
|
|
1337
|
-
@returns {SC.Observable}
|
|
1338
|
-
*/
|
|
1339
|
-
setIfChanged: function(key, value) {
|
|
1340
|
-
if(value === undefined && SC.typeOf(key) === SC.T_HASH) {
|
|
1341
|
-
var hash = key;
|
|
1342
|
-
|
|
1343
|
-
for(key in hash) {
|
|
1344
|
-
if (!hash.hasOwnProperty(key)) continue;
|
|
1345
|
-
this.setIfChanged(key, hash[key]);
|
|
1346
|
-
}
|
|
1366
|
+
valueCache[context] = seenValues;
|
|
1367
|
+
revisionCache[context] = seenRevisions;
|
|
1368
|
+
return ret;
|
|
1369
|
+
},
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
Sets the property only if the passed value is different from the
|
|
1373
|
+
current value. Depending on how expensive a get() is on this property,
|
|
1374
|
+
this may be more efficient.
|
|
1347
1375
|
|
|
1348
|
-
|
|
1376
|
+
NOTE: By default, the set() method will not set the value unless it has
|
|
1377
|
+
changed. However, this check can skipped by setting .property().idempotent(NO)
|
|
1378
|
+
setIfChanged() may be useful in this case.
|
|
1379
|
+
|
|
1380
|
+
@param {String|Hash} key the key to change
|
|
1381
|
+
@param {Object} value the value to change
|
|
1382
|
+
@returns {SC.Observable}
|
|
1383
|
+
*/
|
|
1384
|
+
setIfChanged: function (key, value) {
|
|
1385
|
+
if (value === undefined && SC.typeOf(key) === SC.T_HASH) {
|
|
1386
|
+
var hash = key;
|
|
1387
|
+
|
|
1388
|
+
for (key in hash) {
|
|
1389
|
+
if (!hash.hasOwnProperty(key)) continue;
|
|
1390
|
+
this.setIfChanged(key, hash[key]);
|
|
1349
1391
|
}
|
|
1350
1392
|
|
|
1351
|
-
return (this.get(key) !== value) ? this.set(key, value) : this ;
|
|
1352
|
-
},
|
|
1353
|
-
|
|
1354
|
-
/**
|
|
1355
|
-
Navigates the property path, returning the value at that point.
|
|
1356
|
-
|
|
1357
|
-
If any object in the path is undefined, returns undefined.
|
|
1358
|
-
@param {String} path The property path you want to retrieve
|
|
1359
|
-
*/
|
|
1360
|
-
getPath: function(path) {
|
|
1361
|
-
var tuple = SC.tupleForPropertyPath(path, this) ;
|
|
1362
|
-
if (tuple === null || tuple[0] === null) return undefined ;
|
|
1363
|
-
return SC.get(tuple[0], tuple[1]) ;
|
|
1364
|
-
},
|
|
1365
|
-
|
|
1366
|
-
/**
|
|
1367
|
-
Navigates the property path, finally setting the value.
|
|
1368
|
-
|
|
1369
|
-
@param {String} path the property path to set
|
|
1370
|
-
@param {Object} value the value to set
|
|
1371
|
-
@returns {SC.Observable}
|
|
1372
|
-
*/
|
|
1373
|
-
setPath: function(path, value) {
|
|
1374
|
-
if (path.indexOf('.') >= 0) {
|
|
1375
|
-
var tuple = SC.tupleForPropertyPath(path, this) ;
|
|
1376
|
-
if (!tuple || !tuple[0]) return null ;
|
|
1377
|
-
tuple[0].set(tuple[1], value) ;
|
|
1378
|
-
} else this.set(path, value) ; // shortcut
|
|
1379
1393
|
return this;
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
|
-
/**
|
|
1383
|
-
Navigates the property path, finally setting the value but only if
|
|
1384
|
-
the value does not match the current value. This will avoid sending
|
|
1385
|
-
unnecessary change notifications.
|
|
1386
|
-
|
|
1387
|
-
@param {String} path the property path to set
|
|
1388
|
-
@param {Object} value the value to set
|
|
1389
|
-
@returns {Object} this
|
|
1390
|
-
*/
|
|
1391
|
-
setPathIfChanged: function(path, value) {
|
|
1392
|
-
if (path.indexOf('.') >= 0) {
|
|
1393
|
-
var tuple = SC.tupleForPropertyPath(path, this) ;
|
|
1394
|
-
if (!tuple || !tuple[0]) return null ;
|
|
1395
|
-
if (tuple[0].get(tuple[1]) !== value) {
|
|
1396
|
-
tuple[0].set(tuple[1], value) ;
|
|
1397
|
-
}
|
|
1398
|
-
} else this.setIfChanged(path, value) ; // shortcut
|
|
1399
|
-
return this;
|
|
1400
|
-
},
|
|
1394
|
+
}
|
|
1401
1395
|
|
|
1402
|
-
|
|
1403
|
-
|
|
1396
|
+
return (this.get(key) !== value) ? this.set(key, value) : this;
|
|
1397
|
+
},
|
|
1404
1398
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1399
|
+
/**
|
|
1400
|
+
Navigates the property path, returning the value at that point.
|
|
1407
1401
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
@param {String} key property name
|
|
1450
|
-
@param {Object} value optional parameter for "true" value
|
|
1451
|
-
@param {Object} alt optional parameter for "false" value
|
|
1452
|
-
@returns {Object} new value
|
|
1453
|
-
*/
|
|
1454
|
-
toggleProperty: function(key,value,alt) {
|
|
1455
|
-
if (value === undefined) value = true ;
|
|
1456
|
-
if (alt === undefined) alt = false ;
|
|
1457
|
-
value = (this.get(key) == value) ? alt : value ;
|
|
1458
|
-
this.set(key,value);
|
|
1459
|
-
return this.get(key) ;
|
|
1460
|
-
},
|
|
1461
|
-
|
|
1462
|
-
/**
|
|
1463
|
-
Convenience method to call propertyWillChange/propertyDidChange.
|
|
1464
|
-
|
|
1465
|
-
Sometimes you need to notify observers that a property has changed value
|
|
1466
|
-
without actually changing this value. In those cases, you can use this
|
|
1467
|
-
method as a convenience instead of calling propertyWillChange() and
|
|
1468
|
-
propertyDidChange().
|
|
1469
|
-
|
|
1470
|
-
@param {String} key The property key that has just changed.
|
|
1471
|
-
@param {Object} value The new value of the key. May be null.
|
|
1472
|
-
@returns {SC.Observable}
|
|
1473
|
-
*/
|
|
1474
|
-
notifyPropertyChange: function(key, value) {
|
|
1475
|
-
this.propertyWillChange(key) ;
|
|
1476
|
-
this.propertyDidChange(key, value) ;
|
|
1477
|
-
return this;
|
|
1478
|
-
},
|
|
1479
|
-
|
|
1480
|
-
/**
|
|
1481
|
-
Notifies observers of all possible property changes.
|
|
1482
|
-
|
|
1483
|
-
Sometimes when you make a major update to your object, it is cheaper to
|
|
1484
|
-
simply notify all observers that their property might have changed than
|
|
1485
|
-
to figure out specifically which properties actually did change.
|
|
1486
|
-
|
|
1487
|
-
In those cases, you can simply call this method to notify all property
|
|
1488
|
-
observers immediately. Note that this ignores property groups.
|
|
1489
|
-
|
|
1490
|
-
@returns {SC.Observable}
|
|
1491
|
-
*/
|
|
1492
|
-
allPropertiesDidChange: function() {
|
|
1493
|
-
this._kvo_cache = null; //clear cached props
|
|
1494
|
-
this._notifyPropertyObservers('*') ;
|
|
1495
|
-
return this ;
|
|
1496
|
-
},
|
|
1497
|
-
|
|
1498
|
-
/**
|
|
1499
|
-
Allows you to inspect a property for changes. Whenever the named property
|
|
1500
|
-
changes, a log will be printed to the console. This (along with removeProbe)
|
|
1501
|
-
are convenience methods meant for debugging purposes.
|
|
1502
|
-
|
|
1503
|
-
@param {String} key The name of the property you want probed for changes
|
|
1504
|
-
*/
|
|
1505
|
-
addProbe: function(key) { this.addObserver(key,SC.logChange); },
|
|
1506
|
-
|
|
1507
|
-
/**
|
|
1508
|
-
Stops a running probe from observing changes to the observer.
|
|
1509
|
-
|
|
1510
|
-
@param {String} key The name of the property you want probed for changes
|
|
1511
|
-
*/
|
|
1512
|
-
removeProbe: function(key) { this.removeObserver(key,SC.logChange); },
|
|
1513
|
-
|
|
1514
|
-
/**
|
|
1515
|
-
Logs the named properties to the SC.Logger.
|
|
1516
|
-
|
|
1517
|
-
@param {String...} propertyNames one or more property names
|
|
1518
|
-
*/
|
|
1519
|
-
logProperty: function() {
|
|
1520
|
-
var props = SC.$A(arguments),
|
|
1521
|
-
prop, propsLen, idx;
|
|
1522
|
-
for(idx=0, propsLen = props.length; idx<propsLen; idx++) {
|
|
1523
|
-
prop = props[idx] ;
|
|
1524
|
-
SC.Logger.log('%@:%@: '.fmt(SC.guidFor(this), prop), this.get(prop)) ;
|
|
1402
|
+
If any object in the path is undefined, returns undefined.
|
|
1403
|
+
@param {String} path The property path you want to retrieve
|
|
1404
|
+
*/
|
|
1405
|
+
getPath: function (path) {
|
|
1406
|
+
var tuple = SC.tupleForPropertyPath(path, this);
|
|
1407
|
+
if (tuple === null || tuple[0] === null) return undefined;
|
|
1408
|
+
return SC.get(tuple[0], tuple[1]);
|
|
1409
|
+
},
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
Navigates the property path, finally setting the value.
|
|
1413
|
+
|
|
1414
|
+
@param {String} path the property path to set
|
|
1415
|
+
@param {Object} value the value to set
|
|
1416
|
+
@returns {SC.Observable}
|
|
1417
|
+
*/
|
|
1418
|
+
setPath: function (path, value) {
|
|
1419
|
+
if (path.indexOf('.') >= 0) {
|
|
1420
|
+
var tuple = SC.tupleForPropertyPath(path, this);
|
|
1421
|
+
if (!tuple || !tuple[0]) return null;
|
|
1422
|
+
tuple[0].set(tuple[1], value);
|
|
1423
|
+
} else this.set(path, value); // shortcut
|
|
1424
|
+
return this;
|
|
1425
|
+
},
|
|
1426
|
+
|
|
1427
|
+
/**
|
|
1428
|
+
Navigates the property path, finally setting the value but only if
|
|
1429
|
+
the value does not match the current value. This will avoid sending
|
|
1430
|
+
unnecessary change notifications.
|
|
1431
|
+
|
|
1432
|
+
@param {String} path the property path to set
|
|
1433
|
+
@param {Object} value the value to set
|
|
1434
|
+
@returns {Object} this
|
|
1435
|
+
*/
|
|
1436
|
+
setPathIfChanged: function (path, value) {
|
|
1437
|
+
if (path.indexOf('.') >= 0) {
|
|
1438
|
+
var tuple = SC.tupleForPropertyPath(path, this);
|
|
1439
|
+
if (!tuple || !tuple[0]) return null;
|
|
1440
|
+
if (tuple[0].get(tuple[1]) !== value) {
|
|
1441
|
+
tuple[0].set(tuple[1], value);
|
|
1525
1442
|
}
|
|
1526
|
-
},
|
|
1443
|
+
} else this.setIfChanged(path, value); // shortcut
|
|
1444
|
+
return this;
|
|
1445
|
+
},
|
|
1446
|
+
|
|
1447
|
+
/**
|
|
1448
|
+
Convenience method to get an array of properties.
|
|
1449
|
+
|
|
1450
|
+
Pass in multiple property keys or an array of property keys. This
|
|
1451
|
+
method uses getPath() so you can also pass key paths.
|
|
1452
|
+
|
|
1453
|
+
@returns {Array} Values of property keys.
|
|
1454
|
+
*/
|
|
1455
|
+
getEach: function () {
|
|
1456
|
+
var keys = SC.A(arguments),
|
|
1457
|
+
ret = [], idx, idxLen;
|
|
1458
|
+
|
|
1459
|
+
for (idx = 0, idxLen = keys.length; idx < idxLen; idx++) {
|
|
1460
|
+
ret[ret.length] = this.getPath(keys[idx]);
|
|
1461
|
+
}
|
|
1462
|
+
return ret;
|
|
1463
|
+
},
|
|
1464
|
+
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
Increments the value of a property.
|
|
1527
1468
|
|
|
1528
|
-
|
|
1469
|
+
@param {String} key property name
|
|
1470
|
+
@param {Number} increment the amount to increment (optional)
|
|
1471
|
+
@returns {Number} new value of property
|
|
1472
|
+
*/
|
|
1473
|
+
incrementProperty: function (key, increment) {
|
|
1474
|
+
if (!increment) increment = 1;
|
|
1475
|
+
this.set(key, (this.get(key) || 0) + increment);
|
|
1476
|
+
return this.get(key);
|
|
1477
|
+
},
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
Decrements the value of a property.
|
|
1529
1481
|
|
|
1530
|
-
|
|
1482
|
+
@param {String} key property name
|
|
1483
|
+
@param {Number} increment the amount to decrement (optional)
|
|
1484
|
+
@returns {Number} new value of property
|
|
1485
|
+
*/
|
|
1486
|
+
decrementProperty: function (key, increment) {
|
|
1487
|
+
if (!increment) increment = 1;
|
|
1488
|
+
this.set(key, (this.get(key) || 0) - increment);
|
|
1489
|
+
return this.get(key);
|
|
1490
|
+
},
|
|
1491
|
+
|
|
1492
|
+
/**
|
|
1493
|
+
Inverts a property. Property should be a bool.
|
|
1531
1494
|
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1495
|
+
@param {String} key property name
|
|
1496
|
+
@param {Object} value optional parameter for "true" value
|
|
1497
|
+
@param {Object} alt optional parameter for "false" value
|
|
1498
|
+
@returns {Object} new value
|
|
1499
|
+
*/
|
|
1500
|
+
toggleProperty: function (key, value, alt) {
|
|
1501
|
+
if (value === undefined) value = true;
|
|
1502
|
+
if (alt === undefined) alt = false;
|
|
1503
|
+
value = (this.get(key) == value) ? alt : value;
|
|
1504
|
+
this.set(key, value);
|
|
1505
|
+
return this.get(key);
|
|
1506
|
+
},
|
|
1536
1507
|
|
|
1537
1508
|
/**
|
|
1538
|
-
|
|
1539
|
-
|
|
1509
|
+
Convenience method to call propertyWillChange/propertyDidChange.
|
|
1510
|
+
|
|
1511
|
+
Sometimes you need to notify observers that a property has changed value
|
|
1512
|
+
without actually changing this value. In those cases, you can use this
|
|
1513
|
+
method as a convenience instead of calling propertyWillChange() and
|
|
1514
|
+
propertyDidChange().
|
|
1515
|
+
|
|
1516
|
+
@param {String} key The property key that has just changed.
|
|
1517
|
+
@param {Object} value The new value of the key. May be null.
|
|
1518
|
+
@returns {SC.Observable}
|
|
1519
|
+
*/
|
|
1520
|
+
notifyPropertyChange: function (key, value) {
|
|
1521
|
+
this.propertyWillChange(key);
|
|
1522
|
+
this.propertyDidChange(key, value);
|
|
1523
|
+
return this;
|
|
1524
|
+
},
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
Notifies observers of all possible property changes.
|
|
1528
|
+
|
|
1529
|
+
Sometimes when you make a major update to your object, it is cheaper to
|
|
1530
|
+
simply notify all observers that their property might have changed than
|
|
1531
|
+
to figure out specifically which properties actually did change.
|
|
1532
|
+
|
|
1533
|
+
In those cases, you can simply call this method to notify all property
|
|
1534
|
+
observers immediately. Note that this ignores property groups.
|
|
1535
|
+
|
|
1536
|
+
@returns {SC.Observable}
|
|
1537
|
+
*/
|
|
1538
|
+
allPropertiesDidChange: function () {
|
|
1539
|
+
this._kvo_cache = null; //clear cached props
|
|
1540
|
+
this._notifyPropertyObservers('*');
|
|
1541
|
+
return this;
|
|
1542
|
+
},
|
|
1543
|
+
|
|
1544
|
+
/**
|
|
1545
|
+
Allows you to inspect a property for changes. Whenever the named property
|
|
1546
|
+
changes, a log will be printed to the console. This (along with removeProbe)
|
|
1547
|
+
are convenience methods meant for debugging purposes.
|
|
1548
|
+
|
|
1549
|
+
@param {String} key The name of the property you want probed for changes
|
|
1550
|
+
*/
|
|
1551
|
+
addProbe: function (key) { this.addObserver(key, SC.logChange); },
|
|
1552
|
+
|
|
1553
|
+
/**
|
|
1554
|
+
Stops a running probe from observing changes to the observer.
|
|
1555
|
+
|
|
1556
|
+
@param {String} key The name of the property you want probed for changes
|
|
1557
|
+
*/
|
|
1558
|
+
removeProbe: function (key) { this.removeObserver(key, SC.logChange); },
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
Logs the named properties to the SC.Logger.
|
|
1562
|
+
|
|
1563
|
+
@param {String...} propertyNames one or more property names
|
|
1564
|
+
*/
|
|
1565
|
+
logProperty: function () {
|
|
1566
|
+
var props = SC.$A(arguments),
|
|
1567
|
+
prop, propsLen, idx;
|
|
1568
|
+
for (idx = 0, propsLen = props.length; idx < propsLen; idx++) {
|
|
1569
|
+
prop = props[idx];
|
|
1570
|
+
SC.Logger.log('%@:%@: '.fmt(SC.guidFor(this), prop), this.get(prop));
|
|
1571
|
+
}
|
|
1572
|
+
},
|
|
1573
|
+
|
|
1574
|
+
propertyRevision: 1
|
|
1575
|
+
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
/** @private used by addProbe/removeProbe */
|
|
1579
|
+
SC.logChange = function logChange(target, key, value) {
|
|
1580
|
+
SC.Logger.log("CHANGE: %@[%@] => %@".fmt(target, key, target.get(key)));
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
/**
|
|
1584
|
+
Retrieves a property from an object, using get() if the
|
|
1585
|
+
object implements SC.Observable.
|
|
1586
|
+
|
|
1587
|
+
@param {Object} object the object to query
|
|
1588
|
+
@param {String} key the property to retrieve
|
|
1589
|
+
*/
|
|
1590
|
+
SC.mixin(SC, {
|
|
1591
|
+
get: function (object, key) {
|
|
1592
|
+
if (!object) return undefined;
|
|
1593
|
+
if (key === undefined) return this[object];
|
|
1594
|
+
if (object.get) return object.get(key);
|
|
1595
|
+
return object[key];
|
|
1596
|
+
},
|
|
1597
|
+
|
|
1598
|
+
/**
|
|
1599
|
+
Retrieves a property from an object at a specified path, using get() if
|
|
1600
|
+
the object implements SC.Observable.
|
|
1540
1601
|
|
|
1541
1602
|
@param {Object} object the object to query
|
|
1542
|
-
@param {String}
|
|
1603
|
+
@param {String} path the path to the property to retrieve
|
|
1543
1604
|
*/
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
if (object.get) return object.get(key);
|
|
1549
|
-
return object[key];
|
|
1550
|
-
},
|
|
1551
|
-
|
|
1552
|
-
/**
|
|
1553
|
-
Retrieves a property from an object at a specified path, using get() if
|
|
1554
|
-
the object implements SC.Observable.
|
|
1555
|
-
|
|
1556
|
-
@param {Object} object the object to query
|
|
1557
|
-
@param {String} path the path to the property to retrieve
|
|
1558
|
-
*/
|
|
1559
|
-
getPath: function(object, path) {
|
|
1560
|
-
if (path === undefined) {
|
|
1561
|
-
path = object;
|
|
1562
|
-
object = window;
|
|
1563
|
-
}
|
|
1564
|
-
return SC.objectForPropertyPath(path, object);
|
|
1605
|
+
getPath: function (object, path) {
|
|
1606
|
+
if (path === undefined) {
|
|
1607
|
+
path = object;
|
|
1608
|
+
object = window;
|
|
1565
1609
|
}
|
|
1566
|
-
|
|
1610
|
+
return SC.objectForPropertyPath(path, object);
|
|
1611
|
+
}
|
|
1612
|
+
});
|
|
1567
1613
|
|
|
1568
|
-
|
|
1569
|
-
|
|
1614
|
+
// Make all Array's observable
|
|
1615
|
+
SC.mixin(Array.prototype, SC.Observable);
|