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
@@ -7,7 +7,6 @@
7
7
 
8
8
  require('system/drag') ;
9
9
 
10
-
11
10
  /**
12
11
  @namespace
13
12
 
@@ -17,24 +16,28 @@ require('system/drag') ;
17
16
  */
18
17
  SC.DragDataSource = {
19
18
 
20
- /** @property
19
+ /**
21
20
  Implement this property as an array of data types you want to support
22
21
  for drag operations.
22
+
23
+ @type Array
24
+ @default []
23
25
  */
24
26
  dragDataTypes: [],
25
27
 
26
28
  /**
27
29
  Implement this method to return the data in the format passed. Return
28
30
  null if the requested data type cannot be generated.
29
-
31
+
30
32
  @param {SC.Drag} drag The Drag instance managing this drag.
31
33
  @param {Object} dataType The proposed dataType to return. This will
32
34
  always be one of the data types declared in dragDataTypes.
33
35
 
34
36
  @returns The data object for the specified type
35
37
  */
36
- dragDataForType: function(drag, dataType) { return null; }
37
-
38
- };
38
+ dragDataForType: function(drag, dataType) {
39
+ return null;
40
+ }
39
41
 
42
+ };
40
43
 
@@ -5,16 +5,14 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
-
9
8
  require('system/drag') ;
10
9
 
11
10
  /**
12
- @mixin
11
+ @namespace
13
12
 
14
13
  The DragSource protocol is used to dynamically generate multiple types of
15
14
  data from a single object. You must implement this protocol if you want to
16
15
  provide the data for a drag event.
17
-
18
16
  */
19
17
  SC.DragSource = {
20
18
 
@@ -23,29 +21,32 @@ SC.DragSource = {
23
21
  Return a bitwise OR'd mask of the drag operations allowed on the
24
22
  specified target. If you don't care about the target, just return a
25
23
  constant value.
26
-
24
+
25
+ The default implementation returns SC.DRAG_NONE
26
+
27
27
  @param {SC.View} dropTarget The proposed target of the drop.
28
28
  @param {SC.Drag} drag The SC.Drag instance managing this drag.
29
-
30
29
  */
31
- dragSourceOperationMaskFor: function(drag, dropTarget) { return SC.DRAG_NONE ; },
30
+ dragSourceOperationMaskFor: function(drag, dropTarget) {
31
+ return SC.DRAG_NONE;
32
+ },
32
33
 
33
34
  /**
34
35
  If this property is set to NO or is not implemented, then the user may
35
36
  modify the drag operation by changing the modifier keys they have
36
37
  pressed.
37
38
 
38
- @returns {Boolean}
39
+ @type Boolean
40
+ @default NO
39
41
  */
40
42
  ignoreModifierKeysWhileDragging: NO,
41
43
 
42
- /**
44
+ /**
43
45
  This method is called when the drag begins. You can use this to do any
44
46
  visual highlighting to indicate that the receiver is the source of the
45
47
  drag.
46
-
48
+
47
49
  @param {SC.Drag} drag The Drag instance managing this drag.
48
-
49
50
  @param {Point} loc The point in *window* coordinates where the drag
50
51
  began. You can use convertOffsetFromView() to convert this to local
51
52
  coordinates.
@@ -55,29 +56,24 @@ SC.DragSource = {
55
56
  /**
56
57
  This method is called whenever the drag image is moved. This is
57
58
  similar to the dragUpdated() method called on drop targets.
58
-
59
+
59
60
  @param {SC.Drag} drag The Drag instance managing this drag.
60
-
61
61
  @param {Point} loc The point in *window* coordinates where the drag
62
62
  mouse is. You can use convertOffsetFromView() to convert this to local
63
63
  coordinates.
64
64
  */
65
65
  dragDidMove: function(drag, loc) {},
66
66
 
67
- /**
67
+ /**
68
68
  This method is called when the drag ended. You can use this to do any
69
69
  cleanup. The operation is the actual operation performed on the drag.
70
-
70
+
71
71
  @param {SC.Drag} drag The drag instance managing the drag.
72
-
73
- @param {Point} loc The point in WINDOW coordinates where the drag
74
- ended.
75
-
76
- @param {DragOp} op The drag operation that was performed. One of
72
+ @param {Point} loc The point in WINDOW coordinates where the drag
73
+ ended.
74
+ @param {DragOp} op The drag operation that was performed. One of
77
75
  SC.DRAG_COPY, SC.DRAG_MOVE, SC.DRAG_LINK, or SC.DRAG_NONE.
78
-
79
76
  */
80
77
  dragDidEnd: function(drag, loc, op) {}
81
-
82
- } ;
83
78
 
79
+ };
@@ -5,7 +5,6 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
-
9
8
  require('system/drag');
