diff options
author | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-02-01 00:09:27 -0800 |
commit | 8592cfb89db05f0e52d8c1b8c7046e6f49e3522d (patch) | |
tree | a6f9b5adfe16fd6232708f8a2345cd79056caca9 /node_modules/montage-user/data/query.js | |
parent | c6d1a1da9e7cdf477daf32410d80691eb1e828d5 (diff) | |
download | ninja-8592cfb89db05f0e52d8c1b8c7046e6f49e3522d.tar.gz |
Adding a montage framework copy for the user document
Adding a new montage copy containing the latest version of montage to use the new native widgets
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'node_modules/montage-user/data/query.js')
-rwxr-xr-x | node_modules/montage-user/data/query.js | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/node_modules/montage-user/data/query.js b/node_modules/montage-user/data/query.js new file mode 100755 index 00000000..9fce9dae --- /dev/null +++ b/node_modules/montage-user/data/query.js | |||
@@ -0,0 +1,114 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | /** | ||
7 | @module montage/data/query | ||
8 | @requires montage/core/core | ||
9 | @requires montage/data/selector | ||
10 | @requires montage/core/logger | ||
11 | */ | ||
12 | var Montage = require("montage").Montage; | ||
13 | var Selector = require("data/selector").Selector; | ||
14 | var Key = require("data/selector").Key; | ||
15 | var logger = require("core/logger").logger("query"); | ||
16 | /** | ||
17 | @class module:montage/data/query.Query | ||
18 | @extends module:montage/data/selector.Selector | ||
19 | */ | ||
20 | var Query = exports.Query = Montage.create(Selector,/** @lends module:montage/data/query.Query# */ { | ||
21 | /** | ||
22 | Description TODO | ||
23 | @type {Property} | ||
24 | @default {Function} null | ||
25 | */ | ||
26 | blueprint: { | ||
27 | value: null, | ||
28 | serializable: true | ||
29 | }, | ||
30 | /** | ||
31 | Description TODO | ||
32 | @type {Property} | ||
33 | @default {Selector} null | ||
34 | */ | ||
35 | selector: { | ||
36 | value: null, | ||
37 | serializable: true | ||
38 | }, | ||
39 | /** | ||
40 | Description TODO | ||
41 | @type {Property} | ||
42 | @default {String} "" | ||
43 | */ | ||
44 | name: { | ||
45 | serializable: true, | ||
46 | enumerable: true, | ||
47 | value: "" | ||
48 | }, | ||
49 | /** | ||
50 | Description TODO | ||
51 | @function | ||
52 | @param {Function} blueprint TODO | ||
53 | @returns this.initWithBlueprintAndSelector(blueprint, null) | ||
54 | */ | ||
55 | initWithBlueprint: { | ||
56 | enumerable: true, | ||
57 | value: function(blueprint) { | ||
58 | return this.initWithBlueprintAndSelector(blueprint, null); | ||
59 | } | ||
60 | }, | ||
61 | /** | ||
62 | Description TODO | ||
63 | @function | ||
64 | @param {Function} blueprint TODO | ||
65 | @param {Selector} selector TODO | ||
66 | @returns itself | ||
67 | */ | ||
68 | initWithBlueprintAndSelector: { | ||
69 | enumerable: true, | ||
70 | value: function(blueprint, selector) { | ||
71 | this.blueprint = blueprint; | ||
72 | Object.defineProperty(this, "blueprint", {writable: false}); | ||
73 | if ((selector != null) && (typeof selector === 'object')) { | ||
74 | this.selector = selector; | ||
75 | } else { | ||
76 | this.selector = this; | ||
77 | } | ||
78 | return this; | ||
79 | } | ||
80 | }, | ||
81 | /** | ||
82 | Description TODO | ||
83 | @function | ||
84 | @param {Function} propertyPath TODO | ||
85 | @returns this.selector | ||
86 | */ | ||
87 | where: { | ||
88 | value: function(propertyPath) { | ||
89 | // where clause with an empty key path is a noop. | ||
90 | if ((propertyPath != null) && (typeof propertyPath == 'string') && (propertyPath.length > 0)) { | ||
91 | // TODO [PJYF Aug 23 2011] We should check that the key path is valid | ||
92 | return Key.create().init(this, [propertyPath]); | ||
93 | } | ||
94 | return this.selector; | ||
95 | } | ||
96 | }, | ||
97 | /** | ||
98 | Description TODO | ||
99 | @function | ||
100 | @param {Function} propertyPath TODO | ||
101 | @returns this.selector | ||
102 | */ | ||
103 | property: { | ||
104 | value: function(propertyPath) { | ||
105 | if (((propertyPath) != null) && (typeof (propertyPath) == 'string') && (propertyPath.length > 0)) { | ||
106 | // TODO [PJYF Aug 23 2011] We should check that the key path is valid | ||
107 | return Key.create().init(this, [(propertyPath)]); | ||
108 | } | ||
109 | // TODO [PJYF Aug 23 2011] We should raise here. | ||
110 | return this.selector; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | }); | ||