/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @fileoverview Representation of an enum. */ /** * @class * Base interface for all enum objects. * This class allows containers to use constants for fields that are usually * have a common set of values. * There are two main ways to use this class. * *
* If your gadget just wants to display how much of a smoker someone is, * it can simply use: *
* *html = "This person smokes: " + person.getField('smoker').getValue();
*
* * This value field will be correctly set up by the container. This is a place * where the container can even localize the value for the gadget so that it * always shows the right thing. *
* ** If your gadget wants to have some logic around the smoker * field it can use: *
* *if (person.getField('smoker').getKey() != "NO") { //gadget logic here }
*
* * Note: * The key may be null if the person's smoker field cannot be coerced * into one of the standard enum types. * The value, on the other hand, is never null. *
* * @name opensocial.Enum */ /** * Base interface for all enum objects. * * @private * @constructor */ opensocial.Enum = function() {}; /** * Use this for logic within your gadget. If they key is null then the value * does not fit in the defined enums. * * @return {String} The enum's key. This should be one of the defined enums * below. */ opensocial.Enum.prototype.getKey = function() {}; /** * The value of this enum. This will be a user displayable string. If the * container supports localization, the string will be localized. * * @return {String} The enum's value. */ opensocial.Enum.prototype.getDisplayValue = function() {}; /** * @static * @class * The enum keys used by the smoker field. *See also: * * opensocial.Person.Field.Smoker *
* * @name opensocial.Enum.Smoker */ opensocial.Enum.Smoker = { /** @member opensocial.Enum.Smoker */ NO : 'NO', /** @member opensocial.Enum.Smoker */ YES : 'YES', /** @member opensocial.Enum.Smoker */ SOCIALLY : 'SOCIALLY', /** @member opensocial.Enum.Smoker */ OCCASIONALLY : 'OCCASIONALLY', /** @member opensocial.Enum.Smoker */ REGULARLY : 'REGULARLY', /** @member opensocial.Enum.Smoker */ HEAVILY : 'HEAVILY', /** @member opensocial.Enum.Smoker */ QUITTING : 'QUITTING', /** @member opensocial.Enum.Smoker */ QUIT : 'QUIT' }; /** * @static * @class * The enum keys used by the drinker field. *See also: * * opensocial.Person.Field.Drinker *
* * @name opensocial.Enum.Drinker */ opensocial.Enum.Drinker = { /** @member opensocial.Enum.Drinker */ NO : 'NO', /** @member opensocial.Enum.Drinker */ YES : 'YES', /** @member opensocial.Enum.Drinker */ SOCIALLY : 'SOCIALLY', /** @member opensocial.Enum.Drinker */ OCCASIONALLY : 'OCCASIONALLY', /** @member opensocial.Enum.Drinker */ REGULARLY : 'REGULARLY', /** @member opensocial.Enum.Drinker */ HEAVILY : 'HEAVILY', /** @member opensocial.Enum.Drinker */ QUITTING : 'QUITTING', /** @member opensocial.Enum.Drinker */ QUIT : 'QUIT' }; /** * @static * @class * The enum keys used by the gender field. *See also: * * opensocial.Person.Field.Gender *
* * @name opensocial.Enum.Gender */ opensocial.Enum.Gender = { /** @member opensocial.Enum.Gender */ MALE : 'MALE', /** @member opensocial.Enum.Gender */ FEMALE : 'FEMALE' }; /** * @static * @class * The enum keys used by the lookingFor field. *See also: * * opensocial.Person.Field.LookingFor *
* * @name opensocial.Enum.LookingFor */ opensocial.Enum.LookingFor = { /** @member opensocial.Enum.LookingFor */ DATING : 'DATING', /** @member opensocial.Enum.LookingFor */ FRIENDS : 'FRIENDS', /** @member opensocial.Enum.LookingFor */ RELATIONSHIP : 'RELATIONSHIP', /** @member opensocial.Enum.LookingFor */ NETWORKING : 'NETWORKING', /** @member opensocial.Enum.LookingFor */ ACTIVITY_PARTNERS : 'ACTIVITY_PARTNERS', /** @member opensocial.Enum.LookingFor */ RANDOM : 'RANDOM' }; /** * @static * @class * The enum keys used by the networkPresence field. *See also: * * opensocial.Person.Field.NetworkPresence *
* * @name opensocial.Enum.Presence */ opensocial.Enum.Presence = { /** * The entity or resource is off line. * @member opensocial.Enum.Presence */ OFFLINE : 'OFFLINE', /** * The entity or resource is on line. * @member opensocial.Enum.Presence */ ONLINE : 'ONLINE', /** * The entity or resource is temporarily away. * @member opensocial.Enum.Presence */ AWAY : 'AWAY', /** * The entity or resource is actively interested in chatting. * @member opensocial.Enum.Presence */ CHAT : 'CHAT', /** * The entity or resource is busy (dnd = "Do Not Disturb"). * @member opensocial.Enum.Presence */ DND : 'DND', /** * The entity or resource is away for an extended period * (xa = "eXtended Away"). * @member opensocial.Enum.Presence */ XA : 'XA' };