10
9
 
11
10
  /**
@@ -19,18 +18,18 @@ require('system/drag');
19
18
  The general call sequence for all drop targets is (in pseudo-Ragel, regex
20
19
  format):
21
20
 
22
- dragStarted
23
- (
24
- computeDragOperations+
25
- (
26
- dragEntered
27
- dragUpdated
28
- ( computeDragOperations | dragUpdated )*
29
- ( acceptDragOperation performDragOperation? )? // mouseUp
30
- dragExited
31
- )*
32
- )*
33
- dragEnded
21
+ dragStarted
22
+ (
23
+ computeDragOperations+
24
+ (
25
+ dragEntered
26
+ dragUpdated
27
+ ( computeDragOperations | dragUpdated )*
28
+ ( acceptDragOperation performDragOperation? )? // mouseUp
29
+ dragExited
30
+ )*
31
+ )*
32
+ dragEnded
34
33
 
35
34
  Thus, every drop target will have its dragStarted and dragEnded methods called
36
35
  once during every drag session. computeDragOperations, if called at all, may be
@@ -47,6 +46,10 @@ SC.DropTarget = {
47
46
  Drop targets must be specially registered in order to receive drop
48
47
  events. SproutCore knows to register your view when this property
49
48
  is true on view creation.
49
+
50
+ @type Boolean
51
+ @default YES
52
+ @constant
50
53
  */
51
54
  isDropTarget: YES,
52
55
 
