sproutcore 1.6.0.rc.2-x86-mingw32 → 1.6.0.1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +12 -0
- data/VERSION.yml +1 -1
- data/bin/sc-docs +6 -1
- data/lib/buildtasks/target.rake +1 -1
- data/lib/frameworks/sproutcore/Buildfile +5 -1
- data/lib/frameworks/sproutcore/CHANGELOG.md +175 -1
- data/lib/frameworks/sproutcore/apps/test_controls/controllers/select.js +12 -0
- data/lib/frameworks/sproutcore/apps/test_controls/resources/select_page.js +19 -5
- data/lib/frameworks/sproutcore/frameworks/ajax/system/request.js +28 -31
- data/lib/frameworks/sproutcore/frameworks/ajax/system/response.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/controller.js +21 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/responder_context.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/checkbox_support.js +6 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +26 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/keyboard.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +12 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/template.js +25 -9
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +157 -5
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/render_context.js +7 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/root_responder.js +9 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +8 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/string.js +104 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/theme.js +3 -56
- data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/content_destroyed.js +59 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/string.js +41 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/mixins/template_helpers/text_field_support.js +10 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/panes/template.js +16 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +11 -0
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/didAppendToDocument.js +18 -2
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/insertBefore.js +10 -6
- data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/keyboard.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +9 -1
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view.js +9 -4
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/keyboard.js +15 -3
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/manipulation.js +14 -8
- data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/theming.js +8 -18
- data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/datastore/mixins/relationship_support.js +296 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/models/child_record.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +330 -326
- data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +22 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +614 -614
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/data_sources/data_source.js +14 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_array_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/nested_records/nested_record_complex.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record/core_methods.js +20 -13
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/models/record_attribute.js +61 -46
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/nested_store/commitChangesFromNestedStore.js +30 -30
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/commitChangesFromNestedStore.js +24 -24
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/connectDataSource.js +31 -0
- data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/store/pushRelationships.js +1177 -0
- data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +4 -63
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +7 -8
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +18 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/checkbox.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/collection.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/disclosure.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/image_button.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/master_detail.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/menu.js +12 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/picker.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/progress.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/radio_group.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segment.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/segmented.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/toolbar.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/well.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/render_delegates/workspace.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/resources/segmented.css +1 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/alert/ui.js +33 -22
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/panes/panel/methods.js +20 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/checkbox/methods.js +10 -3
- data/lib/frameworks/sproutcore/frameworks/desktop/tests/views/date_field/methods.js +34 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +14 -15
- data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +40 -14
- data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +699 -700
- data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +11 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +16 -6
- data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +0 -1
- data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +49 -7
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_button.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/desktop/views/slider.js +4 -26
- data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +20 -19
- data/lib/frameworks/sproutcore/frameworks/experimental/Buildfile +2 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/designer/designers/view_designer.js +249 -249
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/edit_mode.js +13 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/mixins/emptiness.js +53 -37
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/render_delegates/form_row.js +3 -11
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/edit_mode.js +53 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/mixins/emptiness.js +114 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form.js +174 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_row.js +86 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form.js +80 -110
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/views/form_row.js +96 -97
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/README.md +2 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/polymorphism/models/record.js +20 -36
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu.js +121 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/ext/menu_item.js +90 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/mixins/select_view_menu.js +139 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/render_delegates/select_button.js +14 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/ext/menu_resizing.js +25 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/bindings.js +43 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/mixins/select_view_menu/check_selected.js +32 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/menu_setup.js +40 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/popup_button/show_menu.js +45 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/menu_width.js +49 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/tests/views/select/selected_item.js +191 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/popup_button.js +264 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/select_view/views/select.js +450 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_child.js +14 -6
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/mixins/split_thumb.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/render_delegates/split_divider.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/split.js +9 -0
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/split_view/views/thumb.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +7 -17
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/flowed_layout.js +35 -8
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_editor_delegate.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inner_frame.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/canvas_image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/helpers/sizing.js +2 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/image.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/label.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/render_delegates/render_delegate.js +6 -6
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/images/favicon.ico +0 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/resources/text_field.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/foundation/system/exception_handler.js +4 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/system/math.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/foundation/system/module.js +13 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/string_measurement.js +6 -9
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/flowed_layout/tests.js +912 -0
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/methods.js +36 -7
- data/lib/frameworks/sproutcore/frameworks/foundation/tests/views/text_field/ui.js +58 -4
- data/lib/frameworks/sproutcore/frameworks/foundation/validators/validator.js +1 -3
- data/lib/frameworks/sproutcore/frameworks/foundation/views/field.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/foundation/views/label.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +25 -14
- data/lib/frameworks/sproutcore/frameworks/handlebars/handlebars.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/core.js +15 -9
- data/lib/frameworks/sproutcore/frameworks/runtime/debug/test_suites/array/flatten.js +24 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/array.js +2 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/ext/function.js +5 -5
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +19 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/copyable.js +3 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/freezable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +14 -14
- data/lib/frameworks/sproutcore/frameworks/runtime/system/error.js +3 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/system/logger.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +2 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/system/range_observer.js +1 -1
- data/lib/frameworks/sproutcore/frameworks/runtime/system/run_loop.js +3 -3
- data/lib/frameworks/sproutcore/frameworks/runtime/system/set.js +15 -16
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/itemType.js +6 -2
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +30 -0
- data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/range_observer/create.js +17 -0
- data/lib/frameworks/sproutcore/frameworks/statechart/system/state.js +9 -2
- data/lib/frameworks/sproutcore/frameworks/statechart/system/statechart.js +3 -1
- data/lib/frameworks/sproutcore/frameworks/testing/resources/runner.css +0 -1
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/base.css +80 -0
- data/lib/frameworks/sproutcore/frameworks/yuireset/resources/core.css +0 -4
- data/lib/frameworks/sproutcore/lib/index.rhtml +2 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list.css +3 -3
- data/lib/frameworks/sproutcore/themes/ace/resources/collection/normal/list_item.css +2 -2
- data/lib/frameworks/sproutcore/themes/ace/resources/form/form.css +9 -0
- data/lib/frameworks/sproutcore/themes/ace/resources/menu/menu.css +3 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/picker.js +1 -1
- data/lib/frameworks/sproutcore/themes/ace/resources/picker/popover/workspace.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/button.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/panel.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/progress.js +2 -0
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/slider.js +1 -1
- data/lib/frameworks/sproutcore/themes/legacy_theme/render_delegates/well.js +1 -1
- data/lib/sproutcore/builders/base.rb +5 -1
- data/lib/sproutcore/builders/handlebars.rb +12 -1
- data/lib/sproutcore/models/target.rb +1 -9
- data/lib/sproutcore/rack/proxy.rb +238 -92
- data/lib/sproutcore/tools/docs.rb +1 -7
- data/spec/fixtures/builder_tests/apps/handlebars_test/Buildfile +1 -0
- data/spec/fixtures/builder_tests/apps/handlebars_test/{template.handlebars → templates/template.handlebars} +2 -0
- data/spec/lib/builders/handlebars_spec.rb +10 -4
- data/sproutcore.gemspec +3 -1
- metadata +73 -44
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/default_styles.css +0 -5
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/english.lproj/strings.js +0 -15
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_checkbox_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_label.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_radio_field.js +0 -17
- data/lib/frameworks/sproutcore/frameworks/experimental/frameworks/forms/tests/views/form_text_field.js +0 -17
@@ -826,7 +826,7 @@ SC.ListItemView = SC.View.extend(SC.InlineEditable, SC.Control,
|
|
826
826
|
.addClass('sc-disclosure-view')
|
827
827
|
.addClass('sc-regular-size')
|
828
828
|
.addClass(this.get('theme').classNames)
|
829
|
-
.addClass(renderer.get('
|
829
|
+
.addClass(renderer.get('className'));
|
830
830
|
|
831
831
|
var source = this._disclosureRenderSource;
|
832
832
|
if (!source) {
|
@@ -863,7 +863,7 @@ SC.ListItemView = SC.View.extend(SC.InlineEditable, SC.Control,
|
|
863
863
|
.addClass('sc-checkbox-view')
|
864
864
|
.addClass('sc-regular-size')
|
865
865
|
.addClass(this.get('theme').classNames)
|
866
|
-
.addClass(renderer.get('
|
866
|
+
.addClass(renderer.get('className'));
|
867
867
|
|
868
868
|
var source = this._checkboxRenderSource;
|
869
869
|
if (!source) {
|
@@ -103,10 +103,20 @@ SC.MasterDetailView = SC.View.extend(
|
|
103
103
|
}.property().cacheable(),
|
104
104
|
|
105
105
|
/**
|
106
|
+
The width of the 'master' side of the master/detail view.
|
107
|
+
|
106
108
|
@type Number
|
107
109
|
@default 250
|
108
110
|
*/
|
109
111
|
masterWidth: 250,
|
112
|
+
|
113
|
+
/**
|
114
|
+
The width of the divider between the master and detail views.
|
115
|
+
|
116
|
+
@type Number
|
117
|
+
@default From theme, or 1.
|
118
|
+
*/
|
119
|
+
dividerWidth: SC.propertyFromRenderDelegate('dividerWidth', 1),
|
110
120
|
|
111
121
|
/**
|
112
122
|
A property (computed) that says whether the master view is hidden.
|
@@ -296,7 +306,7 @@ SC.MasterDetailView = SC.View.extend(
|
|
296
306
|
});
|
297
307
|
|
298
308
|
// and child, naturally
|
299
|
-
var extra = this.
|
309
|
+
var extra = this.get('dividerWidth');
|
300
310
|
detail.set("layout", { left: masterWidth + extra, right: 0, top: 0, bottom: 0 });
|
301
311
|
} else {
|
302
312
|
// remove master if needed
|
@@ -28,10 +28,10 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
28
28
|
|
29
29
|
/**
|
30
30
|
@type Array
|
31
|
-
@default ['title', 'isEnabled', 'isSeparator']
|
31
|
+
@default ['title', 'isEnabled', 'isSeparator', 'isChecked']
|
32
32
|
@see SC.View#displayProperties
|
33
33
|
*/
|
34
|
-
displayProperties: ['title', 'isEnabled', 'isSeparator'],
|
34
|
+
displayProperties: ['title', 'isEnabled', 'isSeparator', 'isChecked'],
|
35
35
|
|
36
36
|
|
37
37
|
/**
|
@@ -103,6 +103,16 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
103
103
|
this.getContentProperty('itemSeparatorKey') !== YES;
|
104
104
|
}.property('content.isEnabled').cacheable(),
|
105
105
|
|
106
|
+
/**
|
107
|
+
YES if the menu item should include a check next to it.
|
108
|
+
|
109
|
+
@type Boolean
|
110
|
+
@property
|
111
|
+
*/
|
112
|
+
isChecked: function() {
|
113
|
+
return this.getContentProperty('itemCheckboxKey');
|
114
|
+
}.property(),
|
115
|
+
|
106
116
|
/**
|
107
117
|
This menu item's submenu, if it exists.
|
108
118
|
|
@@ -172,10 +182,10 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
172
182
|
this.set('itemHeight',itemHeight);
|
173
183
|
|
174
184
|
//addressing accessibility
|
175
|
-
if(
|
185
|
+
if (this.get('isSeparator')) {
|
176
186
|
//assign the role of separator
|
177
187
|
context.attr('role', 'separator');
|
178
|
-
} else if (this.
|
188
|
+
} else if (this.get('isChecked')) {
|
179
189
|
//assign the role of menuitemcheckbox
|
180
190
|
context.attr('role', 'menuitemcheckbox');
|
181
191
|
context.attr('aria-checked', true);
|
@@ -183,7 +193,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
183
193
|
|
184
194
|
context = context.begin('a').addClass('menu-item');
|
185
195
|
|
186
|
-
if (
|
196
|
+
if (this.get('isSeparator')) {
|
187
197
|
context.push('<span class="separator"></span>');
|
188
198
|
context.addClass('disabled');
|
189
199
|
} else {
|
@@ -197,7 +207,7 @@ SC.MenuItemView = SC.View.extend(SC.ContentDisplay,
|
|
197
207
|
if (SC.typeOf(val) !== SC.T_STRING) val = val.toString();
|
198
208
|
this.renderLabel(context, val);
|
199
209
|
|
200
|
-
if (this.
|
210
|
+
if (this.get('isChecked')) {
|
201
211
|
context.push('<div class="checkbox"></div>');
|
202
212
|
}
|
203
213
|
|
@@ -349,14 +349,15 @@ SC.RadioView = SC.View.extend(SC.Control,
|
|
349
349
|
mouseDown: function(evt) {
|
350
350
|
if (!this.get('isEnabled')) return YES;
|
351
351
|
|
352
|
-
var delegate = this.get('renderDelegate'), proxy = this.get('renderDelegateProxy')
|
353
|
-
|
352
|
+
var delegate = this.get('renderDelegate'), proxy = this.get('renderDelegateProxy'),
|
353
|
+
elem = this.$(),
|
354
|
+
index = delegate.indexForEvent(proxy, elem, evt);
|
354
355
|
|
355
356
|
this._activeRadioButton = index;
|
356
357
|
|
357
358
|
if (index !== undefined) {
|
358
359
|
this.get('displayItems')[index].set('isActive', YES);
|
359
|
-
delegate.updateRadioAtIndex(proxy,
|
360
|
+
delegate.updateRadioAtIndex(proxy, elem, index);
|
360
361
|
}
|
361
362
|
|
362
363
|
// even if radiobuttons are not set to get firstResponder, allow default
|
@@ -374,22 +375,63 @@ SC.RadioView = SC.View.extend(SC.Control,
|
|
374
375
|
if (!this.get('isEnabled')) return YES;
|
375
376
|
|
376
377
|
var delegate = this.get('renderDelegate'), proxy = this.get('renderDelegateProxy'),
|
377
|
-
|
378
|
-
|
378
|
+
elem = this.$(),
|
379
|
+
displayItems = this.get('displayItems'),
|
380
|
+
index = delegate.indexForEvent(proxy, elem, evt);
|
379
381
|
|
380
382
|
if (this._activeRadioButton !== undefined && index !== this._activeRadioButton) {
|
381
383
|
displayItems[this._activeRadioButton].set('isActive', NO);
|
382
|
-
delegate.updateRadioAtIndex(proxy,
|
384
|
+
delegate.updateRadioAtIndex(proxy, elem, this._activeRadioButton);
|
383
385
|
}
|
384
386
|
|
385
387
|
this._activeRadioButton = undefined;
|
386
388
|
|
387
389
|
if (index !== undefined) {
|
388
390
|
displayItems[index].set('isActive', NO);
|
389
|
-
delegate.updateRadioAtIndex(proxy,
|
391
|
+
delegate.updateRadioAtIndex(proxy, elem, index);
|
390
392
|
this.set('value', displayItems[index].value);
|
391
393
|
}
|
394
|
+
|
395
|
+
evt.allowDefault();
|
396
|
+
return YES;
|
392
397
|
},
|
398
|
+
|
399
|
+
keyDown: function(evt) {
|
400
|
+
if(!this.get('isEnabled')) return YES;
|
401
|
+
// handle tab key
|
402
|
+
if (evt.which === 9 || evt.keyCode === 9) {
|
403
|
+
var view = evt.shiftKey ? this.get('previousValidKeyView') : this.get('nextValidKeyView');
|
404
|
+
if(view) view.becomeFirstResponder();
|
405
|
+
else evt.allowDefault();
|
406
|
+
return YES ; // handled
|
407
|
+
}
|
408
|
+
if (evt.which >= 37 && evt.which <= 40){
|
409
|
+
|
410
|
+
var delegate = this.get('renderDelegate'), proxy = this.get('renderDelegateProxy'),
|
411
|
+
elem = this.$(),
|
412
|
+
displayItems = this.get('displayItems'),
|
413
|
+
val = this.get('value');
|
414
|
+
for(var i= 0, iLen = displayItems.length; i<iLen; i++){
|
415
|
+
if(val === displayItems[i].value) break;
|
416
|
+
}
|
417
|
+
|
418
|
+
|
419
|
+
if (evt.which === 37 || evt.which === 38 ){
|
420
|
+
if(i<=0) i = displayItems.length-1;
|
421
|
+
else i--;
|
422
|
+
}
|
423
|
+
if (evt.which === 39 || evt.which === 40 ){
|
424
|
+
if(i>=displayItems.length-1) i = 0;
|
425
|
+
else i++;
|
426
|
+
}
|
427
|
+
delegate.updateRadioAtIndex(proxy, elem, i);
|
428
|
+
this.set('value', displayItems[i].value);
|
429
|
+
}
|
430
|
+
evt.allowDefault();
|
431
|
+
|
432
|
+
return NO;
|
433
|
+
},
|
434
|
+
|
393
435
|
|
394
436
|
/** @private */
|
395
437
|
touchStart: function(evt) {
|
@@ -16,6 +16,8 @@ sc_require('views/button');
|
|
16
16
|
list of items. The selected item will be displayed on the button.
|
17
17
|
User has the option of enabling checkbox for the selected menu item.
|
18
18
|
|
19
|
+
@deprecated Please use SC.SelectView instead
|
20
|
+
|
19
21
|
@extends SC.ButtonView
|
20
22
|
@version 1.0
|
21
23
|
@author Mohammed Ashik
|
@@ -23,6 +25,13 @@ sc_require('views/button');
|
|
23
25
|
SC.SelectButtonView = SC.ButtonView.extend(
|
24
26
|
/** @scope SC.SelectButtonView.prototype */ {
|
25
27
|
|
28
|
+
init: function(){
|
29
|
+
// @if (debug)
|
30
|
+
SC.Logger.warn("SC.SelectButtonView is deprecated. Please use SC.SelectView instead.");
|
31
|
+
// @endif
|
32
|
+
sc_super();
|
33
|
+
},
|
34
|
+
|
26
35
|
/**
|
27
36
|
@type Boolean
|
28
37
|
@default YES
|
@@ -9,11 +9,14 @@
|
|
9
9
|
/**
|
10
10
|
@class
|
11
11
|
|
12
|
+
DEPRECATED. Use SelectView instead.
|
13
|
+
|
12
14
|
SelectFieldView displays browser-native popup menu. To use this view,
|
13
15
|
you should either bake into the HTML the preset list of options, or
|
14
16
|
you can set the -objects property to an array of items to show. The
|
15
17
|
value is current value of the select.
|
16
|
-
|
18
|
+
|
19
|
+
@deprecated
|
17
20
|
@extends SC.FieldView
|
18
21
|
@author Charles Jolley
|
19
22
|
@author Mike Ball
|
@@ -165,7 +168,8 @@ SC.SelectFieldView = SC.FieldView.extend(
|
|
165
168
|
|
166
169
|
/** @private */
|
167
170
|
render: function(context, firstTime) {
|
168
|
-
if
|
171
|
+
// Only re-render if it's the firstTime or if a change is required
|
172
|
+
if (firstTime || this.get('cpDidChange')) {
|
169
173
|
this.set('cpDidChange', NO);
|
170
174
|
// get list of objects.
|
171
175
|
var nameKey = this.get('nameKey') ;
|
@@ -215,21 +215,6 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
215
215
|
return NO;
|
216
216
|
}.property('isEnabled'),
|
217
217
|
|
218
|
-
willBecomeKeyResponderFrom: function(keyView) {
|
219
|
-
// focus the text field.
|
220
|
-
if (!this._isFocused) {
|
221
|
-
this._isFocused = YES ;
|
222
|
-
this.becomeFirstResponder();
|
223
|
-
if (this.get('isVisibleInWindow')) {
|
224
|
-
this.$().focus();
|
225
|
-
}
|
226
|
-
}
|
227
|
-
},
|
228
|
-
|
229
|
-
willLoseKeyResponderTo: function(responder) {
|
230
|
-
if (this._isFocused) this._isFocused = NO ;
|
231
|
-
},
|
232
|
-
|
233
218
|
keyDown: function(evt) {
|
234
219
|
|
235
220
|
// handle tab key
|
@@ -240,7 +225,7 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
240
225
|
return YES ; // handled
|
241
226
|
}
|
242
227
|
|
243
|
-
if (evt.which
|
228
|
+
if (evt.which >= 37 && evt.which <= 40){
|
244
229
|
var min = this.get('minimum'),max=this.get('maximum'),
|
245
230
|
step = this.get('step'),
|
246
231
|
size = max-min, val=0, calculateStep;
|
@@ -272,17 +257,10 @@ SC.SliderView = SC.View.extend(SC.Control,
|
|
272
257
|
}
|
273
258
|
}
|
274
259
|
if(val>=min && val<=max) this.set('value', val);
|
260
|
+
}else{
|
261
|
+
evt.allowDefault();
|
262
|
+
return NO;
|
275
263
|
}
|
276
|
-
//handle arrows
|
277
|
-
|
278
|
-
// validate keyDown...
|
279
|
-
// if (this.performValidateKeyDown(evt)) {
|
280
|
-
// this._isKeyDown = YES ;
|
281
|
-
// evt.allowDefault();
|
282
|
-
// } else {
|
283
|
-
// evt.stop();
|
284
|
-
// }
|
285
|
-
SC.RunLoop.begin().end();
|
286
264
|
return YES;
|
287
265
|
},
|
288
266
|
|
@@ -15,14 +15,7 @@
|
|
15
15
|
@extends SC.Control
|
16
16
|
@since SproutCore 1.0
|
17
17
|
*/
|
18
|
-
SC.WebView = SC.View.extend(SC.Control,
|
19
|
-
/** @scope SC.WebView.prototype */ {
|
20
|
-
|
21
|
-
/**
|
22
|
-
@type Array
|
23
|
-
@default ['sc-web-view']
|
24
|
-
@see SC.View#classNames
|
25
|
-
*/
|
18
|
+
SC.WebView = SC.View.extend(SC.Control, {/** @scope SC.WebView.prototype */
|
26
19
|
classNames: 'sc-web-view',
|
27
20
|
|
28
21
|
/**
|
@@ -44,22 +37,29 @@ SC.WebView = SC.View.extend(SC.Control,
|
|
44
37
|
*/
|
45
38
|
shouldAutoResize: NO,
|
46
39
|
|
47
|
-
/**
|
40
|
+
/**
|
41
|
+
@param {SC.RenderContext} context
|
42
|
+
@param {Boolean} firstTime
|
43
|
+
*/
|
48
44
|
render: function(context, firstTime) {
|
49
|
-
var src = this.get('value');
|
45
|
+
var src = this.get('value'), iframe;
|
46
|
+
|
50
47
|
if (firstTime) {
|
51
48
|
context.push('<iframe src="' + src +
|
52
49
|
'" style="position: absolute; width: 100%; height: 100%; border: 0px; margin: 0px; padding: 0px;"></iframe>');
|
53
|
-
}
|
54
|
-
|
50
|
+
}
|
51
|
+
else if(src!==this._lastSrc) {
|
52
|
+
iframe = this.$('iframe');
|
55
53
|
// clear out the previous src, to force a reload
|
56
54
|
iframe.attr('src', 'javascript:;');
|
57
55
|
iframe.attr('src', src);
|
58
56
|
}
|
57
|
+
|
58
|
+
this._lastSrc = src;
|
59
59
|
},
|
60
60
|
|
61
|
-
/**
|
62
|
-
|
61
|
+
/**
|
62
|
+
Called when the layer gets created.
|
63
63
|
*/
|
64
64
|
didCreateLayer: function() {
|
65
65
|
var f = this.$('iframe');
|
@@ -78,20 +78,21 @@ SC.WebView = SC.View.extend(SC.Control,
|
|
78
78
|
*/
|
79
79
|
iframeDidLoad: function() {
|
80
80
|
//fit the iframe to size of the contents.
|
81
|
-
if (this.get('shouldAutoResize') === YES){
|
81
|
+
if (this.get('shouldAutoResize') === YES) {
|
82
82
|
var contentWindow;
|
83
83
|
var iframeElt = this.$('iframe')[0];
|
84
|
-
if(iframeElt && iframeElt.contentWindow){
|
84
|
+
if(iframeElt && iframeElt.contentWindow) {
|
85
85
|
contentWindow = iframeElt.contentWindow;
|
86
86
|
if(contentWindow && contentWindow.document && contentWindow.document.documentElement){
|
87
87
|
var docElement = contentWindow.document.documentElement;
|
88
88
|
// setting the width before the height gives more accurate results..
|
89
89
|
// atleast for the test iframe content i'm using.
|
90
90
|
//TODO: try out document flows other than top to bottom.
|
91
|
-
if (!SC.browser.isIE){
|
91
|
+
if (!SC.browser.isIE) {
|
92
92
|
this.$().width(docElement.scrollWidth);
|
93
|
-
this.$().height(docElement.scrollHeight);
|
94
|
-
}
|
93
|
+
this.$().height(docElement.scrollHeight);
|
94
|
+
}
|
95
|
+
else {
|
95
96
|
this.$().width(docElement.scrollWidth + 12);
|
96
97
|
this.$().height(docElement.scrollHeight + 5);
|
97
98
|
}
|
@@ -14,21 +14,21 @@ sc_require('views/high_light');
|
|
14
14
|
a view in the UI. When your app loads in `design.mode`, a peer Designer
|
15
15
|
instance is created for every view using the class method Designer or
|
16
16
|
`SC.ViewDesigner` if the view class does not define a Designer class.
|
17
|
-
|
17
|
+
|
18
18
|
Whenever you put your app into design mode, all events will be routed first
|
19
|
-
to the peer designer for an object, which will have an opportunity to
|
19
|
+
to the peer designer for an object, which will have an opportunity to
|
20
20
|
prosent a design UI.
|
21
21
|
|
22
|
-
Likewise, the designer palettes provided by the view builder will focus on
|
22
|
+
Likewise, the designer palettes provided by the view builder will focus on
|
23
23
|
the designer instead of the view itself.
|
24
|
-
|
24
|
+
|
25
25
|
## Designer UI
|
26
|
-
|
26
|
+
|
27
27
|
The basic ViewDesigner class automatically handles the UI interaction for
|
28
28
|
layout. You can also double click on the view to perform a default action.
|
29
|
-
|
29
|
+
|
30
30
|
For views with `isContainerView` set to `YES`, double clicking on the view will
|
31
|
-
automatically "focus" the view. This allows you to select the view's
|
31
|
+
automatically "focus" the view. This allows you to select the view's
|
32
32
|
children instead of the view itself.
|
33
33
|
|
34
34
|
@extends SC.Object
|
@@ -39,148 +39,148 @@ SC.ViewDesigner = SC.Object.extend(
|
|
39
39
|
|
40
40
|
/** The view managed by this designer. */
|
41
41
|
view: null,
|
42
|
-
|
42
|
+
|
43
43
|
/** The class for the design. Set when the view is created. */
|
44
44
|
viewClass: null,
|
45
|
-
|
45
|
+
|
46
46
|
/** Set to YES if the view is currently selected for editing. */
|
47
47
|
designIsSelected: NO,
|
48
48
|
|
49
49
|
/** Set to YES if this particular designer should not be enabled. */
|
50
50
|
designIsEnabled: YES,
|
51
|
-
|
51
|
+
|
52
52
|
/**
|
53
53
|
The current page. Comes from the view.
|
54
|
-
|
54
|
+
|
55
55
|
@property {SC.Page}
|
56
56
|
*/
|
57
57
|
page: function() {
|
58
58
|
var v = this.get('view');
|
59
59
|
return (v) ? v.get('page') : null;
|
60
60
|
}.property('view').cacheable(),
|
61
|
-
|
61
|
+
|
62
62
|
/**
|
63
63
|
The design controller from the page. Comes from page
|
64
|
-
|
64
|
+
|
65
65
|
@property {SC.PageDesignController}
|
66
66
|
*/
|
67
67
|
designController: function() {
|
68
68
|
var p = this.get('page');
|
69
|
-
return (p) ? p.get('designController') : null ;
|
69
|
+
return (p) ? p.get('designController') : null ;
|
70
70
|
}.property('page').cacheable(),
|
71
|
-
|
72
|
-
/**
|
71
|
+
|
72
|
+
/**
|
73
73
|
If set to NO, the default childView encoding will not run. You can use
|
74
74
|
this option, for example, if your view creates its own childViews.
|
75
|
-
|
75
|
+
|
76
76
|
Alternatively, you can override the `encodeChildViewsDesign()` and
|
77
77
|
`encodeChildViewsLoc()` methods.
|
78
|
-
|
78
|
+
|
79
79
|
@property {Boolean}
|
80
80
|
*/
|
81
81
|
encodeChildViews: YES,
|
82
|
-
|
82
|
+
|
83
83
|
concatenatedProperties: ['designProperties', 'localizedProperties', 'excludeProperties'],
|
84
84
|
|
85
85
|
|
86
86
|
// ..........................................................
|
87
87
|
// SIZE AND POSITIONING SUPPORT
|
88
|
-
//
|
89
|
-
|
88
|
+
//
|
89
|
+
|
90
90
|
/**
|
91
91
|
Set to `NO` to hide horizontal resize handles
|
92
92
|
*/
|
93
93
|
canResizeHorizontal: YES,
|
94
|
-
|
94
|
+
|
95
95
|
/**
|
96
96
|
Set to `NO` to resize vertical handles
|
97
97
|
*/
|
98
98
|
canResizeVertical: YES,
|
99
|
-
|
99
|
+
|
100
100
|
/**
|
101
101
|
Allows moving.
|
102
102
|
*/
|
103
103
|
canReposition: YES,
|
104
|
-
|
104
|
+
|
105
105
|
/**
|
106
106
|
Determines the minimum allowed width
|
107
107
|
*/
|
108
108
|
minWidth: 10,
|
109
|
-
|
109
|
+
|
110
110
|
/**
|
111
111
|
Determines the minimum allowed height
|
112
112
|
*/
|
113
113
|
minHeight: 10,
|
114
|
-
|
114
|
+
|
115
115
|
/**
|
116
116
|
Determines maximum allowed width. `null` means no limit
|
117
117
|
*/
|
118
118
|
maxWidth: 100000000,
|
119
|
-
|
119
|
+
|
120
120
|
/**
|
121
121
|
Determines maximum allowed height. `null` means no limit
|
122
122
|
*/
|
123
123
|
maxHeight: 100000000,
|
124
|
-
|
124
|
+
|
125
125
|
/**
|
126
126
|
Returns the current layout for the view. Set this property to update
|
127
127
|
the layout. Direct properties are exposed a well. You will usually want
|
128
128
|
to work with those instead.
|
129
|
-
|
129
|
+
|
130
130
|
@property
|
131
131
|
@type {Hash}
|
132
132
|
*/
|
133
133
|
layout: function(key, value) {
|
134
134
|
var view = this.get('view');
|
135
|
-
if (!view) return null;
|
136
|
-
|
135
|
+
if (!view) return null;
|
136
|
+
|
137
137
|
if (value !== undefined) view.set('layout', value);
|
138
138
|
return view.get('layout');
|
139
139
|
}.property('view').cacheable(),
|
140
|
-
|
140
|
+
|
141
141
|
/**
|
142
|
-
The current anchor location. This determines which of the other dimension
|
142
|
+
The current anchor location. This determines which of the other dimension
|
143
143
|
metrics are actually used to compute the layout. The value may be one of:
|
144
|
-
|
144
|
+
|
145
145
|
TOP_LEFT, TOP_CENTER, TOP_RIGHT, TOP_HEIGHT,
|
146
146
|
CENTER_LEFT, CENTER_CENTER, CENTER_RIGHT, CENTER_HEIGHT
|
147
147
|
BOTTOM_LEFT, BOTTOM_CENTER, BOTTOM_RIGHT, BOTTOM_HEIGHT,
|
148
148
|
WIDTH_LEFT, WIDTH_CENTER, WIDTH_RIGHT, WIDTH_HEIGHT,
|
149
149
|
null
|
150
|
-
|
150
|
+
|
151
151
|
@property
|
152
152
|
@type {Number}
|
153
153
|
*/
|
154
154
|
anchorLocation: function(key, value) {
|
155
|
-
var layout = this.get('layout'),
|
155
|
+
var layout = this.get('layout'),
|
156
156
|
K = SC.ViewDesigner,
|
157
157
|
h, v, frame, view, pview, pframe, ret;
|
158
|
-
|
158
|
+
|
159
159
|
if (!layout) return null;
|
160
160
|
|
161
161
|
// update to refelct new anchor locations...
|
162
162
|
if (value !== undefined) {
|
163
|
-
|
164
|
-
ret = {};
|
163
|
+
|
164
|
+
ret = {};
|
165
165
|
view = this.get('view');
|
166
166
|
frame = view.get('frame');
|
167
167
|
pview = view.get('parentView');
|
168
168
|
pframe = pview ? pview.get('frame') : null;
|
169
169
|
if (!pframe) pframe = SC.RootResponder.responder.computeWindowSize();
|
170
|
-
|
170
|
+
|
171
171
|
// compute new layout in each direction
|
172
172
|
if (value & K.ANCHOR_LEFT) {
|
173
173
|
ret.left = frame.x;
|
174
174
|
ret.width = frame.width;
|
175
|
-
|
175
|
+
|
176
176
|
} else if (value & K.ANCHOR_RIGHT) {
|
177
177
|
ret.right = (pframe.width - SC.maxX(frame));
|
178
178
|
ret.width = frame.width;
|
179
|
-
|
179
|
+
|
180
180
|
} else if (value & K.ANCHOR_CENTERX) {
|
181
181
|
ret.centerX = Math.round(SC.midX(frame) - (pframe.width/2)) ;
|
182
182
|
ret.width = frame.width;
|
183
|
-
|
183
|
+
|
184
184
|
} else if (value & K.ANCHOR_WIDTH) {
|
185
185
|
ret.left = frame.x;
|
186
186
|
ret.right = (pframe.width - SC.maxX(frame));
|
@@ -190,15 +190,15 @@ SC.ViewDesigner = SC.Object.extend(
|
|
190
190
|
if (value & K.ANCHOR_TOP) {
|
191
191
|
ret.top = frame.y;
|
192
192
|
ret.height = frame.height;
|
193
|
-
|
193
|
+
|
194
194
|
} else if (value & K.ANCHOR_BOTTOM) {
|
195
195
|
ret.bottom = (pframe.height - SC.maxY(frame));
|
196
196
|
ret.height = frame.height;
|
197
|
-
|
197
|
+
|
198
198
|
} else if (value & K.ANCHOR_CENTERY) {
|
199
199
|
ret.centerY = Math.round(SC.midY(frame) - (pframe.height/2)) ;
|
200
200
|
ret.height = frame.height;
|
201
|
-
|
201
|
+
|
202
202
|
} else if (value & K.ANCHOR_HEIGHT) {
|
203
203
|
ret.top = frame.y;
|
204
204
|
ret.bottom = (pframe.height - SC.maxY(frame));
|
@@ -207,13 +207,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
207
207
|
this.set('layout', ret);
|
208
208
|
layout = ret ;
|
209
209
|
}
|
210
|
-
|
210
|
+
|
211
211
|
if (!SC.none(layout.left)) {
|
212
212
|
h = SC.none(layout.width) ? K.ANCHOR_WIDTH : K.ANCHOR_LEFT;
|
213
213
|
} else if (!SC.none(layout.right)) h = K.ANCHOR_RIGHT;
|
214
214
|
else if (!SC.none(layout.centerX)) h = K.ANCHOR_CENTERX;
|
215
215
|
else h = 0;
|
216
|
-
|
216
|
+
|
217
217
|
if (!SC.none(layout.top)) {
|
218
218
|
v = SC.none(layout.height) ? K.ANCHOR_HEIGHT : K.ANCHOR_TOP;
|
219
219
|
} else if (!SC.none(layout.bottom)) v = K.ANCHOR_BOTTOM ;
|
@@ -223,19 +223,19 @@ SC.ViewDesigner = SC.Object.extend(
|
|
223
223
|
return v | h;
|
224
224
|
}.property('layout').cacheable(),
|
225
225
|
|
226
|
-
_layoutProperty: function(key, value) {
|
226
|
+
_layoutProperty: function(key, value) {
|
227
227
|
var layout = this.get('layout');
|
228
228
|
if (!layout) return null;
|
229
|
-
|
229
|
+
|
230
230
|
if (!SC.none(layout) && (value !== undefined)) {
|
231
231
|
layout = SC.copy(layout);
|
232
232
|
layout[key] = value;
|
233
233
|
this.set('layout', layout);
|
234
234
|
}
|
235
|
-
|
235
|
+
|
236
236
|
return layout[key];
|
237
237
|
},
|
238
|
-
|
238
|
+
|
239
239
|
/**
|
240
240
|
Returns the top offset of the current layout or `null` if not defined
|
241
241
|
*/
|
@@ -277,48 +277,48 @@ SC.ViewDesigner = SC.Object.extend(
|
|
277
277
|
layoutLeft: function(key, value) {
|
278
278
|
return this._layoutProperty('left', value);
|
279
279
|
}.property('layout').cacheable(),
|
280
|
-
|
280
|
+
|
281
281
|
/**
|
282
282
|
Returns the right offset of the current layout or `null` if not defined
|
283
283
|
*/
|
284
284
|
layoutRight: function(key, value) {
|
285
285
|
return this._layoutProperty('right', value);
|
286
286
|
}.property('layout').cacheable(),
|
287
|
-
|
287
|
+
|
288
288
|
/**
|
289
289
|
Returns the centerX offset of the current layout or `null` if not defined
|
290
290
|
*/
|
291
291
|
layoutCenterX: function(key, value) {
|
292
292
|
return this._layoutProperty('centerX', value);
|
293
293
|
}.property('layout').cacheable(),
|
294
|
-
|
294
|
+
|
295
295
|
/**
|
296
296
|
Returns the width offset of the current layout or `null` if not defined
|
297
297
|
*/
|
298
298
|
layoutWidth: function(key, value) {
|
299
299
|
return this._layoutProperty('width', value);
|
300
300
|
}.property('layout').cacheable(),
|
301
|
-
|
301
|
+
|
302
302
|
// ..........................................................
|
303
303
|
// GENERIC PROPERTIES
|
304
|
-
//
|
304
|
+
//
|
305
305
|
// Adds support for adding generic properties to a view. These will
|
306
306
|
// overwrite whatever you write out using specifically supported props.
|
307
|
-
|
307
|
+
|
308
308
|
// ..........................................................
|
309
309
|
// HANDLE ENCODING OF VIEW DESIGN
|
310
|
-
//
|
310
|
+
//
|
311
311
|
|
312
312
|
/**
|
313
313
|
Encodes any simple properties that can just be copied from the view onto
|
314
314
|
the coder. This is used by `encodeDesignProperties()` and
|
315
315
|
`encodeLocalizedProperties()`.
|
316
316
|
*/
|
317
|
-
encodeSimpleProperties: function(props, coder) {
|
317
|
+
encodeSimpleProperties: function(props, coder) {
|
318
318
|
var view = this.get('view'), proto = this.get('viewClass').prototype ;
|
319
319
|
props.forEach(function(prop) {
|
320
320
|
var val = view[prop] ; // avoid get() since we don't want to exec props
|
321
|
-
|
321
|
+
|
322
322
|
//handle bindings
|
323
323
|
if (prop.length > 7 && prop.slice(-7) === "Binding" && val !== undefined){
|
324
324
|
coder.js(prop,val.encodeDesign());
|
@@ -330,34 +330,34 @@ SC.ViewDesigner = SC.Object.extend(
|
|
330
330
|
}
|
331
331
|
}, this);
|
332
332
|
},
|
333
|
-
|
334
333
|
|
335
|
-
|
334
|
+
|
335
|
+
/**
|
336
336
|
Array of properties that can be encoded directly. This is an easy way to
|
337
337
|
add support for simple properties that need to be written to the design
|
338
|
-
without added code. These properties will be encoded by
|
338
|
+
without added code. These properties will be encoded by
|
339
339
|
`encodeDesignProperties()`.
|
340
|
-
|
340
|
+
|
341
341
|
You can add to this array in your subclasses.
|
342
342
|
*/
|
343
343
|
designProperties: ['layout', 'isVisible', 'isEnabled', 'styleClass'],
|
344
|
-
|
345
|
-
|
344
|
+
|
345
|
+
|
346
346
|
/*
|
347
347
|
Array of properties specifically not displayed in the editable properties
|
348
348
|
list
|
349
349
|
*/
|
350
|
-
|
350
|
+
|
351
351
|
excludeProperties: ['layout', 'childViews'],
|
352
|
-
|
353
|
-
|
352
|
+
|
353
|
+
|
354
354
|
/*
|
355
355
|
Array of properties avaliaible to edit in greenhouse
|
356
|
-
|
356
|
+
|
357
357
|
*/
|
358
358
|
editableProperties: function(){
|
359
359
|
|
360
|
-
var con = this.get('designAttrs'),
|
360
|
+
var con = this.get('designAttrs'),
|
361
361
|
view = this.get('view'),
|
362
362
|
ret = [],
|
363
363
|
designProperties = this.get('designProperties'),
|
@@ -373,13 +373,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
373
373
|
ret.pushObject(SC.Object.create({value: view[k], key: k, view: view}));
|
374
374
|
}
|
375
375
|
});
|
376
|
-
|
377
|
-
return ret;
|
376
|
+
|
377
|
+
return ret;
|
378
378
|
}.property('designProperties').cacheable(),
|
379
|
-
|
380
|
-
|
381
|
-
/**
|
382
|
-
Invoked by a design coder to encode design properties. The default
|
379
|
+
|
380
|
+
|
381
|
+
/**
|
382
|
+
Invoked by a design coder to encode design properties. The default
|
383
383
|
implementation invoked `encodeDesignProperties()` and
|
384
384
|
`encodeChildViewsDesign()`. You can override this method with your own
|
385
385
|
additional encoding if you like.
|
@@ -394,22 +394,22 @@ SC.ViewDesigner = SC.Object.extend(
|
|
394
394
|
|
395
395
|
/**
|
396
396
|
Encodes the design properties for the view. These properties are simply
|
397
|
-
copied from the view onto the coder. As an optimization, the value of
|
397
|
+
copied from the view onto the coder. As an optimization, the value of
|
398
398
|
each property will be checked against the default value in the class. If
|
399
399
|
they match, the property will not be emitted.
|
400
400
|
*/
|
401
401
|
encodeDesignProperties: function(coder) {
|
402
402
|
return this.encodeSimpleProperties(this.get('designProperties'), coder);
|
403
403
|
},
|
404
|
-
|
405
|
-
|
404
|
+
|
405
|
+
|
406
406
|
encodeDesignAttributeProperties: function(coder){
|
407
407
|
var designProps = this.get('designProperties'),
|
408
408
|
designAttrs = this.get('designAttrs'),
|
409
409
|
simpleProps = [];
|
410
|
-
|
410
|
+
|
411
411
|
if(designAttrs) designAttrs = designAttrs[0];
|
412
|
-
|
412
|
+
|
413
413
|
for(var attr in designAttrs){
|
414
414
|
if(designAttrs.hasOwnProperty(attr) && designProps.indexOf(attr) < 0 && attr !== 'childViews'){
|
415
415
|
simpleProps.push(attr);
|
@@ -417,10 +417,10 @@ SC.ViewDesigner = SC.Object.extend(
|
|
417
417
|
}
|
418
418
|
return this.encodeSimpleProperties(simpleProps, coder);
|
419
419
|
},
|
420
|
-
|
420
|
+
|
421
421
|
/**
|
422
|
-
Encodes the design for child views. The default implementation loops
|
423
|
-
through child views. If you store your child views elsewhere in your
|
422
|
+
Encodes the design for child views. The default implementation loops
|
423
|
+
through child views. If you store your child views elsewhere in your
|
424
424
|
config (for example as named properties), then you may want to override
|
425
425
|
this method with your own encoding.
|
426
426
|
*/
|
@@ -430,18 +430,18 @@ SC.ViewDesigner = SC.Object.extend(
|
|
430
430
|
if (childViews.length>0) coder.object('childViews', childViews);
|
431
431
|
},
|
432
432
|
|
433
|
-
/**
|
433
|
+
/**
|
434
434
|
Array of localized that can be encoded directly. This is an easy way to
|
435
|
-
add support for simple properties that need to be written to the
|
436
|
-
localization without added code. These properties will be encoded by
|
435
|
+
add support for simple properties that need to be written to the
|
436
|
+
localization without added code. These properties will be encoded by
|
437
437
|
`encodeLocalizedProperties()`.
|
438
|
-
|
438
|
+
|
439
439
|
You can add to this array in your subclasses.
|
440
440
|
*/
|
441
441
|
localizedProperties: [],
|
442
|
-
|
443
|
-
/**
|
444
|
-
Invoked by a localization coder to encode design properties. The default
|
442
|
+
|
443
|
+
/**
|
444
|
+
Invoked by a localization coder to encode design properties. The default
|
445
445
|
implementation invoked `encodeLocalizedProperties()` and
|
446
446
|
`encodeChildViewsLoc()`. You can override this method with your own
|
447
447
|
additional encoding if you like.
|
@@ -454,18 +454,18 @@ SC.ViewDesigner = SC.Object.extend(
|
|
454
454
|
},
|
455
455
|
|
456
456
|
/**
|
457
|
-
Encodes the localized properties for the view. These properties are
|
458
|
-
simply copied from the view onto the coder. As an optimization, the value
|
459
|
-
of each property will be checked against the default value in the class.
|
457
|
+
Encodes the localized properties for the view. These properties are
|
458
|
+
simply copied from the view onto the coder. As an optimization, the value
|
459
|
+
of each property will be checked against the default value in the class.
|
460
460
|
If they match, the property will not be emitted.
|
461
461
|
*/
|
462
462
|
encodeLocalizedProperties: function(coder) {
|
463
463
|
return this.encodeSimpleProperties(this.get('localizedProperties'),coder);
|
464
464
|
},
|
465
|
-
|
465
|
+
|
466
466
|
/**
|
467
|
-
Encodes the design for child views. The default implementation loops
|
468
|
-
through child views. If you store your child views elsewhere in your
|
467
|
+
Encodes the design for child views. The default implementation loops
|
468
|
+
through child views. If you store your child views elsewhere in your
|
469
469
|
config (for example as named properties), then you may want to override
|
470
470
|
this method with your own encoding.
|
471
471
|
*/
|
@@ -476,31 +476,31 @@ SC.ViewDesigner = SC.Object.extend(
|
|
476
476
|
},
|
477
477
|
|
478
478
|
/**
|
479
|
-
This method is invoked when the designer is instantiated. You can use
|
479
|
+
This method is invoked when the designer is instantiated. You can use
|
480
480
|
this method to reload any state saved in the view. This method is called
|
481
|
-
before any observers or bindings are setup to give you a chance to
|
481
|
+
before any observers or bindings are setup to give you a chance to
|
482
482
|
configure the initial state of the designer.
|
483
483
|
*/
|
484
484
|
awakeDesign: function() {},
|
485
|
-
|
486
|
-
|
485
|
+
|
486
|
+
|
487
487
|
/**
|
488
488
|
over-ride this method in your designers to customies drop operations
|
489
489
|
default just calls appendChild
|
490
|
-
|
490
|
+
|
491
491
|
TODO: Come up with a better name for this method.
|
492
492
|
*/
|
493
493
|
addView: function(view){
|
494
494
|
this.view.appendChild(view);
|
495
495
|
},
|
496
|
-
|
496
|
+
|
497
497
|
// ..........................................................
|
498
498
|
// VIEW RELAYING
|
499
|
-
//
|
499
|
+
//
|
500
500
|
// View property changes relay automatically...
|
501
|
-
|
501
|
+
|
502
502
|
/**
|
503
|
-
Invoked whenever the view changes. This will observe all property
|
503
|
+
Invoked whenever the view changes. This will observe all property
|
504
504
|
changes on the new view.
|
505
505
|
*/
|
506
506
|
viewDidChange: function() {
|
@@ -513,30 +513,30 @@ SC.ViewDesigner = SC.Object.extend(
|
|
513
513
|
if (view) view.addObserver('*', this, func);
|
514
514
|
this.viewPropertyDidChange(view, '*', null, null);
|
515
515
|
}.observes('view'),
|
516
|
-
|
516
|
+
|
517
517
|
/**
|
518
518
|
Invoked whenever a property on the view has changed. The passed key will
|
519
519
|
be '*' when the entire view has changed. The default implementation here
|
520
|
-
will notify the property as changed on the
|
521
|
-
property value is undefined on the
|
522
|
-
|
523
|
-
It will notify all properties changed for '*'. You may override this
|
520
|
+
will notify the property as changed on the receiver if the
|
521
|
+
property value is undefined on the receiver.
|
522
|
+
|
523
|
+
It will notify all properties changed for '*'. You may override this
|
524
524
|
method with your own behavior if you like.
|
525
525
|
*/
|
526
|
-
viewPropertyDidChange: function(view, key) {
|
526
|
+
viewPropertyDidChange: function(view, key) {
|
527
527
|
if (key === '*') this.allPropertiesDidChange();
|
528
528
|
else if (this[key] === undefined) this.notifyPropertyChange(key) ;
|
529
|
-
|
529
|
+
|
530
530
|
if ((key === '*') || (key === 'layout')) {
|
531
531
|
if (this.get('designIsSelected') && this._handles) {
|
532
532
|
this._handles.set('layout', SC.clone(view.get('layout')));
|
533
533
|
}
|
534
534
|
}
|
535
535
|
},
|
536
|
-
|
536
|
+
|
537
537
|
/**
|
538
|
-
The `unknownProperty` handler will pass through to the view by default.
|
539
|
-
This will often provide you the support you need without needing to
|
538
|
+
The `unknownProperty` handler will pass through to the view by default.
|
539
|
+
This will often provide you the support you need without needing to
|
540
540
|
customize the Designer. Just make sure you don't define a conflicting
|
541
541
|
property name on the designer itself!
|
542
542
|
*/
|
@@ -546,47 +546,47 @@ SC.ViewDesigner = SC.Object.extend(
|
|
546
546
|
return value ;
|
547
547
|
} else return this.view.get(key);
|
548
548
|
},
|
549
|
-
|
549
|
+
|
550
550
|
// ......................................
|
551
551
|
// PRIVATE METHODS
|
552
552
|
//
|
553
|
-
|
553
|
+
|
554
554
|
init: function() {
|
555
|
-
|
555
|
+
|
556
556
|
// setup design from view state...
|
557
557
|
this.awakeDesign();
|
558
|
-
|
558
|
+
|
559
559
|
// setup bindings, etc
|
560
560
|
sc_super();
|
561
|
-
|
561
|
+
|
562
562
|
// now add observer for property changes on view to relay change out.
|
563
563
|
this.viewDidChange();
|
564
|
-
|
564
|
+
|
565
565
|
// and register with designController, if defined...
|
566
566
|
var c= this.get('designController');
|
567
567
|
if (c) c.registerDesigner(this) ;
|
568
|
-
|
568
|
+
|
569
569
|
},
|
570
570
|
|
571
571
|
destroy: function() {
|
572
572
|
sc_super();
|
573
|
-
this.set('view', null); // clears the view observer...
|
573
|
+
this.set('view', null); // clears the view observer...
|
574
574
|
},
|
575
|
-
|
575
|
+
|
576
576
|
designIsSelectedDidChange: function() {
|
577
|
-
if (SC.kindOf(this.view, SC.Pane)) return this ;
|
578
|
-
|
577
|
+
if (SC.kindOf(this.view, SC.Pane)) return this ;
|
578
|
+
|
579
579
|
var isSel = this.get('designIsSelected');
|
580
580
|
var handles = this._handles;
|
581
|
-
|
581
|
+
|
582
582
|
if (isSel) {
|
583
|
-
|
583
|
+
|
584
584
|
if (!handles) {
|
585
|
-
handles = this._handles = SC.SelectionHandlesView.create({
|
586
|
-
designer: this
|
585
|
+
handles = this._handles = SC.SelectionHandlesView.create({
|
586
|
+
designer: this
|
587
587
|
});
|
588
588
|
}
|
589
|
-
|
589
|
+
|
590
590
|
var parent = this.view.get('parentView');
|
591
591
|
if (!handles.get('parentView') !== parent) parent.appendChild(handles);
|
592
592
|
handles.set('layout', this.view.get('layout'));
|
@@ -594,7 +594,7 @@ SC.ViewDesigner = SC.Object.extend(
|
|
594
594
|
if (handles.get('parentView')) handles.removeFromParent();
|
595
595
|
}
|
596
596
|
}.observes('designIsSelected'),
|
597
|
-
|
597
|
+
|
598
598
|
tryToPerform: function(methodName, arg1, arg2) {
|
599
599
|
// only handle event if we are in design mode
|
600
600
|
var page = this.view ? this.view.get('page') : null ;
|
@@ -608,13 +608,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
608
608
|
return SC.Object.prototype.tryToPerform.apply(this.view, arguments);
|
609
609
|
}
|
610
610
|
},
|
611
|
-
|
611
|
+
|
612
612
|
// ..........................................................
|
613
613
|
// DRAWING SUPPORT
|
614
|
-
//
|
614
|
+
//
|
615
615
|
|
616
616
|
/**
|
617
|
-
Update the layer to add any design-specific marking
|
617
|
+
Update the layer to add any design-specific marking
|
618
618
|
*/
|
619
619
|
didCreateLayer: function() {},
|
620
620
|
|
@@ -627,46 +627,46 @@ SC.ViewDesigner = SC.Object.extend(
|
|
627
627
|
Update the layer to add any design-specific marking
|
628
628
|
*/
|
629
629
|
willDestroyLayer: function() {},
|
630
|
-
|
630
|
+
|
631
631
|
// ..........................................................
|
632
632
|
// ROOT DESIGNER SUPPORT
|
633
|
-
//
|
634
|
-
|
633
|
+
//
|
634
|
+
|
635
635
|
parentDesignerIsRoot: function(){
|
636
636
|
var dc = this.get('designController'), view = this.get('view');
|
637
637
|
return dc.get('rootDesigner') === view.getPath('parentView.designer');
|
638
638
|
}.property(),
|
639
|
-
|
639
|
+
|
640
640
|
/**
|
641
641
|
set this property to `YES` if you want your designer to become Root
|
642
642
|
*/
|
643
643
|
acceptRootDesigner: NO,
|
644
|
-
|
644
|
+
|
645
645
|
isRootDesigner: NO,
|
646
|
-
|
646
|
+
|
647
647
|
isRootDesignerDidChange: function() {
|
648
|
-
|
648
|
+
|
649
649
|
var isRoot = this.get('isRootDesigner'),
|
650
650
|
highLight = this._highLight;
|
651
|
-
|
651
|
+
|
652
652
|
if (isRoot && this.get('designIsEnabled')) {
|
653
|
-
|
653
|
+
|
654
654
|
if (!highLight) {
|
655
|
-
highLight = this._highLight = SC.RootDesignerHighLightView.create({
|
656
|
-
designer: this
|
655
|
+
highLight = this._highLight = SC.RootDesignerHighLightView.create({
|
656
|
+
designer: this
|
657
657
|
});
|
658
658
|
}
|
659
|
-
|
659
|
+
|
660
660
|
var parent = this.view.get('parentView');
|
661
661
|
highLight.set('targetFrame', this.view.get('frame'));
|
662
|
-
|
662
|
+
|
663
663
|
if (!highLight.get('parentView') !== parent) parent.insertBefore(highLight,this.view);
|
664
|
-
}
|
664
|
+
}
|
665
665
|
else if (highLight) {
|
666
666
|
if (highLight.get('parentView')) highLight.removeFromParent();
|
667
667
|
}
|
668
668
|
}.observes('isRootDesigner'),
|
669
|
-
|
669
|
+
|
670
670
|
resignRootDesigner: function(){
|
671
671
|
var prevRoot = this.get('prevRootDesigner');
|
672
672
|
if(this.get('isRootDesigner') && prevRoot){
|
@@ -674,7 +674,7 @@ SC.ViewDesigner = SC.Object.extend(
|
|
674
674
|
if(dc) dc.makeRootDesigner(prevRoot);
|
675
675
|
}
|
676
676
|
},
|
677
|
-
|
677
|
+
|
678
678
|
shouldReleaseRootDesigner: function(evt){
|
679
679
|
var frame = this.view.get('frame');
|
680
680
|
if(this.get('isRootDesigner') && !SC.pointInRect({ x: evt.pageX, y: evt.pageY }, frame)){
|
@@ -683,13 +683,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
683
683
|
}
|
684
684
|
return NO;
|
685
685
|
},
|
686
|
-
|
686
|
+
|
687
687
|
// ..........................................................
|
688
688
|
// MOUSE HANDLING
|
689
|
-
//
|
690
|
-
|
689
|
+
//
|
690
|
+
|
691
691
|
HANDLE_MARGIN: 10,
|
692
|
-
|
692
|
+
|
693
693
|
/**
|
694
694
|
Select on `mouseDown`. If `metaKey` or `shiftKey` is pressed, add to
|
695
695
|
selection. Otherwise just save starting info for dragging
|
@@ -697,13 +697,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
697
697
|
mouseDown: function(evt) {
|
698
698
|
this.shouldReleaseRootDesigner(evt);
|
699
699
|
if (!this.get('designIsEnabled') || !this.get('parentDesignerIsRoot')) return NO ;
|
700
|
-
|
700
|
+
|
701
701
|
// save mouse down info
|
702
|
-
var view = this.get('view'),
|
702
|
+
var view = this.get('view'),
|
703
703
|
info, vert, horiz, repos, frame, pview, margin, canH, canV;
|
704
|
-
|
704
|
+
|
705
705
|
if (!view) return NO; // nothing to do
|
706
|
-
|
706
|
+
|
707
707
|
// save mouse down state for later use
|
708
708
|
this._mouseDownInfo = info = {
|
709
709
|
layout: SC.copy(view.get('layout')),
|
@@ -712,8 +712,8 @@ SC.ViewDesigner = SC.Object.extend(
|
|
712
712
|
metaKey: evt.metaKey || evt.shiftKey,
|
713
713
|
source: this,
|
714
714
|
x: evt.pageX, y: evt.pageY
|
715
|
-
};
|
716
|
-
info.hanchor = info.vanchor = info.reposition = NO;
|
715
|
+
};
|
716
|
+
info.hanchor = info.vanchor = info.reposition = NO;
|
717
717
|
|
718
718
|
// detect what operations are available.
|
719
719
|
repos = this.get('canReposition');
|
@@ -737,7 +737,7 @@ SC.ViewDesigner = SC.Object.extend(
|
|
737
737
|
vert = "top";
|
738
738
|
} else if (Math.abs(info.y - SC.maxY(frame)) <= margin) {
|
739
739
|
vert = "bottom";
|
740
|
-
}
|
740
|
+
}
|
741
741
|
}
|
742
742
|
|
743
743
|
canH = this.get('canResizeHorizontal');
|
@@ -745,7 +745,7 @@ SC.ViewDesigner = SC.Object.extend(
|
|
745
745
|
|
746
746
|
// look for corners if can resize in both directions...
|
747
747
|
if (canH && canV) {
|
748
|
-
if (!vert || !horiz) vert = horiz = NO ;
|
748
|
+
if (!vert || !horiz) vert = horiz = NO ;
|
749
749
|
|
750
750
|
// if can only resize horizonal - must be in middle vertical
|
751
751
|
} else if (canH) {
|
@@ -764,8 +764,8 @@ SC.ViewDesigner = SC.Object.extend(
|
|
764
764
|
// now save settings...
|
765
765
|
if (horiz) info.hanchor = horiz ;
|
766
766
|
if (vert) info.vanchor = vert ;
|
767
|
-
if (!horiz && !vert && repos) info.reposition = YES ;
|
768
|
-
|
767
|
+
if (!horiz && !vert && repos) info.reposition = YES ;
|
768
|
+
|
769
769
|
// if not yet selected, select item immediately. This way future events
|
770
770
|
// will be handled properly
|
771
771
|
if (!info.selected) {
|
@@ -773,8 +773,8 @@ SC.ViewDesigner = SC.Object.extend(
|
|
773
773
|
}
|
774
774
|
|
775
775
|
// save initial info on all selected items
|
776
|
-
if (info.reposition) this.get('designController').prepareReposition(info);
|
777
|
-
|
776
|
+
if (info.reposition) this.get('designController').prepareReposition(info);
|
777
|
+
|
778
778
|
return YES ;
|
779
779
|
},
|
780
780
|
|
@@ -784,14 +784,14 @@ SC.ViewDesigner = SC.Object.extend(
|
|
784
784
|
info[SC.keyFor('layout', SC.guidFor(this))] = layout;
|
785
785
|
return this ;
|
786
786
|
},
|
787
|
-
|
787
|
+
|
788
788
|
/**
|
789
789
|
mouse dragged will resize or reposition depending on the settings from
|
790
790
|
mousedown.
|
791
791
|
*/
|
792
792
|
mouseDragged: function(evt) {
|
793
793
|
if (!this.get('designIsEnabled') || !this.get('parentDesignerIsRoot')) return NO ;
|
794
|
-
var info = this._mouseDownInfo,
|
794
|
+
var info = this._mouseDownInfo,
|
795
795
|
view = this.get('view'),
|
796
796
|
layout, startX, startY;
|
797
797
|
//do some binding!!!
|
@@ -818,11 +818,11 @@ SC.ViewDesigner = SC.Object.extend(
|
|
818
818
|
newLink.end = {x: ep.x, y: ep.y};
|
819
819
|
newLink.style = { color: 'green', width: 3 };
|
820
820
|
this.setIfChanged('shapes', [newLink]);
|
821
|
-
}
|
821
|
+
}
|
822
822
|
}.observes('startPoint', 'endPoint')
|
823
823
|
});
|
824
824
|
SC.designPage.get('designMainPane').appendChild(dragLink);
|
825
|
-
|
825
|
+
|
826
826
|
SC.Drag.start({
|
827
827
|
event: evt,
|
828
828
|
source: this,
|
@@ -848,16 +848,16 @@ SC.ViewDesigner = SC.Object.extend(
|
|
848
848
|
}
|
849
849
|
|
850
850
|
},
|
851
|
-
|
851
|
+
|
852
852
|
// ..........................................................
|
853
853
|
// Drag source and drag data source
|
854
|
-
//
|
854
|
+
//
|
855
855
|
dragDataTypes: ['SC.Binding'],
|
856
856
|
|
857
|
-
dragDataForType: function(drag, dataType) {
|
858
|
-
return dataType === 'SC.Binding' ? this.get('view') : null;
|
857
|
+
dragDataForType: function(drag, dataType) {
|
858
|
+
return dataType === 'SC.Binding' ? this.get('view') : null;
|
859
859
|
},
|
860
|
-
|
860
|
+
|
861
861
|
/**
|
862
862
|
On `mouseUp` potentially change selection and cleanup.
|
863
863
|
*/
|
@@ -865,15 +865,15 @@ SC.ViewDesigner = SC.Object.extend(
|
|
865
865
|
if (!this.get('designIsEnabled') || !this.get('parentDesignerIsRoot')) return NO ;
|
866
866
|
|
867
867
|
var info = this._mouseDownInfo;
|
868
|
-
|
868
|
+
|
869
869
|
// if selected on mouse down and we didn't do any dragging, then deselect.
|
870
870
|
if (info.selected && !info.dragged) {
|
871
|
-
|
871
|
+
|
872
872
|
// is the mouse still inside the view? If not, don't do anything...
|
873
873
|
var view = this.get('view'),
|
874
|
-
frame = view ? view.get('frame') : null,
|
874
|
+
frame = view ? view.get('frame') : null,
|
875
875
|
pview = view.get('parentView');
|
876
|
-
|
876
|
+
|
877
877
|
if (frame && pview) frame = pview.convertFrameToView(frame, null);
|
878
878
|
|
879
879
|
if (!frame || SC.pointInRect({ x: evt.pageX, y: evt.pageY }, frame)) {
|
@@ -886,19 +886,19 @@ SC.ViewDesigner = SC.Object.extend(
|
|
886
886
|
if(SC._Greenhouse && evt.clickCount === 2){
|
887
887
|
var dc = this.get('designController');
|
888
888
|
if(this.acceptRootDesigner && dc) {
|
889
|
-
dc.makeRootDesigner(this);
|
889
|
+
dc.makeRootDesigner(this);
|
890
890
|
}
|
891
891
|
else{
|
892
892
|
//TODO: [MB] decide if this is the functionality I want...
|
893
893
|
SC._Greenhouse.sendAction('openInspector', view);
|
894
894
|
}
|
895
895
|
}
|
896
|
-
|
896
|
+
|
897
897
|
this._mouseDownInfo = null;
|
898
|
-
|
898
|
+
|
899
899
|
return YES ;
|
900
900
|
},
|
901
|
-
|
901
|
+
|
902
902
|
/**
|
903
903
|
Called by `designerController` to reposition the view
|
904
904
|
*/
|
@@ -907,9 +907,9 @@ SC.ViewDesigner = SC.Object.extend(
|
|
907
907
|
this._mouseReposition(evt, info, this.HKEYS, layout);
|
908
908
|
this._mouseReposition(evt, info, this.VKEYS, layout);
|
909
909
|
this.set('layout', layout);
|
910
|
-
return this;
|
910
|
+
return this;
|
911
911
|
},
|
912
|
-
|
912
|
+
|
913
913
|
HKEYS: {
|
914
914
|
evtPoint: "pageX",
|
915
915
|
point: "x",
|
@@ -933,31 +933,31 @@ SC.ViewDesigner = SC.Object.extend(
|
|
933
933
|
size: "height",
|
934
934
|
anchor: "vanchor"
|
935
935
|
},
|
936
|
-
|
936
|
+
|
937
937
|
/**
|
938
938
|
Generic resizer. Must pass one set of keys: VKEYS, HKEYS
|
939
939
|
*/
|
940
940
|
_mouseResize: function(evt, info, keys, ret) {
|
941
|
-
|
941
|
+
|
942
942
|
var delta = evt[keys.evtPoint] - info[keys.point],
|
943
943
|
layout = info.layout,
|
944
944
|
view = this.get('view'),
|
945
945
|
min = this.get(keys.min),
|
946
946
|
max = this.get(keys.max),
|
947
|
-
|
947
|
+
|
948
948
|
headKey = keys.head,
|
949
949
|
tailKey = keys.tail,
|
950
950
|
centerKey = keys.center,
|
951
951
|
sizeKey = keys.size,
|
952
|
-
|
952
|
+
|
953
953
|
hasHead = !SC.none(layout[keys.head]),
|
954
954
|
hasTail = !SC.none(layout[keys.tail]),
|
955
955
|
hasCenter = !SC.none(layout[keys.center]),
|
956
|
-
hasSize = !SC.none(layout[keys.size]),
|
956
|
+
hasSize = !SC.none(layout[keys.size]),
|
957
957
|
w;
|
958
958
|
|
959
959
|
if (info[keys.anchor] === headKey) {
|
960
|
-
|
960
|
+
|
961
961
|
// if left aligned, adjust left size and width if set.
|
962
962
|
if (hasHead) {
|
963
963
|
if (hasSize) {
|
@@ -965,13 +965,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
965
965
|
ret[sizeKey] = Math.min(max, Math.max(min, Math.floor(layout[sizeKey] - delta)));
|
966
966
|
min = (layout[headKey]+w) - min;
|
967
967
|
max = (layout[headKey]+w) - max;
|
968
|
-
|
968
|
+
|
969
969
|
ret[headKey] = Math.max(max, Math.min(min, Math.floor(layout[headKey]+delta)));
|
970
|
-
|
970
|
+
|
971
971
|
} else {
|
972
972
|
ret[headKey] = Math.floor(layout[headKey]+delta);
|
973
973
|
}
|
974
|
-
|
974
|
+
|
975
975
|
// if right aligned or centered, adjust the width...
|
976
976
|
} else if (hasTail || hasCenter) {
|
977
977
|
if (hasCenter) delta *= 2;
|
@@ -981,7 +981,7 @@ SC.ViewDesigner = SC.Object.extend(
|
|
981
981
|
} else ret[headKey] = Math.floor((layout[headKey]||0)+delta);
|
982
982
|
|
983
983
|
} else if (info[keys.anchor] === tailKey) {
|
984
|
-
|
984
|
+
|
985
985
|
// reverse above
|
986
986
|
if (hasTail) {
|
987
987
|
|
@@ -990,13 +990,13 @@ SC.ViewDesigner = SC.Object.extend(
|
|
990
990
|
ret[sizeKey] = Math.min(max, Math.max(min, Math.floor(layout[sizeKey] + delta)));
|
991
991
|
min = (layout[tailKey]+w)-min;
|
992
992
|
max = (layout[tailKey]+w)-max;
|
993
|
-
|
993
|
+
|
994
994
|
ret[tailKey] = Math.max(max, Math.min(min, Math.floor(layout[tailKey]-delta)));
|
995
995
|
|
996
996
|
} else {
|
997
997
|
ret[tailKey] = Math.floor(layout[tailKey]-delta);
|
998
998
|
}
|
999
|
-
|
999
|
+
|
1000
1000
|
} else {
|
1001
1001
|
if (hasCenter) delta *= 2;
|
1002
1002
|
ret[sizeKey] = Math.max(min, Math.min(max, Math.floor((layout[sizeKey]||0)+delta)));
|
@@ -1005,81 +1005,81 @@ SC.ViewDesigner = SC.Object.extend(
|
|
1005
1005
|
|
1006
1006
|
return this;
|
1007
1007
|
},
|
1008
|
-
|
1008
|
+
|
1009
1009
|
_mouseReposition: function(evt, info, keys, ret) {
|
1010
1010
|
var delta = evt[keys.evtPoint] - info[keys.point],
|
1011
1011
|
layout = info[SC.keyFor('layout', SC.guidFor(this))],
|
1012
1012
|
view = this.get('view'),
|
1013
|
-
|
1013
|
+
|
1014
1014
|
headKey = keys.head,
|
1015
1015
|
tailKey = keys.tail,
|
1016
1016
|
centerKey = keys.center,
|
1017
1017
|
sizeKey = keys.size,
|
1018
|
-
|
1018
|
+
|
1019
1019
|
hasHead = !SC.none(layout[headKey]),
|
1020
1020
|
hasTail = !SC.none(layout[tailKey]),
|
1021
1021
|
hasCenter = !SC.none(layout[centerKey]),
|
1022
|
-
hasSize = !SC.none(layout[sizeKey]),
|
1022
|
+
hasSize = !SC.none(layout[sizeKey]),
|
1023
1023
|
w;
|
1024
1024
|
|
1025
1025
|
// auto-widths can't be repositioned
|
1026
1026
|
if (hasHead && hasTail && !hasSize) return NO ;
|
1027
|
-
|
1027
|
+
|
1028
1028
|
// left/top aligned, just adjust top/left location
|
1029
1029
|
if (hasHead) {
|
1030
1030
|
ret[headKey] = layout[headKey]+delta;
|
1031
|
-
|
1031
|
+
|
1032
1032
|
// right/bottom aligned, adjust bottom/right location
|
1033
1033
|
} else if (hasTail) {
|
1034
1034
|
ret[tailKey] = layout[tailKey]-delta;
|
1035
1035
|
|
1036
1036
|
} else if (hasCenter) {
|
1037
1037
|
ret[centerKey] = layout[centerKey]+delta;
|
1038
|
-
|
1038
|
+
|
1039
1039
|
} else ret[headKey] = (layout[headKey]||0)+delta;
|
1040
|
-
|
1040
|
+
|
1041
1041
|
return YES ;
|
1042
1042
|
},
|
1043
|
-
|
1043
|
+
|
1044
1044
|
// ..........................................................
|
1045
1045
|
// Drag data source (for binding lines)
|
1046
|
-
//
|
1046
|
+
//
|
1047
1047
|
/**
|
1048
|
-
This method must be overridden for drag operations to be allowed.
|
1048
|
+
This method must be overridden for drag operations to be allowed.
|
1049
1049
|
Return a bitwise OR'd mask of the drag operations allowed on the
|
1050
1050
|
specified target. If you don't care about the target, just return a
|
1051
1051
|
constant value.
|
1052
|
-
|
1052
|
+
|
1053
1053
|
@param {SC.View} dropTarget The proposed target of the drop.
|
1054
1054
|
@param {SC.Drag} drag The SC.Drag instance managing this drag.
|
1055
|
-
|
1055
|
+
|
1056
1056
|
*/
|
1057
1057
|
dragSourceOperationMaskFor: function(drag, dropTarget) {
|
1058
1058
|
return SC.DRAG_LINK;
|
1059
1059
|
},
|
1060
1060
|
|
1061
|
-
/**
|
1061
|
+
/**
|
1062
1062
|
This method is called when the drag begins. You can use this to do any
|
1063
|
-
visual highlighting to indicate that the receiver is the source of the
|
1063
|
+
visual highlighting to indicate that the receiver is the source of the
|
1064
1064
|
drag.
|
1065
|
-
|
1065
|
+
|
1066
1066
|
@param {SC.Drag} drag The Drag instance managing this drag.
|
1067
|
-
|
1068
|
-
@param {Point} loc The point in *window* coordinates where the drag
|
1069
|
-
began. You can use convertOffsetFromView() to convert this to local
|
1067
|
+
|
1068
|
+
@param {Point} loc The point in *window* coordinates where the drag
|
1069
|
+
began. You can use convertOffsetFromView() to convert this to local
|
1070
1070
|
coordinates.
|
1071
1071
|
*/
|
1072
1072
|
dragDidBegin: function(drag, loc) {
|
1073
1073
|
},
|
1074
|
-
|
1074
|
+
|
1075
1075
|
/**
|
1076
1076
|
This method is called whenever the drag image is moved. This is
|
1077
1077
|
similar to the `dragUpdated()` method called on drop targets.
|
1078
1078
|
|
1079
1079
|
@param {SC.Drag} drag The Drag instance managing this drag.
|
1080
1080
|
|
1081
|
-
@param {Point} loc The point in *window* coordinates where the drag
|
1082
|
-
mouse is. You can use convertOffsetFromView() to convert this to local
|
1081
|
+
@param {Point} loc The point in *window* coordinates where the drag
|
1082
|
+
mouse is. You can use convertOffsetFromView() to convert this to local
|
1083
1083
|
coordinates.
|
1084
1084
|
*/
|
1085
1085
|
dragDidMove: function(drag, loc) {
|
@@ -1097,19 +1097,19 @@ SC.ViewDesigner = SC.Object.extend(
|
|
1097
1097
|
}
|
1098
1098
|
}
|
1099
1099
|
},
|
1100
|
-
|
1101
|
-
/**
|
1100
|
+
|
1101
|
+
/**
|
1102
1102
|
This method is called when the drag ended. You can use this to do any
|
1103
1103
|
cleanup. The operation is the actual operation performed on the drag.
|
1104
|
-
|
1104
|
+
|
1105
1105
|
@param {SC.Drag} drag The drag instance managing the drag.
|
1106
|
-
|
1107
|
-
@param {Point} loc The point in WINDOW coordinates where the drag
|
1108
|
-
ended.
|
1109
|
-
|
1110
|
-
@param {DragOp} op The drag operation that was performed. One of
|
1106
|
+
|
1107
|
+
@param {Point} loc The point in WINDOW coordinates where the drag
|
1108
|
+
ended.
|
1109
|
+
|
1110
|
+
@param {DragOp} op The drag operation that was performed. One of
|
1111
1111
|
SC.DRAG_COPY, SC.DRAG_MOVE, SC.DRAG_LINK, or SC.DRAG_NONE.
|
1112
|
-
|
1112
|
+
|
1113
1113
|
*/
|
1114
1114
|
dragDidEnd: function(drag, loc, op) {
|
1115
1115
|
var dragLink = drag.dragLink;
|
@@ -1123,7 +1123,7 @@ if (!SC.View.Designer) SC.View.Designer = SC.ViewDesigner ;
|
|
1123
1123
|
// ..........................................................
|
1124
1124
|
// DESIGN NOTIFICATION METHODS
|
1125
1125
|
//
|
1126
|
-
// These methods are invoked automatically on the designer class whenever it
|
1126
|
+
// These methods are invoked automatically on the designer class whenever it
|
1127
1127
|
// is loaded.
|
1128
1128
|
|
1129
1129
|
SC.ViewDesigner.mixin({
|
@@ -1132,12 +1132,12 @@ SC.ViewDesigner.mixin({
|
|
1132
1132
|
ANCHOR_RIGHT: 0x0002,
|
1133
1133
|
ANCHOR_CENTERX: 0x0004,
|
1134
1134
|
ANCHOR_WIDTH: 0x0010,
|
1135
|
-
|
1135
|
+
|
1136
1136
|
ANCHOR_TOP: 0x0100,
|
1137
1137
|
ANCHOR_BOTTOM: 0x0200,
|
1138
1138
|
ANCHOR_CENTERY: 0x0400,
|
1139
1139
|
ANCHOR_HEIGHT: 0x1000,
|
1140
|
-
|
1140
|
+
|
1141
1141
|
/**
|
1142
1142
|
Invoked whenever a designed view is loaded. This will save the design
|
1143
1143
|
attributes for later use by a designer.
|
@@ -1149,34 +1149,34 @@ SC.ViewDesigner.mixin({
|
|
1149
1149
|
},
|
1150
1150
|
|
1151
1151
|
/**
|
1152
|
-
Invoked whenever a location is applied to a designed view. Saves the
|
1152
|
+
Invoked whenever a location is applied to a designed view. Saves the
|
1153
1153
|
attributes separately for use by the design view.
|
1154
1154
|
*/
|
1155
1155
|
didLoadLocalization: function(designedView, attrs) {
|
1156
1156
|
// nothing to do for now.
|
1157
1157
|
},
|
1158
|
-
|
1158
|
+
|
1159
1159
|
/**
|
1160
|
-
Invoked whenver a view is created. This will create a peer designer if
|
1160
|
+
Invoked whenver a view is created. This will create a peer designer if
|
1161
1161
|
needed.
|
1162
1162
|
*/
|
1163
1163
|
didCreateView: function(view, attrs) {
|
1164
1164
|
// add designer if page is in design mode
|
1165
1165
|
var page = view.get('page'), design = view.constructor;
|
1166
|
-
|
1166
|
+
|
1167
1167
|
if (design.isDesign && page && page.get('needsDesigner')) {
|
1168
|
-
|
1168
|
+
|
1169
1169
|
// find the designer class
|
1170
1170
|
var cur = design, origDesign = design;
|
1171
1171
|
while(cur && !cur.Designer) cur = cur.superclass;
|
1172
1172
|
var DesignerClass = (cur) ? cur.Designer : SC.View.Designer;
|
1173
|
-
|
1173
|
+
|
1174
1174
|
// next find the first superclass view that is not a design (and a real
|
1175
|
-
// class). This is important to make sure that we can determine the
|
1175
|
+
// class). This is important to make sure that we can determine the
|
1176
1176
|
// real name of a view's class.
|
1177
1177
|
while (design && design.isDesign) design = design.superclass;
|
1178
1178
|
if (!design) design = SC.View;
|
1179
|
-
|
1179
|
+
|
1180
1180
|
view.designer = DesignerClass.create({
|
1181
1181
|
view: view,
|
1182
1182
|
viewClass: design,
|
@@ -1185,13 +1185,13 @@ SC.ViewDesigner.mixin({
|
|
1185
1185
|
});
|
1186
1186
|
}
|
1187
1187
|
}
|
1188
|
-
|
1188
|
+
|
1189
1189
|
});
|
1190
1190
|
|
1191
1191
|
|
1192
1192
|
// ..........................................................
|
1193
1193
|
// FIXUP SC.View
|
1194
|
-
//
|
1194
|
+
//
|
1195
1195
|
|
1196
1196
|
SC.View.prototype._orig_respondsTo = SC.View.prototype.respondsTo;
|
1197
1197
|
SC.View.prototype._orig_tryToPerform = SC.View.prototype.tryToPerform;
|
@@ -1218,8 +1218,8 @@ SC.View.prototype.respondsTo = function( methodName ) {
|
|
1218
1218
|
}
|
1219
1219
|
};
|
1220
1220
|
|
1221
|
-
/**
|
1222
|
-
If the view has a designer, give it an opportunity to handle an event
|
1221
|
+
/**
|
1222
|
+
If the view has a designer, give it an opportunity to handle an event
|
1223
1223
|
before passing it on to the main view.
|
1224
1224
|
*/
|
1225
1225
|
/*SC.View.prototype.tryToPerform = function(methodName, arg1, arg2) {
|
@@ -1240,7 +1240,7 @@ SC.View.prototype.tryToPerform = function(methodName, arg1, arg2) {
|
|
1240
1240
|
|
1241
1241
|
|
1242
1242
|
/*
|
1243
|
-
If the view has a designer, also call designers didCreateLayer method to
|
1243
|
+
If the view has a designer, also call designers didCreateLayer method to
|
1244
1244
|
allow drawing.
|
1245
1245
|
*/
|
1246
1246
|
SC.View.prototype.createLayer = function() {
|
@@ -1250,7 +1250,7 @@ SC.View.prototype.createLayer = function() {
|
|
1250
1250
|
};
|
1251
1251
|
|
1252
1252
|
/*
|
1253
|
-
If the view has a designer, also call the designer's didUpdateLayer method
|
1253
|
+
If the view has a designer, also call the designer's didUpdateLayer method
|
1254
1254
|
to allow drawing.
|
1255
1255
|
*/
|
1256
1256
|
SC.View.prototype.updateLayer = function() {
|