sproutcore 1.5.0.rc.1 → 1.5.0.rc.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (193) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION.yml +1 -1
  3. data/lib/frameworks/sproutcore/Buildfile +9 -4
  4. data/lib/frameworks/sproutcore/README.md +1 -0
  5. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Preview.pdf +0 -0
  6. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/QuickLook/Thumbnail.tiff +0 -0
  7. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/data.plist +0 -0
  8. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image10.png +0 -0
  9. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image11.png +0 -0
  10. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image13.png +0 -0
  11. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image15.png +0 -0
  12. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image16.png +0 -0
  13. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image17.png +0 -0
  14. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image18.png +0 -0
  15. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image19.png +0 -0
  16. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image22.tiff +0 -0
  17. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image23.png +0 -0
  18. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image24.png +0 -0
  19. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image25.png +0 -0
  20. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image30.png +0 -0
  21. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image31.png +0 -0
  22. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image8.png +0 -0
  23. data/lib/frameworks/sproutcore/design/{TestRunner_Design.gaffle → TestRunner_Design.graffle}/image9.png +0 -0
  24. data/lib/frameworks/sproutcore/frameworks/animation/core.js +23 -25
  25. data/lib/frameworks/sproutcore/frameworks/bootstrap/system/browser.js +160 -0
  26. data/lib/frameworks/sproutcore/frameworks/core_foundation/controllers/array.js +73 -82
  27. data/lib/frameworks/sproutcore/frameworks/core_foundation/core.js +1 -3
  28. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/bind.js +110 -7
  29. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/collection.js +10 -7
  30. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/localization.js +1 -1
  31. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions → core_foundation/ext/handlebars}/view.js +4 -2
  32. data/lib/frameworks/sproutcore/frameworks/{handlebars/extensions.js → core_foundation/ext/handlebars.js} +0 -57
  33. data/lib/frameworks/sproutcore/frameworks/core_foundation/ext/object.js +1 -3
  34. data/lib/frameworks/sproutcore/frameworks/core_foundation/mixins/template_helpers/text_field_support.js +11 -0
  35. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/main.js +1 -3
  36. data/lib/frameworks/sproutcore/frameworks/core_foundation/panes/pane.js +2 -4
  37. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/application.js +14 -16
  38. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/builder.js +29 -37
  39. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/datetime.js +0 -0
  40. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/event.js +71 -19
  41. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/locale.js +3 -7
  42. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/page.js +5 -7
  43. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/selection_set.js +1 -3
  44. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/sparse_array.js +4 -0
  45. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/timer.js +21 -27
  46. data/lib/frameworks/sproutcore/frameworks/core_foundation/system/utils.js +3 -5
  47. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/array/array_case.js +3 -3
  48. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/controllers/object/single_enumerable_case.js +1 -1
  49. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/system/sparse_array.js +1 -1
  50. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/template/handlebars.js +93 -1
  51. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/clippingFrame.js +1 -1
  52. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/convertLayouts.js +13 -11
  53. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layer.js +2 -6
  54. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/layoutStyle.js +4 -4
  55. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/theme.js +2 -0
  56. data/lib/frameworks/sproutcore/frameworks/core_foundation/tests/views/view/view.js +4 -4
  57. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template.js +6 -2
  58. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/template_collection.js +87 -32
  59. data/lib/frameworks/sproutcore/frameworks/core_foundation/views/view/layout.js +21 -25
  60. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/cascade.js +15 -19
  61. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/data_source.js +114 -167
  62. data/lib/frameworks/sproutcore/frameworks/datastore/data_sources/fixtures.js +4 -4
  63. data/lib/frameworks/sproutcore/frameworks/datastore/models/child_attribute.js +4 -6
  64. data/lib/frameworks/sproutcore/frameworks/datastore/models/children_attribute.js +2 -4
  65. data/lib/frameworks/sproutcore/frameworks/datastore/models/fetched_attribute.js +7 -7
  66. data/lib/frameworks/sproutcore/frameworks/datastore/models/many_attribute.js +18 -20
  67. data/lib/frameworks/sproutcore/frameworks/datastore/models/record.js +74 -72
  68. data/lib/frameworks/sproutcore/frameworks/datastore/models/record_attribute.js +36 -29
  69. data/lib/frameworks/sproutcore/frameworks/datastore/models/single_attribute.js +2 -2
  70. data/lib/frameworks/sproutcore/frameworks/datastore/system/child_array.js +97 -78
  71. data/lib/frameworks/sproutcore/frameworks/datastore/system/many_array.js +117 -97
  72. data/lib/frameworks/sproutcore/frameworks/datastore/system/nested_store.js +13 -13
  73. data/lib/frameworks/sproutcore/frameworks/datastore/system/query.js +111 -108
  74. data/lib/frameworks/sproutcore/frameworks/datastore/system/record_array.js +231 -198
  75. data/lib/frameworks/sproutcore/frameworks/datastore/system/store.js +146 -145
  76. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/query/builders.js +21 -21
  77. data/lib/frameworks/sproutcore/frameworks/datastore/tests/system/record_array/flush.js +49 -50
  78. data/lib/frameworks/sproutcore/frameworks/datetime/{system → frameworks/core/system}/datetime.js +122 -171
  79. data/lib/frameworks/sproutcore/frameworks/datetime/{tests → frameworks/core/tests}/system/datetime.js +0 -0
  80. data/lib/frameworks/sproutcore/frameworks/datetime/{resources → frameworks/localized/resources}/strings.js +0 -0
  81. data/lib/frameworks/sproutcore/frameworks/datetime/frameworks/localized/system/datetime.js +91 -0
  82. data/lib/frameworks/sproutcore/frameworks/desktop/core.js +18 -2
  83. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/border.js +23 -16
  84. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_fast_path.js +56 -45
  85. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_group.js +5 -2
  86. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_row_delegate.js +21 -19
  87. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/collection_view_delegate.js +82 -77
  88. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/navigation_builder.js +18 -12
  89. data/lib/frameworks/sproutcore/frameworks/desktop/mixins/scrollable.js +29 -17
  90. data/lib/frameworks/sproutcore/frameworks/desktop/panes/alert.js +148 -107
  91. data/lib/frameworks/sproutcore/frameworks/desktop/panes/menu.js +31 -16
  92. data/lib/frameworks/sproutcore/frameworks/desktop/panes/modal.js +16 -13
  93. data/lib/frameworks/sproutcore/frameworks/desktop/panes/palette.js +38 -17
  94. data/lib/frameworks/sproutcore/frameworks/desktop/panes/panel.js +37 -25
  95. data/lib/frameworks/sproutcore/frameworks/desktop/panes/picker.js +247 -144
  96. data/lib/frameworks/sproutcore/frameworks/desktop/panes/select_button.js +155 -100
  97. data/lib/frameworks/sproutcore/frameworks/desktop/panes/sheet.js +39 -17
  98. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_data_source.js +9 -6
  99. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drag_source.js +18 -22
  100. data/lib/frameworks/sproutcore/frameworks/desktop/protocols/drop_target.js +27 -17
  101. data/lib/frameworks/sproutcore/frameworks/desktop/system/drag.js +77 -44
  102. data/lib/frameworks/sproutcore/frameworks/desktop/system/undo_manager.js +68 -33
  103. data/lib/frameworks/sproutcore/frameworks/desktop/views/button.js +168 -110
  104. data/lib/frameworks/sproutcore/frameworks/desktop/views/checkbox.js +37 -5
  105. data/lib/frameworks/sproutcore/frameworks/desktop/views/collection.js +187 -123
  106. data/lib/frameworks/sproutcore/frameworks/desktop/views/date_field.js +73 -49
  107. data/lib/frameworks/sproutcore/frameworks/desktop/views/disclosure.js +34 -9
  108. data/lib/frameworks/sproutcore/frameworks/desktop/views/file.js +51 -14
  109. data/lib/frameworks/sproutcore/frameworks/desktop/views/grid.js +38 -8
  110. data/lib/frameworks/sproutcore/frameworks/desktop/views/image_button.js +15 -9
  111. data/lib/frameworks/sproutcore/frameworks/desktop/views/list.js +54 -34
  112. data/lib/frameworks/sproutcore/frameworks/desktop/views/list_item.js +113 -42
  113. data/lib/frameworks/sproutcore/frameworks/desktop/views/master_detail.js +84 -28
  114. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_item.js +67 -51
  115. data/lib/frameworks/sproutcore/frameworks/desktop/views/menu_scroll.js +122 -35
  116. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation.js +40 -16
  117. data/lib/frameworks/sproutcore/frameworks/desktop/views/navigation_bar.js +28 -18
  118. data/lib/frameworks/sproutcore/frameworks/desktop/views/popup_button.js +27 -31
  119. data/lib/frameworks/sproutcore/frameworks/desktop/views/progress.js +118 -68
  120. data/lib/frameworks/sproutcore/frameworks/desktop/views/radio.js +117 -61
  121. data/lib/frameworks/sproutcore/frameworks/desktop/views/scene.js +23 -16
  122. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroll.js +241 -77
  123. data/lib/frameworks/sproutcore/frameworks/desktop/views/scroller.js +134 -69
  124. data/lib/frameworks/sproutcore/frameworks/desktop/views/segment.js +107 -25
  125. data/lib/frameworks/sproutcore/frameworks/desktop/views/segmented.js +125 -48
  126. data/lib/frameworks/sproutcore/frameworks/desktop/views/select.js +165 -69
  127. data/lib/frameworks/sproutcore/frameworks/desktop/views/select_field.js +73 -24
  128. data/lib/frameworks/sproutcore/frameworks/desktop/views/separator.js +19 -5
  129. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list.js +16 -4
  130. data/lib/frameworks/sproutcore/frameworks/desktop/views/source_list_group.js +14 -7
  131. data/lib/frameworks/sproutcore/frameworks/desktop/views/split.js +43 -37
  132. data/lib/frameworks/sproutcore/frameworks/desktop/views/split_divider.js +8 -1
  133. data/lib/frameworks/sproutcore/frameworks/desktop/views/stacked.js +14 -3
  134. data/lib/frameworks/sproutcore/frameworks/desktop/views/static_content.js +16 -2
  135. data/lib/frameworks/sproutcore/frameworks/desktop/views/tab.js +99 -0
  136. data/lib/frameworks/sproutcore/frameworks/desktop/views/thumb.js +13 -1
  137. data/lib/frameworks/sproutcore/frameworks/desktop/views/toolbar.js +58 -8
  138. data/lib/frameworks/sproutcore/frameworks/desktop/views/web.js +34 -18
  139. data/lib/frameworks/sproutcore/frameworks/desktop/views/well.js +25 -9
  140. data/lib/frameworks/sproutcore/frameworks/desktop/views/workspace.js +70 -36
  141. data/lib/frameworks/sproutcore/frameworks/foundation/controllers/tree.js +10 -5
  142. data/lib/frameworks/sproutcore/frameworks/foundation/debug/control_test_pane.js +28 -17
  143. data/lib/frameworks/sproutcore/frameworks/foundation/delegates/inline_text_field.js +41 -43
  144. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/pinch.js +42 -4
  145. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/swipe.js +94 -4
  146. data/lib/frameworks/sproutcore/frameworks/foundation/gestures/tap.js +41 -1
  147. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_mixin.js +2 -0
  148. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/auto_resize.js +18 -9
  149. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/collection_content.js +7 -5
  150. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_display.js +7 -8
  151. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/content_value_support.js +34 -24
  152. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/control.js +48 -18
  153. data/lib/frameworks/sproutcore/frameworks/foundation/mixins/inline_text_field.js +1 -0
  154. data/lib/frameworks/sproutcore/frameworks/foundation/system/utils/misc.js +1 -2
  155. data/lib/frameworks/sproutcore/frameworks/foundation/tasks/preload_bundle.js +1 -1
  156. data/lib/frameworks/sproutcore/frameworks/foundation/tests/mixins/inline_text_field/beginEditing.js +0 -11
  157. data/lib/frameworks/sproutcore/frameworks/foundation/validators/date_time.js +1 -1
  158. data/lib/frameworks/sproutcore/frameworks/foundation/views/text_field.js +8 -0
  159. data/lib/frameworks/sproutcore/frameworks/qunit/README.md +24 -0
  160. data/lib/frameworks/sproutcore/frameworks/qunit/package.json +21 -0
  161. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.css +215 -0
  162. data/lib/frameworks/sproutcore/frameworks/qunit/qunit/qunit.js +1442 -0
  163. data/lib/frameworks/sproutcore/frameworks/qunit/test/headless.html +24 -0
  164. data/lib/frameworks/sproutcore/frameworks/qunit/test/index.html +18 -0
  165. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.html +17 -0
  166. data/lib/frameworks/sproutcore/frameworks/qunit/test/logs.js +150 -0
  167. data/lib/frameworks/sproutcore/frameworks/qunit/test/same.js +1421 -0
  168. data/lib/frameworks/sproutcore/frameworks/qunit/test/test.js +314 -0
  169. data/lib/frameworks/sproutcore/frameworks/runtime/core.js +1 -1
  170. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/array.js +369 -60
  171. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/enumerable.js +2 -405
  172. data/lib/frameworks/sproutcore/frameworks/runtime/mixins/observable.js +3 -9
  173. data/lib/frameworks/sproutcore/frameworks/runtime/private/property_chain.js +50 -45
  174. data/lib/frameworks/sproutcore/frameworks/runtime/system/binding.js +20 -1
  175. data/lib/frameworks/sproutcore/frameworks/runtime/system/object.js +0 -9
  176. data/lib/frameworks/sproutcore/frameworks/runtime/tests/core/guidFor.js +1 -1
  177. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/array.js +36 -14
  178. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable.js +0 -34
  179. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/enumerable/enumerable_observers.js +50 -61
  180. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/observable.js +2 -2
  181. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/propertyChanges.js +1 -1
  182. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/observable/registerDependentKeys.js +45 -1
  183. data/lib/frameworks/sproutcore/frameworks/runtime/tests/mixins/propertyChanges.js +1 -1
  184. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/bindings.js +5 -0
  185. data/lib/frameworks/sproutcore/frameworks/runtime/tests/system/object/enhance.js +1 -1
  186. data/lib/frameworks/sproutcore/frameworks/testing/core.js +3 -0
  187. data/lib/frameworks/sproutcore/frameworks/testing/system/plan.js +0 -1
  188. data/lib/frameworks/sproutcore/frameworks/testing/system/runner.js +0 -1
  189. data/lib/gen/html_app/templates/apps/@target_name@/@target_name@.js +1 -1
  190. data/vendor/chance/lib/chance/instance.rb +8 -6
  191. metadata +41 -31
  192. data/lib/frameworks/sproutcore/frameworks/testing/jquery.js +0 -3559
  193. data/lib/frameworks/sproutcore/frameworks/testing/qunit.js +0 -827