@@ -58,7 +61,7 @@ SC.DropTarget = {
58
61
  The default implementation does nothing.
59
62
 
60
63
  @param {SC.Drag} drag The current drag object.
61
- @param {SC.Event} evt The most recent mouse move event. Use to get location
64
+ @param {SC.Event} evt The most recent mouse move event. Use to get location
62
65
  */
63
66
  dragStarted: function(drag, evt) {},
64
67
 
@@ -134,10 +137,13 @@ SC.DropTarget = {
134
137
  @param {SC.Drag} drag The current drag object
135
138
  @param {SC.Event} evt The most recent mouse move event. Use to get
136
139
  location
140
+
137
141
  @returns {DragOps} A mask of all the drag operations allowed or
138
142
  SC.DRAG_NONE
139
143
  */
140
- computeDragOperations: function(drag, evt) { return SC.DRAG_NONE; },
144
+ computeDragOperations: function(drag, evt) {
145
+ return SC.DRAG_NONE;
146
+ },
141
147
 
142
148
  /**
143
149
  Called when the user releases the mouse.
@@ -154,7 +160,9 @@ SC.DropTarget = {
154
160
 
155
161
  @return {Boolean} YES if operation is OK, NO to cancel.
156
162
  */
157
- acceptDragOperation: function(drag, op) { return YES; },
163
+ acceptDragOperation: function(drag, op) {
164
+ return YES;
165
+ },
158
166
 
159
167
  /**
160
168
  Called to actually perform the drag operation.
@@ -172,6 +180,8 @@ SC.DropTarget = {
172
180
 
173
181
  @return {DragOp} Drag Operation actually performed
174
182
  */
175
- performDragOperation: function(drag, op) { return SC.DRAG_NONE; }
183
+ performDragOperation: function(drag, op) {
184
+ return SC.DRAG_NONE;
185
+ }
176
186
 
177
187
  };
@@ -6,14 +6,45 @@
6
6
  // ==========================================================================
7
7
 
8
8
 
9
- SC.DRAG_LINK = 0x0004; SC.DRAG_COPY = 0x0001; SC.DRAG_MOVE = 0x0002;
10
- SC.DRAG_NONE = 0x0000; SC.DRAG_ANY = 0x000F; SC.DRAG_DATA = 0x0008; // includes SC.DRAG_REORDER
9
+ /**
10
+ @static
11
+ */
12
+ SC.DRAG_LINK = 0x0004;
13
+
14
+ /**
15
+ @static
16
+ */
17
+ SC.DRAG_COPY = 0x0001;
18
+
19
+ /**
20
+ @static
21
+ */
22
+ SC.DRAG_MOVE = 0x0002;
23
+
24
+ /**
25
+ @static
26
+ */
27
+ SC.DRAG_NONE = 0x0000;
28
+
29
+ /**
30
+ @static
31
+ */
32
+ SC.DRAG_ANY = 0x000F;
33
+
34
+ /**
35
+ @static
36
+ */
37
+ SC.DRAG_DATA = 0x0008; // includes SC.DRAG_REORDER
38
+
39
+ /**
40
+ @static
41
+ */
11
42
  SC.DRAG_AUTOSCROLL_ZONE_THICKNESS = 20;
12
43
 
13
- // Add draggable and scrollable support to SC.View
14
44
  SC.View.reopen(
15
45
  /** @scope SC.View.prototype */ {
16
46
 
47
+ /** @private */
17
48
  init: function(original) {
18
49
  original();
19
50
 
@@ -24,6 +55,7 @@ SC.View.reopen(
24
55
  if (this.get('isScrollable')) { SC.Drag.addScrollableView(this) ; }
25
56
  }.enhance(),
26
57
 
58
+ /** @private */
27
59
  destroy: function(original) {
28
60
  // unregister for drags
29
61
  if (this.get('isDropTarget')) { SC.Drag.removeDropTarget(this) ; }
@@ -43,45 +75,45 @@ SC.View.reopen(
43
75
  user releases the mouse button.
44
76
 
45
77
  To initiate a drag, you should call SC.Drag.start() with the options below
46
- specified in a hash. Pass the ones you need to get the drag you want:
78
+ specified in a hash. Pass the ones you need to get the drag you want:
47
79
 
48
- - *event: (req)* The mouse event/touch that triggered the drag. This will be used
49
- to position the element.
80
+ - *event: (req)* The mouse event/touch that triggered the drag. This will be used
81
+ to position the element.
50
82
 
51
- - *source: (req)* The drag source object that should be consulted during
52
- the drag operations. This is usually the container view that initiated
53
- the drag.
83
+ - *source: (req)* The drag source object that should be consulted during
84
+ the drag operations. This is usually the container view that initiated
85
+ the drag.
54
86
 
55
- - *dragView: * Optional view that will be used as the source image for the
56
- drag. The drag operation will clone the DOM elements for this view and
57
- parent them under the drag pane, which has the class name 'sc-ghost-view'.
58
- The drag view is not moved from its original location during a drag.
59
- If the dragView is not provided, the source is used as dragView.
87
+ - *dragView:* Optional view that will be used as the source image for the
88
+ drag. The drag operation will clone the DOM elements for this view and
89
+ parent them under the drag pane, which has the class name 'sc-ghost-view'.
90
+ The drag view is not moved from its original location during a drag.
91
+ If the dragView is not provided, the source is used as dragView.
60
92
 
61
- - *ghost: YES | NO* If NO, the drag view image will show, but the source
62
- dragView will not be hidden. Set to YES to make it appear that the
63
- dragView itself is being dragged around.
93
+ - *ghost: YES | NO* If NO, the drag view image will show, but the source
94
+ dragView will not be hidden. Set to YES to make it appear that the
95
+ dragView itself is being dragged around.
64
96
 
65
- - *slideBack: YES | NO* If YES and the drag operation is cancelled, the
66
- dragView will slide back to its source origin.
97
+ - *slideBack: YES | NO* If YES and the drag operation is cancelled, the
98
+ dragView will slide back to its source origin.
67
99
 
68
- - *origin:* If passed, this will be used as the origin point for the
69
- ghostView when it slides back. You normally do not need to pass this
70
- unless the ghost view does not appear in the main UI.
100
+ - *origin:* If passed, this will be used as the origin point for the
101
+ ghostView when it slides back. You normally do not need to pass this
102
+ unless the ghost view does not appear in the main UI.
71
103
 
72
- - *data:* Optional hash of data types and values. You can use this to pass
73
- a static set of data instead of providing a dataSource. If you provide
74
- a dataSource, it will be used instead.
104
+ - *data:* Optional hash of data types and values. You can use this to pass
105
+ a static set of data instead of providing a dataSource. If you provide
106
+ a dataSource, it will be used instead.
75
107
 
76
- - *dataSource:* Optional object that will provide the data for the drag to
77
- be consumed by the drop target. If you do not pass this parameter or the
78
- data hash, then the source object will be used if it implements the
79
- SC.DragDataSource protocol.
108
+ - *dataSource:* Optional object that will provide the data for the drag to
109
+ be consumed by the drop target. If you do not pass this parameter or the
110
+ data hash, then the source object will be used if it implements the
111
+ SC.DragDataSource protocol.
80
112
 
81
- - *anchorView:* if you pass this optional view, then the drag will only be
82
- allowed to happen within this view. The ghostView will actually be added
83
- as a child of this view during the drag. Normally the anchorView is the
84
- window.
113
+ - *anchorView:* if you pass this optional view, then the drag will only be
114
+ allowed to happen within this view. The ghostView will actually be added
115
+ as a child of this view during the drag. Normally the anchorView is the
116
+ window.
85
117
 
86
118
  @extends SC.Object
87
119
  */
@@ -115,7 +147,7 @@ SC.Drag = SC.Object.extend(
115
147
  ghostActsLikeCursor: NO,
116
148
 
117
149
  /**
118
- The view that was used as the source of the ghostView.
150
+ The view that was used as the source of the ghostView.
119
151
 
120
152
  The drag view is not moved from its original location during a drag.
121
153
  Instead, the DOM content of the view is cloned and managed by the
@@ -190,7 +222,7 @@ SC.Drag = SC.Object.extend(
190
222
  on your dragEntered() and prepareForDragOperation() methods to determine
191
223
  if you can handle any of the data types offered up by the drag source.
192
224
 
193
- @property {Array} available data types
225
+ @type Array
194
226
  */
195
227
  dataTypes: function() {
196
228
  // first try to use the data source.
@@ -217,7 +249,7 @@ SC.Drag = SC.Object.extend(
217
249
  /**
218
250
  Checks for a named data type in the drag.
219
251
 
220
- @param dataType {String} the data type
252
+ @param {String} dataType the data type
221
253
  @returns {Boolean} YES if data type is present in dataTypes array.
222
254
  */
223
255
  hasDataType: function(dataType) {
@@ -406,6 +438,7 @@ SC.Drag = SC.Object.extend(
406
438
  // PRIVATE PROPERTIES AND METHODS
407
439
  //
408
440
 
441
+ /** @private */
409
442
  touchStart: function(evt) {
410
443
  return YES;
411
444
  },
@@ -539,6 +572,7 @@ SC.Drag = SC.Object.extend(
539
572
  this._dragInProgress = NO ; // required by autoscroll (invoked by a timer)
540
573
  },
541
574
 
575
+ /** @private */
542
576
  touchEnd: function(evt){
543
577
  this.mouseUp(evt);
544
578
  },
@@ -594,16 +628,15 @@ SC.Drag = SC.Object.extend(
594
628
  loc.y -= this.ghostOffset.y ;
595
629
  var gV = this.ghostView;
596
630
  if(gV) {
597
- gV.adjust({ top: loc.y, left: loc.x }) ;
631
+ gV.adjust({ top: loc.y, left: loc.x }) ;
598
632
  gV.invokeOnce('updateLayout') ;
599
633
  }
600
634
  },
601
635
 
602
- /**
636
+ /** @private
603
637
  YES if the ghostView has been manually hidden.
604
638
 
605
- @private
606
- @type {Boolean}
639
+ @type Boolean
607
640
  @default NO
608
641
  */
609
642
  _ghostViewHidden: NO,
@@ -946,7 +979,7 @@ SC.Drag.mixin(
946
979
  @param {SC.View} target a view implementing the SC.DropTarget protocol
947
980
  */
948
981
  addDropTarget: function(target) {
949
- this._dropTargets[SC.guidFor(target)] = target ;
982
+ this._dropTargets[SC.guidFor(target)] = target;
950
983
  },
951
984
 
952
985
  /**
@@ -958,7 +991,7 @@ SC.Drag.mixin(
958
991
  @param {SC.View} target A previously registered drop target
959
992
  */
960
993
  removeDropTarget: function(target) {
961
- delete this._dropTargets[SC.guidFor(target)] ;
994
+ delete this._dropTargets[SC.guidFor(target)];
962
995
  },
963
996
 
964
997
  /**
@@ -968,7 +1001,7 @@ SC.Drag.mixin(
968
1001
  @param {SC.View} target The view that should be auto-scrolled
969
1002
  */
970
1003
  addScrollableView: function(target) {
971
- this._scrollableViews[SC.guidFor(target)] = target ;
1004
+ this._scrollableViews[SC.guidFor(target)] = target;
972
1005
  },
973
1006
 
974
1007
  /**
@@ -978,7 +1011,7 @@ SC.Drag.mixin(
978
1011
  @param {SC.View} target A previously registered scrollable view
979
1012
  */
980
1013
  removeScrollableView: function(target) {
981
- delete this._scrollableViews[SC.guidFor(target)] ;
1014
+ delete this._scrollableViews[SC.guidFor(target)];
982
1015
  }
983
1016
 
984
1017
  });
@@ -5,8 +5,9 @@
5
5
  // License: Licensed under MIT license (see license.js)
6
6
  // ==========================================================================
7
7
 
8
-
9
- require('core');
8
+ /*
9
+ TODO More docs for this class
10
+ */
10
11
 
11
12
  /**
12
13
  @class
@@ -15,7 +16,7 @@ require('core');
15
16
  do is to make sure that you register a function with this manager to undo
16
17
  every change you make. You can then invoke the undo/redo methods to do it.
17
18
 
18
- h4. USING THE UNDOMANAGER
19
+ ## Using SC.UndoManager
19
20
 
20
21
  Typically you create an undo manager inside on of your controllers. Then,
21
22
  whenever you are about to perform an action on your model object, all you
@@ -25,29 +26,28 @@ require('core');
25
26
  Besure the undo function you register also saves undo functions. This makes
26
27
  redo possible.
27
28
 
28
- More docs TBD.
29
-
30
29
  @extends SC.Object
31
30
  */
32
31
  SC.UndoManager = SC.Object.extend(
33
- /** @scope SC.UndoManager.prototype */
34
- {
32
+ /** @scope SC.UndoManager.prototype */ {
35
33
 
36
34
  /**
37
- (Property) Name of the next undo action name.
38
-
39
35
  Use this property to build your Undo menu name.
40
36
 
37
+ @field
38
+ @type String
39
+ @default null
41
40
  */
42
41
  undoActionName: function() {
43
42
  return this.undoStack ? this.undoStack.name : null ;
44
43
  }.property('undoStack'),
45
44
 
46
45
  /**
47
- (Property) Name of the next return action name.
48
-
49
46
  Use this property to build your Redo menu name.
50
47
 
48
+ @field
49
+ @type String
50
+ @default null
51
51
  */
52
52
  redoActionName: function() {
53
53
  return this.redoStack ? this.redoStack.name : null ;
@@ -57,43 +57,57 @@ SC.UndoManager = SC.Object.extend(
57
57
  True if there is an undo action on the stack.
58
58
 
59
59
  Use to validate your menu item.
60
+
61
+ @field
62
+ @type Boolean
63
+ @default NO
60
64
  */
61
65
  canUndo: function() {
62
- return this.undoStack != null;
66
+ // instead of this.undoStack !== null && this.undoStack !== undefined
67
+ return this.undoStack != null;
63
68
  }.property('undoStack'),
64
69
 
65
70
  /**
66
- True if there is an redo action on the stack.
71
+ True if there is an redo action on the stack. Use to validate your menu item.
67
72
 
68
- Use to validate your menu item.
73
+ @field
74
+ @type Boolean
75
+ @default NO
69
76
  */
70
77
  canRedo: function() {
78
+ // instead of this.redoStack !== null && this.redoStack !== undefined
71
79
  return this.redoStack != null;
72
80
  }.property('redoStack'),
73
81
 
74
- /**
75
- Tries to undo the last action.
76
-
77
- Returns true if succeeded. Fails if an undo group is currently open.
82
+ /**
83
+ Tries to undo the last action. Fails if an undo group is currently open.
84
+
85
+ @returns {Boolean} YES if suceeded, NO otherwise.
78
86
  */
79
- undo: function() { this._undoOrRedo('undoStack','isUndoing'); },
80
-
81
- /**
82
- Tries to redo the last action.
87
+ undo: function() {
88
+ this._undoOrRedo('undoStack','isUndoing');
89
+ },
83
90
 
84
- Returns true if succeeded. Fails if an undo group is currently open.
91
+ /**
92
+ Tries to redo the last action. Fails if a redo group is currently open.
93
+
94
+ @returns {Boolean} YES if suceeded, NO otherwise.
85
95
  */
86
- redo: function() { this._undoOrRedo('redoStack','isRedoing'); },
96
+ redo: function() {
97
+ this._undoOrRedo('redoStack','isRedoing');
98
+ },
87
99
 
88
100
  /**
89
- True if the manager is currently undoing events.
101
+ @type Boolean
102
+ @default NO
90
103
  */
91
- isUndoing: false,
104
+ isUndoing: NO,
92
105
 
93
106
  /**
94
- True if the manager is currently redoing events.
107
+ @type Boolean
108
+ @default NO
95
109
  */
96
- isRedoing: false,
110
+ isRedoing: NO,
97
111
 
98
112
  /** @private */
99
113
  groupingLevel: 0,
@@ -126,6 +140,8 @@ SC.UndoManager = SC.Object.extend(
126
140
 
127
141
  When you are finished performing the action, balance this with a call to
128
142
  endUndoGroup().
143
+
144
+ @param {String} name
129
145
  */
130
146
  beginUndoGroup: function(name) {
131
147
  // is a group already active? Just increment the counter.
@@ -141,7 +157,12 @@ SC.UndoManager = SC.Object.extend(
141
157
  }
142
158
  },
143
159
 
144
- /** end the undo group. see beginUndoGroup() */
160
+ /**
161
+ @throws {Error} If there is no active group
162
+
163
+ @param {String} name
164
+ @see beginUndoGroup()
165
+ */
145
166
  endUndoGroup: function(name) {
146
167
  // if more than one groups are active, just decrement the counter.
147
168
  if (!this._activeGroup) raise("endUndoGroup() called outside group.") ;
@@ -156,9 +177,13 @@ SC.UndoManager = SC.Object.extend(
156
177
  },
157
178
 
158
179
  /**
159
- Change the name of the current undo group.
160
-
180
+ Change the name of the current undo group.
181
+
161
182
  Normally you don't want to do this as it will effect the whole group.
183
+
184
+ @param {String} name
185
+
186
+ @throws {Error} If there is no active group
162
187
  */
163
188
  setActionName: function(name) {
164
189
  if (!this._activeGroup) raise("setActionName() called outside group.") ;
@@ -168,8 +193,18 @@ SC.UndoManager = SC.Object.extend(
168
193
  // --------------------------------
169
194
  // PRIVATE
170
195
  //
171
- _activeGroup: null, undoStack: null, redoStack: null,
172
- _undoOrRedo: function(stack,state) {
196
+
197
+ /** @private */
198
+ _activeGroup: null,
199
+
200
+ /** @private */
201
+ undoStack: null,
202
+
203
+ /** @private */
204
+ redoStack: null,
205
+
206
+ /** @private */
207
+ _undoOrRedo: function(stack, state) {
173
208
  if (this._activeGroup) return false ;
174
209
  if (this.get(stack) == null) return true; // noting to do.
175
210