publish_my_data 0.0.32 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. data/app/assets/images/publish_my_data/small-spinner.gif +0 -0
  2. data/app/assets/images/publish_my_data/sort-asc.gif +0 -0
  3. data/app/assets/images/publish_my_data/sort-desc.gif +0 -0
  4. data/app/assets/javascripts/bootstrap/affix.js +126 -0
  5. data/app/assets/javascripts/bootstrap/alert.js +98 -0
  6. data/app/assets/javascripts/bootstrap/button.js +109 -0
  7. data/app/assets/javascripts/bootstrap/carousel.js +217 -0
  8. data/app/assets/javascripts/bootstrap/collapse.js +179 -0
  9. data/app/assets/javascripts/bootstrap/dropdown.js +154 -0
  10. data/app/assets/javascripts/bootstrap/modal.js +246 -0
  11. data/app/assets/javascripts/bootstrap/popover.js +117 -0
  12. data/app/assets/javascripts/bootstrap/scrollspy.js +158 -0
  13. data/app/assets/javascripts/bootstrap/tab.js +135 -0
  14. data/app/assets/javascripts/bootstrap/tooltip.js +386 -0
  15. data/app/assets/javascripts/bootstrap/transition.js +56 -0
  16. data/app/assets/javascripts/publish_my_data/grid/10_data-loader.js +142 -0
  17. data/app/assets/javascripts/publish_my_data/grid/20_cube-grid.js +512 -0
  18. data/app/assets/javascripts/publish_my_data/grid/30_cube-dimension.js +77 -0
  19. data/app/assets/javascripts/publish_my_data/grid/40_cube-dimension-dropdown.js +87 -0
  20. data/app/assets/javascripts/publish_my_data/grid/45_cube-dimension-label.js +58 -0
  21. data/app/assets/javascripts/publish_my_data/grid/50_cube-dimensions-controls.js +336 -0
  22. data/app/assets/javascripts/publish_my_data/grid/60_dataset_cube_grid.js +187 -0
  23. data/app/assets/javascripts/publish_my_data/grid/70_sparql_results_grid.js +135 -0
  24. data/app/assets/javascripts/publish_my_data/select_text.js +27 -0
  25. data/app/assets/javascripts/publish_my_data.js +3 -0
  26. data/app/assets/javascripts/slick_grid/10_event-drag.js +402 -0
  27. data/app/assets/javascripts/slick_grid/20_slick-core.js +458 -0
  28. data/app/assets/javascripts/slick_grid/30_slick-grid.js +3295 -0
  29. data/app/assets/stylesheets/bootstrap/_alerts.scss +67 -0
  30. data/app/assets/stylesheets/bootstrap/_badges.scss +51 -0
  31. data/app/assets/stylesheets/bootstrap/_breadcrumbs.scss +23 -0
  32. data/app/assets/stylesheets/bootstrap/_button-groups.scss +248 -0
  33. data/app/assets/stylesheets/bootstrap/_buttons.scss +160 -0
  34. data/app/assets/stylesheets/bootstrap/_carousel.scss +209 -0
  35. data/app/assets/stylesheets/bootstrap/_close.scss +33 -0
  36. data/app/assets/stylesheets/bootstrap/_code.scss +56 -0
  37. data/app/assets/stylesheets/bootstrap/_component-animations.scss +29 -0
  38. data/app/assets/stylesheets/bootstrap/_dropdowns.scss +194 -0
  39. data/app/assets/stylesheets/bootstrap/_forms.scss +350 -0
  40. data/app/assets/stylesheets/bootstrap/_glyphicons.scss +232 -0
  41. data/app/assets/stylesheets/bootstrap/_grid.scss +346 -0
  42. data/app/assets/stylesheets/bootstrap/_input-groups.scss +127 -0
  43. data/app/assets/stylesheets/bootstrap/_jumbotron.scss +40 -0
  44. data/app/assets/stylesheets/bootstrap/_labels.scss +58 -0
  45. data/app/assets/stylesheets/bootstrap/_list-group.scss +88 -0
  46. data/app/assets/stylesheets/bootstrap/_media.scss +56 -0
  47. data/app/assets/stylesheets/bootstrap/_mixins.scss +728 -0
  48. data/app/assets/stylesheets/bootstrap/_modals.scss +145 -0
  49. data/app/assets/stylesheets/bootstrap/_navbar.scss +625 -0
  50. data/app/assets/stylesheets/bootstrap/_navs.scss +229 -0
  51. data/app/assets/stylesheets/bootstrap/_normalize.scss +396 -0
  52. data/app/assets/stylesheets/bootstrap/_pager.scss +55 -0
  53. data/app/assets/stylesheets/bootstrap/_pagination.scss +83 -0
  54. data/app/assets/stylesheets/bootstrap/_panels.scss +148 -0
  55. data/app/assets/stylesheets/bootstrap/_popovers.scss +133 -0
  56. data/app/assets/stylesheets/bootstrap/_print.scss +100 -0
  57. data/app/assets/stylesheets/bootstrap/_progress-bars.scss +95 -0
  58. data/app/assets/stylesheets/bootstrap/_responsive-utilities.scss +209 -0
  59. data/app/assets/stylesheets/bootstrap/_scaffolding.scss +130 -0
  60. data/app/assets/stylesheets/bootstrap/_tables.scss +236 -0
  61. data/app/assets/stylesheets/bootstrap/_theme.scss +232 -0
  62. data/app/assets/stylesheets/bootstrap/_thumbnails.scss +31 -0
  63. data/app/assets/stylesheets/bootstrap/_tooltip.scss +95 -0
  64. data/app/assets/stylesheets/bootstrap/_type.scss +238 -0
  65. data/app/assets/stylesheets/bootstrap/_utilities.scss +42 -0
  66. data/app/assets/stylesheets/bootstrap/_variables.scss +620 -0
  67. data/app/assets/stylesheets/bootstrap/_wells.scss +29 -0
  68. data/app/assets/stylesheets/bootstrap/bootstrap.scss +59 -0
  69. data/app/assets/stylesheets/publish_my_data/core.scss +244 -0
  70. data/app/assets/stylesheets/publish_my_data/data_grid.scss +103 -0
  71. data/app/assets/stylesheets/publish_my_data/variables.scss +1 -0
  72. data/app/assets/stylesheets/{publish_my_data.css → publish_my_data.scss} +13 -2
  73. data/app/assets/stylesheets/slick_grid/slick_grid.scss +155 -0
  74. data/app/assets/stylesheets/slick_grid/slick_grid_default_theme.scss +97 -0
  75. data/app/controllers/concerns/publish_my_data/data_cube.rb +42 -0
  76. data/app/controllers/publish_my_data/data_cube/dimensions_controller.rb +58 -0
  77. data/app/controllers/publish_my_data/data_cube/observations_controller.rb +54 -0
  78. data/app/controllers/publish_my_data/datasets_controller.rb +0 -11
  79. data/app/controllers/publish_my_data/example_resources_controller.rb +11 -0
  80. data/app/controllers/publish_my_data/home_controller.rb +4 -0
  81. data/app/controllers/publish_my_data/information_resources_controller.rb +0 -13
  82. data/app/helpers/publish_my_data/application_helper.rb +66 -0
  83. data/app/helpers/publish_my_data/crumb_helper.rb +61 -0
  84. data/app/helpers/publish_my_data/datasets_helper.rb +31 -0
  85. data/app/helpers/publish_my_data/resources_helper.rb +24 -0
  86. data/app/models/concerns/publish_my_data/cube_results.rb +51 -0
  87. data/app/models/concerns/publish_my_data/dataset_powers.rb +13 -0
  88. data/app/models/publish_my_data/data_cube/cube.rb +358 -0
  89. data/app/models/publish_my_data/data_cube/dimension.rb +58 -0
  90. data/app/models/publish_my_data/vocabulary.rb +0 -4
  91. data/app/views/layouts/publish_my_data/application.html.haml +18 -0
  92. data/app/views/layouts/publish_my_data/error.html.haml +21 -0
  93. data/app/views/publish_my_data/classes/show.html.haml +28 -0
  94. data/app/views/publish_my_data/concept_schemes/show.html.haml +79 -0
  95. data/app/views/publish_my_data/concepts/show.html.haml +28 -0
  96. data/app/views/publish_my_data/data_cube/_controls.html.haml +19 -0
  97. data/app/views/publish_my_data/data_cube/_grid.html.haml +37 -0
  98. data/app/views/publish_my_data/datasets/_example_resources.html.haml +47 -0
  99. data/app/views/publish_my_data/datasets/_types_table.html.erb +33 -0
  100. data/app/views/publish_my_data/datasets/index.html.haml +32 -0
  101. data/app/views/publish_my_data/datasets/show.html.haml +186 -0
  102. data/app/views/publish_my_data/errors/not_found.html.haml +18 -0
  103. data/app/views/publish_my_data/errors/response_too_large.html.haml +16 -0
  104. data/app/views/publish_my_data/errors/timeout.html.haml +16 -0
  105. data/app/views/publish_my_data/errors/uncaught.html.haml +16 -0
  106. data/app/views/publish_my_data/example_resources/index.js.erb +1 -0
  107. data/app/views/publish_my_data/home/accessibility.html.haml +1 -0
  108. data/app/views/publish_my_data/home/docs.html.haml +1 -0
  109. data/app/views/publish_my_data/home/home.html.haml +5 -0
  110. data/app/views/publish_my_data/home/privacy.html.haml +1 -0
  111. data/app/views/publish_my_data/ontologies/show.html.haml +100 -0
  112. data/app/views/publish_my_data/properties/show.html.haml +28 -0
  113. data/app/views/publish_my_data/resources/_resource_data.html.haml +16 -0
  114. data/app/views/publish_my_data/resources/_sparql_section.html.haml +22 -0
  115. data/app/views/publish_my_data/resources/index.html.haml +37 -0
  116. data/app/views/publish_my_data/resources/show.html.haml +36 -0
  117. data/app/views/publish_my_data/shared/_browser_warning.html.haml +4 -0
  118. data/app/views/publish_my_data/shared/_deprecation_notice.html.haml +8 -0
  119. data/app/views/publish_my_data/shared/_footer.html.haml +11 -0
  120. data/app/views/publish_my_data/shared/_google_analytics.html.haml +11 -0
  121. data/app/views/publish_my_data/shared/_logo.html.haml +1 -0
  122. data/app/views/publish_my_data/shared/_meta_title.html.haml +2 -0
  123. data/app/views/publish_my_data/sparql/_form.html.haml +28 -0
  124. data/app/views/publish_my_data/sparql/_formats_dropdown.html.haml +11 -0
  125. data/app/views/publish_my_data/sparql/endpoint.html.haml +125 -0
  126. data/app/views/publish_my_data/sparql/formats_dropdowns/_ask.html.haml +7 -0
  127. data/app/views/publish_my_data/sparql/formats_dropdowns/_construct.html.haml +7 -0
  128. data/app/views/publish_my_data/sparql/formats_dropdowns/_describe.html.haml +1 -0
  129. data/app/views/publish_my_data/sparql/formats_dropdowns/_select.html.haml +9 -0
  130. data/app/views/publish_my_data/themes/index.html.haml +30 -0
  131. data/app/views/publish_my_data/themes/show.html.haml +43 -0
  132. data/config/routes.rb +20 -5
  133. data/lib/publish_my_data/version.rb +1 -1
  134. data/lib/publish_my_data.rb +7 -12
  135. data/spec/controllers/publish_my_data/datasets_controller_spec.rb +0 -75
  136. data/spec/controllers/publish_my_data/information_resources_controller_spec.rb +2 -11
  137. data/spec/dummy/config/environments/development.rb +0 -4
  138. data/spec/dummy/config/environments/test.rb +0 -4
  139. data/spec/dummy/log/test.log +62962 -0
  140. data/spec/dummy/tmp/cache/sass/e509ccd4d793d2c162d70125e9f3656b6c28f357/(__TEMPLATE__)c +0 -0
  141. data/spec/features/running_a_sparql_query_spec.rb +1 -1
  142. data/spec/features/uri_dereferencing_spec.rb +1 -1
  143. metadata +200 -58
  144. data/app/controllers/concerns/publish_my_data/data_download.rb +0 -22
  145. data/app/controllers/publish_my_data/vocabularies_controller.rb +0 -18
  146. data/app/views/layouts/publish_my_data/application.html.erb +0 -13
  147. data/app/views/layouts/publish_my_data/error.html.erb +0 -13
  148. data/app/views/publish_my_data/classes/show.html.erb +0 -3
  149. data/app/views/publish_my_data/concept_schemes/_concepts.html.erb +0 -18
  150. data/app/views/publish_my_data/concept_schemes/show.html.erb +0 -11
  151. data/app/views/publish_my_data/concepts/show.html.erb +0 -3
  152. data/app/views/publish_my_data/datasets/index.html.erb +0 -20
  153. data/app/views/publish_my_data/datasets/show.html.erb +0 -18
  154. data/app/views/publish_my_data/errors/not_found.html.erb +0 -1
  155. data/app/views/publish_my_data/errors/response_too_large.html.erb +0 -1
  156. data/app/views/publish_my_data/errors/timeout.html.erb +0 -1
  157. data/app/views/publish_my_data/errors/uncaught.html.erb +0 -6
  158. data/app/views/publish_my_data/ontologies/show.html.erb +0 -17
  159. data/app/views/publish_my_data/properties/show.html.erb +0 -3
  160. data/app/views/publish_my_data/resources/_predicates_table.html.erb +0 -30
  161. data/app/views/publish_my_data/resources/_predicates_table_head.html.erb +0 -6
  162. data/app/views/publish_my_data/resources/_resource_formats.html.erb +0 -4
  163. data/app/views/publish_my_data/resources/_summaries.html.erb +0 -18
  164. data/app/views/publish_my_data/resources/_uri_and_label.html.erb +0 -3
  165. data/app/views/publish_my_data/resources/index.html.erb +0 -40
  166. data/app/views/publish_my_data/resources/show.html.erb +0 -3
  167. data/app/views/publish_my_data/sparql/_ask_formats.html.erb +0 -3
  168. data/app/views/publish_my_data/sparql/_construct_formats.html.erb +0 -3
  169. data/app/views/publish_my_data/sparql/_describe_formats.html.erb +0 -1
  170. data/app/views/publish_my_data/sparql/_error_message.html.erb +0 -3
  171. data/app/views/publish_my_data/sparql/_form.html.erb +0 -4
  172. data/app/views/publish_my_data/sparql/_formats.html.erb +0 -6
  173. data/app/views/publish_my_data/sparql/_pagination.html.erb +0 -6
  174. data/app/views/publish_my_data/sparql/_results.html.erb +0 -5
  175. data/app/views/publish_my_data/sparql/_results_data.html.erb +0 -4
  176. data/app/views/publish_my_data/sparql/_select_formats.html.erb +0 -3
  177. data/app/views/publish_my_data/sparql/endpoint.html.erb +0 -10
  178. data/app/views/publish_my_data/themes/index.html.erb +0 -13
  179. data/app/views/publish_my_data/themes/show.html.erb +0 -15
  180. data/config/initializers/20_s3_setup.rb +0 -4
  181. data/spec/controllers/publish_my_data/vocabularies_controller_spec.rb +0 -14
  182. data/spec/support/data_download.rb +0 -60
