sproutcore 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/History.txt +70 -2
  2. data/Manifest.txt +3 -15
  3. data/config/hoe.rb +1 -1
  4. data/frameworks/sproutcore/animation/animation.js +411 -0
  5. data/frameworks/sproutcore/controllers/array.js +68 -21
  6. data/frameworks/sproutcore/controllers/object.js +21 -2
  7. data/frameworks/sproutcore/drag/drag.js +13 -4
  8. data/frameworks/sproutcore/drag/drop_target.js +26 -19
  9. data/frameworks/sproutcore/english.lproj/core.css +4 -0
  10. data/frameworks/sproutcore/english.lproj/strings.js +5 -0
  11. data/frameworks/sproutcore/english.lproj/theme.css +5 -0
  12. data/frameworks/sproutcore/foundation/application.js +1 -2
  13. data/frameworks/sproutcore/foundation/set.js +31 -12
  14. data/frameworks/sproutcore/foundation/sorted_set.js +590 -0
  15. data/frameworks/sproutcore/foundation/string.js +43 -9
  16. data/frameworks/sproutcore/globals/window.js +34 -9
  17. data/frameworks/sproutcore/lib/button_views.rb +1 -0
  18. data/frameworks/sproutcore/lib/collection_view.rb +1 -0
  19. data/frameworks/sproutcore/lib/core_views.rb +3 -0
  20. data/frameworks/sproutcore/lib/index.rhtml +1 -1
  21. data/frameworks/sproutcore/mixins/collection_view_delegate.js +201 -0
  22. data/frameworks/sproutcore/mixins/observable.js +2 -7
  23. data/frameworks/sproutcore/models/record.js +1 -1
  24. data/frameworks/sproutcore/models/store.js +81 -28
  25. data/frameworks/sproutcore/tests/views/view/clippingFrame.rhtml +9 -6
  26. data/frameworks/sproutcore/views/collection/collection.js +649 -211
  27. data/frameworks/sproutcore/views/collection/grid.js +62 -26
  28. data/frameworks/sproutcore/views/collection/list.js +57 -21
  29. data/frameworks/sproutcore/views/collection/source_list.js +61 -13
  30. data/frameworks/sproutcore/views/image.js +7 -0
  31. data/frameworks/sproutcore/views/inline_text_field.js +4 -5
  32. data/frameworks/sproutcore/views/slider.js +2 -0
  33. data/frameworks/sproutcore/views/view.js +2 -2
  34. data/lib/sproutcore/build_tools/html_builder.rb +4 -6
  35. data/lib/sproutcore/build_tools/resource_builder.rb +32 -20
  36. data/lib/sproutcore/bundle.rb +130 -32
  37. data/lib/sproutcore/bundle_manifest.rb +24 -21
  38. data/lib/sproutcore/helpers/static_helper.rb +22 -9
  39. data/lib/sproutcore/merb/bundle_controller.rb +4 -3
  40. data/lib/sproutcore/version.rb +1 -1
  41. metadata +14 -17
  42. data/clients/view_builder/builders/builder.js +0 -339
  43. data/clients/view_builder/builders/button.js +0 -81
  44. data/clients/view_builder/controllers/document.js +0 -21
  45. data/clients/view_builder/core.js +0 -19
  46. data/clients/view_builder/english.lproj/body.css +0 -77
  47. data/clients/view_builder/english.lproj/body.rhtml +0 -39
  48. data/clients/view_builder/english.lproj/controls.css +0 -0
  49. data/clients/view_builder/english.lproj/strings.js +0 -14
  50. data/clients/view_builder/main.js +0 -38
  51. data/clients/view_builder/mixins/design_mode.js +0 -92
  52. data/clients/view_builder/tests/controllers/document.rhtml +0 -20
  53. data/clients/view_builder/tests/views/builder.rhtml +0 -20
  54. data/clients/view_builder/tests/views/palette.rhtml +0 -21
  55. data/clients/view_builder/views/builder.js +0 -26
  56. data/clients/view_builder/views/palette.js +0 -30
