sproutcore 1.5.0.pre.3 → 1.5.0.pre.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.rspec +1 -0
- data/CHANGELOG +42 -0
- data/README.txt +25 -0
- data/VERSION.yml +1 -1
- data/bin/sc-build +1 -1
- data/bin/sc-build-number +1 -1
- data/bin/sc-docs +1 -1
- data/bin/sc-gen +1 -1
- data/bin/sc-init +1 -1
- data/bin/sc-manifest +1 -1
- data/bin/sc-server +1 -1
- data/bin/sproutcore +1 -1
- data/lib/buildtasks/build.rake +5 -0
- data/lib/buildtasks/manifest.rake +20 -1
- data/lib/frameworks/sproutcore/Buildfile +12 -9
- data/lib/frameworks/sproutcore/CHANGELOG.md +48 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/README +2 -9
- data/lib/frameworks/sproutcore/apps/greenhouse/TODO +11 -27
- data/lib/frameworks/sproutcore/apps/greenhouse/controllers/library.js +3 -10
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/css/main-page.css +4 -31
- data/lib/frameworks/sproutcore/apps/greenhouse/english.lproj/dialogs.js +5 -4
- data/lib/frameworks/sproutcore/apps/greenhouse/models/dir.js +3 -3
- data/lib/frameworks/sproutcore/apps/greenhouse/models/file.js +2 -2
- data/lib/frameworks/sproutcore/apps/greenhouse/states/main.js +31 -14
- data/lib/frameworks/sproutcore/apps/greenhouse/states/modals.js +2 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/states/ready.js +27 -1
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/list_item.js +1 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/tests/views/plist_item.js +20 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/theme.js +25 -0
- data/lib/frameworks/sproutcore/apps/greenhouse/views/plist_item.js +161 -24
- data/lib/frameworks/sproutcore/apps/greenhouse/views/tear_off_picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +37 -25
- data/lib/frameworks/sproutcore/frameworks/bootstrap/tests/system/browser.js +135 -26
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/controller.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/controllers/object.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/core.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/object.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/ext/run_loop.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/selection_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +68 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/layout.js +108 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/main.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/manipulation.js +27 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/panes/pane.js +215 -505
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/visibility.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/observable_protocol.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/protocols/sparse_array_delegate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/core.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/resources/view.css +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/application.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/browser.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/core_query.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/cursor.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/device.js +210 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/event.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/page.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/platform.js +31 -5
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/ready.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/render_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/root_responder.js +83 -110
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/selection_set.js +7 -4
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/timer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/array_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/enum_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/null_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/selection_support.js +26 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/array/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/empty_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/multiple_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/controllers/object/single_enumerable_case.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/responder_context.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/mixins/string.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/builder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/core_query/within.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/json.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/locale.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/begin.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/element.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/end.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/get.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_attr.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_basic.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_className.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/helpers_style.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/join.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/push_text.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/tag.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/render_context/update.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeKeyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMainPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/makeMenuPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/root_responder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/root_responder/targetForAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/add.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/copy.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/indexSetForSource.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/isEqual.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/selection_set/remove.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/sparse_array.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invalidate.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/invokeLater.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/isPaused.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/performAction.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/timer/schedule.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/normalizeURL.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/utils/offset.js +268 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/system/utils/rect.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/main_pane.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/append_remove.js +107 -18
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/pane/child_view.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/firstResponder.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/keyPane.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/layout.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/pane/sendEvent.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/checkbox_support.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/text_field_support.js +73 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/collection.js +65 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/core.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template_view/handlebars.js +295 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/animation.js +19 -18
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/build_children.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/clippingFrame.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertFrames.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/convertLayouts.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createChildViews.js +18 -15
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/createLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/destroyLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/didAppendToDocument.js +11 -8
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/findLayerInParentLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/init.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/insertBefore.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisible.js +28 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/isVisibleInWindow.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +22 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/layoutChildViews.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutDidChange.js +180 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +640 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/parentViewDidChange.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/prepareContext.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/removeChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/render.js +125 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/render_delegate_support.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/replaceChild.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/static_layout.js +21 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/theme.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayer.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/updateLayerLocation.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/view.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/{amber → core_foundation}/tests/views/view/viewDidResize.js +0 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/checkbox_support.js +20 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/collection.js +99 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template/text_field_support.js +35 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +77 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/animation.js +187 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/base.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/cursor.js +41 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/enabled.js +57 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +223 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +1150 -0
- data/lib/frameworks/sproutcore/frameworks/{amber/views → core_foundation/views/view}/layout_style.js +93 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +489 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +362 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/touch.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/visibility.js +113 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +1280 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +27 -53
- data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +13 -19
- data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +183 -71
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +26 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +25 -4
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +139 -21
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/fixtures.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/integration/cyclical_relationship.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/{parentless.js → data_store.js} +62 -16
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +51 -17
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array.js +36 -10
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +11 -11
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/normalize.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/{foundation/english.lproj → datetime/resources}/strings.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/system/datetime.js +5 -37
- data/lib/frameworks/sproutcore/frameworks/{foundation → datetime}/tests/system/datetime.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/debug/core.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/designer/controllers/designs.js +1 -2
- data/lib/frameworks/sproutcore/frameworks/designer/designers/object_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/designers/view_designer.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/designer/views/designer_drop_target.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/english.lproj/segmented.css +71 -70
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +4 -19
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +33 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/methods.js +25 -103
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/segmented/ui.js +102 -92
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/tab/ui.js +22 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +38 -25
- data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +42 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +513 -230
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/experimental/README.md +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/README.md +11 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/device.js +215 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/device_motion/platform.js +67 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +34 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/polymorphic_single_attribute.js +183 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +23 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/tests/models/polymorphic/single.js +124 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +0 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +151 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +27 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/system/image_queue.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/system/logger.js +163 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/user_defaults.js +6 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +1 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/system/logger.js +44 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/image/ui.js +200 -167
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/views/image.js +52 -137
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +7 -11
- data/lib/frameworks/sproutcore/frameworks/handlebars/extensions.js +138 -0
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1338 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +32 -26
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/base.js +162 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +10 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +123 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/private/chain_observer.js +50 -13
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +163 -333
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +58 -8
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +9 -6
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/makeArray.js +15 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/chained.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +18 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/logger.js +31 -143
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/concatenated_properties.js +71 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +177 -0
- data/lib/frameworks/sproutcore/frameworks/table/views/table.js +5 -4
- data/lib/frameworks/sproutcore/frameworks/table/views/table_header.js +5 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/button/button.js +8 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +2 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/18px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/24px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/30px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/44px/segmented.css +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/segmented/segmented.css +2 -2
- data/lib/frameworks/sproutcore/themes/standard_theme/english.lproj/segmented.css +62 -62
- data/lib/gen/html_app/Buildfile +36 -0
- data/lib/gen/html_app/README +1 -0
- data/lib/gen/html_app/USAGE +15 -0
- data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +14 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/images/.gitkeep +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/stylesheets/@target_name@.css +0 -0
- data/lib/gen/html_app/templates/apps/@target_name@/resources/templates/@target_name@.handlebars +1 -0
- data/lib/gen/html_project/Buildfile +45 -0
- data/lib/gen/html_project/INIT +3 -0
- data/lib/gen/html_project/README +1 -0
- data/lib/gen/html_project/USAGE +2 -0
- data/lib/gen/html_project/templates/@filename@/Buildfile +8 -0
- data/lib/gen/html_project/templates/@filename@/README +7 -0
- data/lib/sproutcore/builders/handlebars.rb +30 -0
- data/lib/sproutcore/builders.rb +1 -1
- data/lib/sproutcore/helpers/static_helper.rb +3 -3
- data/lib/sproutcore/tools/init.rb +25 -9
- data/spec/buildtasks/manifest/prepare_build_tasks/handlebars_spec.rb +39 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/template.handlebars +5 -0
- data/spec/fixtures/real_world/frameworks/sproutcore/english.lproj/templates/demo.handlebars +4 -0
- data/spec/lib/builders/handlebars_spec.rb +29 -0
- data/vendor/chance/lib/chance/imagers/data_url.rb +20 -7
- data/vendor/chance/lib/chance/instance.rb +4 -1
- data/vendor/chance/lib/chance/parser.rb +31 -31
- data/vendor/chance/lib/chance/slicing.rb +38 -8
- metadata +195 -225
- data/lib/frameworks/sproutcore/frameworks/amber/system/device.js +0 -143
- data/lib/frameworks/sproutcore/frameworks/amber/system/utils.js +0 -174
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/main_pane.js +0 -31
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/pane/sendTouchEvent.js +0 -267
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutDidChange.js +0 -149
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/layoutStyle.js +0 -602
- data/lib/frameworks/sproutcore/frameworks/amber/tests/views/view/render.js +0 -115
- data/lib/frameworks/sproutcore/frameworks/amber/views/base.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/amber/views/view.js +0 -4003
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +0 -105
|
@@ -8,78 +8,78 @@
|
|
|
8
8
|
sc_require('views/view');
|
|
9
9
|
sc_require('mixins/responder_context');
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
Indicates a value has a mixed state of both on and off.
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
Indicates a value has a mixed state of both on and off.
|
|
13
|
+
|
|
14
14
|
@property {String}
|
|
15
15
|
*/
|
|
16
16
|
SC.MIXED_STATE = '__MIXED__' ;
|
|
17
17
|
|
|
18
18
|
/** @class
|
|
19
|
-
A Pane is like a regular view except that it does not need to live within a
|
|
20
|
-
parent view. You usually use a Pane to form the root of a view hierarchy in
|
|
21
|
-
your application, such as your main application view or for floating
|
|
19
|
+
A Pane is like a regular view except that it does not need to live within a
|
|
20
|
+
parent view. You usually use a Pane to form the root of a view hierarchy in
|
|
21
|
+
your application, such as your main application view or for floating
|
|
22
22
|
palettes, popups, menus, etc.
|
|
23
|
-
|
|
24
|
-
Usually you will not work directly with the SC.Pane class, but with one of
|
|
23
|
+
|
|
24
|
+
Usually you will not work directly with the SC.Pane class, but with one of
|
|
25
25
|
its subclasses such as SC.MainPane, SC.Panel, or SC.PopupPane.
|
|
26
26
|
|
|
27
27
|
h1. Showing a Pane
|
|
28
|
-
|
|
29
|
-
To make a pane visible, you need to add it to your HTML document. The
|
|
28
|
+
|
|
29
|
+
To make a pane visible, you need to add it to your HTML document. The
|
|
30
30
|
simplest way to do this is to call the append() method:
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
{{{
|
|
33
33
|
myPane = SC.Pane.create();
|
|
34
34
|
myPane.append(); // adds the pane to the document
|
|
35
35
|
}}}
|
|
36
|
-
|
|
37
|
-
This will insert your pane into the end of your HTML document body, causing
|
|
38
|
-
it to display on screen. It will also register your pane with the
|
|
39
|
-
SC.RootResponder for the document so you can start to receive keyboard,
|
|
36
|
+
|
|
37
|
+
This will insert your pane into the end of your HTML document body, causing
|
|
38
|
+
it to display on screen. It will also register your pane with the
|
|
39
|
+
SC.RootResponder for the document so you can start to receive keyboard,
|
|
40
40
|
mouse, and touch events.
|
|
41
|
-
|
|
42
|
-
If you need more specific control for where you pane appears in the
|
|
43
|
-
document, you can use several other insertion methods such as appendTo(),
|
|
44
|
-
prependTo(), before() and after(). These methods all take a an element to
|
|
41
|
+
|
|
42
|
+
If you need more specific control for where you pane appears in the
|
|
43
|
+
document, you can use several other insertion methods such as appendTo(),
|
|
44
|
+
prependTo(), before() and after(). These methods all take a an element to
|
|
45
45
|
indicate where in your HTML document you would like you pane to be inserted.
|
|
46
|
-
|
|
47
|
-
Once a pane is inserted into the document, it will be sized and positioned
|
|
48
|
-
according to the layout you have specified. It will then automatically
|
|
49
|
-
resize with the window if needed, relaying resize notifications to children
|
|
46
|
+
|
|
47
|
+
Once a pane is inserted into the document, it will be sized and positioned
|
|
48
|
+
according to the layout you have specified. It will then automatically
|
|
49
|
+
resize with the window if needed, relaying resize notifications to children
|
|
50
50
|
as well.
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
h1. Hiding a Pane
|
|
53
|
-
|
|
54
|
-
When you are finished with a pane, you can hide the pane by calling the
|
|
55
|
-
remove() method. This method will actually remove the Pane from the
|
|
56
|
-
document body, as well as deregistering it from the RootResponder so that it
|
|
53
|
+
|
|
54
|
+
When you are finished with a pane, you can hide the pane by calling the
|
|
55
|
+
remove() method. This method will actually remove the Pane from the
|
|
56
|
+
document body, as well as deregistering it from the RootResponder so that it
|
|
57
57
|
no longer receives events.
|
|
58
|
-
|
|
59
|
-
The isVisibleInWindow method will also change to NO for the Pane and all of
|
|
60
|
-
its childViews and the views will no longer have their updateDisplay methods
|
|
61
|
-
called.
|
|
62
|
-
|
|
63
|
-
You can readd a pane to the document again any time in the future by using
|
|
58
|
+
|
|
59
|
+
The isVisibleInWindow method will also change to NO for the Pane and all of
|
|
60
|
+
its childViews and the views will no longer have their updateDisplay methods
|
|
61
|
+
called.
|
|
62
|
+
|
|
63
|
+
You can readd a pane to the document again any time in the future by using
|
|
64
64
|
any of the insertion methods defined in the previous section.
|
|
65
|
-
|
|
65
|
+
|
|
66
66
|
h1. Receiving Events
|
|
67
|
-
|
|
68
|
-
Your pane and its child views will automatically receive any mouse or touch
|
|
69
|
-
events as long as it is on the screen. To receive keyboard events, however,
|
|
70
|
-
you must focus the keyboard on your pane by calling makeKeyPane() on the
|
|
71
|
-
pane itself. This will cause the RootResponder to route keyboard events to
|
|
72
|
-
your pane. The pane, in turn, will route those events to its current
|
|
67
|
+
|
|
68
|
+
Your pane and its child views will automatically receive any mouse or touch
|
|
69
|
+
events as long as it is on the screen. To receive keyboard events, however,
|
|
70
|
+
you must focus the keyboard on your pane by calling makeKeyPane() on the
|
|
71
|
+
pane itself. This will cause the RootResponder to route keyboard events to
|
|
72
|
+
your pane. The pane, in turn, will route those events to its current
|
|
73
73
|
keyView, if there is any.
|
|
74
|
-
|
|
75
|
-
Note that all SC.Views (anything that implements SC.ClassicResponder,
|
|
76
|
-
really) will be notified when it is about or gain or lose keyboard focus.
|
|
77
|
-
These notifications are sent both when the view is made keyView of a
|
|
78
|
-
particular pane and when the pane is made keyPane for the entire
|
|
74
|
+
|
|
75
|
+
Note that all SC.Views (anything that implements SC.ClassicResponder,
|
|
76
|
+
really) will be notified when it is about or gain or lose keyboard focus.
|
|
77
|
+
These notifications are sent both when the view is made keyView of a
|
|
78
|
+
particular pane and when the pane is made keyPane for the entire
|
|
79
79
|
application.
|
|
80
|
-
|
|
81
|
-
You can prevent your Pane from becoming key by setting the acceptsKeyPane
|
|
82
|
-
to NO on the pane. This is useful when creating palettes and other popups
|
|
80
|
+
|
|
81
|
+
You can prevent your Pane from becoming key by setting the acceptsKeyPane
|
|
82
|
+
to NO on the pane. This is useful when creating palettes and other popups
|
|
83
83
|
that should not steal keyboard control from another view.
|
|
84
84
|
|
|
85
85
|
@extends SC.View
|
|
@@ -89,134 +89,36 @@ SC.MIXED_STATE = '__MIXED__' ;
|
|
|
89
89
|
SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
90
90
|
/** @scope SC.Pane.prototype */ {
|
|
91
91
|
|
|
92
|
-
/**
|
|
93
|
-
Returns YES for easy detection of when you reached the pane.
|
|
92
|
+
/**
|
|
93
|
+
Returns YES for easy detection of when you reached the pane.
|
|
94
94
|
@property {Boolean}
|
|
95
95
|
*/
|
|
96
96
|
isPane: YES,
|
|
97
|
-
|
|
98
|
-
/**
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
99
|
Set to the current page when the pane is instantiated from a page object.
|
|
100
100
|
@property {SC.Page}
|
|
101
101
|
*/
|
|
102
102
|
page: null,
|
|
103
|
-
|
|
103
|
+
|
|
104
104
|
// .......................................................
|
|
105
105
|
// ROOT RESPONDER SUPPORT
|
|
106
106
|
//
|
|
107
107
|
|
|
108
108
|
/**
|
|
109
|
-
The rootResponder for this pane. Whenever you add a pane to a document,
|
|
110
|
-
this property will be set to the rootResponder that is now forwarding
|
|
109
|
+
The rootResponder for this pane. Whenever you add a pane to a document,
|
|
110
|
+
this property will be set to the rootResponder that is now forwarding
|
|
111
111
|
events to the pane.
|
|
112
|
-
|
|
113
|
-
@property {SC.Responder}
|
|
114
|
-
*/
|
|
115
|
-
rootResponder: null,
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
Last known window size.
|
|
119
|
-
|
|
120
|
-
@property {Rect}
|
|
121
|
-
*/
|
|
122
|
-
currentWindowSize: null,
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
The parent dimensions are always the last known window size.
|
|
126
|
-
|
|
127
|
-
@returns {Rect} current window size
|
|
128
|
-
*/
|
|
129
|
-
computeParentDimensions: function(frame) {
|
|
130
|
-
if(this.get('designer') && SC.suppressMain) return sc_super();
|
|
131
|
-
|
|
132
|
-
var wframe = this.get('currentWindowSize'),
|
|
133
|
-
wDim = {x: 0, y: 0, width: 1000, height: 1000},
|
|
134
|
-
layout = this.get('layout');
|
|
135
|
-
|
|
136
|
-
if (wframe){
|
|
137
|
-
wDim.width = wframe.width;
|
|
138
|
-
wDim.height = wframe.height;
|
|
139
|
-
}
|
|
140
|
-
// Call the RootResponder instance...
|
|
141
|
-
else if (SC.RootResponder.responder) {
|
|
142
|
-
var wSize = SC.RootResponder.responder.get('currentWindowSize');
|
|
143
|
-
if (wSize){
|
|
144
|
-
wDim.width = wSize.width;
|
|
145
|
-
wDim.height = wSize.height;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
// If all else fails then we need to Calculate it from the window size and DOM
|
|
149
|
-
else {
|
|
150
|
-
var size, body, docElement;
|
|
151
|
-
if(!this._bod || !this._docElement){
|
|
152
|
-
body = document.body;
|
|
153
|
-
docElement = document.documentElement;
|
|
154
|
-
this._body=body;
|
|
155
|
-
this._docElement=docElement;
|
|
156
|
-
}else{
|
|
157
|
-
body = this._body;
|
|
158
|
-
docElement = this._docElement;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (window.innerHeight) {
|
|
162
|
-
wDim.width = window.innerWidth;
|
|
163
|
-
wDim.height = window.innerHeight;
|
|
164
|
-
} else if (docElement && docElement.clientHeight) {
|
|
165
|
-
wDim.width = docElement.clientWidth;
|
|
166
|
-
wDim.height = docElement.clientHeight;
|
|
167
|
-
} else if (body) {
|
|
168
|
-
wDim.width = body.clientWidth;
|
|
169
|
-
wDim.height = body.clientHeight;
|
|
170
|
-
}
|
|
171
|
-
this.windowSizeDidChange(null, wDim);
|
|
172
|
-
}
|
|
173
112
|
|
|
174
|
-
|
|
175
|
-
// If there is a minWidth or minHeight set on the pane, take that
|
|
176
|
-
// into account when calculating dimensions.
|
|
177
|
-
|
|
178
|
-
if (layout.minHeight || layout.minWidth) {
|
|
179
|
-
if (layout.minHeight) {
|
|
180
|
-
wDim.height = Math.max(wDim.height, layout.minHeight);
|
|
181
|
-
}
|
|
182
|
-
if (layout.minWidth) {
|
|
183
|
-
wDim.width = Math.max(wDim.width, layout.minWidth);
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return wDim;
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
/** @private Disable caching due to an known bug in SC. */
|
|
190
|
-
frame: function() {
|
|
191
|
-
if(this.get('designer') && SC.suppressMain) return sc_super();
|
|
192
|
-
return this.computeFrameWithParentFrame(null) ;
|
|
193
|
-
}.property(),
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
Invoked by the root responder whenever the window resizes. This should
|
|
197
|
-
simply begin the process of notifying children that the view size has
|
|
198
|
-
changed, if needed.
|
|
199
|
-
|
|
200
|
-
@param {Rect} oldSize the old window size
|
|
201
|
-
@param {Rect} newSize the new window size
|
|
202
|
-
@returns {SC.Pane} receiver
|
|
113
|
+
@property {SC.Responder}
|
|
203
114
|
*/
|
|
204
|
-
|
|
205
|
-
this.set('currentWindowSize', newSize) ;
|
|
206
|
-
this.parentViewDidResize(); // start notifications.
|
|
207
|
-
return this ;
|
|
208
|
-
},
|
|
115
|
+
rootResponder: null,
|
|
209
116
|
|
|
210
|
-
/** @private */
|
|
211
|
-
paneLayoutDidChange: function() {
|
|
212
|
-
this.invokeOnce(this.updateLayout);
|
|
213
|
-
}.observes('layout'),
|
|
214
|
-
|
|
215
117
|
/**
|
|
216
|
-
Attempts to send the event down the responder chain for this pane. If you
|
|
217
|
-
pass a target, this method will begin with the target and work up the
|
|
218
|
-
responder chain. Otherwise, it will begin with the current rr
|
|
219
|
-
and walk up the chain looking for any responder that implements a handler
|
|
118
|
+
Attempts to send the event down the responder chain for this pane. If you
|
|
119
|
+
pass a target, this method will begin with the target and work up the
|
|
120
|
+
responder chain. Otherwise, it will begin with the current rr
|
|
121
|
+
and walk up the chain looking for any responder that implements a handler
|
|
220
122
|
for the passed method and returns YES when executed.
|
|
221
123
|
|
|
222
124
|
@param {String} action
|
|
@@ -226,7 +128,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
226
128
|
*/
|
|
227
129
|
sendEvent: function(action, evt, target) {
|
|
228
130
|
var handler;
|
|
229
|
-
|
|
131
|
+
|
|
230
132
|
// walk up the responder chain looking for a method to handle the event
|
|
231
133
|
if (!target) target = this.get('firstResponder') ;
|
|
232
134
|
while(target) {
|
|
@@ -238,7 +140,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
238
140
|
target = null;
|
|
239
141
|
break;
|
|
240
142
|
}
|
|
241
|
-
|
|
143
|
+
|
|
242
144
|
// now, only pass along if the target does not already have any touches, or is
|
|
243
145
|
// capable of accepting multitouch.
|
|
244
146
|
if (!target.get("hasTouch") || target.get("acceptsMultitouch")) {
|
|
@@ -251,12 +153,12 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
251
153
|
} else {
|
|
252
154
|
if (target.tryToPerform(action, evt)) break;
|
|
253
155
|
}
|
|
254
|
-
|
|
156
|
+
|
|
255
157
|
// even if someone tries to fill in the nextResponder on the pane, stop
|
|
256
158
|
// searching when we hit the pane.
|
|
257
159
|
target = (target === this) ? null : target.get('nextResponder') ;
|
|
258
160
|
}
|
|
259
|
-
|
|
161
|
+
|
|
260
162
|
// if no handler was found in the responder chain, try the default
|
|
261
163
|
if (!target && (target = this.get('defaultResponder'))) {
|
|
262
164
|
if (typeof target === SC.T_STRING) {
|
|
@@ -276,100 +178,6 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
276
178
|
return evt.mouseHandler || target ;
|
|
277
179
|
},
|
|
278
180
|
|
|
279
|
-
/**
|
|
280
|
-
Attempts to send a touch event down the responder chain for this pane. If
|
|
281
|
-
you pass a target, this method will begin with the target and work up the
|
|
282
|
-
responder chain. Otherwise, it will begin with the current firstResponder
|
|
283
|
-
and walk up the chain looking for any responder that implements a handler
|
|
284
|
-
for the passed method and returns YES or SC.MIXED_STATE when executed.
|
|
285
|
-
|
|
286
|
-
This method differs from the sendEvent method by supporting views that
|
|
287
|
-
return SC.MIXED_STATE. In that case, the event will continue to bubble up
|
|
288
|
-
the chain until the end is reached or another view returns YES.
|
|
289
|
-
|
|
290
|
-
@param {String} action
|
|
291
|
-
@param {SC.Event} evt
|
|
292
|
-
@param {Object} target
|
|
293
|
-
@returns {Array} views an array of views that handled the event
|
|
294
|
-
*/
|
|
295
|
-
sendTouchEvent: function(action, evt, target) {
|
|
296
|
-
var handler, response, exclusive = NO, ret = [] ;
|
|
297
|
-
|
|
298
|
-
// walk up the responder chain looking for a method to handle the event
|
|
299
|
-
if (!target) target = this.get('firstResponder') ;
|
|
300
|
-
while (target) {
|
|
301
|
-
if (target.respondsTo(action)) {
|
|
302
|
-
switch (target[action](evt)) {
|
|
303
|
-
case SC.MIXED_STATE:
|
|
304
|
-
// The view is interested in events but doesn't want exclusive
|
|
305
|
-
// control, so keep it in a list of interested views
|
|
306
|
-
ret.push(target);
|
|
307
|
-
break;
|
|
308
|
-
case YES:
|
|
309
|
-
// The view wants to respond to this event, so we'll stop looking
|
|
310
|
-
// and give it exclusive control
|
|
311
|
-
ret = [target];
|
|
312
|
-
target = null;
|
|
313
|
-
exclusive = YES;
|
|
314
|
-
continue;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// even if someone tries to fill in the nextResponder on the pane, stop
|
|
319
|
-
// searching when we hit the pane.
|
|
320
|
-
target = (target === this) ? null : target.get('nextResponder') ;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// if no handler was found in the responder chain, try the default
|
|
324
|
-
if (!exclusive && (target = this.get('defaultResponder'))) {
|
|
325
|
-
if (typeof target === SC.T_STRING) {
|
|
326
|
-
target = SC.objectForPropertyPath(target);
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
if (target) {
|
|
330
|
-
// Make sure we merge the return arrays instead of clobbering
|
|
331
|
-
// our earlier results
|
|
332
|
-
if (target.isResponderContext) {
|
|
333
|
-
ret = ret.concat(target.sendTouchAction(action, this, evt));
|
|
334
|
-
} else {
|
|
335
|
-
if (target.respondsTo(action)) response = target[action](evt);
|
|
336
|
-
|
|
337
|
-
switch (response) {
|
|
338
|
-
case SC.MIXED_STATE:
|
|
339
|
-
ret.push(target);
|
|
340
|
-
break;
|
|
341
|
-
case YES:
|
|
342
|
-
ret = [target];
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
target = null;
|
|
349
|
-
return ret ;
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
performKeyEquivalent: function(keystring, evt) {
|
|
353
|
-
var ret = sc_super() ; // try normal view behavior first
|
|
354
|
-
if (!ret) {
|
|
355
|
-
var defaultResponder = this.get('defaultResponder') ;
|
|
356
|
-
if (defaultResponder) {
|
|
357
|
-
// try default responder's own performKeyEquivalent method,
|
|
358
|
-
// if it has one...
|
|
359
|
-
if (defaultResponder.performKeyEquivalent) {
|
|
360
|
-
ret = defaultResponder.performKeyEquivalent(keystring, evt) ;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// even if it does have one, if it doesn't handle the event, give
|
|
364
|
-
// methodName-style key equivalent handling a try
|
|
365
|
-
if (!ret && defaultResponder.tryToPerform) {
|
|
366
|
-
ret = defaultResponder.tryToPerform(keystring, evt) ;
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
return ret ;
|
|
371
|
-
},
|
|
372
|
-
|
|
373
181
|
// .......................................................
|
|
374
182
|
// RESPONDER CONTEXT
|
|
375
183
|
//
|
|
@@ -385,34 +193,34 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
385
193
|
}.property().cacheable(),
|
|
386
194
|
|
|
387
195
|
/**
|
|
388
|
-
The first responder. This is the first view that should receive action
|
|
389
|
-
events. Whenever you click on a view, it will usually become
|
|
390
|
-
firstResponder.
|
|
391
|
-
|
|
196
|
+
The first responder. This is the first view that should receive action
|
|
197
|
+
events. Whenever you click on a view, it will usually become
|
|
198
|
+
firstResponder.
|
|
199
|
+
|
|
392
200
|
@property {SC.Responder}
|
|
393
201
|
*/
|
|
394
202
|
firstResponder: null,
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
If YES, this pane can become the key pane. You may want to set this to NO
|
|
398
|
-
for certain types of panes. For example, a palette may never want to
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
If YES, this pane can become the key pane. You may want to set this to NO
|
|
206
|
+
for certain types of panes. For example, a palette may never want to
|
|
399
207
|
become key. The default value is YES.
|
|
400
|
-
|
|
208
|
+
|
|
401
209
|
@property {Boolean}
|
|
402
210
|
*/
|
|
403
211
|
acceptsKeyPane: YES,
|
|
404
|
-
|
|
212
|
+
|
|
405
213
|
/**
|
|
406
|
-
This is set to YES when your pane is currently the target of key events.
|
|
407
|
-
|
|
214
|
+
This is set to YES when your pane is currently the target of key events.
|
|
215
|
+
|
|
408
216
|
@property {Boolean}
|
|
409
217
|
*/
|
|
410
218
|
isKeyPane: NO,
|
|
411
219
|
|
|
412
220
|
/**
|
|
413
|
-
Make the pane receive key events. Until you call this method, the
|
|
414
|
-
keyView set for this pane will not receive key events.
|
|
415
|
-
|
|
221
|
+
Make the pane receive key events. Until you call this method, the
|
|
222
|
+
keyView set for this pane will not receive key events.
|
|
223
|
+
|
|
416
224
|
@returns {SC.Pane} receiver
|
|
417
225
|
*/
|
|
418
226
|
becomeKeyPane: function() {
|
|
@@ -420,11 +228,11 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
420
228
|
if (this.rootResponder) this.rootResponder.makeKeyPane(this) ;
|
|
421
229
|
return this ;
|
|
422
230
|
},
|
|
423
|
-
|
|
231
|
+
|
|
424
232
|
/**
|
|
425
|
-
Remove the pane view status from the pane. This will simply set the
|
|
233
|
+
Remove the pane view status from the pane. This will simply set the
|
|
426
234
|
keyPane on the rootResponder to null.
|
|
427
|
-
|
|
235
|
+
|
|
428
236
|
@returns {SC.Pane} receiver
|
|
429
237
|
*/
|
|
430
238
|
resignKeyPane: function() {
|
|
@@ -432,13 +240,13 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
432
240
|
if (this.rootResponder) this.rootResponder.makeKeyPane(null);
|
|
433
241
|
return this ;
|
|
434
242
|
},
|
|
435
|
-
|
|
243
|
+
|
|
436
244
|
/**
|
|
437
|
-
Makes the passed view (or any object that implements SC.Responder) into
|
|
245
|
+
Makes the passed view (or any object that implements SC.Responder) into
|
|
438
246
|
the new firstResponder for this pane. This will cause the current first
|
|
439
247
|
responder to lose its responder status and possibly keyResponder status as
|
|
440
248
|
well.
|
|
441
|
-
|
|
249
|
+
|
|
442
250
|
@param {SC.View} view
|
|
443
251
|
@param {Event} evt that cause this to become first responder
|
|
444
252
|
@returns {SC.Pane} receiver
|
|
@@ -447,16 +255,16 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
447
255
|
var current=this.get('firstResponder'), isKeyPane=this.get('isKeyPane');
|
|
448
256
|
if (current === view) return this ; // nothing to do
|
|
449
257
|
if (SC.platform.touch && view && view.kindOf(SC.TextFieldView) && !view.get('focused')) return this;
|
|
450
|
-
|
|
258
|
+
|
|
451
259
|
// notify current of firstResponder change
|
|
452
260
|
if (current) current.willLoseFirstResponder(current, evt);
|
|
453
|
-
|
|
261
|
+
|
|
454
262
|
// if we are currently key pane, then notify key views of change also
|
|
455
263
|
if (isKeyPane) {
|
|
456
|
-
if (current) current.willLoseKeyResponderTo
|
|
457
|
-
if (view) view.willBecomeKeyResponderFrom
|
|
264
|
+
if (current) { current.tryToPerform('willLoseKeyResponderTo', view); }
|
|
265
|
+
if (view) { view.tryToPerform('willBecomeKeyResponderFrom', current); }
|
|
458
266
|
}
|
|
459
|
-
|
|
267
|
+
|
|
460
268
|
// change setting
|
|
461
269
|
if (current) {
|
|
462
270
|
current.beginPropertyChanges()
|
|
@@ -465,70 +273,28 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
465
273
|
}
|
|
466
274
|
|
|
467
275
|
this.set('firstResponder', view) ;
|
|
468
|
-
|
|
276
|
+
|
|
469
277
|
if (view) {
|
|
470
278
|
view.beginPropertyChanges()
|
|
471
279
|
.set('isFirstResponder', YES).set('isKeyResponder', isKeyPane)
|
|
472
280
|
.endPropertyChanges();
|
|
473
281
|
}
|
|
474
|
-
|
|
282
|
+
|
|
475
283
|
// and notify again if needed.
|
|
476
284
|
if (isKeyPane) {
|
|
477
|
-
if (view) view.didBecomeKeyResponderFrom
|
|
478
|
-
if (current) current.didLoseKeyResponderTo
|
|
285
|
+
if (view) { view.tryToPerform('didBecomeKeyResponderFrom', current); }
|
|
286
|
+
if (current) { current.tryToPerform('didLoseKeyResponderTo', view); }
|
|
479
287
|
}
|
|
480
|
-
|
|
288
|
+
|
|
481
289
|
if (view) view.didBecomeFirstResponder(view);
|
|
482
290
|
return this ;
|
|
483
291
|
},
|
|
484
292
|
|
|
485
|
-
/** @private
|
|
486
|
-
If the user presses the tab key and the pane does not have a first
|
|
487
|
-
responder, try to give it to the next eligible responder.
|
|
488
|
-
|
|
489
|
-
If the keyDown event reaches the pane, we can assume that no responders in
|
|
490
|
-
the responder chain, nor the default responder, handled the event.
|
|
491
|
-
*/
|
|
492
|
-
keyDown: function(evt) {
|
|
493
|
-
var nextValidKeyView;
|
|
494
|
-
|
|
495
|
-
// Handle tab key presses if we don't have a first responder already
|
|
496
|
-
if ((evt.which === 9 || (SC.browser.mozilla && evt.keyCode ===9)) && !this.get('firstResponder')) {
|
|
497
|
-
// Cycle forwards by default, backwards if the shift key is held
|
|
498
|
-
if (evt.shiftKey) {
|
|
499
|
-
nextValidKeyView = this.get('previousValidKeyView');
|
|
500
|
-
} else {
|
|
501
|
-
nextValidKeyView = this.get('nextValidKeyView');
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
if (nextValidKeyView) {
|
|
505
|
-
this.makeFirstResponder(nextValidKeyView);
|
|
506
|
-
return YES;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
return NO;
|
|
511
|
-
},
|
|
512
|
-
|
|
513
|
-
/** @private method forwards status changes in a generic way. */
|
|
514
|
-
_forwardKeyChange: function(shouldForward, methodName, pane, isKey) {
|
|
515
|
-
var keyView, responder, newKeyView;
|
|
516
|
-
if (shouldForward && (responder = this.get('firstResponder'))) {
|
|
517
|
-
newKeyView = (pane) ? pane.get('firstResponder') : null ;
|
|
518
|
-
keyView = this.get('firstResponder') ;
|
|
519
|
-
if (keyView) keyView[methodName](newKeyView);
|
|
520
|
-
|
|
521
|
-
if ((isKey !== undefined) && responder) {
|
|
522
|
-
responder.set('isKeyResponder', isKey);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
},
|
|
526
|
-
|
|
527
293
|
/**
|
|
528
|
-
Called just before the pane loses it's keyPane status. This will notify
|
|
529
|
-
the current keyView, if there is one, that it is about to lose focus,
|
|
530
|
-
giving it one last opportunity to save its state.
|
|
531
|
-
|
|
294
|
+
Called just before the pane loses it's keyPane status. This will notify
|
|
295
|
+
the current keyView, if there is one, that it is about to lose focus,
|
|
296
|
+
giving it one last opportunity to save its state.
|
|
297
|
+
|
|
532
298
|
@param {SC.Pane} pane
|
|
533
299
|
@returns {SC.Pane} reciever
|
|
534
300
|
*/
|
|
@@ -536,13 +302,13 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
536
302
|
this._forwardKeyChange(this.get('isKeyPane'), 'willLoseKeyResponderTo', pane, NO);
|
|
537
303
|
return this ;
|
|
538
304
|
},
|
|
539
|
-
|
|
305
|
+
|
|
540
306
|
/**
|
|
541
|
-
Called just before the pane becomes keyPane. Notifies the current keyView
|
|
542
|
-
that it is about to gain focus. The keyView can use this opportunity to
|
|
543
|
-
prepare itself, possibly stealing any value it might need to steal from
|
|
307
|
+
Called just before the pane becomes keyPane. Notifies the current keyView
|
|
308
|
+
that it is about to gain focus. The keyView can use this opportunity to
|
|
309
|
+
prepare itself, possibly stealing any value it might need to steal from
|
|
544
310
|
the current key view.
|
|
545
|
-
|
|
311
|
+
|
|
546
312
|
@param {SC.Pane} pane
|
|
547
313
|
@returns {SC.Pane} receiver
|
|
548
314
|
*/
|
|
@@ -553,10 +319,10 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
553
319
|
|
|
554
320
|
|
|
555
321
|
/**
|
|
556
|
-
Called just after the pane has lost its keyPane status. Notifies the
|
|
557
|
-
current keyView of the change. The keyView can use this method to do any
|
|
322
|
+
Called just after the pane has lost its keyPane status. Notifies the
|
|
323
|
+
current keyView of the change. The keyView can use this method to do any
|
|
558
324
|
final cleanup and changes its own display value if needed.
|
|
559
|
-
|
|
325
|
+
|
|
560
326
|
@param {SC.Pane} pane
|
|
561
327
|
@returns {SC.Pane} reciever
|
|
562
328
|
*/
|
|
@@ -566,13 +332,13 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
566
332
|
this._forwardKeyChange(isKeyPane, 'didLoseKeyResponderTo', pane);
|
|
567
333
|
return this ;
|
|
568
334
|
},
|
|
569
|
-
|
|
335
|
+
|
|
570
336
|
/**
|
|
571
|
-
Called just after the keyPane focus has changed to the receiver. Notifies
|
|
572
|
-
the keyView of its new status. The keyView should use this method to
|
|
573
|
-
update its display and actually set focus on itself at the browser level
|
|
337
|
+
Called just after the keyPane focus has changed to the receiver. Notifies
|
|
338
|
+
the keyView of its new status. The keyView should use this method to
|
|
339
|
+
update its display and actually set focus on itself at the browser level
|
|
574
340
|
if needed.
|
|
575
|
-
|
|
341
|
+
|
|
576
342
|
@param {SC.Pane} pane
|
|
577
343
|
@returns {SC.Pane} receiver
|
|
578
344
|
|
|
@@ -583,246 +349,185 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
583
349
|
this._forwardKeyChange(!isKeyPane, 'didBecomeKeyResponderFrom', pane, YES);
|
|
584
350
|
return this ;
|
|
585
351
|
},
|
|
586
|
-
|
|
352
|
+
|
|
587
353
|
// .......................................................
|
|
588
354
|
// MAIN PANE SUPPORT
|
|
589
355
|
//
|
|
590
|
-
|
|
356
|
+
|
|
591
357
|
/**
|
|
592
|
-
Returns YES whenever the pane has been set as the main pane for the
|
|
358
|
+
Returns YES whenever the pane has been set as the main pane for the
|
|
593
359
|
application.
|
|
594
|
-
|
|
360
|
+
|
|
595
361
|
@property {Boolean}
|
|
596
362
|
*/
|
|
597
363
|
isMainPane: NO,
|
|
598
|
-
|
|
364
|
+
|
|
599
365
|
/**
|
|
600
366
|
Invoked when the pane is about to become the focused pane. Override to
|
|
601
367
|
implement your own custom handling.
|
|
602
|
-
|
|
368
|
+
|
|
603
369
|
@param {SC.Pane} pane the pane that currently have focus
|
|
604
370
|
@returns {void}
|
|
605
371
|
*/
|
|
606
372
|
focusFrom: function(pane) {},
|
|
607
|
-
|
|
373
|
+
|
|
608
374
|
/**
|
|
609
|
-
Invoked when the the pane is about to lose its focused pane status.
|
|
375
|
+
Invoked when the the pane is about to lose its focused pane status.
|
|
610
376
|
Override to implement your own custom handling
|
|
611
|
-
|
|
377
|
+
|
|
612
378
|
@param {SC.Pane} pane the pane that will receive focus next
|
|
613
379
|
@returns {void}
|
|
614
380
|
*/
|
|
615
381
|
blurTo: function(pane) {},
|
|
616
|
-
|
|
382
|
+
|
|
617
383
|
/**
|
|
618
|
-
Invoked when the view is about to lose its mainPane status. The default
|
|
619
|
-
implementation will also remove the pane from the document since you can't
|
|
384
|
+
Invoked when the view is about to lose its mainPane status. The default
|
|
385
|
+
implementation will also remove the pane from the document since you can't
|
|
620
386
|
have more than one mainPane in the document at a time.
|
|
621
|
-
|
|
387
|
+
|
|
622
388
|
@param {SC.Pane} pane
|
|
623
389
|
@returns {void}
|
|
624
390
|
*/
|
|
625
391
|
blurMainTo: function(pane) {
|
|
626
392
|
this.set('isMainPane', NO) ;
|
|
627
393
|
},
|
|
628
|
-
|
|
629
|
-
/**
|
|
630
|
-
Invokes when the view is about to become the new mainPane. The default
|
|
631
|
-
implementation simply updates the isMainPane property. In your subclass,
|
|
632
|
-
you should make sure your pane has been added to the document before
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
Invokes when the view is about to become the new mainPane. The default
|
|
397
|
+
implementation simply updates the isMainPane property. In your subclass,
|
|
398
|
+
you should make sure your pane has been added to the document before
|
|
633
399
|
trying to make it the mainPane. See SC.MainPane for more information.
|
|
634
|
-
|
|
400
|
+
|
|
635
401
|
@param {SC.Pane} pane
|
|
636
402
|
@returns {void}
|
|
637
403
|
*/
|
|
638
404
|
focusMainFrom: function(pane) {
|
|
639
405
|
this.set('isMainPane', YES);
|
|
640
406
|
},
|
|
641
|
-
|
|
407
|
+
|
|
642
408
|
// .......................................................
|
|
643
409
|
// ADDING/REMOVE PANES TO SCREEN
|
|
644
|
-
//
|
|
645
|
-
|
|
410
|
+
//
|
|
411
|
+
|
|
646
412
|
/**
|
|
647
|
-
Inserts the pane at the end of the document. This will also add the pane
|
|
413
|
+
Inserts the pane at the end of the document. This will also add the pane
|
|
648
414
|
to the rootResponder.
|
|
649
|
-
|
|
415
|
+
|
|
650
416
|
@param {SC.RootResponder} rootResponder
|
|
651
417
|
@returns {SC.Pane} receiver
|
|
652
418
|
*/
|
|
653
|
-
append: function() {
|
|
419
|
+
append: function() {
|
|
654
420
|
return this.appendTo(document.body) ;
|
|
655
421
|
},
|
|
656
|
-
|
|
422
|
+
|
|
657
423
|
/**
|
|
658
424
|
Removes the pane from the document. This will remove the
|
|
659
425
|
DOM node and deregister you from the document window.
|
|
660
|
-
|
|
426
|
+
|
|
661
427
|
@returns {SC.Pane} receiver
|
|
662
428
|
*/
|
|
663
429
|
remove: function() {
|
|
664
430
|
if (!this.get('isVisibleInWindow')) return this ; // nothing to do
|
|
665
431
|
if (!this.get('isPaneAttached')) return this ; // nothing to do
|
|
666
|
-
|
|
432
|
+
|
|
667
433
|
// remove layer...
|
|
668
434
|
var dom = this.get('layer') ;
|
|
669
435
|
if (dom && dom.parentNode) dom.parentNode.removeChild(dom) ;
|
|
670
436
|
dom = null ;
|
|
671
|
-
|
|
437
|
+
|
|
672
438
|
// remove intercept
|
|
673
439
|
this._removeIntercept();
|
|
674
|
-
|
|
440
|
+
|
|
675
441
|
// resign keyPane status, if we had it
|
|
676
442
|
this.resignKeyPane();
|
|
677
|
-
|
|
443
|
+
|
|
678
444
|
// remove the pane
|
|
679
445
|
var rootResponder = this.rootResponder ;
|
|
680
446
|
if (this.get('isMainPane')) rootResponder.makeMainPane(null) ;
|
|
681
447
|
rootResponder.panes.remove(this) ;
|
|
682
448
|
this.rootResponder = null ;
|
|
683
|
-
|
|
449
|
+
|
|
684
450
|
// clean up some of my own properties
|
|
685
451
|
this.set('isPaneAttached', NO) ;
|
|
686
452
|
this.parentViewDidChange();
|
|
687
453
|
return this ;
|
|
688
454
|
},
|
|
689
|
-
|
|
455
|
+
|
|
690
456
|
/**
|
|
691
|
-
Inserts the pane into the
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
457
|
+
Inserts the current pane into the page. The actual DOM insertion is done
|
|
458
|
+
by a function passed into `insert`, which receives the layer as a
|
|
459
|
+
parameter. This function is responsible for making sure a layer exists,
|
|
460
|
+
is not already attached, and for calling `paneDidAttach` when done.
|
|
461
|
+
|
|
462
|
+
pane = SC.Pane.create();
|
|
463
|
+
pane.insert(function(layer) {
|
|
464
|
+
jQuery(layer).insertBefore("#otherElement");
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
@param {Function} fn function which performs the actual DOM manipulation
|
|
468
|
+
necessary in order to insert the pane's layer into the DOM.
|
|
698
469
|
@returns {SC.Pane} receiver
|
|
699
|
-
|
|
700
|
-
|
|
470
|
+
*/
|
|
471
|
+
insert: function(fn) {
|
|
701
472
|
var layer = this.get('layer');
|
|
702
|
-
if (!layer) layer =this.createLayer().get('layer');
|
|
703
|
-
|
|
704
|
-
if (this.get('isPaneAttached') && (layer.parentNode === elem)) {
|
|
705
|
-
return this; // nothing to do
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
elem.insertBefore(layer, null); // add to DOM
|
|
709
|
-
elem = layer = null ;
|
|
473
|
+
if (!layer) { layer = this.createLayer().get('layer'); }
|
|
710
474
|
|
|
711
|
-
|
|
475
|
+
fn(layer);
|
|
476
|
+
if (!this.get('isPaneAttached')) { this.paneDidAttach(); }
|
|
477
|
+
return this;
|
|
712
478
|
},
|
|
713
479
|
|
|
714
|
-
/**
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
@param {DOMElement} elem the element to append to
|
|
718
|
-
@returns {SC.Pane} receiver
|
|
719
|
-
*/
|
|
720
|
-
prependTo: function(elem) {
|
|
721
|
-
if (this.get('isPaneAttached')) return this;
|
|
722
|
-
|
|
723
|
-
var layer = this.get('layer');
|
|
724
|
-
if (!layer) layer =this.createLayer().get('layer');
|
|
725
|
-
|
|
726
|
-
if (this.get('isPaneAttached') && (layer.parentNode === elem)) {
|
|
727
|
-
return this; // nothing to do
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
elem.insertBefore(layer, elem.firstChild); // add to DOM
|
|
731
|
-
elem = layer = null ;
|
|
732
|
-
|
|
733
|
-
return this.paneDidAttach(); // do the rest of the setup
|
|
734
|
-
},
|
|
480
|
+
/**
|
|
481
|
+
Inserts the pane into the DOM.
|
|
735
482
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
element.
|
|
739
|
-
|
|
740
|
-
@param {DOMElement} elem the element to append to
|
|
483
|
+
@param {DOMElement|jQuery|String} elem the element to append the pane's layer to.
|
|
484
|
+
This is passed to `jQuery()`, so any value supported by `jQuery()` will work.
|
|
741
485
|
@returns {SC.Pane} receiver
|
|
742
486
|
*/
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
if (!layer) layer =this.createLayer().get('layer');
|
|
748
|
-
|
|
749
|
-
var parent = elem.parentNode ;
|
|
750
|
-
|
|
751
|
-
if (this.get('isPaneAttached') && (layer.parentNode === parent)) {
|
|
752
|
-
return this; // nothing to do
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
parent.insertBefore(layer, elem); // add to DOM
|
|
756
|
-
parent = elem = layer = null ;
|
|
757
|
-
|
|
758
|
-
return this.paneDidAttach(); // do the rest of the setup
|
|
487
|
+
appendTo: function(elem) {
|
|
488
|
+
return this.insert(function(layer) {
|
|
489
|
+
jQuery(elem).append(layer);
|
|
490
|
+
});
|
|
759
491
|
},
|
|
760
492
|
|
|
761
|
-
/**
|
|
762
|
-
inserts the pane's rootElement into the hierarchy after the passed
|
|
763
|
-
element.
|
|
764
|
-
|
|
765
|
-
@param {DOMElement} elem the element to append to
|
|
766
|
-
@returns {SC.Pane} receiver
|
|
767
|
-
*/
|
|
768
|
-
after: function(elem) {
|
|
769
|
-
|
|
770
|
-
var layer = this.get('layer');
|
|
771
|
-
if (!layer) layer =this.createLayer().get('layer');
|
|
772
|
-
|
|
773
|
-
var parent = elem.parentNode ;
|
|
774
|
-
|
|
775
|
-
if (this.get('isPaneAttached') && (layer.parentNode === parent)) {
|
|
776
|
-
return this; // nothing to do
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
parent.insertBefore(layer, elem.nextSibling); // add to DOM
|
|
780
|
-
parent = elem = layer = null ;
|
|
781
|
-
|
|
782
|
-
return this.paneDidAttach(); // do the rest of the setup
|
|
783
|
-
},
|
|
784
|
-
|
|
785
|
-
/**
|
|
786
|
-
This method has no effect in the pane. Instead use remove().
|
|
787
|
-
|
|
788
|
-
@returns {void}
|
|
789
|
-
*/
|
|
790
|
-
removeFromParent: function() { },
|
|
791
|
-
|
|
792
493
|
/** @private
|
|
793
|
-
Called when the pane is attached to a DOM element in a window, this will
|
|
794
|
-
change the view status to be visible in the window and also register
|
|
494
|
+
Called when the pane is attached to a DOM element in a window, this will
|
|
495
|
+
change the view status to be visible in the window and also register
|
|
795
496
|
with the rootResponder.
|
|
796
497
|
*/
|
|
797
498
|
paneDidAttach: function() {
|
|
798
|
-
|
|
799
499
|
// hook into root responder
|
|
800
500
|
var responder = (this.rootResponder = SC.RootResponder.responder);
|
|
801
501
|
responder.panes.add(this);
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
this.parentViewDidChange() ;
|
|
809
|
-
|
|
810
|
-
//notify that the layers have been appended to the document
|
|
502
|
+
|
|
503
|
+
this.set('isPaneAttached', YES);
|
|
504
|
+
|
|
505
|
+
this.recomputeDependentProperties();
|
|
506
|
+
|
|
507
|
+
// notify that the layers have been appended to the document
|
|
811
508
|
this._notifyDidAppendToDocument();
|
|
812
|
-
|
|
509
|
+
|
|
813
510
|
// handle intercept if needed
|
|
814
511
|
this._addIntercept();
|
|
815
512
|
return this ;
|
|
816
513
|
},
|
|
817
|
-
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
This method is called after the pane is attached and before child views
|
|
517
|
+
are notified that they were appended to the document. Override this
|
|
518
|
+
method to recompute properties that depend on the pane's existence
|
|
519
|
+
in the DOM but must be run prior to child view notification.
|
|
520
|
+
*/
|
|
521
|
+
recomputeDependentProperties: function() {},
|
|
522
|
+
|
|
818
523
|
/**
|
|
819
524
|
YES when the pane is currently attached to a document DOM. Read only.
|
|
820
|
-
|
|
525
|
+
|
|
821
526
|
@property {Boolean}
|
|
822
527
|
@readOnly
|
|
823
528
|
*/
|
|
824
529
|
isPaneAttached: NO,
|
|
825
|
-
|
|
530
|
+
|
|
826
531
|
/**
|
|
827
532
|
If YES, a touch intercept pane will be added above this pane when on
|
|
828
533
|
touch platforms.
|
|
@@ -841,7 +546,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
841
546
|
TODO: ALLOW THIS TO AUTOMATICALLY SET THE Z-INDEX OF THE PANE (as an option).
|
|
842
547
|
*/
|
|
843
548
|
zIndex: 0,
|
|
844
|
-
|
|
549
|
+
|
|
845
550
|
/**
|
|
846
551
|
The amount over the pane's z-index that the touch intercept should be.
|
|
847
552
|
*/
|
|
@@ -864,49 +569,54 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
864
569
|
document.body.appendChild(div);
|
|
865
570
|
}
|
|
866
571
|
},
|
|
867
|
-
|
|
572
|
+
|
|
868
573
|
_removeIntercept: function() {
|
|
869
574
|
if (this._touchIntercept) {
|
|
870
575
|
document.body.removeChild(this._touchIntercept);
|
|
871
576
|
this._touchIntercept = null;
|
|
872
577
|
}
|
|
873
578
|
},
|
|
874
|
-
|
|
579
|
+
|
|
875
580
|
hideTouchIntercept: function() {
|
|
876
581
|
if (this._touchIntercept) this._touchIntercept.style.display = "none";
|
|
877
582
|
},
|
|
878
|
-
|
|
583
|
+
|
|
879
584
|
showTouchIntercept: function() {
|
|
880
585
|
if (this._touchIntercept) this._touchIntercept.style.display = "block";
|
|
881
586
|
},
|
|
882
587
|
|
|
883
588
|
/**
|
|
884
|
-
Updates the isVisibleInWindow state on the pane and its childViews if
|
|
589
|
+
Updates the isVisibleInWindow state on the pane and its childViews if
|
|
885
590
|
necessary. This works much like SC.View's default implementation, but it
|
|
886
591
|
does not need a parentView to function.
|
|
887
|
-
|
|
592
|
+
|
|
888
593
|
@returns {SC.Pane} receiver
|
|
889
594
|
*/
|
|
890
595
|
recomputeIsVisibleInWindow: function() {
|
|
891
596
|
if (this.get('designer') && SC.suppressMain) return sc_super();
|
|
892
597
|
var previous = this.get('isVisibleInWindow'),
|
|
893
|
-
current = this.get('isVisible') && this.get(
|
|
598
|
+
current = this.get('isVisible') && this.get('isPaneAttached');
|
|
894
599
|
|
|
895
600
|
// If our visibility has changed, then set the new value and notify our
|
|
896
601
|
// child views to update their value.
|
|
897
602
|
if (previous !== current) {
|
|
898
603
|
this.set('isVisibleInWindow', current);
|
|
899
|
-
|
|
900
|
-
var childViews = this.get('childViews'), len = childViews.length, idx;
|
|
604
|
+
|
|
605
|
+
var childViews = this.get('childViews'), len = childViews.length, idx, view;
|
|
901
606
|
for(idx=0;idx<len;idx++) {
|
|
902
|
-
childViews[idx]
|
|
607
|
+
view = childViews[idx];
|
|
608
|
+
if (view.recomputeIsVisibleInWindow) {
|
|
609
|
+
view.recomputeIsVisibleInWindow(current);
|
|
610
|
+
}
|
|
903
611
|
}
|
|
904
612
|
|
|
905
613
|
|
|
906
614
|
// For historical reasons, we'll also layout the child views if
|
|
907
615
|
// necessary.
|
|
908
616
|
if (current) {
|
|
909
|
-
if (this.get('childViewsNeedLayout'))
|
|
617
|
+
if (this.get('childViewsNeedLayout')) {
|
|
618
|
+
this.invokeOnce(this.layoutChildViewsIfNeeded);
|
|
619
|
+
}
|
|
910
620
|
}
|
|
911
621
|
else {
|
|
912
622
|
// Also, if we were previously visible and were the key pane, resign
|
|
@@ -914,7 +624,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
914
624
|
// observer or some such helper method because this work is not
|
|
915
625
|
// strictly related to computing the visibility, but view performance
|
|
916
626
|
// is critical, so avoiding the extra observer is worthwhile.
|
|
917
|
-
if (this.get('isKeyPane')) this.resignKeyPane();
|
|
627
|
+
if (this.get('isKeyPane')) { this.resignKeyPane(); }
|
|
918
628
|
}
|
|
919
629
|
}
|
|
920
630
|
|
|
@@ -931,13 +641,13 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
931
641
|
|
|
932
642
|
return this;
|
|
933
643
|
},
|
|
934
|
-
|
|
644
|
+
|
|
935
645
|
/** @private */
|
|
936
646
|
updateLayerLocation: function() {
|
|
937
647
|
if(this.get('designer') && SC.suppressMain) return sc_super();
|
|
938
|
-
// note: the normal code here to update node location is removed
|
|
648
|
+
// note: the normal code here to update node location is removed
|
|
939
649
|
// because we don't need it for panes.
|
|
940
|
-
return this ;
|
|
650
|
+
return this ;
|
|
941
651
|
},
|
|
942
652
|
|
|
943
653
|
/** @private */
|
|
@@ -948,7 +658,7 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
948
658
|
this.hasTouchIntercept = SC.platform.touch;
|
|
949
659
|
}
|
|
950
660
|
|
|
951
|
-
// if a layer was set manually then we will just attach to existing
|
|
661
|
+
// if a layer was set manually then we will just attach to existing
|
|
952
662
|
// HTML.
|
|
953
663
|
var hasLayer = !!this.get('layer') ;
|
|
954
664
|
sc_super() ;
|
|
@@ -957,6 +667,6 @@ SC.Pane = SC.View.extend(SC.ResponderContext,
|
|
|
957
667
|
|
|
958
668
|
/** @private */
|
|
959
669
|
classNames: 'sc-pane'.w()
|
|
960
|
-
|
|
670
|
+
|
|
961
671
|
}) ;
|
|
962
672
|
|