@@ -0,0 +1,458 @@
1
+ /***
2
+ * Contains core SlickGrid classes.
3
+ * @module Core
4
+ * @namespace Slick
5
+ */
6
+
7
+ (function ($) {
8
+ // register namespace
9
+ $.extend(true, window, {
10
+ "Slick": {
11
+ "Event": Event,
12
+ "EventData": EventData,
13
+ "EventHandler": EventHandler,
14
+ "Range": Range,
15
+ "NonDataRow": NonDataItem,
16
+ "Group": Group,
17
+ "GroupTotals": GroupTotals,
18
+ "EditorLock": EditorLock,
19
+
20
+ /***
21
+ * A global singleton editor lock.
22
+ * @class GlobalEditorLock
23
+ * @static
24
+ * @constructor
25
+ */
26
+ "GlobalEditorLock": new EditorLock()
27
+ }
28
+ });
29
+
30
+ /***
31
+ * An event object for passing data to event handlers and letting them control propagation.
32
+ * <p>This is pretty much identical to how W3C and jQuery implement events.</p>
33
+ * @class EventData
34
+ * @constructor
35
+ */
36
+ function EventData() {
37
+ var isPropagationStopped = false;
38
+ var isImmediatePropagationStopped = false;
39
+
40
+ /***
41
+ * Stops event from propagating up the DOM tree.
42
+ * @method stopPropagation
43
+ */
44
+ this.stopPropagation = function () {
45
+ isPropagationStopped = true;
46
+ };
47
+
48
+ /***
49
+ * Returns whether stopPropagation was called on this event object.
50
+ * @method isPropagationStopped
51
+ * @return {Boolean}
52
+ */
53
+ this.isPropagationStopped = function () {
54
+ return isPropagationStopped;
55
+ };
56
+
57
+ /***
58
+ * Prevents the rest of the handlers from being executed.
59
+ * @method stopImmediatePropagation
60
+ */
61
+ this.stopImmediatePropagation = function () {
62
+ isImmediatePropagationStopped = true;
63
+ };
64
+
65
+ /***
66
+ * Returns whether stopImmediatePropagation was called on this event object.\
67
+ * @method isImmediatePropagationStopped
68
+ * @return {Boolean}
69
+ */
70
+ this.isImmediatePropagationStopped = function () {
71
+ return isImmediatePropagationStopped;
72
+ }
73
+ }
74
+
75
+ /***
76
+ * A simple publisher-subscriber implementation.
77
+ * @class Event
78
+ * @constructor
79
+ */
80
+ function Event() {
81
+ var handlers = [];
82
+
83
+ /***
84
+ * Adds an event handler to be called when the event is fired.
85
+ * <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code>
86
+ * object the event was fired with.<p>
87
+ * @method subscribe
88
+ * @param fn {Function} Event handler.
89
+ */
90
+ this.subscribe = function (fn) {
91
+ handlers.push(fn);
92
+ };
93
+
94
+ /***
95
+ * Removes an event handler added with <code>subscribe(fn)</code>.
96
+ * @method unsubscribe
97
+ * @param fn {Function} Event handler to be removed.
98
+ */
99
+ this.unsubscribe = function (fn) {
100
+ for (var i = handlers.length - 1; i >= 0; i--) {
101
+ if (handlers[i] === fn) {
102
+ handlers.splice(i, 1);
103
+ }
104
+ }
105
+ };
106
+
107
+ /***
108
+ * Fires an event notifying all subscribers.
109
+ * @method notify
110
+ * @param args {Object} Additional data object to be passed to all handlers.
111
+ * @param e {EventData}
112
+ * Optional.
113
+ * An <code>EventData</code> object to be passed to all handlers.
114
+ * For DOM events, an existing W3C/jQuery event object can be passed in.
115
+ * @param scope {Object}
116
+ * Optional.
117
+ * The scope ("this") within which the handler will be executed.
118
+ * If not specified, the scope will be set to the <code>Event</code> instance.
119
+ */
120
+ this.notify = function (args, e, scope) {
121
+ e = e || new EventData();
122
+ scope = scope || this;
123
+
124
+ var returnValue;
125
+ for (var i = 0; i < handlers.length && !(e.isPropagationStopped() || e.isImmediatePropagationStopped()); i++) {
126
+ returnValue = handlers[i].call(scope, e, args);
127
+ }
128
+
129
+ return returnValue;
130
+ };
131
+ }
132
+
133
+ function EventHandler() {
134
+ var handlers = [];
135
+
136
+ this.subscribe = function (event, handler) {
137
+ handlers.push({
138
+ event: event,
139
+ handler: handler
140
+ });
141
+ event.subscribe(handler);
142
+
143
+ return this; // allow chaining
144
+ };
145
+
146
+ this.unsubscribe = function (event, handler) {
147
+ var i = handlers.length;
148
+ while (i--) {
149
+ if (handlers[i].event === event &&
150
+ handlers[i].handler === handler) {
151
+ handlers.splice(i, 1);
152
+ event.unsubscribe(handler);
153
+ return;
154
+ }
155
+ }
156
+
157
+ return this; // allow chaining
158
+ };
159
+
160
+ this.unsubscribeAll = function () {
161
+ var i = handlers.length;
162
+ while (i--) {
163
+ handlers[i].event.unsubscribe(handlers[i].handler);
164
+ }
165
+ handlers = [];
166
+
167
+ return this; // allow chaining
168
+ }
169
+ }
170
+
171
+ /***
172
+ * A structure containing a range of cells.
173
+ * @class Range
174
+ * @constructor
175
+ * @param fromRow {Integer} Starting row.
176
+ * @param fromCell {Integer} Starting cell.
177
+ * @param toRow {Integer} Optional. Ending row. Defaults to <code>fromRow</code>.
178
+ * @param toCell {Integer} Optional. Ending cell. Defaults to <code>fromCell</code>.
179
+ */
180
+ function Range(fromRow, fromCell, toRow, toCell) {
181
+ if (toRow === undefined && toCell === undefined) {
182
+ toRow = fromRow;
183
+ toCell = fromCell;
184
+ }
185
+
186
+ /***
187
+ * @property fromRow
188
+ * @type {Integer}
189
+ */
190
+ this.fromRow = Math.min(fromRow, toRow);
191
+
192
+ /***
193
+ * @property fromCell
194
+ * @type {Integer}
195
+ */
196
+ this.fromCell = Math.min(fromCell, toCell);
197
+
198
+ /***
199
+ * @property toRow
200
+ * @type {Integer}
201
+ */
202
+ this.toRow = Math.max(fromRow, toRow);
203
+
204
+ /***
205
+ * @property toCell
206
+ * @type {Integer}
207
+ */
208
+ this.toCell = Math.max(fromCell, toCell);
209
+
210
+ /***
211
+ * Returns whether a range represents a single row.
212
+ * @method isSingleRow
213
+ * @return {Boolean}
214
+ */
215
+ this.isSingleRow = function () {
216
+ return this.fromRow == this.toRow;
217
+ };
218
+
219
+ /***
220
+ * Returns whether a range represents a single cell.
221
+ * @method isSingleCell
222
+ * @return {Boolean}
223
+ */
224
+ this.isSingleCell = function () {
225
+ return this.fromRow == this.toRow && this.fromCell == this.toCell;
226
+ };
227
+
228
+ /***
229
+ * Returns whether a range contains a given cell.
230
+ * @method contains
231
+ * @param row {Integer}
232
+ * @param cell {Integer}
233
+ * @return {Boolean}
234
+ */
235
+ this.contains = function (row, cell) {
236
+ return row >= this.fromRow && row <= this.toRow &&
237
+ cell >= this.fromCell && cell <= this.toCell;
238
+ };
239
+
240
+ /***
241
+ * Returns a readable representation of a range.
242
+ * @method toString
243
+ * @return {String}
244
+ */
245
+ this.toString = function () {
246
+ if (this.isSingleCell()) {
247
+ return "(" + this.fromRow + ":" + this.fromCell + ")";
248
+ }
249
+ else {
250
+ return "(" + this.fromRow + ":" + this.fromCell + " - " + this.toRow + ":" + this.toCell + ")";
251
+ }
252
+ }
253
+ }
254
+
255
+
256
+ /***
257
+ * A base class that all special / non-data rows (like Group and GroupTotals) derive from.
258
+ * @class NonDataItem
259
+ * @constructor
260
+ */
261
+ function NonDataItem() {
262
+ this.__nonDataRow = true;
263
+ }
264
+
265
+
266
+ /***
267
+ * Information about a group of rows.
268
+ * @class Group
269
+ * @extends Slick.NonDataItem
270
+ * @constructor
271
+ */
272
+ function Group() {
273
+ this.__group = true;
274
+
275
+ /**
276
+ * Grouping level, starting with 0.
277
+ * @property level
278
+ * @type {Number}
279
+ */
280
+ this.level = 0;
281
+
282
+ /***
283
+ * Number of rows in the group.
284
+ * @property count
285
+ * @type {Integer}
286
+ */
287
+ this.count = 0;
288
+
289
+ /***
290
+ * Grouping value.
291
+ * @property value
292
+ * @type {Object}
293
+ */
294
+ this.value = null;
295
+
296
+ /***
297
+ * Formatted display value of the group.
298
+ * @property title
299
+ * @type {String}
300
+ */
301
+ this.title = null;
302
+
303
+ /***
304
+ * Whether a group is collapsed.
305
+ * @property collapsed
306
+ * @type {Boolean}
307
+ */
308
+ this.collapsed = false;
309
+
310
+ /***
311
+ * GroupTotals, if any.
312
+ * @property totals
313
+ * @type {GroupTotals}
314
+ */
315
+ this.totals = null;
316
+
317
+ /**
318
+ * Rows that are part of the group.
319
+ * @property rows
320
+ * @type {Array}
321
+ */
322
+ this.rows = [];
323
+
324
+ /**
325
+ * Sub-groups that are part of the group.
326
+ * @property groups
327
+ * @type {Array}
328
+ */
329
+ this.groups = null;
330
+
331
+ /**
332
+ * A unique key used to identify the group. This key can be used in calls to DataView
333
+ * collapseGroup() or expandGroup().
334
+ * @property groupingKey
335
+ * @type {Object}
336
+ */
337
+ this.groupingKey = null;
338
+ }
339
+
340
+ Group.prototype = new NonDataItem();
341
+
342
+ /***
343
+ * Compares two Group instances.
344
+ * @method equals
345
+ * @return {Boolean}
346
+ * @param group {Group} Group instance to compare to.
347
+ */
348
+ Group.prototype.equals = function (group) {
349
+ return this.value === group.value &&
350
+ this.count === group.count &&
351
+ this.collapsed === group.collapsed;
352
+ };
353
+
354
+ /***
355
+ * Information about group totals.
356
+ * An instance of GroupTotals will be created for each totals row and passed to the aggregators
357
+ * so that they can store arbitrary data in it. That data can later be accessed by group totals
358
+ * formatters during the display.
359
+ * @class GroupTotals
360
+ * @extends Slick.NonDataItem
361
+ * @constructor
362
+ */
363
+ function GroupTotals() {
364
+ this.__groupTotals = true;
365
+
366
+ /***
367
+ * Parent Group.
368
+ * @param group
369
+ * @type {Group}
370
+ */
371
+ this.group = null;
372
+ }
373
+
374
+ GroupTotals.prototype = new NonDataItem();
375
+
376
+ /***
377
+ * A locking helper to track the active edit controller and ensure that only a single controller
378
+ * can be active at a time. This prevents a whole class of state and validation synchronization
379
+ * issues. An edit controller (such as SlickGrid) can query if an active edit is in progress
380
+ * and attempt a commit or cancel before proceeding.
381
+ * @class EditorLock
382
+ * @constructor
383
+ */
384
+ function EditorLock() {
385
+ var activeEditController = null;
386
+
387
+ /***
388
+ * Returns true if a specified edit controller is active (has the edit lock).
389
+ * If the parameter is not specified, returns true if any edit controller is active.
390
+ * @method isActive
391
+ * @param editController {EditController}
392
+ * @return {Boolean}
393
+ */
394
+ this.isActive = function (editController) {
395
+ return (editController ? activeEditController === editController : activeEditController !== null);
396
+ };
397
+
398
+ /***
399
+ * Sets the specified edit controller as the active edit controller (acquire edit lock).
400
+ * If another edit controller is already active, and exception will be thrown.
401
+ * @method activate
402
+ * @param editController {EditController} edit controller acquiring the lock
403
+ */
404
+ this.activate = function (editController) {
405
+ if (editController === activeEditController) { // already activated?
406
+ return;
407
+ }
408
+ if (activeEditController !== null) {
409
+ throw "SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";
410
+ }
411
+ if (!editController.commitCurrentEdit) {
412
+ throw "SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";
413
+ }
414
+ if (!editController.cancelCurrentEdit) {
415
+ throw "SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";
416
+ }
417
+ activeEditController = editController;
418
+ };
419
+
420
+ /***
421
+ * Unsets the specified edit controller as the active edit controller (release edit lock).
422
+ * If the specified edit controller is not the active one, an exception will be thrown.
423
+ * @method deactivate
424
+ * @param editController {EditController} edit controller releasing the lock
425
+ */
426
+ this.deactivate = function (editController) {
427
+ if (activeEditController !== editController) {
428
+ throw "SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";
429
+ }
430
+ activeEditController = null;
431
+ };
432
+
433
+ /***
434
+ * Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit
435
+ * controller and returns whether the commit attempt was successful (commit may fail due to validation
436
+ * errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded
437
+ * and false otherwise. If no edit controller is active, returns true.
438
+ * @method commitCurrentEdit
439
+ * @return {Boolean}
440
+ */
441
+ this.commitCurrentEdit = function () {
442
+ return (activeEditController ? activeEditController.commitCurrentEdit() : true);
443
+ };
444
+
445
+ /***
446
+ * Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit
447
+ * controller and returns whether the edit was successfully cancelled. If no edit controller is
448
+ * active, returns true.
449
+ * @method cancelCurrentEdit
450
+ * @return {Boolean}
451
+ */
452
+ this.cancelCurrentEdit = function cancelCurrentEdit() {
453
+ return (activeEditController ? activeEditController.cancelCurrentEdit() : true);
454
+ };
455
+ }
456
+ })(jQuery);
457
+
458
+