shindig-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lind...@apache.org
Subject svn commit: r1005506 [36/45] - in /shindig/branches/2.0.x: ./ content/editor/ content/editor/CodeMirror-0.8/ content/editor/CodeMirror-0.8/css/ content/editor/CodeMirror-0.8/js/ content/samplecontainer/examples/media/ etc/ etc/checkstyle/ extras/src/ma...
Date Thu, 07 Oct 2010 15:54:40 GMT
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/i18n/numberformattest.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/i18n/numberformattest.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/i18n/numberformattest.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/i18n/numberformattest.js Thu Oct  7 15:54:09 2010
@@ -22,378 +22,378 @@
  */
 
 function NumberFormatTest(name) {
-    TestCase.call(this, name);
+  TestCase.call(this, name);
 }
 
 NumberFormatTest.inherits(TestCase);
 
 var NumberFormatConstants_en = {
-    DECIMAL_SEP:'.',
-    GROUP_SEP:',',
-    PERCENT:'%',
-    ZERO_DIGIT:'0',
-    PLUS_SIGN:'+',
-    MINUS_SIGN:'-',
-    EXP_SYMBOL:'E',
-    PERMILL:'\u2030',
-    INFINITY:'\u221E',
-    NAN:'NaN',
-    MONETARY_SEP:'.',
-    MONETARY_GROUP_SEP:',',
-    DECIMAL_PATTERN:'#,##0.###',
-    SCIENTIFIC_PATTERN:'#E0',
-    PERCENT_PATTERN:'#,##0%',
-    CURRENCY_PATTERN:'\u00A4#,##0.00',
-    DEF_CURRENCY_CODE:'USD'
+  DECIMAL_SEP: '.',
+  GROUP_SEP: ',',
+  PERCENT: '%',
+  ZERO_DIGIT: '0',
+  PLUS_SIGN: '+',
+  MINUS_SIGN: '-',
+  EXP_SYMBOL: 'E',
+  PERMILL: '\u2030',
+  INFINITY: '\u221E',
+  NAN: 'NaN',
+  MONETARY_SEP: '.',
+  MONETARY_GROUP_SEP: ',',
+  DECIMAL_PATTERN: '#,##0.###',
+  SCIENTIFIC_PATTERN: '#E0',
+  PERCENT_PATTERN: '#,##0%',
+  CURRENCY_PATTERN: '\u00A4#,##0.00',
+  DEF_CURRENCY_CODE: 'USD'
 };
 
 NumberFormatTest.prototype.setUp = function() {
-    gadgets.i18n.numFormatter_
+  gadgets.i18n.numFormatter_
             = new gadgets.i18n.NumberFormat(NumberFormatConstants_en);
 };
 
 NumberFormatTest.prototype.testStandardFormat = function() {
-    var str;
-    str = gadgets.i18n.formatNumber(gadgets.i18n.CURRENCY_PATTERN, 1234.579);
-    this.assertEquals("$1,234.58", str);
-    str = gadgets.i18n.formatNumber(gadgets.i18n.DECIMAL_PATTERN, 1234.579);
-    this.assertEquals("1,234.579", str);
-    str = gadgets.i18n.formatNumber(gadgets.i18n.PERCENT_PATTERN, 1234.579);
-    this.assertEquals("123,458%", str);
-    str = gadgets.i18n.formatNumber(gadgets.i18n.SCIENTIFIC_PATTERN, 1234.579);
-    this.assertEquals("1E3", str);
+  var str;
+  str = gadgets.i18n.formatNumber(gadgets.i18n.CURRENCY_PATTERN, 1234.579);
+  this.assertEquals('$1,234.58', str);
+  str = gadgets.i18n.formatNumber(gadgets.i18n.DECIMAL_PATTERN, 1234.579);
+  this.assertEquals('1,234.579', str);
+  str = gadgets.i18n.formatNumber(gadgets.i18n.PERCENT_PATTERN, 1234.579);
+  this.assertEquals('123,458%', str);
+  str = gadgets.i18n.formatNumber(gadgets.i18n.SCIENTIFIC_PATTERN, 1234.579);
+  this.assertEquals('1E3', str);
 };
 
 NumberFormatTest.prototype.testBasicParse = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("0.0000", "123.4579");
-    this.assertEquals(123.4579, value);
+  value = gadgets.i18n.parseNumber('0.0000', '123.4579');
+  this.assertEquals(123.4579, value);
 
-    value = gadgets.i18n.parseNumber("0.0000", "+123.4579");
-    this.assertEquals(123.4579, value);
+  value = gadgets.i18n.parseNumber('0.0000', '+123.4579');
+  this.assertEquals(123.4579, value);
 
-    value = gadgets.i18n.parseNumber("0.0000", "-123.4579");
-    this.assertEquals(-123.4579, value);
+  value = gadgets.i18n.parseNumber('0.0000', '-123.4579');
+  this.assertEquals(-123.4579, value);
 };
 
 NumberFormatTest.prototype.testPrefixParse = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "123.4579");
-    this.assertEquals(123.4579, value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '123.4579');
+  this.assertEquals(123.4579, value);
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "(123.4579)");
-    this.assertEquals(-123.4579, value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '(123.4579)');
+  this.assertEquals(-123.4579, value);
 };
 
 NumberFormatTest.prototype.testPrecentParse = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "123.4579%");
-    this.assertEquals((123.4579 / 100), value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '123.4579%');
+  this.assertEquals((123.4579 / 100), value);
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "(%123.4579)");
-    this.assertEquals((-123.4579 / 100), value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '(%123.4579)');
+  this.assertEquals((-123.4579 / 100), value);
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "123.4579\u2030");
-    this.assertEquals((123.4579 / 1000), value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '123.4579\u2030');
+  this.assertEquals((123.4579 / 1000), value);
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "(\u2030123.4579)");
-    this.assertEquals((-123.4579 / 1000), value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '(\u2030123.4579)');
+  this.assertEquals((-123.4579 / 1000), value);
 };
 
 NumberFormatTest.prototype.testPercentAndPerMillAdvance = function() {
-    var value;
-    var pos = [0];
-    value = gadgets.i18n.parseNumber("0", "120%", pos);
-    this.assertEquals(1.2, value);
-    this.assertEquals(4, pos[0]);
-    pos[0] = 0;
-    value = gadgets.i18n.parseNumber("0", "120\u2030", pos);
-    this.assertEquals(0.12, value);
-    this.assertEquals(4, pos[0]);
+  var value;
+  var pos = [0];
+  value = gadgets.i18n.parseNumber('0', '120%', pos);
+  this.assertEquals(1.2, value);
+  this.assertEquals(4, pos[0]);
+  pos[0] = 0;
+  value = gadgets.i18n.parseNumber('0', '120\u2030', pos);
+  this.assertEquals(0.12, value);
+  this.assertEquals(4, pos[0]);
 };
 
 NumberFormatTest.prototype.testInfinityParse = function() {
-    var value;
+  var value;
 
   // gwt need to add those symbols first
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "\u221e");
-    this.assertEquals(Number.POSITIVE_INFINITY, value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '\u221e');
+  this.assertEquals(Number.POSITIVE_INFINITY, value);
 
-    value = gadgets.i18n.parseNumber("0.0;(0.0)", "(\u221e)");
-    this.assertEquals(Number.NEGATIVE_INFINITY, value);
+  value = gadgets.i18n.parseNumber('0.0;(0.0)', '(\u221e)');
+  this.assertEquals(Number.NEGATIVE_INFINITY, value);
 };
 NumberFormatTest.prototype.testExponentParse = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("#E0", "1.234E3");
-    this.assertEquals(1.234E+3, value);
+  value = gadgets.i18n.parseNumber('#E0', '1.234E3');
+  this.assertEquals(1.234E+3, value);
 
-    value = gadgets.i18n.parseNumber("0.###E0", "1.234E3");
-    this.assertEquals(1.234E+3, value);
+  value = gadgets.i18n.parseNumber('0.###E0', '1.234E3');
+  this.assertEquals(1.234E+3, value);
 
-    value = gadgets.i18n.parseNumber("#E0", "1.2345E4");
-    this.assertEquals(12345.0, value);
+  value = gadgets.i18n.parseNumber('#E0', '1.2345E4');
+  this.assertEquals(12345.0, value);
 
-    value = gadgets.i18n.parseNumber("0E0", "1.2345E4");
-    this.assertEquals(12345.0, value);
+  value = gadgets.i18n.parseNumber('0E0', '1.2345E4');
+  this.assertEquals(12345.0, value);
 
-    value = gadgets.i18n.parseNumber("0E0", "1.2345E+4");
-    this.assertEquals(12345.0, value);
+  value = gadgets.i18n.parseNumber('0E0', '1.2345E+4');
+  this.assertEquals(12345.0, value);
 };
 
 NumberFormatTest.prototype.testGroupingParse = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("#,###", "1,234,567,890");
-    this.assertEquals(1234567890, value);
-    value = gadgets.i18n.parseNumber("#,####", "12,3456,7890");
-    this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#,###', '1,234,567,890');
+  this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#,####', '12,3456,7890');
+  this.assertEquals(1234567890, value);
 
-    value = gadgets.i18n.parseNumber("#", "1234567890");
-    this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#', '1234567890');
+  this.assertEquals(1234567890, value);
 };
 
 /**
  * Add as many tests as you like.
  */
 NumberFormatTest.prototype.testBasicFormat = function() {
-    var str = gadgets.i18n.formatNumber("0.0000", 123.45789179565757);
-    this.assertEquals("123.4579", str);
+  var str = gadgets.i18n.formatNumber('0.0000', 123.45789179565757);
+  this.assertEquals('123.4579', str);
 };
 
 NumberFormatTest.prototype.testGrouping = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("#,###", 1234567890);
-    this.assertEquals("1,234,567,890", str);
-    str = gadgets.i18n.formatNumber("#,####", 1234567890);
-    this.assertEquals("12,3456,7890", str);
+  str = gadgets.i18n.formatNumber('#,###', 1234567890);
+  this.assertEquals('1,234,567,890', str);
+  str = gadgets.i18n.formatNumber('#,####', 1234567890);
+  this.assertEquals('12,3456,7890', str);
 
