package test;

import java.util.Date;

import com.google.gwt.i18n.shared.DateTimeFormat;
import com.smartgwt.client.widgets.grid.ListGridRecord;

/*******************************************************************************
* 
*******************************************************************************/
public class SampleData
{
   private static ListGridRecord[] records;   

   private static String[] names_list = {"Tanna", "Norberto", "Yolanda", "Romaine", "Sandy", "Marcelle", "Mavis",
      "Arlen", "Abbey", "Kiera", "Wilfred", "Kaylene", "Carin", "Sierra", "Celestina", "Deon", "Carolann", "Elnora",
      "Lashunda", "Hwa", "Ronni", "Ling", "Clorinda", "Ned", "Justina", "Magen", "Almeta", "Alisha", "Dorsey",
      "Hyacinth", "Lavonna", "Kindra", "Wendell", "Latesha", "Meggan", "Denita", "Felicidad", "Marion", "Valeria",
      "Tyree", "Vernetta", "Laree", "Alysia", "Colene", "Jarrett", "Arnetta", "Berta", "Zina", "Nathanial", "Genna",
      "Carlton", "Darline", "Shirlene", "Cornell", "Tanesha", "Jeramy", "Emery", "Arlette", "Arron", "Myrna", "Suanne",
      "Mari", "Elwanda", "Fermin", "Domonique", "Euna", "Claudio", "Nilsa", "Erin", "Vanita", "Tinisha", "Codi",
      "Ardelia", "Lovella", "Andrew", "Sharolyn", "Jonah", "Carissa", "Troy", "Glenda", "Fred", "Magdalen", "Garnett",
      "Dewey", "Nicki", "Sharie", "Phebe", "Randal", "Harvey", "Janna", "Leonardo", "Katy", "Towanda", "Janae",
      "Roland", "Trudi", "Deborah", "Tess", "Yoko", "Reynalda", "Nicholle", "Megan", "Donya", "Rochell", "Lettie",
      "Carolyn", "Caryl", "Romana", "Hassie", "Gilberte", "Mazie", "Janee", "Isela", "Viki", "Joey", "Donnette",
      "Ayana", "Anton", "Hilde", "Simonne", "Brooke", "Shellie", "Callie", "Natalia", "Lorinda", "Frankie", "Jamar",
      "Mariano", "Les", "Jeremy", "Dania", "Christiane", "Mozella", "Kattie", "Evette", "Kathy", "Salvador", "Mitchel",
      "Charley", "Calvin", "Sparkle", "Lonny", "Altha", "Signe", "Josette", "Caprice", "Rae", "Mariam", "Lenard",
      "Mirian"};
   
   private static Integer[] ages = {21, 25, 40, 47, 24, 53, 27, 49, 34, 44, 34, 22, 48, 36, 27, 33, 38, 61, 40, 40, 66, 50, 35, 46, 56,
      54, 61, 48, 62, 57, 70, 63, 48, 58, 46, 47, 36, 69, 52, 67, 54, 20, 33, 54, 28, 32, 57, 36, 56, 30, 24, 58, 43,
      44, 39, 41, 40, 33, 58, 38, 46, 21, 65, 51, 40, 64, 34, 64, 52, 23, 41, 63, 54, 46, 67, 66, 59, 67, 25, 23, 58,
      23, 69, 28, 66, 49, 37, 44, 61, 53, 60, 68, 30, 65, 68, 36, 34, 38, 28, 37, 45, 55, 68, 30, 25, 57, 70, 66, 36,
      63, 33, 60, 58, 56, 48, 48, 31, 28, 54, 61, 65, 69, 21, 33, 47, 58, 39, 62, 33, 25, 58, 56, 70, 63, 43, 42, 28,
      60, 33, 63, 65, 22, 61, 48, 39, 41, 57, 49, 51, 47, 21, 25, 40, 47, 24, 53, 27, 49, 34, 44, 34, 22, 48, 36, 27,
      33, 38, 61, 40, 40, 66, 50, 35, 46, 56, 54, 61, 48, 62, 57, 70, 63, 48, 58, 46, 47, 36, 69, 52, 67, 54, 20, 33,
      54, 28, 32, 57, 36, 56, 30, 24, 58, 43, 44, 39, 41, 40, 33, 58, 38, 46, 21, 65, 51, 40, 64, 34, 64, 52, 23, 41,
      63, 54, 46, 67, 66, 59, 67, 25, 23, 58, 23, 69, 28, 66, 49, 37, 44, 61, 53, 60, 68, 30, 65, 68, 36, 34, 38, 28,
      37, 45, 55, 68, 30, 25, 57, 70, 66, 36, 63, 33, 60, 58, 56, 48, 48, 31, 28, 54, 61, 65, 69, 21, 33, 47, 58, 39,
      62, 33, 25, 58, 56, 70, 63, 43, 42, 28, 60, 33, 63, 65, 22, 61, 48, 39, 41, 57, 49, 51, 47};
   