@@ -124,23 +124,57 @@ String.prototype.fmt = String.prototype.format ;
124
124
  // Add strings for various languages to this collection. String.loc()
125
125
  // method will try to localize the string passed using the current language.
126
126
  // if the language is not available, it will use English.
127
- Object.extend(String,{
127
+ Object.extend(String,
128
+ /** @scope String @static */ {
129
+
130
+ /**
131
+ The current browser language as a two letter code.
132
+ */
133
+ browserLanguage: ((navigator.language || navigator.browserLanguage).split('-', 1)[0]),
134
+
135
+ /**
136
+ If YES, localization will favor the detected language instead of the
137
+ preferred one.
138
+ */
139
+ useAutodetectedLanguage: NO,
140
+
141
+ /**
142
+ This property is set by the build tools to the current build language.
143
+ */
144
+ preferredLanguage: null,
128
145
 
129
- // Default language is English. Currently French, German, and Japanese are
130
- // detected. All other languages default to English.
146
+ /**
147
+ Returns the hash key to use for loc strings. The default implementation
148
+ will autodetect the browser language and look for a loc string to
149
+ match. If it can't find one then it will introspect to find loc strings
150
+ that are defined and use those instead.
151
+ */
131
152
  currentLanguage: function () {
132
- var browserLanguage = (navigator.language || navigator.browserLanguage).split('-', 1);
133
- switch(browserLanguage[0])
153
+
154
+ var ret = (this.useAutodetectedLanguage) ? (this.browserLanguage || this.preferredLanguage || 'en') : (this.preferredLanguage || this.browserLanguage || 'en') ;
155
+
156
+ // then try a couple of normalized forms...
157
+ if (!this[ret]) switch(ret)
134
158
  {
135
159
  case 'fr':
136
- return 'French';
160
+ ret = 'French';
161
+ break ;
137
162
  case 'de':
138
- return 'German';
163
+ ret = 'German';
164
+ break ;
139
165
  case 'ja':
140
- return 'Japanese';
166
+ case 'jp':
167
+ ret = 'Japanese';
168
+ break ;
169
+ case 'en':
170
+ ret = 'English' ;
171
+ break ;
172
+
141
173
  default:
142
- return 'English';
174
+ break ;
143
175
  }
176
+
177
+ return ret ;
144
178
  }
145
179
 
146
180
  });
@@ -7,6 +7,8 @@ require('Core') ;
7
7
  require('foundation/responder');
8
8
  require('panes/pane');
9
9
 
10
+ SC.CAPTURE_BACKSPACE_KEY = NO ;
11
+
10
12
  // The window global object is automatically setup for each window that you
11
13
  // load. Window listens for mouse and keyboard events and routes them to the
12
14
  // first responder. Using the firstResponder method you can control who gets
@@ -112,19 +114,36 @@ SC.window = SC.PaneView.extend({
112
114
  // we can map to some non-printable set of keycodes.)
113
115
  _onkeydown: function(evt)
114
116
  {
117
+ // Firefox does NOT handle delete here...
118
+ if (SC.Platform.Firefox > 0 && (evt.which === 8)) {
119
+ return true ;
120
+ }
121
+
115
122
  // modifier keys are handled separately by the 'flagsChanged' event
116
123
  this._handleModifierChanges(evt);
117
- if (this._isModifierKey(evt)) return;
118
- if (!this._isFunctionOrNonPrintableKey(evt)) return true; // let normal browser processing do its thing.
119
- return this._sendEvent('keyDown', evt);
124
+ if (this._isModifierKey(evt)) return false;
125
+
126
+ // let normal browser processing do its thing.
127
+ if (!this._isFunctionOrNonPrintableKey(evt)) return true;
128
+ var ret = this._sendEvent('keyDown', evt);
129
+ return ret ;
120
130
  },
121
131
 
122
132
  // this one gets used for all the other keys not handled by key down.
133
+ // FireFox also needs to handle delete here...
123
134
  _onkeypress: function(evt)
124
135
  {
125
- if (this._isFunctionOrNonPrintableKey(evt)) return; // handled in _onkeydown
126
- if (evt.charCode != undefined && evt.charCode == 0) return;
127
- return this._sendEvent('keyDown', evt);
136
+
137
+ // handled in _onkeydown
138
+ if (SC.Platform.Firefox > 0 && (evt.which === 8)) {
139
+ var ret = this._sendEvent('keyDown', evt);
140
+
141
+ } else {
142
+ if (this._isFunctionOrNonPrintableKey(evt)) return true;
143
+ if (evt.charCode != undefined && evt.charCode == 0) return true;
144
+ var ret = this._sendEvent('keyDown', evt);
145
+ }
146
+ return ret ;
128
147
  },
129
148
 
130
149
  _onkeyup: function(evt)
@@ -342,10 +361,16 @@ SC.window = SC.PaneView.extend({
342
361
  var win = this ;
343
362
  win._EVTS.each(function(e) {
344
363
  var func = win['_on' + e] ;
345
- var target = (SC.isIE() && (e != 'resize')) ? document : window ;
364
+ var target = (e != 'resize') ? document : window ;
346
365
  if (func) {
347
366
  var f = func.bindAsEventListener(win) ;
348
- Event.observe(target, e, f) ;
367
+
368
+ if (e === 'keypress' && SC.CAPTURE_BACKSPACE_KEY && SC.Platform.Firefox > 0) {
369
+ document.onkeypress = f ;
370
+ } else {
371
+ Event.observe(target, e, f) ;
372
+ }
373
+
349
374
  win._listenerCache.push([target, e, f]) ;
350
375
  }
351
376
  });
@@ -353,10 +378,10 @@ SC.window = SC.PaneView.extend({
353
378
  this.get('size') ; // fetch the size from the window and save it.
354
379
  this.set('isVisibleInWindow', true) ;
355
380
  this._onfocus() ;
381
+
356
382
  }
357
383
  }).viewFor($tag('body')) ;
358
384
 
359
-
360
385
  // events:
361
386
  // window.onfocus --
362
387
  // notify all views that they now have window focus.
@@ -262,6 +262,7 @@ view_helper :radio_group_view do
262
262
  # get the layout mode.
263
263
  var :layout, :vertical
264
264
  css_class_names << 'sc-radio-group-view'
265
+ css_class_names << 'radio'
265
266
  css_class_names << @layout if @layout
266
267
 
267
268
  var :tag, 'span'
@@ -29,6 +29,7 @@ view_helper :collection_view do
29
29
  property :content_value_editable, :key => 'contentValueIsEditable'
30
30
  property :accepts_first_responder, true
31
31
  property :can_reorder_content
32
+ property :can_delete_content
32
33
 
33
34
  property :content_icon_key
34
35
 
@@ -49,6 +49,9 @@ view_helper :view do
49
49
  property :can_collapse
50
50
  property :collapsed, :key => 'isCollapsed'
51
51
 
52
+ # General delegate support
53
+ property(:delegate) { |x| x }
54
+ property :drop_target, :key => 'isDropTarget'
52
55
 
53
56
  # set panel type
54
57
  var :panel
@@ -24,7 +24,7 @@
24
24
  <%= stylesheets_for_client %>
25
25
  <%= @content_for_page_styles %>
26
26
  </head>
27
- <body class="<%= @theme || 'sc-theme' %>">
27
+ <body class="<%= @theme || 'sc-theme' %> focus">
28
28
  <% #
29
29
  # This is where you root body element will appear. To cause your
30
30
  # content to appear here, just declare content_for('body') in one of
@@ -0,0 +1,201 @@
1
+ // ========================================================================
2
+ // SproutCore
3
+ // copyright 2006-2008 Sprout Systems, Inc.
4
+ // ========================================================================
5
+
6
+ /**
7
+ Indicates that the collection view expects to accept a drop ON the specified
8
+ item.
9
+ */
10
+ SC.DROP_ON = 0x01;
11
+
12
+ /**
13
+ Indicates that the collection view expects to accept a drop BEFORE the
14
+ specified item.
15
+ */
16
+ SC.DROP_BEFORE = 0x02;
17
+
18
+ /**
19
+ Indicates that the collection view want's to know which operations would
20
+ be allowed for either drop operation.
21
+ */
22
+ SC.DROP_ANY = 0x03;
23
+
24
+ /**
25
+ @namespace
26
+
27
+ A Collection View Delegate is consulted by a SC.CollectionView's to control
28
+ certain behaviors such as selection control and drag and drop behaviors.
29
+
30
+ To act as a Collection Delegate, the object should be set as the delegate
31
+ property of the collection view and should implement one or more of the
32
+ methods below.
33
+
34
+ You can also choose to mixin this delegate to get suitable default
35
+ implementations of these methods.
36
+
37
+ @since SproutCore 1.0
38
+ */
39
+ SC.CollectionViewDelegate = {
40
+
41
+ /**
42
+ This method will be called anytime the collection view is about to
43
+ change the selection in response to user mouse clicks or keyboard events.
44
+
45
+ You can use this method to adjust the proposed selection, eliminating any
46
+ selected objects that cannot be selected. The default implementation of
47
+ this method simply returns the proposed selection.
48
+
49
+ @param view {SC.CollectionView} the collection view
50
+ @param sel {Array} Proposed array of selected objects.
51
+ @returns The actual array allowed or null if no change is allowed.
52
+ */
53
+ collectionViewSelectionForProposedSelection: function(view, sel) {
54
+ return sel ;
55
+ },
56
+
57
+ /**
58
+ Called by the collection view just before it starts a drag to give you
59
+ an opportunity to decide if the drag should be allowed.
60
+
61
+ You can use this method to implement fine-grained control over when a
62
+ drag will be allowed and when it will not be allowed. For example, you
63
+ may enable content reordering but then implement this method to prevent
64
+ reordering of certain items in the view.
65
+
66
+ The default implementation always returns YES.
67
+
68
+ @param view {SC.CollectionView} the collection view
69
+ @returns {Boolean} YES to alow, NO to prevent it
70
+ */
71
+ collectionViewShouldBeginDrag: function(view) { return YES; },
72
+
73
+ /**
74
+ Called by the collection view just before it starts a drag so that
75
+ you can provide the data types you would like to support in the data.
76
+
77
+ You can implement this method to return an array of the data types you
78
+ will provide for the drag data.
79
+
80
+ If you return null or an empty array, can you have set canReorderContent
81
+ to YES on the CollectionView, then the drag will go ahead but only
82
+ reordering will be allowed. If canReorderContent is NO, then the drag
83
+ will not be allowed to start.
84
+
85
+ If you simply want to control whether a drag is allowed or not, you
86
+ should instead implement collectionViewShouldBeginDrag().
87
+
88
+ The default returns an empty array.
89
+
90
+ @param view {SC.CollectionView} the collection view to begin dragging.
91
+ @returns {Array} array of supported data types.
92
+ */
93
+ collectionViewDragDataTypes: function(view) { return []; },
94
+
95
+ /**
96
+ Called by a collection view when a drag concludes to give you the option
97
+ to provide the drag data for the drop.
98
+
99
+ This method should be implemented essentially as you would implement the
100
+ dragDataForType() if you were a drag data source. You will never be asked
101
+ to provide drag data for a reorder event, only for other types of data.
102
+
103
+ The default implementation returns null.
104
+
105
+ @param view {SC.CollectionView} the collection view that initiated the drag
106
+ @param dataType {String} the data type to provide
107
+ @param drag {SC.Drag} the drag object
108
+ @returns {Object} the data object or null if the data could not be provided.
109
+ */
110
+ collectionViewDragDataForType: function(view, dataType, drag) {
111
+ return null ;
112
+ },
113
+
114
+ /**
115
+ Called by the collection view during a drag to let you determine the
116
+ kind and location of a drop you might want to accept.
117
+
118
+ You can override this method to implement fine-grained control over how
119
+ and when a dragged item is allowed to be dropped into a collection view.
120
+
121
+ This method will be called by the collection view both to determine in
122
+ general which operations you might support and specifically the operations
123
+ you would support if the user dropped an item over a specific location.
124
+
125
+ If the dropOperations parameter is SC.DROP_ANY, then you should simply
126
+ return the logical-or of all the operations you might possibly support
127
+ (or you can simply return the value of proposedDragOperation if you
128
+ support anything.) In this case, you should make your method as fast as
129
+ possible since it may be called frequently during a drag.
130
+
131
+ If hte dropOperation parameter is SC.DROP_ON or SC.DROP_BEFORE, then the
132
+ proposedInsertionPoint will be a non-negative value and you should
133
+ determine the specific operations you will support if the user dropped the
134
+ drag item at that point.
135
+
136
+ If you do not like the proposed drop operation or insertion point, you
137
+ can override these properties as well by setting the proposedDropOperation
138
+ and proposedInsertionIndex properties on the collection view during this
139
+ method. These properties are ignored all other times.
140
+
141
+ @param view {SC.CollectionView} the collection view
142
+ @param drag {SC.Drag} the current drag object
143
+ @param dropOperation {String} the proposed drop operation. Will be one of SC.DROP_ON, SC.DROP_BEFORE, or SC.DROP_ANY.
144
+ @param proposedInsertionIndex {Number} an index into the content array
145
+ representing the proposed insertion point.
146
+ @param proposedDragOperations {Number} proposed logical OR of allowed drag operations.
147
+ @returns the allowed drag operation. Defaults to proposedDragOperation
148
+ */
149
+ collectionViewValidateDrop: function(view, drag, dropOperation, proposedInsertionIndex, proposedDragOperation) {
150
+ return proposedDragOperation ;
151
+ },
152
+
153
+ /**
154
+ Called by the collection view to actually accept a drop. This method will
155
+ only be invoked AFTER your validateDrop method has been called to
156
+ determine if you want to even allow the drag operation to go through.
157
+
158
+ You should actually make changes to the data model if needed here and
159
+ then return the actual drag operation that was performed. If you return
160
+ SC.DRAG_NONE and the dragOperation was SC.DRAG_REORDER, then the default
161
+ reorder behavior will be provided by the collection view.
162
+
163
+ @param view {SC.CollectionView}
164
+ */
165
+ collectionViewAcceptDrop: function(view, drag, dropOperation, proposedInsertionIndex, dragOperation) {
166
+ return SC.DRAG_NONE ;
167
+ },
168
+
169
+ /**
170
+ Called by the collection view whenever the deleteSelection() method is
171
+ called. You can implement this method to get fine-grained control over
172
+ which items can be deleted. To prevent deletion, return null.
173
+
174
+ This method is only called if canDeleteContent is YES on the collection
175
+ view.
176
+
177
+ @param view {SC.CollectionView} the collection view
178
+ @param item {Array} proposed array of items to delete.
179
+ @returns {Array} items allowed to delete or null.
180
+ */
181
+ collectionViewShouldDeleteContent: function(view, items) { return items; },
182
+
183
+ /**
184
+ Called by the collection view to actually delete the selected items.
185
+
186
+ The default behavior will use standard array operators to remove the
187
+ items from the content array. You can implement this method to provide
188
+ your own deletion method.
189
+
190
+ If you simply want to controls the items to be deleted, you should instead
191
+ implement collectionViewShouldDeleteItems(). This method will only be
192
+ called if canDeleteContent is YES and collectionViewShouldDeleteContent()
193
+ returns a non-empty array.
194
+
195
+ @param view {SC.CollectionView} the view collection view
196
+ @param items {Array} the items to delete
197
+ @returns {Boolean} YES if the operation succeeded, NO otherwise.
198
+ */
199
+ collectionViewDeleteContent: function(view, items) { return NO; }
200
+
201
+ };
@@ -768,13 +768,8 @@ SC.NotificationQueue = {
768
768
  var now = start ;
769
769
  var n = null ;
770
770
  while(((now - start) < this.maxFlush) && (n = this.queue.pop())) {
771
- try {
772
- var t = n[0] || n[1] ;
773
- n[1].apply(t,n[2]) ;
774
- }
775
- catch(e) {
776
- console.log("Exception while notify("+n[2]+"): " + e) ;
777
- } // catch
771
+ var t = n[0] || n[1] ;
772
+ n[1].apply(t,n[2]) ;
778
773
  now = Date.now() ;
779
774
  }
780
775
  this._flushing = false ;
@@ -164,7 +164,7 @@ SC.Record = SC.Object.extend({
164
164
  // This will return the current set of attributes as a hash you can send back
165
165
  // to the server.
166
166
  attributes: function() {
167
- return $H(this._attributes) ;
167
+ return Object.clone(this._attributes) ;
168
168
  }.property(),
169
169
 
170
170
  // If you try to get/set a property not defined by the record, then this method
@@ -5,21 +5,46 @@
5
5
 
6
6
  require('foundation/object') ;
7
7
 
8
- // The Store is where you can find all of your records. You should also
9
- // use this to define your various types of records, since this will be
10
- // used to automatically update from data coming from the server.
11
- //
12
- // You should create a store for each application. This allows the records
13
- // for apps to be kept separate, even if they live in the same page.
14
- //
15
- SC.Store = SC.Object.create({
8
+ /**
9
+ @class
10
+
11
+ The Store is where you can find all of your records. You should also
12
+ use this to define your various types of records, since this will be
13
+ used to automatically update from data coming from the server.
14
+
15
+ You should create a store for each application. This allows the records
16
+ for apps to be kept separate, even if they live in the same page.
17
+
18
+ @extends SC.Object
19
+ @static
20
+ @since SproutCore 1.0
21
+ */
22
+ SC.Store = SC.Object.create(
23
+ /** @scope SC.Store.prototype */ {
24
+
25
+ /**
26
+ Pushes updated data to all the named records.
27
+
28
+ This method is often called from a server to update the store with the
29
+ included record objects.
16
30
 
17
- // This can be passed in from a Server to push updated data to all the
18
- // named records. The parameter should be an array of hashes. Each hash
19
- // can contain arrays or strings. Each one should also have a recordType
20
- // property, which points to the record type. dataSource is the server.
21
- // this will be automatically set on all the objects so that their future
22
- // refreshes will come from the server.
31
+ You can use this method yourself to mass update the store whenever you
32
+ retrieve new records from the server. The first parameter should contain
33
+ an array of JSON-compatible hashes. The hashes can have any properties
34
+ you want but they should at least contain the following two keys:
35
+
36
+ - guid: This is a unique identifier for the record.
37
+ - type: The name of the record type. I.e. "Contact" or "Photo"
38
+
39
+ @param dataHashes {Array} array of hash records. See discussion.
40
+ @param dataSource {Object} the data source. Usually a server object.
41
+ @param recordType {SC.Record} optional record type, used if type is not
42
+ found in the data hashes itself.
43
+ @param isLoaded {Boolean} YES if the data hashes represent the full set of
44
+ data loaded from the server. NO otherwise.
45
+
46
+ @returns {Array} Array of records that were actually created/updated.
47
+ */
23
48
  updateRecords: function(dataHashes, dataSource, recordType, isLoaded) {
24
49
 
25
50
  this.set('updateRecordsInProgress',true) ;
@@ -71,8 +96,10 @@ SC.Store = SC.Object.create({
71
96
  // Record Helpers
72
97
  //
73
98
 
74
- // add a record instance to the store. The record will now be monitored for
75
- // changes.
99
+ /**
100
+ Add a record instance to the store. The record will now be monitored for
101
+ changes.
102
+ */
76
103
  addRecord: function(rec) {
77
104
  // save record in a cache
78
105
  rec.needsAddToStore = false;
@@ -95,8 +122,10 @@ SC.Store = SC.Object.create({
95
122
  this.recordDidChange(rec) ;
96
123
  },
97
124
 
98
- // remove a record instance from the store. The record will no longer be
99
- // monitored for changes and may be deleted.
125
+ /**
126
+ remove a record instance from the store. The record will no longer be
127
+ monitored for changes and may be deleted.
128
+ */
100
129
  removeRecord: function(rec) {
101
130
  // remove from cache
102
131
  var guid = rec._storeKey();
@@ -119,11 +148,13 @@ SC.Store = SC.Object.create({
119
148
  },
120
149
 
121
150
  /**
122
- * Since records are cached by primaryKey, whenever that key changes we need to re-cache it in the proper place
123
- * @param {string} oldkey Previous primary key
124
- * @param {string} newkey New primary key
125
- * @param {SC.Record} rec The object to relocate
126
- * @return {SC.Record} The record passed in
151
+ Since records are cached by primaryKey, whenever that key changes we need
152
+ to re-cache it in the proper place
153
+
154
+ @param {string} oldkey Previous primary key
155
+ @param {string} newkey New primary key
156
+ @param {SC.Record} rec The object to relocate
157
+ @returns {SC.Record} The record passed in
127
158
  **/
128
159
  relocateRecord: function( oldkey, newkey, rec )
129
160
  {
@@ -141,8 +172,10 @@ SC.Store = SC.Object.create({
141
172
  },
142
173
 
143
174
 
144
- // You can pass any number of condition hashes to this, ending with a
145
- // recordType. It will AND the results of each condition hash.
175
+ /**
176
+ You can pass any number of condition hashes to this, ending with a
177
+ recordType. It will AND the results of each condition hash.
178
+ */
146
179
  findRecords: function() {
147
180
  var allConditions = $A(arguments) ;
148
181
  var recordType = allConditions.pop() ;
@@ -174,8 +207,10 @@ SC.Store = SC.Object.create({
174
207
  return ret ;
175
208
  },
176
209
 
177
- // finds the record with the primary key value. If the record does not
178
- // exist, creates it.
210
+ /**
211
+ finds the record with the primary key value. If the record does not
212
+ exist, creates it.
213
+ */
179
214
  getRecordFor: function(pkValue,recordType,dontAutoaddRecord) {
180
215
  var ret = this._getRecordFor(pkValue,recordType) ;
181
216
  if (!ret) {
@@ -188,6 +223,22 @@ SC.Store = SC.Object.create({
188
223
  return ret ;
189
224
  },
190
225
 
226
+ /**
227
+ Returns an array of all records in the store. Mostly used for storing.
228
+ */
229
+ records: function() {
230
+ var ret = [] ;
231
+ if (this._quickCache) {
232
+ for(var key in this._quickCache) {
233
+ var recs = this._quickCache[key] ;
234
+ for(var recKey in recs) {
235
+ ret.push(recs[recKey]) ;
236
+ }
237
+ }
238
+ }
239
+ return ret ;
240
+ }.property(),
241
+
191
242
  // ....................................
192
243
  // Collection Helpers
193
244
  //
@@ -231,7 +282,9 @@ SC.Store = SC.Object.create({
231
282
  //
232
283
  _records: {}, _changedRecords: null, _collections: {},
233
284
 
234
- // called whenever properties on a record change.
285
+ /** @private
286
+ called whenever properties on a record change.
287
+ */
235
288
  recordDidChange: function(rec) {
236
289
  // add to changed records. This will eventually notify collections.
237
290
  var guid = rec._storeKey() ;