-    str = gadgets.i18n.formatNumber("#", 1234567890);
-    this.assertEquals("1234567890", str);
+  str = gadgets.i18n.formatNumber('#', 1234567890);
+  this.assertEquals('1234567890', str);
 };
 
 NumberFormatTest.prototype.testPerMill = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("###.###\u2030", 0.4857);
-    this.assertEquals("485.7\u2030", str);
+  str = gadgets.i18n.formatNumber('###.###\u2030', 0.4857);
+  this.assertEquals('485.7\u2030', str);
 };
 
 NumberFormatTest.prototype.testCurrency = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00", 1234.56);
-    this.assertEquals("$1,234.56", str);
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00", -1234.56);
-    this.assertEquals("-$1,234.56", str);
-
-    str = gadgets.i18n.formatNumber(
-            "\u00a4\u00a4 #,##0.00;-\u00a4\u00a4 #,##0.00", 1234.56);
-    this.assertEquals("USD 1,234.56", str);
-    str = gadgets.i18n.formatNumber(
-            "\u00a4\u00a4 #,##0.00;\u00a4\u00a4 -#,##0.00", -1234.56);
-    this.assertEquals("USD -1,234.56", str);
-
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00",
-            1234.56, "BRL");
-    this.assertEquals("R$1,234.56", str);
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00",
-            -1234.56, "BRL");
-    this.assertEquals("-R$1,234.56", str);
-
-    str = gadgets.i18n.formatNumber(
-            "\u00a4\u00a4 #,##0.00;(\u00a4\u00a4 #,##0.00)", 1234.56, "BRL");
-    this.assertEquals("BRL 1,234.56", str);
-    str = gadgets.i18n.formatNumber(
-            "\u00a4\u00a4 #,##0.00;(\u00a4\u00a4 #,##0.00)", -1234.56, "BRL");
-    this.assertEquals("(BRL 1,234.56)", str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00', 1234.56);
+  this.assertEquals('$1,234.56', str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00', -1234.56);
+  this.assertEquals('-$1,234.56', str);
+
+  str = gadgets.i18n.formatNumber(
+      '\u00a4\u00a4 #,##0.00;-\u00a4\u00a4 #,##0.00', 1234.56);
+  this.assertEquals('USD 1,234.56', str);
+  str = gadgets.i18n.formatNumber(
+      '\u00a4\u00a4 #,##0.00;\u00a4\u00a4 -#,##0.00', -1234.56);
+  this.assertEquals('USD -1,234.56', str);
+
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00',
+      1234.56, 'BRL');
+  this.assertEquals('R$1,234.56', str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00',
+      -1234.56, 'BRL');
+  this.assertEquals('-R$1,234.56', str);
+
+  str = gadgets.i18n.formatNumber(
+      '\u00a4\u00a4 #,##0.00;(\u00a4\u00a4 #,##0.00)', 1234.56, 'BRL');
+  this.assertEquals('BRL 1,234.56', str);
+  str = gadgets.i18n.formatNumber(
+      '\u00a4\u00a4 #,##0.00;(\u00a4\u00a4 #,##0.00)', -1234.56, 'BRL');
+  this.assertEquals('(BRL 1,234.56)', str);
 };
 
 NumberFormatTest.prototype.testQuotes = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("a'fo''o'b#", 123);
-    this.assertEquals("afo'ob123", str);
+  str = gadgets.i18n.formatNumber("a'fo''o'b#", 123);
+  this.assertEquals("afo'ob123", str);
 
-    str = gadgets.i18n.formatNumber("a''b#", 123);
-    this.assertEquals("a'b123", str);
+  str = gadgets.i18n.formatNumber("a''b#", 123);
+  this.assertEquals("a'b123", str);
 };
 
 NumberFormatTest.prototype.testZeros = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("#.#", 0);
-    this.assertEquals("0", str);
-    str = gadgets.i18n.formatNumber("#.", 0);
-    this.assertEquals("0.", str);
-    str = gadgets.i18n.formatNumber(".#", 0);
-    this.assertEquals(".0", str);
-    str = gadgets.i18n.formatNumber("#", 0);
-    this.assertEquals("0", str);
-
-    str = gadgets.i18n.formatNumber("#0.#", 0);
-    this.assertEquals("0", str);
-    str = gadgets.i18n.formatNumber("#0.", 0);
-    this.assertEquals("0.", str);
-    str = gadgets.i18n.formatNumber("#.0", 0);
-    this.assertEquals(".0", str);
-    str = gadgets.i18n.formatNumber("#", 0);
-    this.assertEquals("0", str);
-    str = gadgets.i18n.formatNumber("000", 0);
-    this.assertEquals("000", str);
+  str = gadgets.i18n.formatNumber('#.#', 0);
+  this.assertEquals('0', str);
+  str = gadgets.i18n.formatNumber('#.', 0);
+  this.assertEquals('0.', str);
+  str = gadgets.i18n.formatNumber('.#', 0);
+  this.assertEquals('.0', str);
+  str = gadgets.i18n.formatNumber('#', 0);
+  this.assertEquals('0', str);
+
+  str = gadgets.i18n.formatNumber('#0.#', 0);
+  this.assertEquals('0', str);
+  str = gadgets.i18n.formatNumber('#0.', 0);
+  this.assertEquals('0.', str);
+  str = gadgets.i18n.formatNumber('#.0', 0);
+  this.assertEquals('.0', str);
+  str = gadgets.i18n.formatNumber('#', 0);
+  this.assertEquals('0', str);
+  str = gadgets.i18n.formatNumber('000', 0);
+  this.assertEquals('000', str);
 };
 
 NumberFormatTest.prototype.testExponential = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("0.####E0", 0.01234);