   private static String[] dates = {"6-10-2001", "30-11-2012", "28-4-1985", "14-5-1999", "19-4-2015", "8-7-2010", "12-9-2003",
      "14-9-2011", "9-5-1988", "16-5-1979", "11-1-1994", "20-11-1986", "8-7-1996", "8-8-1988", "4-3-1978", "2-5-1978",
      "9-3-1995", "14-10-2013", "16-2-1979", "30-5-2008", "23-7-1989", "10-2-2006", "8-6-1985", "27-3-2016",
      "17-3-1989", "23-3-1989", "26-11-1978", "21-11-1992", "18-8-1982", "20-10-2002", "24-12-1985", "21-1-1997",
      "26-5-2016", "6-7-1992", "13-12-2014", "4-4-2014", "26-10-1989", "15-1-1979", "24-7-2011", "28-1-2012",
      "22-7-2000", "30-9-1992", "10-9-1982", "25-6-2014", "21-7-2002", "14-1-1985", "18-5-1992", "5-2-2005", "8-5-2010",
      "30-9-1990", "31-1-2016", "2-3-1996", "24-5-2012", "2-10-2009", "31-5-1980", "2-10-2008", "3-7-1988", "9-8-2003",
      "17-12-2018", "15-4-2007", "17-11-2004", "13-11-1982", "16-4-1980", "11-5-2003", "11-1-2000", "8-6-2007",
      "22-12-1984", "7-5-1982", "7-8-2006", "3-5-2004", "1-5-2017", "18-2-1999", "18-10-2015", "25-12-2009",
      "19-5-1996", "19-2-2002", "2-11-2006", "12-3-1984", "19-2-1997", "15-9-1999", "3-5-2003", "11-10-2013",
      "31-3-1992", "26-6-2000", "26-12-2005", "20-2-1985", "3-4-1977", "10-4-2002", "13-2-1980", "20-5-1992",
      "18-9-2010", "20-10-1986", "15-4-2010", "31-3-2000", "20-1-1981", "25-7-1981", "4-9-1995", "25-4-1998",
      "16-7-2002", "17-7-1999", "27-5-1980", "22-2-2005", "30-4-2015", "19-3-1990", "16-5-1993", "9-7-1982",
      "14-8-1999", "29-11-2012", "23-4-1980", "13-2-2017", "2-11-1988", "7-6-2005", "31-8-2016", "28-5-1999",
      "7-8-1982", "16-6-2003", "3-8-2011", "29-12-1978", "28-4-1982", "29-3-1997", "10-10-1987", "12-2-1996",
      "28-9-2009", "5-10-2017", "9-6-1983", "18-7-1988", "11-2-2014", "12-10-2000", "11-1-1994", "17-2-1983",
      "17-4-1991", "11-6-1999", "9-5-1986", "23-1-1983", "7-4-1984", "8-3-1989", "29-3-1983", "7-8-1981", "10-11-2016",
      "21-7-2002", "10-9-2000", "26-9-1981", "10-12-1993", "29-12-2003", "6-7-2018", "4-10-2010", "26-1-2011",
      "18-12-2008", "6-2-1983", "6-7-1986"};

   public static ListGridRecord[] getRecords()
   {      
      if(records == null)
      {
         records = getNewRecords();
      }
      return records;
   }

   public static ListGridRecord createRecord(int index, String name, String date, Integer age)
   {      
      ListGridRecord record = new ListGridRecord();
      record.setAttribute("dataIndex", index);
      record.setAttribute("dataName", name);
      record.setAttribute("dataAge", age);
      
      String pattern = "dd-MM-yyyy"; 
      Date theDate = DateTimeFormat.getFormat(pattern).parseStrict(date);
      record.setAttribute("dataDate", theDate);
      return record;
   }

   public static ListGridRecord[] getNewRecords()
   {      
      ListGridRecord[] thisrecords = new ListGridRecord[names_list.length];
      for(int index = 0; index < names_list.length; index++)
      {
         thisrecords[index] = createRecord(index, names_list[index], dates[index], ages[index]);
      }
      return thisrecords;

   }
   
   
}