@@ -5,13 +5,39 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
- // ..........................................................
9
- // CONSTANTS
10
- //
8
+ /**
9
+ @static
10
+ @constant
11
+ @type String
12
+ */
11
13
  SC.TOGGLE_BEHAVIOR = 'toggle';
14
+
15
+ /**
16
+ @static
17
+ @constant
18
+ @type String
19
+ */
12
20
  SC.PUSH_BEHAVIOR = 'push';
21
+
22
+ /**
23
+ @static
24
+ @constant
25
+ @type String
26
+ */
13
27
  SC.TOGGLE_ON_BEHAVIOR = 'on';
28
+
29
+ /**
30
+ @static
31
+ @constant
32
+ @type String
33
+ */
14
34
  SC.TOGGLE_OFF_BEHAVIOR = 'off';
35
+
36
+ /**
37
+ @static
38
+ @constant
39
+ @type String
40
+ */
15
41
  SC.HOLD_BEHAVIOR = 'hold';
16
42
 
17
43
  /** @class
@@ -34,10 +60,20 @@ SC.ButtonView = SC.View.extend(SC.Control,
34
60
  /** @scope SC.ButtonView.prototype */ {
35
61
 
36
62
  /**
37
- The HTML representation of SC.ButtonView contains the 'sc-button-view'
38
- class.
63
+ Tied to the isEnabled state
64
+
65
+ @type Boolean
66
+ @default YES
67
+ */
68
+ acceptsFirstResponder: function() {
69
+ if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
70
+ else return NO;
71
+ }.property('isEnabled'),
39
72
 
40
- @property {Array}
73
+ /**
74
+ @type Array
75
+ @default ['sc-button-view']
76
+ @see SC.View#classNames
41
77
  */
42
78
  classNames: ['sc-button-view'],
43
79
 
@@ -45,12 +81,14 @@ SC.ButtonView = SC.View.extend(SC.Control,
45
81
  The theme to apply to the button. By default, a subtheme with the name of
46
82
  'square' is created for backwards-compatibility.
47
83
 
48
- @property {String}
84
+ @type String
85
+ @default 'square'
49
86
  */
50
87
  themeName: 'square',
51
88
 
89
+
52
90
  // ..........................................................
53
- // VALUE PROPERTIES
91
+ // Value Handling
54
92
  //
55
93
 
56
94
  /**
@@ -65,50 +103,52 @@ SC.ButtonView = SC.View.extend(SC.Control,
65
103
  YES or NO, the button will do its best to convert a value to an
66
104
  appropriate state:
67
105
 
68
- - null, false, 0 -> isSelected = false
69
- - any other single value -> isSelected = true
70
- - array -> if all values are the same state: that state. otherwise MIXED.
106
+ - null, false, 0 -> isSelected = false
107
+ - any other single value -> isSelected = true
108
+ - array -> if all values are the same state: that state. otherwise MIXED.
71
109
 
72
- @property {Object}
110
+ @type Object
111
+ @default null
73
112
  */
74
113
  value: null,
75
114
 
76
115
  /**
77
116
  Value of a selected toggle button.
78
-
79
- for a toggle button, set this to any object value you want. The button
80
- will be selected if the value property equals the targetValue. If the
117
+
118
+ For a toggle button, set this to any object value you want. The button
119
+ will be selected if the value property equals the targetValue. If the
81
120
  value is an array of multiple items that contains the targetValue, then
82
121
  the button will be set to a mixed state.
83
-
122
+
84
123
  default is YES
85
124
 
86
- @property {Object}
125
+ @type Boolean|Object
126
+ @default YES
87
127
  */
88
128
  toggleOnValue: YES,
89
129
 
90
130
  /**
91
131
  Value of an unselected toggle button.
92
-
132
+
93
133
  For a toggle button, set this to any object value you want. When the
94
134
  user toggle's the button off, the value of the button will be set to this
95
135
  value.
96
-
97
- default is NO
98
-
99
- @property {Object}
136
+
137
+ @type Boolean|Object
138
+ @default NO
100
139
  */
101
140
  toggleOffValue: NO,
102
141
 
103
142
 
104
143
  // ..........................................................
105
- // TITLE
144
+ // Title Handling
106
145
  //
107
146
 
108
147
  /**
109
148
  If YES, then the title will be localized.
110
149
 
111
- @property {Boolean}
150
+ @type Boolean
151
+ @default NO
112
152
  */
113
153
  localize: NO,
114
154
 
@@ -118,24 +158,27 @@ SC.ButtonView = SC.View.extend(SC.Control,
118
158
  /**
119
159
  The button title. If localize is YES, then this should be the localization key to display. Otherwise, this will be the actual string displayed in the title. This property is observable and bindable.
120
160
 
121
- @property {String}
122
- */
123
- title: '',
161
+ @type String
162
+ @default ""
163
+ */
164
+ title: "",
124
165
 
125
166
  /**
126
- If you set this property, the title property will be updated automatically
167
+ If set, the title property will be updated automatically
127
168
  from the content using the key you specify.
128
169
 
129
- @property {String}
170
+ @type String
171
+ @default null
130
172
  */
131
173
  contentTitleKey: null,
132
174
 
133
175
  /**
134
- The button icon. Set this to either a URL or a CSS class name (for
135
- spriting). Note that if you pass a URL, it must contain at
176
+ The button icon. Set this to either a URL or a CSS class name (for
177
+ spriting). Note that if you pass a URL, it must contain at
136
178
  least one slash to be detected as such.
137
179
 
138
- @property {String}
180
+ @type String
181
+ @default null
139
182
  */
140
183
  icon: null,
141
184
 
@@ -143,24 +186,27 @@ SC.ButtonView = SC.View.extend(SC.Control,
143
186
  If you set this property, the icon will be updated automatically from the
144
187
  content using the key you specify.
145
188
 
146
- @property {String}
189
+ @type String
190
+ @default null
147
191
  */
148
192
  contentIconKey: null,
149
193
 
150
194
  /**
151
- If YES, button will attempt to display an ellipsis if the title cannot
152
- fit inside of the visible area. This feature is not available on all
195
+ If YES, button will attempt to display an ellipsis if the title cannot
196
+ fit inside of the visible area. This feature is not available on all
153
197
  browsers.
154
198
 
155
- @property {Boolean}
199
+ @type Boolean
200
+ @default YES
156
201
  */
157
202
  needsEllipsis: YES,
158
203
 
159
204
  /**
160
- The computed display title. This is generated by localizing the title
161
- property if necessary.
205
+ This is generated by localizing the title property if necessary.
162
206
 
163
- @property {String}
207
+ @type String
208
+ @observes 'title'
209
+ @observes 'localize'
164
210
  */
165
211
  displayTitle: function() {
166
212
  var ret = this.get('title');
@@ -170,10 +216,12 @@ SC.ButtonView = SC.View.extend(SC.Control,
170
216
  /**
171
217
  The key equivalent that should trigger this button on the page.
172
218
 
173
- @property {String}
219
+ @type String
220
+ @default null
174
221
  */
175
222
  keyEquivalent: null,
176
223
 
224
+
177
225
  // ..........................................................
178
226
  // BEHAVIOR
179
227
  //
@@ -182,18 +230,20 @@ SC.ButtonView = SC.View.extend(SC.Control,
182
230
  The behavioral mode of this button.
183
231
 
184
232
  Possible values are:
185
- - *SC.PUSH_BEHAVIOR* Pressing the button will trigger an action tied to the
186
- button. Does not change the value of the button.
187
- - *SC.TOGGLE_BEHAVIOR* Pressing the button will invert the current value of
188
- the button. If the button has a mixed value, it will be set to true.
189
- - *SC.TOGGLE_ON_BEHAVIOR* Pressing the button will set the current state to
190
- true no matter the previous value.
191
- - *SC.TOGGLE_OFF_BEHAVIOR* Pressing the button will set the current state to
192
- false no matter the previous value.
193
- - *SC.HOLD_BEHAVIOR* Pressing the button will cause the action to repeat at a
194
- regular interval specifed by 'holdInterval'
195
-
196
- @property {String}
233
+
234
+ - *SC.PUSH_BEHAVIOR* Pressing the button will trigger an action tied to the
235
+ button. Does not change the value of the button.
236
+ - *SC.TOGGLE_BEHAVIOR* Pressing the button will invert the current value of
237
+ the button. If the button has a mixed value, it will be set to true.
238
+ - *SC.TOGGLE_ON_BEHAVIOR* Pressing the button will set the current state to
239
+ true no matter the previous value.
240
+ - *SC.TOGGLE_OFF_BEHAVIOR* Pressing the button will set the current state to
241
+ false no matter the previous value.
242
+ - *SC.HOLD_BEHAVIOR* Pressing the button will cause the action to repeat at a
243
+ regular interval specifed by 'holdInterval'
244
+
245
+ @type String
246
+ @default SC.PUSH_BEHAVIOR
197
247
  */
198
248
  buttonBehavior: SC.PUSH_BEHAVIOR,
199
249
 
@@ -201,7 +251,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
201
251
  If buttonBehavior is SC.HOLD_BEHAVIOR, this specifies, in milliseconds,
202
252
  how often to trigger the action. Ignored for other behaviors.
203
253
 
204
- @property {Number}
254
+ @type Number
255
+ @default 100
205
256
  */
206
257
  holdInterval: 100,
207
258
 
@@ -211,7 +262,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
211
262
  This is the same as setting the keyEquivalent to 'return'. This will also
212
263
  apply the "def" classname to the button.
213
264
 
214
- @property {Boolean}
265
+ @type Boolean
266
+ @default NO
215
267
  */
216
268
  isDefault: NO,
217
269
  isDefaultBindingDefault: SC.Binding.oneWay().bool(),
@@ -220,7 +272,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
220
272
  If YES, then this button will be triggered when you hit escape.
221
273
  This is the same as setting the keyEquivalent to 'escape'.
222
274
 
223
- @property {Boolean}
275
+ @type Boolean
276
+ @default NO
224
277
  */
225
278
  isCancel: NO,
226
279
  isCancelBindingDefault: SC.Binding.oneWay().bool(),
@@ -242,7 +295,8 @@ SC.ButtonView = SC.View.extend(SC.Control,
242
295
  clicked. It is generally better to use the target/action approach and
243
296
  to implement your code in a controller of some type.
244
297
 
245
- @property {String}
298
+ @type String
299
+ @default null
246
300
  */
247
301
  action: null,
248
302
 
@@ -254,52 +308,44 @@ SC.ButtonView = SC.View.extend(SC.Control,
254
308
  null, then the button will search the responder chain for a view that
255
309
  implements the action when the button is pressed instead.
256
310
 
257
- @property {Object}
311
+ @type Object
312
+ @default null
258
313
  */
259
314
  target: null,
260
315
 
261
- /**
262
- If YES, use a focus ring.
263
-
264
- TODO: When is this property ever changed? Is this redundant with
316
+ /*
317
+ TODO When is this property ever changed? Is this redundant with
265
318
  render delegates since it can now be turned on on a theme-by-theme
266
319
  basis? --TD
320
+ */
321
+ /**
322
+ If YES, use a focus ring.
267
323
 
268
- @property {Boolean}
324
+ @type Boolean
325
+ @default NO
269
326
  */
270
327
  supportFocusRing: NO,
271
328
 
272
- //
329
+ // ..........................................................
273
330
  // Auto Resize Support
331
+ //
332
+ //
274
333
  // These properties are provided so that SC.AutoResize can be mixed in
275
334
  // to enable automatic resizing of the button.
276
335
  //
277
- /**
278
- SC.ButtonView supports automatic resizing.
279
336
 
280
- @private
281
- @property
282
- */
337
+ /** @private */
283
338
  supportsAutoResize: YES,
284
339
 
285
- /**
286
- The layer for autoresizing buttons is the button layer itself.
287
-
288
- TODO: get this from the render delegate so other elements may be used.
289
-
290
- @private
291
- @property
340
+ /*
341
+ TODO get this from the render delegate so other elements may be used.
292
342
  */
343
+ /** @private */
293
344
  autoResizeLayer: function() {
294
345
  return this.get('layer');
295
346
  }.property('layer').cacheable(),
296
347
 
297
- /**
298
- The text to be used to automatically resize the view: the displayTitle.
299
-
300
- @private
301
- @property
302
- */
348
+ /** @private */
303
349
  autoResizeText: function() {
304
350
  return this.get('displayTitle');
305
351
  }.property('displayTitle').cacheable(),
@@ -312,7 +358,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
312
358
  to 10.
313
359
 
314
360
  @default 10
315
- @property
361
+ @type Number
316
362
  */
317
363
  autoResizePadding: SC.propertyFromRenderDelegate('autoResizePadding', 10),
318
364
 
@@ -330,7 +376,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
330
376
  Does nothing if the button is disabled.
331
377
 
332
378
  @param {Event} evt
333
- @returns {Boolean} success/failure of the request
379
+ @returns {Boolean} YES if successful, NO otherwise
334
380
  */
335
381
  triggerActionAfterDelay: function(evt) {
336
382
  // If this button is disabled, we have nothing to do
@@ -365,6 +411,9 @@ SC.ButtonView = SC.View.extend(SC.Control,
365
411
  */
366
412
  didTriggerAction: function() {},
367
413
 
414
+ /*
415
+ TODO Why is this not set by the theme? --TD
416
+ */
368
417
  /**
369
418
  The minimum width the button title should consume. This property is used
370
419
  when generating the HTML styling for the title itself. The default
@@ -374,15 +423,16 @@ SC.ButtonView = SC.View.extend(SC.Control,
374
423
  Note that the title width does not exactly match the width of the button
375
424
  itself. Extra padding added by the theme can impact the final total
376
425
  size.
377
-
378
- TODO: Why is this not set by the theme? --TD
379
426
 
380
- @property {Number}
427
+ @type Number
428
+ @default 80
381
429
  */
382
430
  titleMinWidth: 80,
383
431
 
432
+
384
433
  // ................................................................
385
434
  // INTERNAL SUPPORT
435
+ //
386
436
 
387
437
  /** @private - save keyEquivalent for later use */
388
438
  init: function() {
@@ -398,11 +448,15 @@ SC.ButtonView = SC.View.extend(SC.Control,
398
448
 
399
449
  // if value is not null, update isSelected to match value. If value is
400
450
  // null, we assume you may be using isSelected only.
401
- if (!SC.none(this.get('value'))) this._button_valueDidChange();
451
+ if (!SC.none(this.get('value'))) this._button_valueDidChange();
402
452
  },
403
453
 
404
454
  /**
405
455
  The WAI-ARIA role of the button.
456
+
457
+ @type String
458
+ @default 'button'
459
+ @readOnly
406
460
  */
407
461
  ariaRole: 'button',
408
462
 
@@ -410,11 +464,15 @@ SC.ButtonView = SC.View.extend(SC.Control,
410
464
  // isCancel and isDefault also cause a refresh but this is implemented as
411
465
  // a separate observer (see below)
412
466
 
413
- /** @private
467
+ /**
414
468
  The following properties affect how SC.ButtonView is rendered, and will
415
469
  cause the view to be rerendered if they change.
416
470
 
417
- @property {Array}
471
+ @type Array
472
+ @default [
473
+ 'icon', 'displayTitle', 'value', 'displayToolTip', 'isDefault', 'isCancel',
474
+ 'escapeHTML', 'needsEllipsis', 'hint', 'titleMinWidth', 'supportFocusRing'
475
+ ]
418
476
  */
419
477
  displayProperties: [
420
478
  'icon', 'displayTitle', 'value', 'displayToolTip', 'isDefault', 'isCancel',
@@ -428,16 +486,17 @@ SC.ButtonView = SC.View.extend(SC.Control,
428
486
  In this case, the 'button' property will be retrieved from the theme and
429
487
  set to the render delegate of this view.
430
488
 
431
- @property {String}
489
+ @type String
490
+ @default 'buttonRenderDelegate'
432
491
  */
433
492
  renderDelegateName: 'buttonRenderDelegate',
434
493
 
435
494
  /**
436
- Updates the value, title, and icon keys based on the content object, if
495
+ Updates the value, title, and icon keys based on the content object, if
437
496
  set.
438
497
 
439
- @property {Object} target the target of the object that changed
440
- @property {String} key name of property that changed
498
+ @type {Object} target the target of the object that changed
499
+ @type {String} key name of property that changed
441
500
  @returns {SC.ButtonView} receiver
442
501
  */
443
502
  contentPropertyDidChange: function(target, key) {
@@ -540,7 +599,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
540
599
  return state ;
541
600
  },
542
601
 
543
- /** @private
602
+ /** @private
544
603
  Whenever the button value changes, update the selected state to match.
545
604
  */
546
605
  _button_valueDidChange: function() {
@@ -573,7 +632,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
573
632
  keyEquivalent property to 'return'. This cached value is used to restore
574
633
  the keyEquivalent property if isDefault is set back to NO.
575
634
 
576
- @property {String}
635
+ @type String
577
636
  */
578
637
  _defaultKeyEquivalent: null,
579
638
 
@@ -616,7 +675,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
616
675
  }
617
676
  }
618
677
 
619
- return YES ;
678
+ return YES;
620
679
  },
621
680
 
622
681
  /** @private
@@ -654,6 +713,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
654
713
  return YES ;
655
714
  },
656
715
 
716
+ /** @private */
657
717
  touchStart: function(touch){
658
718
  var buttonBehavior = this.get('buttonBehavior');
659
719
 
@@ -676,6 +736,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
676
736
  return YES;
677
737
  },
678
738
 
739
+ /** @private */
679
740
  touchesDragged: function(evt, touches) {
680
741
  if (!this.touchIsInBoundary(evt)) {
681
742
  if (!this._touch_exited) this.set('isActive', NO);
@@ -689,6 +750,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
689
750
  return YES;
690
751
  },
691
752
 
753
+ /** @private */
692
754
  touchEnd: function(touch){
693
755
  this._touch_exited = NO;
694
756
  this.set('isActive', NO); // track independently in case isEnabled has changed
@@ -703,7 +765,6 @@ SC.ButtonView = SC.View.extend(SC.Control,
703
765
  return YES ;
704
766
  },
705
767
 
706
-
707
768
  /** @private */
708
769
  keyDown: function(evt) {
709
770
  // handle tab key
@@ -720,12 +781,13 @@ SC.ButtonView = SC.View.extend(SC.Control,
720
781
  return NO;
721
782
  },
722
783
 
723
- /** @private Perform an action based on the behavior of the button.
784
+ /** @private
785
+ Perform an action based on the behavior of the button.
724
786
 
725
- - toggle behavior: switch to on/off state
726
- - on behavior: turn on.
727
- - off behavior: turn off.
728
- - otherwise: invoke target/action
787
+ - toggle behavior: switch to on/off state
788
+ - on behavior: turn on.
789
+ - off behavior: turn off.
790
+ - otherwise: invoke target/action
729
791
  */
730
792
  _action: function(evt, skipHoldRepeat) {
731
793
  switch(this.get('buttonBehavior')) {
@@ -795,8 +857,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
795
857
  },
796
858
 
797
859
  /** @private */
798
- _hasLegacyActionHandler: function()
799
- {
860
+ _hasLegacyActionHandler: function() {
800
861
  var action = this.get('action');
801
862
  if (action && (SC.typeOf(action) === SC.T_FUNCTION)) return true;
802
863
  if (action && (SC.typeOf(action) === SC.T_STRING) && (action.indexOf('.') != -1)) return true;
@@ -816,12 +877,7 @@ SC.ButtonView = SC.View.extend(SC.Control,
816
877
  }
817
878
  },
818
879
 
819
- /** tied to the isEnabled state */
820
- acceptsFirstResponder: function() {
821
- if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
822
- else return NO;
823
- }.property('isEnabled'),
824
-
880
+ /** @private */
825
881
  willBecomeKeyResponderFrom: function(keyView) {
826
882
  // focus the text field.
827
883
  if (!this._isFocused) {
@@ -833,10 +889,12 @@ SC.ButtonView = SC.View.extend(SC.Control,
833
889
  }
834
890
  },
835
891
 
892
+ /** @private */
836
893
  willLoseKeyResponderTo: function(responder) {
837
894
  if (this._isFocused) this._isFocused = NO ;
838
895
  },
839
896
 
897
+ /** @private */
840
898
  didAppendToDocument: function() {
841
899
  if(parseInt(SC.browser.msie, 0)===7 && this.get('useStaticLayout')){
842
900
  var layout = this.get('layout'),
@@ -22,32 +22,61 @@
22
22
  @since SproutCore 1.0
23
23
  */
24
24
  SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
25
- /** @scope SC.CheckboxView.prototype */ {
25
+ /** @scope SC.CheckboxView.prototype */ {
26
26
 
27
+ /**
28
+ @type Array
29
+ @default ['sc-checkbox-view', 'sc-checkbox-control']
30
+ @see SC.View#classNames
31
+ */
27
32
  classNames: ['sc-checkbox-view', 'sc-checkbox-control'],
33
+
34
+ /**
35
+ @type String
36
+ @default 'label'
37
+ @see SC.View#tagName
38
+ */
28
39
  tagName: 'label',
29
40
 
30
41
  /**
31
- The WAI-ARIA role of checkbox. This property's value should not be
32
- changed.
42
+ The WAI-ARIA role of checkbox.
33
43
 
34
- @property {String}
44
+ @type String
45
+ @readOnly
35
46
  */
36
47
  ariaRole: 'checkbox',
37
48
 
38
49
  // no special theme for Checkbox; button defaults to 'square', so we have to stop that.
39
50
  themeName: null,
51
+
52
+ /**
53
+ @type String
54
+ @default 'checkboxRenderDelegate'
55
+ */
40
56
  renderDelegateName: 'checkboxRenderDelegate',
41
57
 
42
- /* Ellipsis is disabled by default to allow multiline text */
58
+ /**
59
+ Ellipsis is disabled by default to allow multiline text
60
+
61
+ @type Boolean
62
+ @default NO
63
+ */
43
64
  needsEllipsis: NO,
44
65
 
66
+ /**
67
+ YES if `isEnabled` is YES, NO otherwise
68
+
69
+ @type Boolean
70
+ @default NO
71
+ @observes isEnabled
72
+ */
45
73
  acceptsFirstResponder: function() {
46
74
  if(!SC.SAFARI_FOCUS_BEHAVIOR) return this.get('isEnabled');
47
75
  else return NO;
48
76
  }.property('isEnabled'),
49
77
 
50
78
 
79
+ /** @private */
51
80
  mouseDown: function(evt) {
52
81
  if(!this.get('isEnabled')) return YES;
53
82
  this.set('isActive', YES);
@@ -58,6 +87,7 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
58
87
  return YES;
59
88
  },
60
89
 
90
+ /** @private */
61
91
  mouseUp: function(evt) {
62
92
  this.set('isActive', NO);
63
93
  this._isMouseDown = NO;
@@ -77,10 +107,12 @@ SC.CheckboxView = SC.ButtonView.extend(SC.StaticLayout,
77
107
  },
78
108
 
79
109
 
110
+ /** @private */
80
111
  touchStart: function(evt) {
81
112
  return this.mouseDown(evt);
82
113
  },
83
114
 
115
+ /** @private */
84
116
  touchEnd: function(evt) {
85
117
  return this.mouseUp(evt);
86
118
  }