2 * Licensed under the Apache License, Version 2.0 (the "License");
3 * you may not use this file except in compliance with the License.
4 * You may obtain a copy of the License at
6 * http://www.apache.org/licenses/LICENSE-2.0
8 * Unless required by applicable law or agreed to in writing, software
9 * distributed under the License is distributed on an "AS IS" BASIS,
10 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 * See the License for the specific language governing permissions and
12 * limitations under the License.
16 * @fileoverview Representation of an enum.
22 * Base interface for all enum objects.
23 * This class allows containers to use constants for fields that are usually
24 * have a common set of values.
25 * There are two main ways to use this class.
28 * If your gadget just wants to display how much of a smoker someone is,
32 * <pre>html = "This person smokes: " + person.getField('smoker').getValue();</pre>
35 * This value field will be correctly set up by the container. This is a place
36 * where the container can even localize the value for the gadget so that it
37 * always shows the right thing.
41 * If your gadget wants to have some logic around the smoker
45 * <pre>if (person.getField('smoker').getKey() != "NO") { //gadget logic here }</pre>
49 * The key may be null if the person's smoker field cannot be coerced
50 * into one of the standard enum types.
51 * The value, on the other hand, is never null.
54 * @name opensocial.Enum
59 * Base interface for all enum objects.
64 opensocial.Enum = function() {};
68 * Use this for logic within your gadget. If they key is null then the value
69 * does not fit in the defined enums.
71 * @return {String} The enum's key. This should be one of the defined enums
74 opensocial.Enum.prototype.getKey = function() {};
78 * The value of this enum. This will be a user displayable string. If the
79 * container supports localization, the string will be localized.
81 * @return {String} The enum's value.
83 opensocial.Enum.prototype.getDisplayValue = function() {};
89 * The enum keys used by the smoker field.
91 * <a href="opensocial.Person.Field.html">
92 * opensocial.Person.Field.Smoker</a>
95 * @name opensocial.Enum.Smoker
97 opensocial.Enum.Smoker = {
99 * This field may be used interchangeably with the string 'NO'.
100 * @member opensocial.Enum.Smoker
104 * This field may be used interchangeably with the string 'YES'.
105 * @member opensocial.Enum.Smoker
109 * This field may be used interchangeably with the string 'SOCIALLY'.
110 * @member opensocial.Enum.Smoker
112 SOCIALLY : 'SOCIALLY',
114 * This field may be used interchangeably with the string 'OCCASIONALLY'.
115 * @member opensocial.Enum.Smoker
117 OCCASIONALLY : 'OCCASIONALLY',
119 * This field may be used interchangeably with the string 'REGULARLY'.
120 * @member opensocial.Enum.Smoker
122 REGULARLY : 'REGULARLY',
124 * This field may be used interchangeably with the string 'HEAVILY'.
125 * @member opensocial.Enum.Smoker
129 * This field may be used interchangeably with the string 'QUITTING'.
130 * @member opensocial.Enum.Smoker
132 QUITTING : 'QUITTING',
134 * This field may be used interchangeably with the string 'QUIT'.
135 * @member opensocial.Enum.Smoker
144 * The enum keys used by the drinker field.
145 * <p><b>See also:</b>
146 * <a href="opensocial.Person.Field.html">
147 * opensocial.Person.Field.Drinker</a>
150 * @name opensocial.Enum.Drinker
152 opensocial.Enum.Drinker = {
154 * This field may be used interchangeably with the string 'NO'.
155 * @member opensocial.Enum.Drinker
159 * This field may be used interchangeably with the string 'YES'.
160 * @member opensocial.Enum.Drinker
164 * This field may be used interchangeably with the string 'SOCIALLY'.
165 * @member opensocial.Enum.Drinker
167 SOCIALLY : 'SOCIALLY',
169 * This field may be used interchangeably with the string 'OCCASIONALLY'.
170 * @member opensocial.Enum.Drinker
172 OCCASIONALLY : 'OCCASIONALLY',
174 * This field may be used interchangeably with the string 'REGULARLY'.
175 * @member opensocial.Enum.Drinker
177 REGULARLY : 'REGULARLY',
179 * This field may be used interchangeably with the string 'HEAVILY'.
180 * @member opensocial.Enum.Drinker
184 * This field may be used interchangeably with the string 'QUITTING'.
185 * @member opensocial.Enum.Drinker
187 QUITTING : 'QUITTING',
189 * This field may be used interchangeably with the string 'QUIT'.
190 * @member opensocial.Enum.Drinker
199 * The enum keys used by the gender field.
200 * <p><b>See also:</b>
201 * <a href="opensocial.Person.Field.html">
202 * opensocial.Person.Field.Gender</a>
205 * @name opensocial.Enum.Gender
207 opensocial.Enum.Gender = {
209 * This field may be used interchangeably with the string 'MALE'.
210 * @member opensocial.Enum.Gender
214 * This field may be used interchangeably with the string 'FEMALE'.
215 * @member opensocial.Enum.Gender
224 * The enum keys used by the lookingFor field.
225 * <p><b>See also:</b>
226 * <a href="opensocial.Person.Field.html">
227 * opensocial.Person.Field.LookingFor</a>
230 * @name opensocial.Enum.LookingFor
232 opensocial.Enum.LookingFor = {
234 * This field may be used interchangeably with the string 'DATING'.
235 * @member opensocial.Enum.LookingFor
239 * This field may be used interchangeably with the string 'FRIENDS'.
240 * @member opensocial.Enum.LookingFor
244 * This field may be used interchangeably with the string 'RELATIONSHIP'.
245 * @member opensocial.Enum.LookingFor
247 RELATIONSHIP : 'RELATIONSHIP',
249 * This field may be used interchangeably with the string 'NETWORKING'.
250 * @member opensocial.Enum.LookingFor
252 NETWORKING : 'NETWORKING',
254 * This field may be used interchangeably with the string 'ACTIVITY_PARTNERS'.
255 * @member opensocial.Enum.LookingFor
257 ACTIVITY_PARTNERS : 'ACTIVITY_PARTNERS',
259 * This field may be used interchangeably with the string 'RANDOM'.
260 * @member opensocial.Enum.LookingFor
269 * The enum keys used by the networkPresence field.
270 * <p><b>See also:</b>
271 * <a href="opensocial.Person.Field.html">
272 * opensocial.Person.Field.NetworkPresence</a>
275 * @name opensocial.Enum.Presence
277 opensocial.Enum.Presence = {
279 * The entity or resource is off line.
280 * This field may be used interchangeably with the string 'OFFLINE'.
282 * @member opensocial.Enum.Presence
286 * The entity or resource is on line.
287 * This field may be used interchangeably with the string 'ONLINE'.
289 * @member opensocial.Enum.Presence
293 * The entity or resource is temporarily away.
294 * This field may be used interchangeably with the string 'AWAY'.
296 * @member opensocial.Enum.Presence
300 * The entity or resource is actively interested in chatting.
301 * This field may be used interchangeably with the string 'CHAT'.
302 * @member opensocial.Enum.Presence
306 * The entity or resource is busy (dnd = "Do Not Disturb").
307 * This field may be used interchangeably with the string 'DND'.
308 * @member opensocial.Enum.Presence
312 * The entity or resource is away for an extended period
313 * (xa = "eXtended Away").
314 * This field may be used interchangeably with the string 'XA'.
315 * @member opensocial.Enum.Presence