-    this.assertEquals("1.234E-2", str);
-    str = gadgets.i18n.formatNumber("00.000E00", 0.01234);
-    this.assertEquals("12.340E-03", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", 0.01234);
-    this.assertEquals("12.34E-003", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", 0.01234);
-    this.assertEquals("1.234E-2", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", 123456789);
-    this.assertEquals("1.2346E8", str);
-    str = gadgets.i18n.formatNumber("00.000E00", 123456789);
-    this.assertEquals("12.346E07", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", 123456789);
-    this.assertEquals("123.456789E006", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", 123456789);
-    this.assertEquals("1.235E8", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", 1.23e300);
-    this.assertEquals("1.23E300", str);
-    str = gadgets.i18n.formatNumber("00.000E00", 1.23e300);
-    this.assertEquals("12.300E299", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", 1.23e300);
-    this.assertEquals("1.23E300", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", 1.23e300);
-    this.assertEquals("1.23E300", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", -3.141592653e-271);
-    this.assertEquals("-3.1416E-271", str);
-    str = gadgets.i18n.formatNumber("00.000E00", -3.141592653e-271);
-    this.assertEquals("-31.416E-272", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", -3.141592653e-271);
-    this.assertEquals("-314.159265E-273", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", -3.141592653e-271);
-    this.assertEquals("[3.142E-271]", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", 0);
-    this.assertEquals("0E0", str);
-    str = gadgets.i18n.formatNumber("00.000E00", 0);
-    this.assertEquals("00.000E00", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", 0);
-    this.assertEquals("0E000", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", 0);
-    this.assertEquals("0E0", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", -1);
-    this.assertEquals("-1E0", str);
-    str = gadgets.i18n.formatNumber("00.000E00", -1);
-    this.assertEquals("-10.000E-01", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", -1);
-    this.assertEquals("-1E000", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", -1);
-    this.assertEquals("[1E0]", str);
-
-    str = gadgets.i18n.formatNumber("0.####E0", 1);
-    this.assertEquals("1E0", str);
-    str = gadgets.i18n.formatNumber("00.000E00", 1);
-    this.assertEquals("10.000E-01", str);
-    str = gadgets.i18n.formatNumber("##0.######E000", 1);
-    this.assertEquals("1E000", str);
-    str = gadgets.i18n.formatNumber("0.###E0;[0.###E0]", 1);
-    this.assertEquals("1E0", str);
+  str = gadgets.i18n.formatNumber('0.####E0', 0.01234);
+  this.assertEquals('1.234E-2', str);
+  str = gadgets.i18n.formatNumber('00.000E00', 0.01234);
+  this.assertEquals('12.340E-03', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', 0.01234);
+  this.assertEquals('12.34E-003', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', 0.01234);
+  this.assertEquals('1.234E-2', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', 123456789);
+  this.assertEquals('1.2346E8', str);
+  str = gadgets.i18n.formatNumber('00.000E00', 123456789);
+  this.assertEquals('12.346E07', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', 123456789);
+  this.assertEquals('123.456789E006', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', 123456789);
+  this.assertEquals('1.235E8', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', 1.23e300);
+  this.assertEquals('1.23E300', str);
+  str = gadgets.i18n.formatNumber('00.000E00', 1.23e300);
+  this.assertEquals('12.300E299', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', 1.23e300);
+  this.assertEquals('1.23E300', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', 1.23e300);
+  this.assertEquals('1.23E300', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', -3.141592653e-271);
+  this.assertEquals('-3.1416E-271', str);
+  str = gadgets.i18n.formatNumber('00.000E00', -3.141592653e-271);
+  this.assertEquals('-31.416E-272', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', -3.141592653e-271);
+  this.assertEquals('-314.159265E-273', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', -3.141592653e-271);
+  this.assertEquals('[3.142E-271]', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', 0);
+  this.assertEquals('0E0', str);
+  str = gadgets.i18n.formatNumber('00.000E00', 0);
+  this.assertEquals('00.000E00', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', 0);
+  this.assertEquals('0E000', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', 0);
+  this.assertEquals('0E0', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', -1);
+  this.assertEquals('-1E0', str);
+  str = gadgets.i18n.formatNumber('00.000E00', -1);
+  this.assertEquals('-10.000E-01', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', -1);
+  this.assertEquals('-1E000', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', -1);
+  this.assertEquals('[1E0]', str);
+
+  str = gadgets.i18n.formatNumber('0.####E0', 1);
+  this.assertEquals('1E0', str);
+  str = gadgets.i18n.formatNumber('00.000E00', 1);
+  this.assertEquals('10.000E-01', str);
+  str = gadgets.i18n.formatNumber('##0.######E000', 1);
+  this.assertEquals('1E000', str);
+  str = gadgets.i18n.formatNumber('0.###E0;[0.###E0]', 1);
+  this.assertEquals('1E0', str);
 
-    str = gadgets.i18n.formatNumber("#E0", 12345.0);
+  str = gadgets.i18n.formatNumber('#E0', 12345.0);
   //assertEquals(".1E5", str);
-    this.assertEquals("1E4", str);
-    str = gadgets.i18n.formatNumber("0E0", 12345.0);
-    this.assertEquals("1E4", str);
-    str = gadgets.i18n.formatNumber("##0.###E0", 12345.0);
-    this.assertEquals("12.345E3", str);
-    str = gadgets.i18n.formatNumber("##0.###E0", 12345.00001);
-    this.assertEquals("12.345E3", str);
-    str = gadgets.i18n.formatNumber("##0.###E0", 12345);
-    this.assertEquals("12.345E3", str);
-
-    str = gadgets.i18n.formatNumber("##0.####E0", 789.12345e-9);
-    this.assertEquals("789.1235E-9", str);
-    str = gadgets.i18n.formatNumber("##0.####E0", 780.e-9);
-    this.assertEquals("780E-9", str);
-    str = gadgets.i18n.formatNumber(".###E0", 45678.0);
-    this.assertEquals(".457E5", str);
-    str = gadgets.i18n.formatNumber(".###E0", 0);
-    this.assertEquals(".0E0", str);
-
-    str = gadgets.i18n.formatNumber("#E0", 45678000);
-    this.assertEquals("5E7", str);
-    str = gadgets.i18n.formatNumber("##E0", 45678000);
-    this.assertEquals("46E6", str);
-    str = gadgets.i18n.formatNumber("####E0", 45678000);
-    this.assertEquals("4568E4", str);
-    str = gadgets.i18n.formatNumber("0E0", 45678000);
-    this.assertEquals("5E7", str);
-    str = gadgets.i18n.formatNumber("00E0", 45678000);
-    this.assertEquals("46E6", str);
-    str = gadgets.i18n.formatNumber("000E0", 45678000);
-    this.assertEquals("457E5", str);
-    str = gadgets.i18n.formatNumber("###E0", 0.0000123);
-    this.assertEquals("12E-6", str);
-    str = gadgets.i18n.formatNumber("###E0", 0.000123);
-    this.assertEquals("123E-6", str);
-    str = gadgets.i18n.formatNumber("###E0", 0.00123);
-    this.assertEquals("1E-3", str);
-    str = gadgets.i18n.formatNumber("###E0", 0.0123);
-    this.assertEquals("12E-3", str);
-    str = gadgets.i18n.formatNumber("###E0", 0.123);
-    this.assertEquals("123E-3", str);
-    str = gadgets.i18n.formatNumber("###E0", 1.23);
-    this.assertEquals("1E0", str);
-    str = gadgets.i18n.formatNumber("###E0", 12.3);
-    this.assertEquals("12E0", str);
-    str = gadgets.i18n.formatNumber("###E0", 123.0);
-    this.assertEquals("123E0", str);
-    str = gadgets.i18n.formatNumber("###E0", 1230.0);
-    this.assertEquals("1E3", str);
+  this.assertEquals('1E4', str);
+  str = gadgets.i18n.formatNumber('0E0', 12345.0);
+  this.assertEquals('1E4', str);
+  str = gadgets.i18n.formatNumber('##0.###E0', 12345.0);
+  this.assertEquals('12.345E3', str);
+  str = gadgets.i18n.formatNumber('##0.###E0', 12345.00001);
+  this.assertEquals('12.345E3', str);
+  str = gadgets.i18n.formatNumber('##0.###E0', 12345);
+  this.assertEquals('12.345E3', str);
+
+  str = gadgets.i18n.formatNumber('##0.####E0', 789.12345e-9);
+  this.assertEquals('789.1235E-9', str);
+  str = gadgets.i18n.formatNumber('##0.####E0', 780.e-9);
+  this.assertEquals('780E-9', str);
+  str = gadgets.i18n.formatNumber('.###E0', 45678.0);
+  this.assertEquals('.457E5', str);
+  str = gadgets.i18n.formatNumber('.###E0', 0);
+  this.assertEquals('.0E0', str);
+
+  str = gadgets.i18n.formatNumber('#E0', 45678000);
+  this.assertEquals('5E7', str);
+  str = gadgets.i18n.formatNumber('##E0', 45678000);
+  this.assertEquals('46E6', str);
+  str = gadgets.i18n.formatNumber('####E0', 45678000);
+  this.assertEquals('4568E4', str);
+  str = gadgets.i18n.formatNumber('0E0', 45678000);
+  this.assertEquals('5E7', str);
+  str = gadgets.i18n.formatNumber('00E0', 45678000);
+  this.assertEquals('46E6', str);
+  str = gadgets.i18n.formatNumber('000E0', 45678000);
+  this.assertEquals('457E5', str);
+  str = gadgets.i18n.formatNumber('###E0', 0.0000123);
+  this.assertEquals('12E-6', str);
+  str = gadgets.i18n.formatNumber('###E0', 0.000123);
+  this.assertEquals('123E-6', str);
+  str = gadgets.i18n.formatNumber('###E0', 0.00123);
+  this.assertEquals('1E-3', str);
+  str = gadgets.i18n.formatNumber('###E0', 0.0123);
+  this.assertEquals('12E-3', str);
+  str = gadgets.i18n.formatNumber('###E0', 0.123);
+  this.assertEquals('123E-3', str);
+  str = gadgets.i18n.formatNumber('###E0', 1.23);
+  this.assertEquals('1E0', str);
+  str = gadgets.i18n.formatNumber('###E0', 12.3);
+  this.assertEquals('12E0', str);
+  str = gadgets.i18n.formatNumber('###E0', 123.0);
+  this.assertEquals('123E0', str);
+  str = gadgets.i18n.formatNumber('###E0', 1230.0);
+  this.assertEquals('1E3', str);
 };
 
 NumberFormatTest.prototype.testGroupingParse2 = function() {
-    var value;
+  var value;
 
-    value = gadgets.i18n.parseNumber("#,###", "1,234,567,890");
-    this.assertEquals(1234567890, value);
-    value = gadgets.i18n.parseNumber("#,####", "12,3456,7890");
-    this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#,###', '1,234,567,890');
+  this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#,####', '12,3456,7890');
+  this.assertEquals(1234567890, value);
 
-    value = gadgets.i18n.parseNumber("#", "1234567890");
-    this.assertEquals(1234567890, value);
+  value = gadgets.i18n.parseNumber('#', '1234567890');
+  this.assertEquals(1234567890, value);
 };
 
 NumberFormatTest.prototype.testApis = function() {
-    var str;
+  var str;
 
-    str = gadgets.i18n.formatNumber("#,###", 1234567890);
-    this.assertEquals("1,234,567,890", str);
+  str = gadgets.i18n.formatNumber('#,###', 1234567890);
+  this.assertEquals('1,234,567,890', str);
 
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00", 1234.56);
-    this.assertEquals("$1,234.56", str);
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;(\u00a4#,##0.00)",
-            -1234.56);
-    this.assertEquals("($1,234.56)", str);
-
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;-\u00a4#,##0.00",
-            1234.56, "SEK");
-    this.assertEquals("kr1,234.56", str);
-    str = gadgets.i18n.formatNumber("\u00a4#,##0.00;(\u00a4#,##0.00)",
-            -1234.56, "SEK");
-    this.assertEquals("(kr1,234.56)", str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00', 1234.56);
+  this.assertEquals('$1,234.56', str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;(\u00a4#,##0.00)',
+      -1234.56);
+  this.assertEquals('($1,234.56)', str);
+
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;-\u00a4#,##0.00',
+      1234.56, 'SEK');
+  this.assertEquals('kr1,234.56', str);
+  str = gadgets.i18n.formatNumber('\u00a4#,##0.00;(\u00a4#,##0.00)',
+      -1234.56, 'SEK');
+  this.assertEquals('(kr1,234.56)', str);
 };

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/jsondom/jsondom.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/jsondom/jsondom.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/jsondom/jsondom.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/jsondom/jsondom.js Thu Oct  7 15:54:09 2010
@@ -35,9 +35,9 @@ gadgets.jsondom = (function() {
   var domCache = {};
 
   function Node(data, opt_nextSibling) {
-    if (typeof data === "string") {
+    if (typeof data === 'string') {
       return Text(data, opt_nextSibling);
-    } else if (typeof data === "object") {
+    } else if (typeof data === 'object') {
       if (data.e) {
         throw new Error(data.e);
       }
@@ -63,7 +63,7 @@ gadgets.jsondom = (function() {
     // Set up children. Do so from the back of the list to
     // properly set up nextSibling references.
     var reverseChildren = [];
-    var backChild = (json.c.length > 0 ? Node(json.c[json.c.length-1]) : null);
+    var backChild = (json.c.length > 0 ? Node(json.c[json.c.length - 1]) : null);
     for (var i = json.c.length - 2; i >= 0; --i) {
       var next = Node(json.c[i], backChild);
       reverseChildren.push(next);
@@ -90,15 +90,15 @@ gadgets.jsondom = (function() {
         }
         return null;
       }
-    }
+    };
   }
 
   function Text(value, opt_nextSibling, opt_name, opt_type) {
     var nodeType = opt_type || DOM_TEXT_NODE;
-    var nodeName = opt_name || "#text";
+    var nodeName = opt_name || '#text';
     var nodeValue = value;
     var nextSibling = opt_nextSibling;
-    
+
     return {
       nodeType: nodeType,
       nodeName: nodeName,
@@ -108,7 +108,7 @@ gadgets.jsondom = (function() {
       cloneNode: function() {
         return Text(nodeValue, nodeName);
       }
-    }
+    };
   }
 
   function Attr(name, value) {

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/minimessage.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/minimessage.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/minimessage.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/minimessage.js Thu Oct  7 15:54:09 2010
@@ -22,7 +22,7 @@
  * <ul>
  * <li> status messages, e.g. loading, saving, etc.
  * <li> promotional messages, e.g. new features, new gadget, etc.
- * <li> debug/error messages, e.g. bad input, failed connection to server
+ * <li> debug/error messages, e.g. bad input, failed connection to server.
  * </ul>
  */
 
@@ -31,7 +31,7 @@
  *
  * @description Used to create messages that will appear to the user within the
  *     gadget.
- * @param {string=} opt_moduleId Optional module Id
+ * @param {string=} opt_moduleId Optional module Id.
  * @param {Element=} opt_container Optional HTML container element where
  *                                mini-messages will appear.
  */
@@ -45,7 +45,7 @@ gadgets.MiniMessage = function(opt_modul
 /**
  * Helper function that creates a container HTML element where mini-messages
  * will be appended to.  The container element is inserted at the top of gadget.
- * @return {Element} An HTML div element as the message container
+ * @return {Element} An HTML div element as the message container.
  * @private
  */
 gadgets.MiniMessage.prototype.createContainer_ = function() {
@@ -64,7 +64,7 @@ gadgets.MiniMessage.prototype.createCont
 
 /**
  * Helper function that dynamically inserts CSS rules to the page.
- * @param {string} cssText CSS rules to inject
+ * @param {string} cssText CSS rules to inject.
  * @private
  */
 gadgets.MiniMessage.addCSS_ = function(cssText) {
@@ -83,8 +83,8 @@ gadgets.MiniMessage.addCSS_ = function(c
 
 /**
  * Helper function that expands a class name into two class names.
- * @param {string} label The CSS class name
- * @return {string} "X Xn", with n is the ID of this module
+ * @param {string} label The CSS class name.
+ * @return {string} "X Xn", with n is the ID of this module.
  * @private
  */
 gadgets.MiniMessage.prototype.cascade_ = function(label) {
@@ -95,10 +95,10 @@ gadgets.MiniMessage.prototype.cascade_ =
  * Helper function that returns a function that dismisses a message by removing
  * the message table element from the DOM.  The action is cancelled if the
  * callback function returns false.
- * @param {Element} element HTML element to remove
+ * @param {Element} element HTML element to remove.
  * @param {function()=} opt_callback Optional callback function to be called when
  *                                the message is dismissed.
- * @return {function()} A function that dismisses the specified message
+ * @return {function()} A function that dismisses the specified message.
  * @private
  */
 gadgets.MiniMessage.prototype.dismissFunction_ = function(element, opt_callback) {
@@ -108,7 +108,7 @@ gadgets.MiniMessage.prototype.dismissFun
     }
     try {
       element.parentNode.removeChild(element);
-    } catch(e) {
+    } catch (e) {
       // Silently fail in case the element was already removed.
     }
   };
@@ -118,10 +118,10 @@ gadgets.MiniMessage.prototype.dismissFun
  * Creates a dismissible message with an [[]x] icon that allows users to dismiss
  * the message. When the message is dismissed, it is removed from the DOM
  * and the optional callback function, if defined, is called.
- * @param {string | Object} message The message as an HTML string or DOM element
+ * @param {string | Object} message The message as an HTML string or DOM element.
  * @param {function()=} opt_callback Optional callback function to be called when
- *                                the message is dismissed
- * @return {Element} HTML element of the created message
+ *                                the message is dismissed.
+ * @return {Element} HTML element of the created message.
  */
 gadgets.MiniMessage.prototype.createDismissibleMessage = function(message,
                                                          opt_callback) {
@@ -143,12 +143,12 @@ gadgets.MiniMessage.prototype.createDism
  * Creates a message that displays for the specified number of seconds.
  * When the timer expires,
  * the message is dismissed and the optional callback function is executed.
- * @param {string | Object} message The message as an HTML string or DOM element
+ * @param {string | Object} message The message as an HTML string or DOM element.
  * @param {number} seconds Number of seconds to wait before dismissing
- *                         the message
+ *                         the message.
  * @param {function()=} opt_callback Optional callback function to be called when
- *                                the message is dismissed
- * @return {Element} HTML element of the created message
+ *                                the message is dismissed.
+ * @return {Element} HTML element of the created message.
  */
 gadgets.MiniMessage.prototype.createTimerMessage = function(message, seconds,
                                                             opt_callback) {
@@ -160,8 +160,8 @@ gadgets.MiniMessage.prototype.createTime
 /**
  * Creates a static message that can only be dismissed programmatically
  * (by calling dismissMessage()).
- * @param {string | Object} message The message as an HTML string or DOM element
- * @return {Element} HTML element of the created message
+ * @param {string | Object} message The message as an HTML string or DOM element.
+ * @return {Element} HTML element of the created message.
  */
 gadgets.MiniMessage.prototype.createStaticMessage = function(message) {
   // Generate and assign unique DOM ID to table.
@@ -203,17 +203,17 @@ gadgets.MiniMessage.prototype.createStat
 
 /**
  * Dismisses the specified message.
- * @param {Element} message HTML element of the message to remove
+ * @param {Element} message HTML element of the message to remove.
  */
 gadgets.MiniMessage.prototype.dismissMessage = function(message) {
   this.dismissFunction_(message)();
 };
 
 // Injects the default stylesheet for mini-messages.
-gadgets.config.register("minimessage", {}, function (configuration) { 
-  // Injects the default stylesheet for mini-messages 
-  gadgets.MiniMessage.addCSS_( configuration.minimessage.css.join('')); 
-}); 
+gadgets.config.register('minimessage', {}, function(configuration) {
+  // Injects the default stylesheet for mini-messages
+  gadgets.MiniMessage.addCSS_(configuration.minimessage.css.join(''));
+});
 
 // Alias for legacy code
 var _IG_MiniMessage = gadgets.MiniMessage;

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/taming.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/taming.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/taming.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/minimessage/taming.js Thu Oct  7 15:54:09 2010
@@ -25,7 +25,7 @@
 var tamings___ = tamings___ || [];
 tamings___.push(function(imports) {
   caja___.whitelistCtors([
-      [gadgets, 'MiniMessage', Object]
+    [gadgets, 'MiniMessage', Object]
   ]);
   caja___.whitelistMeths([
     [gadgets.MiniMessage, 'createDismissibleMessage'],

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/oauthpopup/oauthpopup.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/oauthpopup/oauthpopup.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/oauthpopup/oauthpopup.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/oauthpopup/oauthpopup.js Thu Oct  7 15:54:09 2010
@@ -22,12 +22,6 @@
  */
 
 /**
- * @private
- * @constructor
- */
-
-/**
- * @private
  * @constructor
  */
 gadgets.oauth = gadgets.oauth || {};
@@ -55,7 +49,7 @@ gadgets.oauth = gadgets.oauth || {};
  * </ul>
  * <p>
  * The "personalization done" button may be unnecessary.  The popup window
- * manager will attempt to detect when the window closes.  However, the 
+ * manager will attempt to detect when the window closes.  However, the
  * "personalization done" button should still be displayed to handle cases
  * where the popup manager is unable to detect that a window has closed.  This
  * allows the user to signal approval manually.
@@ -124,7 +118,7 @@ gadgets.oauth.Popup = function(destinati
 };
 
 /**
- * @return {function()} an onclick handler for the "open the approval window" link
+ * @return {function()} an onclick handler for the "open the approval window" link.
  */
 gadgets.oauth.Popup.prototype.createOpenerOnClick = function() {
   var self = this;
@@ -135,8 +129,8 @@ gadgets.oauth.Popup.prototype.createOpen
 
 /**
  * Called when the user clicks to open the popup window.
- * 
- * @returns false to prevent the default action for the click.
+ *
+ * @return {boolean} false to prevent the default action for the click.
  * @private
  */
 gadgets.oauth.Popup.prototype.onClick_ = function() {
@@ -144,12 +138,12 @@ gadgets.oauth.Popup.prototype.onClick_ =
   // need to approve the popup, then click again to open the window.
   // Note that because we don't call window.open until the user has clicked
   // something the popup blockers *should* let us through.
-  this.win_ = window.open(this.destination_, "_blank", this.windowOptions_);
+  this.win_ = window.open(this.destination_, '_blank', this.windowOptions_);
   if (this.win_) {
     // Poll every 100ms to check if the window has been closed
     var self = this;
     var closure = function() {
-      self.checkClosed_(); 
+      self.checkClosed_();
     };
     this.timer_ = window.setInterval(closure, 100);
     this.openCallback_();

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.6/opensocial6to7.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.6/opensocial6to7.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.6/opensocial6to7.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.6/opensocial6to7.js Thu Oct  7 15:54:09 2010
@@ -37,28 +37,28 @@ opensocial.makeRequest = function() {
 };
 
 opensocial.ContentRequestParameters = {
-  METHOD : gadgets.io.RequestParameters.METHOD,
-  CONTENT_TYPE : gadgets.io.RequestParameters.CONTENT_TYPE,
-  AUTHENTICATION : gadgets.io.RequestParameters.AUTHORIZATION,
-  NUM_ENTRIES : gadgets.io.RequestParameters.NUM_ENTRIES,
-  GET_SUMMARIES : gadgets.io.RequestParameters.GET_SUMMARIES
+  METHOD: gadgets.io.RequestParameters.METHOD,
+  CONTENT_TYPE: gadgets.io.RequestParameters.CONTENT_TYPE,
+  AUTHENTICATION: gadgets.io.RequestParameters.AUTHORIZATION,
+  NUM_ENTRIES: gadgets.io.RequestParameters.NUM_ENTRIES,
+  GET_SUMMARIES: gadgets.io.RequestParameters.GET_SUMMARIES
 };
 
 opensocial.ContentRequestParameters.MethodType = {
-  GET : gadgets.io.MethodType.GET,
-  POST : gadgets.io.MethodType.POST
+  GET: gadgets.io.MethodType.GET,
+  POST: gadgets.io.MethodType.POST
 };
 
 opensocial.ContentRequestParameters.ContentType = {
-  HTML : gadgets.io.ContentType.TEXT,
-  XML : gadgets.io.ContentType.DOM,
-  FEED : gadgets.io.ContentType.JSON
+  HTML: gadgets.io.ContentType.TEXT,
+  XML: gadgets.io.ContentType.DOM,
+  FEED: gadgets.io.ContentType.JSON
 };
 
 opensocial.ContentRequestParameters.AuthenticationType = {
-  NONE : gadgets.io.AuthorizationType.NONE,
-  SIGNED : gadgets.io.AuthorizationType.SIGNED,
-  AUTHENTICATED : gadgets.io.AuthorizationType.AUTHENTICATED
+  NONE: gadgets.io.AuthorizationType.NONE,
+  SIGNED: gadgets.io.AuthorizationType.SIGNED,
+  AUTHENTICATED: gadgets.io.AuthorizationType.AUTHENTICATED
 };
 
 

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.7/opensocial7to8.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.7/opensocial7to8.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.7/opensocial7to8.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.7/opensocial7to8.js Thu Oct  7 15:54:09 2010
@@ -25,8 +25,8 @@ opensocial.newActivityMediaItem = openso
 opensocial.DataRequest.PersonId = opensocial.IdSpec.PersonId;
 
 opensocial.DataRequest.Group = {
-  OWNER_FRIENDS : 'OWNER_FRIENDS',
-  VIEWER_FRIENDS : 'VIEWER_FRIENDS'
+  OWNER_FRIENDS: 'OWNER_FRIENDS',
+  VIEWER_FRIENDS: 'VIEWER_FRIENDS'
 };
 
 opensocial.DataRequest.prototype.newFetchPeopleRequest_v08
@@ -77,7 +77,7 @@ opensocial.Environment.ObjectType.ACTIVI
 
 opensocial.Person.prototype.getField_v08 = opensocial.Person.prototype.getField;
 opensocial.Person.prototype.getField = function(key, opt_params) {
-  var value =  this.getField_v08(key, opt_params);
+  var value = this.getField_v08(key, opt_params);
   if (key === 'lookingFor' && value) {
     // The lookingFor field used to return a string instead of an enum
     var returnValue = new Array(value.length);
@@ -93,10 +93,10 @@ opensocial.Person.prototype.getField = f
 
 function translateIdSpec(oldIdSpec) {
   if (oldIdSpec == 'OWNER_FRIENDS') {
-    return opensocial.newIdSpec({userId : 'OWNER', groupId : 'FRIENDS'});
+    return opensocial.newIdSpec({userId: 'OWNER', groupId: 'FRIENDS'});
   } else if (oldIdSpec == 'VIEWER_FRIENDS') {
-    return opensocial.newIdSpec({userId : 'VIEWER', groupId : 'FRIENDS'});
+    return opensocial.newIdSpec({userId: 'VIEWER', groupId: 'FRIENDS'});
   } else {
-    return opensocial.newIdSpec({userId : oldIdSpec});
+    return opensocial.newIdSpec({userId: oldIdSpec});
   }
-};
+}

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-0.8/opensocial8to9.js Thu Oct  7 15:54:09 2010
@@ -25,7 +25,7 @@ opensocial.DataRequest.prototype.newUpda
 opensocial.DataRequest.prototype.newUpdatePersonAppDataRequest = function(id,
     key, value) {
   if (id !== opensocial.IdSpec.PersonId.VIEWER) {
-    throw Error("Cannot update app data for person "  + id);
+    throw Error('Cannot update app data for person ' + id);
   }
   return this.newUpdatePersonAppDataRequest_09(key, value);
 };
@@ -38,9 +38,9 @@ opensocial.DataRequest.prototype.newRemo
 opensocial.DataRequest.prototype.newRemovePersonAppDataRequest = function(id,
     keys) {
   if (id !== opensocial.IdSpec.PersonId.VIEWER) {
-    throw Error("Cannot remove app data for person "  + id);
+    throw Error('Cannot remove app data for person ' + id);
   }
 
   return this.newRemovePersonAppDataRequest_09(keys);
 };
-    
+

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/feature.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/feature.xml?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/feature.xml (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/feature.xml Thu Oct  7 15:54:09 2010
@@ -22,6 +22,8 @@
   <dependency>opensocial-reference</dependency> 
   <gadget>
     <script src="fieldtranslations.js"></script>
+    <script src="jsonmediaitem.js"></script>
+    <script src="jsonalbum.js"></script>
     <script src="jsonactivity.js"></script>
     <script src="jsonperson.js"></script>    
     <script src="jsonmessagecollection.js"></script>

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/fieldtranslations.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/fieldtranslations.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/fieldtranslations.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/fieldtranslations.js Thu Oct  7 15:54:09 2010
@@ -18,7 +18,7 @@
 
 /**
  * @fileoverview Helper class used to translate from the 0.8 server apis to the 0.8 js apis
- * (which are unfortunately not the same)
+ * (which are unfortunately not the same).
  */
 
 window['FieldTranslations'] = (function() {
@@ -37,100 +37,100 @@ window['FieldTranslations'] = (function(
 
   return {
     'translateEnumJson' : translateEnumJson,
-    'translateUrlJson' :  translateUrlJson,
-    'translateServerPersonToJsPerson' : 
-    function(serverJson, opt_params) {
-      if (serverJson.emails) {
-        for (var i = 0; i < serverJson.emails.length; i++) {
-          serverJson.emails[i].address = serverJson.emails[i].value;
-        }
-      }
+    'translateUrlJson' : translateUrlJson,
+    'translateServerPersonToJsPerson' :
+        function(serverJson, opt_params) {
+          if (serverJson.emails) {
+            for (var i = 0; i < serverJson.emails.length; i++) {
+              serverJson.emails[i].address = serverJson.emails[i].value;
+            }
+          }
 
-      if (serverJson.phoneNumbers) {
-        for (var p = 0; p < serverJson.phoneNumbers.length; p++) {
-          serverJson.phoneNumbers[p].number = serverJson.phoneNumbers[p].value;
-        }
-      }
+          if (serverJson.phoneNumbers) {
+            for (var p = 0; p < serverJson.phoneNumbers.length; p++) {
+              serverJson.phoneNumbers[p].number = serverJson.phoneNumbers[p].value;
+            }
+          }
 
-      if (serverJson.birthday) {
-        serverJson.dateOfBirth = serverJson.birthday;
-      }
+          if (serverJson.birthday) {
+            serverJson.dateOfBirth = serverJson.birthday;
+          }
 
-      if (serverJson.utcOffset) {
-        serverJson.timeZone = serverJson.utcOffset;
-      }
+          if (serverJson.utcOffset) {
+            serverJson.timeZone = serverJson.utcOffset;
+          }
 
-      if (serverJson.addresses) {
-        for (var j = 0; j < serverJson.addresses.length; j++) {
-          serverJson.addresses[j].unstructuredAddress = serverJson.addresses[j].formatted;
-        }
-      }
+          if (serverJson.addresses) {
+            for (var j = 0; j < serverJson.addresses.length; j++) {
+              serverJson.addresses[j].unstructuredAddress = serverJson.addresses[j].formatted;
+            }
+          }
 
-      if (serverJson.gender) {
-        var key = serverJson.gender == 'male' ? 'MALE' :
-                  (serverJson.gender == 'female') ? 'FEMALE' :
-                  null;
-        serverJson.gender = {key : key, displayValue : serverJson.gender};
-      }
+          if (serverJson.gender) {
+            var key = serverJson.gender == 'male' ? 'MALE' :
+                (serverJson.gender == 'female') ? 'FEMALE' :
+                null;
+            serverJson.gender = {key: key, displayValue: serverJson.gender};
+          }
 
-      translateUrlJson(serverJson.profileSong);
-      translateUrlJson(serverJson.profileVideo);
+          translateUrlJson(serverJson.profileSong);
+          translateUrlJson(serverJson.profileVideo);
 
-      if (serverJson.urls) {
-        for (var u = 0; u < serverJson.urls.length; u++) {
-          translateUrlJson(serverJson.urls[u]);
-        }
-      }
+          if (serverJson.urls) {
+            for (var u = 0; u < serverJson.urls.length; u++) {
+              translateUrlJson(serverJson.urls[u]);
+            }
+          }
 
-      translateEnumJson(serverJson.drinker);
-      translateEnumJson(serverJson.lookingFor);
-      translateEnumJson(serverJson.networkPresence);
-      translateEnumJson(serverJson.smoker);
-
-      if (serverJson.organizations) {
-        serverJson.jobs = [];
-        serverJson.schools = [];
-
-        for (var o = 0; o < serverJson.organizations.length; o++) {
-          var org = serverJson.organizations[o];
-          if (org.type == 'job') {
-            serverJson.jobs.push(org);
-          } else if (org.type == 'school') {
-            serverJson.schools.push(org);
+          translateEnumJson(serverJson.drinker);
+          translateEnumJson(serverJson.lookingFor);
+          translateEnumJson(serverJson.networkPresence);
+          translateEnumJson(serverJson.smoker);
+
+          if (serverJson.organizations) {
+            serverJson.jobs = [];
+            serverJson.schools = [];
+
+            for (var o = 0; o < serverJson.organizations.length; o++) {
+              var org = serverJson.organizations[o];
+              if (org.type == 'job') {
+                serverJson.jobs.push(org);
+              } else if (org.type == 'school') {
+                serverJson.schools.push(org);
+              }
+            }
           }
-        }
-      }
 
-      if (serverJson.name) {
-        serverJson.name.unstructured = serverJson.name.formatted;
-      }
+          if (serverJson.name) {
+            serverJson.name.unstructured = serverJson.name.formatted;
+          }
 
-      if (serverJson.appData) {
-        serverJson.appData = opensocial.Container.escape(
-            serverJson.appData, opt_params, true);
-      }
+          if (serverJson.appData) {
+            serverJson.appData = opensocial.Container.escape(
+                serverJson.appData, opt_params, true);
+          }
 
-    },
+        },
 
 
     'translateJsPersonFieldsToServerFields' :
-    function(fields) {
-      for (var i = 0; i < fields.length; i++) {
-        if (fields[i] == 'dateOfBirth') {
-          fields[i] = 'birthday';
-        } else if (fields[i] == 'timeZone') {
-          fields[i] = 'utcOffset';
-        } else if (fields[i] == 'jobs') {
-          fields[i] = 'organizations';
-        } else if (fields[i] == 'schools') {
-          fields[i] = 'organizations';
-        }
-      }
+        function(fields) {
+          for (var i = 0; i < fields.length; i++) {
+            if (fields[i] == 'dateOfBirth') {
+              fields[i] = 'birthday';
+            } else if (fields[i] == 'timeZone') {
+              fields[i] = 'utcOffset';
+            } else if (fields[i] == 'jobs') {
+              fields[i] = 'organizations';
+            } else if (fields[i] == 'schools') {
+              fields[i] = 'organizations';
+            }
+          }
 
-      // displayName and id always need to be requested
-      fields.push('id');
-      fields.push('displayName');
-    },
+          // displayName and id always need to be requested
+          fields.push('id');
+          fields.push('displayName');
+        },
 
     'translateIsoStringToDate' : function(isoString) {
       // Date parsing code from http://delete.me.uk/2005/03/iso8601.html
@@ -147,7 +147,7 @@ window['FieldTranslations'] = (function(
       if (d[7]) { date.setHours(d[7]); }
       if (d[8]) { date.setMinutes(d[8]); }
       if (d[10]) { date.setSeconds(d[10]); }
-      if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
+      if (d[12]) { date.setMilliseconds(Number('0.' + d[12]) * 1000); }
       if (d[14]) {
         offset = (Number(d[16]) * 60) + Number(d[17]);
         offset *= ((d[15] == '-') ? 1 : -1);
@@ -165,7 +165,7 @@ window['FieldTranslations'] = (function(
      * the JS fetchPerson() API in terms of an appData param.  Translate
      * between the two.
      */
-     'addAppDataAsProfileFields' : function(opt_params) {
+    'addAppDataAsProfileFields' : function(opt_params) {
       if (opt_params) {
         // Push the appData keys in as profileDetails
         if (opt_params['appData']) {
@@ -191,40 +191,40 @@ window['FieldTranslations'] = (function(
     /**
      * Translate standard Javascript arguments to JSON-RPC protocol format.
      */
-    'translateStandardArguments' : 
-    function(opt_params, rpc_params) {
-      if (opt_params['first']) {
-        rpc_params.startIndex = opt_params['first'];
-      }
-      if (opt_params['max']) {
-        rpc_params.count = opt_params['max'];
-      }
-      if (opt_params['sortOrder']) {
-        rpc_params.sortBy = opt_params['sortOrder'];
-      }
-      if (opt_params['filter']) {
-        rpc_params.filterBy = opt_params['filter'];
-      }
-      if (opt_params['filterOp']) {
-        rpc_params.filterOp = opt_params['filterOp'];
-      }
-      if (opt_params['filterValue']) {
-        rpc_params.filterValue = opt_params['filterValue'];
-      }
-      if (opt_params['fields']) {
-        rpc_params.fields = opt_params['fields'];
-      }
-    },
+    'translateStandardArguments' :
+        function(opt_params, rpc_params) {
+          if (opt_params['first']) {
+            rpc_params.startIndex = opt_params['first'];
+          }
+          if (opt_params['max']) {
+            rpc_params.count = opt_params['max'];
+          }
+          if (opt_params['sortOrder']) {
+            rpc_params.sortBy = opt_params['sortOrder'];
+          }
+          if (opt_params['filter']) {
+            rpc_params.filterBy = opt_params['filter'];
+          }
+          if (opt_params['filterOp']) {
+            rpc_params.filterOp = opt_params['filterOp'];
+          }
+          if (opt_params['filterValue']) {
+            rpc_params.filterValue = opt_params['filterValue'];
+          }
+          if (opt_params['fields']) {
+            rpc_params.fields = opt_params['fields'];
+          }
+        },
 
     /**
      * Translate network distance from id spec to JSON-RPC parameters.
      */
-    'translateNetworkDistance' : 
-    function(idSpec, rpc_params) {
-      if (idSpec.getField('networkDistance')) {
-        rpc_params.networkDistance = idSpec.getField('networkDistance');
-      }
-    }
-    // end of returned Object, please no commas
+    'translateNetworkDistance' :
+        function(idSpec, rpc_params) {
+          if (idSpec.getField('networkDistance')) {
+            rpc_params.networkDistance = idSpec.getField('networkDistance');
+          }
+        }
+        // end of returned Object, please no commas
   };
 })();

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonactivity.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonactivity.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonactivity.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonactivity.js Thu Oct  7 15:54:09 2010
@@ -28,7 +28,7 @@
 var JsonActivity = function(opt_params, opt_skipConversions) {
   opt_params = opt_params || {};
   if (!opt_skipConversions) {
-    JsonActivity.constructArrayObject(opt_params, "mediaItems", JsonMediaItem);
+    JsonActivity.constructArrayObject(opt_params, 'mediaItems', JsonMediaItem);
   }
   opensocial.Activity.call(this, opt_params);
 };
@@ -47,19 +47,6 @@ JsonActivity.prototype.toJsonObject = fu
   return jsonObject;
 };
 
-
-// TODO: Split into separate class
-var JsonMediaItem = function(opt_params) {
-  opensocial.MediaItem.call(this, opt_params['mimeType'],
-      opt_params['url'], opt_params);
-};
-JsonMediaItem.inherits(opensocial.MediaItem);
-
-JsonMediaItem.prototype.toJsonObject = function() {
-  return JsonActivity.copyFields(this.fields_);
-};
-
-
 // TODO: Pull this method into a common class, it is from jsonperson.js
 JsonActivity.constructArrayObject = function(map, fieldName, className) {
   var fieldValue = map[fieldName];

Added: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonalbum.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonalbum.js?rev=1005506&view=auto
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonalbum.js (added)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonalbum.js Thu Oct  7 15:54:09 2010
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+var JsonAlbum = function(opt_params) {
+  opt_params = opt_params || {};
+
+  JsonAlbum.constructObject(opt_params, "location", opensocial.Address);
+
+  opensocial.Album.call(this, opt_params);
+};
+JsonAlbum.inherits(opensocial.Album);
+
+JsonAlbum.prototype.toJsonObject = function() {
+  return JsonAlbum.copyFields(this.fields_);
+};
+
+// Converts the fieldName into an instance of the specified object
+JsonAlbum.constructObject = function(map, fieldName, className) {
+  var fieldValue = map[fieldName];
+  if (fieldValue) {
+    map[fieldName] = new className(fieldValue);
+  }
+};
+
+//TODO: Pull into common class as well
+JsonAlbum.copyFields = function(oldObject) {
+  var newObject = {};
+  for (var field in oldObject) {
+    newObject[field] = oldObject[field];
+  }
+  return newObject;
+};

Added: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonmediaitem.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonmediaitem.js?rev=1005506&view=auto
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonmediaitem.js (added)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonmediaitem.js Thu Oct  7 15:54:09 2010
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ */
+
+var JsonMediaItem = function(opt_params) {
+  opt_params = opt_params || {};
+
+  opensocial.MediaItem.call(this, opt_params["mimeType"], opt_params["url"], opt_params);
+};
+
+JsonMediaItem.inherits(opensocial.MediaItem);
+
+JsonMediaItem.prototype.toJsonObject = function() {
+  return JsonMediaItem.copyFields(this.fields_);
+};
+
+//TODO: Pull into common class as well
+JsonMediaItem.copyFields = function(oldObject) {
+  var newObject = {};
+  for (var field in oldObject) {
+    newObject[field] = oldObject[field];
+  }
+  return newObject;
+};

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonperson.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonperson.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonperson.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-base/jsonperson.js Thu Oct  7 15:54:09 2010
@@ -28,27 +28,27 @@
 var JsonPerson = function(opt_params) {
   opt_params = opt_params || {};
 
-  JsonPerson.constructObject(opt_params, "bodyType", opensocial.BodyType);
-  JsonPerson.constructObject(opt_params, "currentLocation", opensocial.Address);
-  JsonPerson.constructObject(opt_params, "name", opensocial.Name);
-  JsonPerson.constructObject(opt_params, "profileSong", opensocial.Url);
-  JsonPerson.constructObject(opt_params, "profileVideo", opensocial.Url);
-
-  JsonPerson.constructDate(opt_params, "dateOfBirth");
-
-  JsonPerson.constructArrayObject(opt_params, "addresses", opensocial.Address);
-  JsonPerson.constructArrayObject(opt_params, "emails", opensocial.Email);
-  JsonPerson.constructArrayObject(opt_params, "jobs", opensocial.Organization);
-  JsonPerson.constructArrayObject(opt_params, "phoneNumbers", opensocial.Phone);
-  JsonPerson.constructArrayObject(opt_params, "schools",
+  JsonPerson.constructObject(opt_params, 'bodyType', opensocial.BodyType);
+  JsonPerson.constructObject(opt_params, 'currentLocation', opensocial.Address);
+  JsonPerson.constructObject(opt_params, 'name', opensocial.Name);
+  JsonPerson.constructObject(opt_params, 'profileSong', opensocial.Url);
+  JsonPerson.constructObject(opt_params, 'profileVideo', opensocial.Url);
+
+  JsonPerson.constructDate(opt_params, 'dateOfBirth');
+
+  JsonPerson.constructArrayObject(opt_params, 'addresses', opensocial.Address);
+  JsonPerson.constructArrayObject(opt_params, 'emails', opensocial.Email);
+  JsonPerson.constructArrayObject(opt_params, 'jobs', opensocial.Organization);
+  JsonPerson.constructArrayObject(opt_params, 'phoneNumbers', opensocial.Phone);
+  JsonPerson.constructArrayObject(opt_params, 'schools',
       opensocial.Organization);
-  JsonPerson.constructArrayObject(opt_params, "urls", opensocial.Url);
+  JsonPerson.constructArrayObject(opt_params, 'urls', opensocial.Url);
 
-  JsonPerson.constructEnum(opt_params, "gender");
-  JsonPerson.constructEnum(opt_params, "smoker");
-  JsonPerson.constructEnum(opt_params, "drinker");
-  JsonPerson.constructEnum(opt_params, "networkPresence");
-  JsonPerson.constructEnumArray(opt_params, "lookingFor");
+  JsonPerson.constructEnum(opt_params, 'gender');
+  JsonPerson.constructEnum(opt_params, 'smoker');
+  JsonPerson.constructEnum(opt_params, 'drinker');
+  JsonPerson.constructEnum(opt_params, 'networkPresence');
+  JsonPerson.constructEnumArray(opt_params, 'lookingFor');
 
   opensocial.Person.call(this, opt_params, opt_params['isOwner'],
       opt_params['isViewer']);
@@ -99,10 +99,10 @@ JsonPerson.constructArrayObject = functi
 };
 
 JsonPerson.prototype.getDisplayName = function() {
-  return this.getField("displayName");
+  return this.getField('displayName');
 };
 
 JsonPerson.prototype.getAppData = function(key) {
-  var appData = this.getField("appData");
+  var appData = this.getField('appData');
   return appData && appData[key];
 };

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data-context/datacontext.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data-context/datacontext.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data-context/datacontext.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data-context/datacontext.js Thu Oct  7 15:54:09 2010
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
- 
+
 /**
  * @fileoverview Implements the global implicit data context for containers.
  */
@@ -47,13 +47,13 @@ opensocial.data.DataContext = function()
     if (typeof obj === 'undefined' || obj === null) {
       return;
     }
-  
+
     dataSets[key] = obj;
     if (!(opt_fireListeners === false)) {
       fireCallbacks(key);
     }
   };
-  
+
   /**
    * Registers a callback listener for a given set of keys.
    * @param {string|Array.<string>} keys Key or set of keys to listen on.
@@ -64,21 +64,21 @@ opensocial.data.DataContext = function()
    */
   var registerListener = function(keys, callback, oneTimeListener, fireIfReady) {
     var oneTime = !!oneTimeListener;
-    var listener = {keys : {}, callback : callback, oneTime: oneTime};
+    var listener = {keys: {}, callback: callback, oneTime: oneTime};
 
     if (typeof keys === 'string') {
       listener.keys[keys] = true;
       if (keys != '*') {
-        keys = [ keys ];
+        keys = [keys];
       }
     } else {
       for (var i = 0; i < keys.length; i++) {
         listener.keys[keys[i]] = true;
       }
     }
-    
+
     listeners.push(listener);
-  
+
     // Check to see if this one should fire immediately.
     if (fireIfReady && keys !== '*' && isDataReady(listener.keys)) {
       window.setTimeout(function() {
@@ -86,7 +86,7 @@ opensocial.data.DataContext = function()
       }, 1);
     }
   };
-  
+
   /**
    * Checks if the data for a map of keys is available.
    * @param {Object.<string, *>} keys An map of keys to check.
@@ -96,7 +96,7 @@ opensocial.data.DataContext = function()
     if (keys['*']) {
       return true;
     }
-    
+
     for (var key in keys) {
       if (typeof dataSets[key] === 'undefined') {
         return false;
@@ -104,7 +104,7 @@ opensocial.data.DataContext = function()
     }
     return true;
   };
-    
+
   /**
    * Fires a listener for a key, but only if the data is ready for other
    * keys this listener is bound to.
@@ -118,8 +118,8 @@ opensocial.data.DataContext = function()
         removeListener(listener);
       }
     }
-  };    
-  
+  };
+
   /**
    * Removes a listener from the list.
    * @param {Object} listener The listener to remove.
@@ -132,7 +132,7 @@ opensocial.data.DataContext = function()
       }
     }
   };
-    
+
   /**
    * Scans all active listeners and fires off any callbacks that inserting this
    * key or list of keys satisfies.
@@ -140,8 +140,8 @@ opensocial.data.DataContext = function()
    * @private
    */
   var fireCallbacks = function(keys) {
-    if (typeof(keys) == "string") {
-      keys = [ keys ];
+    if (typeof(keys) == 'string') {
+      keys = [keys];
     }
     for (var i = 0; i < listeners.length; ++i) {
       var listener = listeners[i];
@@ -157,13 +157,13 @@ opensocial.data.DataContext = function()
 
 
   return {
-    
+
     /**
      * Returns a map of existing data.
      * @return {Object} A map of current data sets.
      * TODO: Add to the spec API?
      */
-    getData : function() {
+    getData: function() {
       var data = {};
       for (var key in dataSets) {
         if (dataSets.hasOwnProperty(key)) {
@@ -172,48 +172,48 @@ opensocial.data.DataContext = function()
       }
       return data;
     },
-    
+
     /**
      * Registers a callback listener for a given set of keys.
      * @param {string|Array.<string>} keys Key or set of keys to listen on.
-     * @param {function(Array.<string>)} callback Function to call when a 
+     * @param {function(Array.<string>)} callback Function to call when a
      * listener is fired.
      */
-    registerListener : function(keys, callback) {
+    registerListener: function(keys, callback) {
       registerListener(keys, callback, false, true);
     },
-        
+
     /**
      * Private version of registerListener which allows one-time listeners to
-     * be registered. Not part of the spec. Exposed because needed by 
+     * be registered. Not part of the spec. Exposed because needed by
      * opensocial-templates.
      * @param {string|Array.<string>} keys Key or set of keys to listen on.
-     * @param {function(Array.<string>)} callback Function to call when a 
+     * @param {function(Array.<string>)} callback Function to call when a.
      */
-    registerOneTimeListener_ : function(keys, callback) {
+    registerOneTimeListener_: function(keys, callback) {
       registerListener(keys, callback, true, true);
     },
-    
+
     /**
      * Private version of registerListener which allows listeners to be
      * registered that do not fire initially, but only after a data change.
      * Exposed because needed by opensocial-templates.
      * @param {string|Array.<string>} keys Key or set of keys to listen on.
-     * @param {function(Array.<string>)} callback Function to call when a
+     * @param {function(Array.<string>)} callback Function to call when a.
      */
-    registerDeferredListener_ : function(keys, callback) {
+    registerDeferredListener_: function(keys, callback) {
       registerListener(keys, callback, false, false);
     },
-    
+
     /**
      * Retrieve a data set for a given key.
      * @param {string} key Key for the requested data set.
      * @return {Object} The data set object.
      */
-    getDataSet : function(key) {
+    getDataSet: function(key) {
       return dataSets[key];
     },
-        
+
     /**
      * Puts a data set into the global DataContext object. Fires listeners
      * if they are satisfied by the associated key being inserted.
@@ -221,17 +221,17 @@ opensocial.data.DataContext = function()
      * @param {string} key The key to associate with this object.
      * @param {ResponseItem|Object} obj The data object.
      */
-    putDataSet : function(key, obj) {
+    putDataSet: function(key, obj) {
       putDataSet(key, obj, true);
-    }, 
-    
+    },
+
     /**
      * Inserts multiple data sets from a JSON object.
      * @param {Object.<string, Object>} dataSets a JSON object containing Data
      * sets keyed by Data Set Key. All the DataSets are added, before firing
      * listeners.
      */
-    putDataSets : function(dataSets) {
+    putDataSets: function(dataSets) {
       var keys = [];
       for (var key in dataSets) {
         keys.push(key);

Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data/data.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data/data.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data/data.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-data/data.js Thu Oct  7 15:54:09 2010
@@ -30,13 +30,13 @@
  * @const
  */
 
-opensocial.data.ATTR_KEY = "key";
+opensocial.data.ATTR_KEY = 'key';
 
 /**
  * @type {string} The type of script tags that contain data markup.
  * @const
  */
-opensocial.data.SCRIPT_TYPE = "text/os-data";
+opensocial.data.SCRIPT_TYPE = 'text/os-data';
 
 opensocial.data.NSMAP = {};
 
@@ -53,7 +53,7 @@ opensocial.data.VAR_REGEX = /^([\w\W]*?)
  */
 opensocial.data.RequestDescriptor = function(xmlNode) {
   this.tagName = xmlNode.tagName;
-  this.tagParts = this.tagName.split(":");
+  this.tagParts = this.tagName.split(':');
   this.attributes = {};
 
   // Flag to indicate that this request depends on other requests.
@@ -78,7 +78,7 @@ opensocial.data.RequestDescriptor = func
 
 /**
  * Checks if an attribute has been specified for this tag.
- * @param {string} name The attribute name
+ * @param {string} name The attribute name.
  * @return {boolean} The attribute is set.
  */
 opensocial.data.RequestDescriptor.prototype.hasAttribute = function(name) {
@@ -140,10 +140,11 @@ opensocial.data.parseExpression_ = funct
  *   - Escapes single quotes.
  *   - Replaces newlines with spaces.
  *   - Addes single quotes around the string.
+ * @private
  */
 opensocial.data.transformLiteral_ = function(string) {
   return "'" + string.replace(/'/g, "\\'").
-      replace(/\n/g, " ") + "'";
+      replace(/\n/g, ' ') + "'";
 };
 
 
@@ -158,7 +159,7 @@ opensocial.data.RequestDescriptor.protot
     handler = ns[this.tagParts[1]];
   }
   if (!handler) {
-    throw Error("Data handler undefined for " + this.tagName);
+    throw Error('Data handler undefined for ' + this.tagName);
   }
   handler(this);
 };
@@ -188,7 +189,7 @@ opensocial.data.RequestDescriptor.protot
   var match = attribute.match(substRex);
   while (match) {
     var token = match[2].substring(2, match[2].length - 1);
-    var key = token.split(".")[0];
+    var key = token.split('.')[0];
     if (!this.neededKeys) {
       this.neededKeys = {};
     }
@@ -214,8 +215,8 @@ opensocial.data.RequestDescriptor.protot
  * @return {Object} The result of evaluation.
  */
 opensocial.data.DataContext.evalExpression = function(expr) {
-  return (new Function("context", "with (context) return " + expr))
-      (opensocial.data.DataContext.getData());
+  return (new Function("context",
+      "with (context) return " + expr))(opensocial.data.DataContext.getData());
 };
 
 
@@ -233,7 +234,7 @@ opensocial.data.requests_ = {};
  */
 opensocial.data.registerRequestDescriptor = function(requestDescriptor) {
   if (opensocial.data.requests_[requestDescriptor.key]) {
-    throw Error("Request already registered for " + requestDescriptor.key);
+    throw Error('Request already registered for ' + requestDescriptor.key);
   }
   opensocial.data.requests_[requestDescriptor.key] = requestDescriptor;
 };
@@ -286,8 +287,8 @@ opensocial.data.getCurrentAPIRequest = f
  * added in a synchronous block of code will be batched. The requests will be
  * automatically sent once the syncronous block is done executing.
  * @param {Object} request Specifies data to fetch
- * (constructed via DataRequest's newFetch???Request() methods)
- * @param {string} key The key to map generated response data to
+ * (constructed via DataRequest's newFetch???Request() methods).
+ * @param {string} key The key to map generated response data to.
  * @param {function(string, ResponseItem)=} opt_callback An optional callback
  * function to pass the returned ResponseItem to. If present, the function will
  * be called with the key and ResponseItem as params. If this is omitted, the
@@ -338,8 +339,8 @@ opensocial.data.createSharedRequestCallb
 /**
  * Processes a response to the shared API DataRequest by looping through
  * requested keys and notifying appropriate parties of the received data.
- * @param {DataResonse} responseItem Data received from the server
- * @param {Array.<string>} keys The list of keys that were requested
+ * @param {DataResonse} responseItem Data received from the server.
+ * @param {Array.<string>} keys The list of keys that were requested.
  * @param {Object.<string, function(string, ResponseItem)>} callbacks A map of
  * any custom callbacks by key.
  */
@@ -363,6 +364,7 @@ opensocial.data.onAPIResponse = function
  * Extract the JSON payload from the ResponseItem. This includes
  * iterating over an array of API objects and extracting their JSON into a
  * simple array structure.
+ * @private
  */
 opensocial.data.extractJson_ = function(responseItem, key) {
   var data = responseItem.getData();
@@ -372,12 +374,12 @@ opensocial.data.extractJson_ = function(
       out.push(data.array_[i].fields_);
     }
     data = out;
-    
+
     // For os:PeopleRequests that request @groupId="self", crack the array
     var request = opensocial.data.requests_[key];
-    if (request.tagName == "os:PeopleRequest") {
-      var groupId = request.getAttribute("groupId");
-      if ((!groupId || groupId == "@self") && data.length == 1) {
+    if (request.tagName == 'os:PeopleRequest') {
+      var groupId = request.getAttribute('groupId');
+      if ((!groupId || groupId == '@self') && data.length == 1) {
         data = data[0];
       }
     }
@@ -423,7 +425,7 @@ opensocial.data.registerRequestHandler =
  */
 opensocial.data.processDocumentMarkup = function(opt_doc) {
   var doc = opt_doc || document;
-  var nodes = doc.getElementsByTagName("script");
+  var nodes = doc.getElementsByTagName('script');
   for (var i = 0; i < nodes.length; ++i) {
     var node = nodes[i];
     if (node.type == opensocial.data.SCRIPT_TYPE) {
@@ -461,6 +463,7 @@ opensocial.data.loadRequests = function(
 /**
  * Parses XML data and constructs the pending request list.
  * @param {string} xml A string containing XML markup.
+ * @private
  */
 opensocial.data.loadRequestsFromMarkup_ = function(xml) {
   xml = opensocial.xmlutil.prepareXML(xml);
@@ -538,8 +541,9 @@ opensocial.data.transformSpecialValue = 
  * Parses a string of comma-separated field names and adds the resulting array
  * (if any) to the params object.
  * @param {Object} params The params object used to construct an Opensocial
- * DataRequest
- * @param {string} fieldsStr A string containing comma-separated field names
+ * DataRequest.
+ * @param {string} fieldsStr A string containing comma-separated field names.
+ * @private
  */
 opensocial.data.addFieldsToParams_ = function(params, fieldsStr) {
   if (!fieldsStr) {
@@ -555,32 +559,32 @@ opensocial.data.addFieldsToParams_ = fun
  * Automatically called when this file is loaded.
  */
 (function() {
-  opensocial.data.registerRequestHandler("os:ViewerRequest", function(descriptor) {
+  opensocial.data.registerRequestHandler('os:ViewerRequest', function(descriptor) {
     var params = {};
-    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute("fields"));
-    var req = opensocial.data.getCurrentAPIRequest().newFetchPersonRequest("VIEWER", params);
+    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute('fields'));
+    var req = opensocial.data.getCurrentAPIRequest().newFetchPersonRequest('VIEWER', params);
     // TODO: Support @fields param.
     opensocial.data.addToCurrentAPIRequest(req, descriptor.key);
   });
 
-  opensocial.data.registerRequestHandler("os:OwnerRequest", function(descriptor) {
+  opensocial.data.registerRequestHandler('os:OwnerRequest', function(descriptor) {
     var params = {};
-    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute("fields"));
-    var req = opensocial.data.getCurrentAPIRequest().newFetchPersonRequest("OWNER", params);
+    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute('fields'));
+    var req = opensocial.data.getCurrentAPIRequest().newFetchPersonRequest('OWNER', params);
     // TODO: Support @fields param.
     opensocial.data.addToCurrentAPIRequest(req, descriptor.key);
   });
 
-  opensocial.data.registerRequestHandler("os:PeopleRequest", function(descriptor) {
-    var userId = descriptor.getAttribute("userId");
-    var groupId = descriptor.getAttribute("groupId") || "@self";
+  opensocial.data.registerRequestHandler('os:PeopleRequest', function(descriptor) {
+    var userId = descriptor.getAttribute('userId');
+    var groupId = descriptor.getAttribute('groupId') || '@self';
     var idSpec = {};
     idSpec.userId = opensocial.data.transformSpecialValue(userId);
-    if (groupId != "@self") {
+    if (groupId != '@self') {
       idSpec.groupId = opensocial.data.transformSpecialValue(groupId);
     }
     var params = {};
-    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute("fields"));
+    opensocial.data.addFieldsToParams_(params, descriptor.getAttribute('fields'));
     // TODO: Support other params.
     var req = opensocial.data.getCurrentAPIRequest().newFetchPeopleRequest(
         opensocial.newIdSpec(idSpec), params);
@@ -588,12 +592,12 @@ opensocial.data.addFieldsToParams_ = fun
     opensocial.data.addToCurrentAPIRequest(req, descriptor.key);
   });
 
-  opensocial.data.registerRequestHandler("os:ActivitiesRequest", function(descriptor) {
-    var userId = descriptor.getAttribute("userId");
-    var groupId = descriptor.getAttribute("groupId") || "@self";
+  opensocial.data.registerRequestHandler('os:ActivitiesRequest', function(descriptor) {
+    var userId = descriptor.getAttribute('userId');
+    var groupId = descriptor.getAttribute('groupId') || '@self';
     var idSpec = {};
     idSpec.userId = opensocial.data.transformSpecialValue(userId);
-    if (groupId != "@self") {
+    if (groupId != '@self') {
       idSpec.groupId = opensocial.data.transformSpecialValue(groupId);
     }
     // TODO: Support other params.
@@ -602,17 +606,17 @@ opensocial.data.addFieldsToParams_ = fun
     opensocial.data.addToCurrentAPIRequest(req, descriptor.key);
   });
 
-  opensocial.data.registerRequestHandler("os:HttpRequest", function(descriptor) {
+  opensocial.data.registerRequestHandler('os:HttpRequest', function(descriptor) {
     var href = descriptor.getAttribute('href');
-    var format = descriptor.getAttribute('format') || "json";
+    var format = descriptor.getAttribute('format') || 'json';
     var params = {};
     params[gadgets.io.RequestParameters.CONTENT_TYPE] =
-        format.toLowerCase() == "text" ? gadgets.io.ContentType.TEXT :
+        format.toLowerCase() == 'text' ? gadgets.io.ContentType.TEXT :
             gadgets.io.ContentType.JSON;
     params[gadgets.io.RequestParameters.METHOD] =
         gadgets.io.MethodType.GET;
     gadgets.io.makeRequest(href, function(obj) {
-        opensocial.data.DataContext.putDataSet(descriptor.key, obj.data);
+      opensocial.data.DataContext.putDataSet(descriptor.key, obj.data);
     }, params);
   });
 })();
@@ -622,7 +626,7 @@ opensocial.data.addFieldsToParams_ = fun
  * Pre-populate a Data Set based on application's URL parameters.
  */
 (opensocial.data.populateParams_ = function() {
-  if (window["gadgets"] && gadgets.util.hasFeature("views")) {
-    opensocial.data.DataContext.putDataSet("ViewParams", gadgets.views.getParams());
+  if (window['gadgets'] && gadgets.util.hasFeature('views')) {
+    opensocial.data.DataContext.putDataSet('ViewParams', gadgets.views.getParams());
   }
 })();



Mime
View raw message