Author: abelevich
Date: 2009-09-24 08:53:53 -0400 (Thu, 24 Sep 2009)
New Revision: 15666
Added:
root/examples-sandbox/trunk/components/tables/src/main/java/org/
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Company.java
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Employee.java
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/utils/
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/utils/EmployeeUtils.java
Log:
sample data
Added:
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java
===================================================================
---
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java
(rev 0)
+++
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/DataBean.java 2009-09-24
12:53:53 UTC (rev 15666)
@@ -0,0 +1,29 @@
+package org.richfaces.demo;
+
+import java.util.List;
+
+import javax.faces.bean.ManagedBean;
+import javax.faces.bean.SessionScoped;
+
+import org.richfaces.demo.model.Employee;
+import org.richfaces.demo.utils.EmployeeUtils;
+
+@ManagedBean(name="dataBean")
+@SessionScoped
+public class DataBean {
+
+ private List<Employee> employeeList;
+
+
+ public void setEmployeeList(List<Employee> employeeList) {
+ this.employeeList = employeeList;
+ }
+
+ public List<Employee> getEmployeeList() {
+ if(employeeList == null){
+ employeeList = EmployeeUtils.obtainDefaultEmployeeList();
+ }
+ return employeeList;
+ }
+
+}
Added:
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Company.java
===================================================================
---
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Company.java
(rev 0)
+++
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Company.java 2009-09-24
12:53:53 UTC (rev 15666)
@@ -0,0 +1,55 @@
+package org.richfaces.demo.model;
+
+public class Company {
+
+ private String name;
+
+ private String state;
+
+ private String phone;
+
+ public Company(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getState() {
+ return state;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ public String getPhone() {
+ return phone;
+ }
+
+ public void setPhone(String phone) {
+ this.phone = phone;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof Company)) {
+ return false;
+ }
+ Company company = (Company) obj;
+ return name.equals(company.getName());
+ }
+
+ @Override
+ public int hashCode() {
+ return 31 + 17 * name.hashCode();
+ }
+}
Added:
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Employee.java
===================================================================
---
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Employee.java
(rev 0)
+++
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/model/Employee.java 2009-09-24
12:53:53 UTC (rev 15666)
@@ -0,0 +1,98 @@
+package org.richfaces.demo.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Random;
+
+public class Employee {
+
+ private String name;
+
+ private String title;
+
+ private Company company;
+
+ private String eMail;
+
+ private List<String[]> phones = new ArrayList<String[]>();
+
+ private static String[] phoneNames = {"Cell phone", "Work phone",
"Home phone"};
+
+ public Employee(String name, String title) {
+ this.name = name;
+ this.title = title;
+ initPhones();
+ }
+
+ private void initPhones() {
+ Random random = new Random();
+ int count = random.nextInt(phoneNames.length + 1);
+ for (int i = 0; i < count; i++) {
+ phones.add(new String[]{phoneNames[i], "+" + random.nextInt(1000) +
"-" + random.nextInt(1000000000)});
+ }
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public Company getCompany() {
+ return company;
+ }
+
+ public void setCompany(Company company) {
+ this.company = company;
+ }
+
+ public String getEMail() {
+ return eMail;
+ }
+
+ public void setEMail(String eMail) {
+ this.eMail = eMail;
+ }
+
+ public void setPhones(List<String[]> phones) {
+ this.phones = phones;
+ }
+
+ public List<String[]> getPhones() {
+ return phones;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!(obj instanceof Employee)) {
+ return false;
+ }
+ Employee employee = (Employee) obj;
+ return name.equals(employee.getName())
+ && title.equals(employee.getTitle())
+ && (company == null ? employee.getCompany() == null : company
+ .equals(employee.getCompany()));
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 1;
+ hash = hash * 17 + name.hashCode();
+ hash = hash * 17 + title.hashCode();
+ hash = hash * 17 + (company == null ? 0 : company.hashCode());
+ return hash;
+ }
+}
\ No newline at end of file
Added:
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/utils/EmployeeUtils.java
===================================================================
---
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/utils/EmployeeUtils.java
(rev 0)
+++
root/examples-sandbox/trunk/components/tables/src/main/java/org/richfaces/demo/utils/EmployeeUtils.java 2009-09-24
12:53:53 UTC (rev 15666)
@@ -0,0 +1,67 @@
+package org.richfaces.demo.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.richfaces.demo.model.Company;
+import org.richfaces.demo.model.Employee;
+
+public class EmployeeUtils {
+
+ public static List<Employee> obtainDefaultEmployeeList() {
+
+ List<Employee> employeeList = new ArrayList<Employee>();
+
+ addEmployeeToCollection(employeeList, "9Alexander Ivanov",
"Director", "aivanov(a)beltelecom.by", "AMicrosoft",
"+375 29 255 00 00", "Minsk, Belarus");
+ addEmployeeToCollection(employeeList, "4Bill Gates",
"President", "bgates(a)microsoft.com", "AMicrosoft",
"817-335-5881", "Tokyo, Japan");
+ addEmployeeToCollection(employeeList, "Amanda Gellhouse",
"IT/Internet Support; Manager", "agellhouse(a)sun.com", "Sun",
"853-729-3784", "Sun Valley, USA");
+ addEmployeeToCollection(employeeList, "2Hideo Kodzima", "Vice
Prezident", "khideo(a)konami.jp", "AMicrosoft",
"419-615-2730", "Tokyo, Japan");
+ addEmployeeToCollection(employeeList, "3Stan Carpenter", "Lead
Designer", "scarpenter(a)ndogs.com", "AMicrosoft",
"714-647-3380", "Tokyo, Japan");
+ addEmployeeToCollection(employeeList, "Clement Gaudet", "Chief
Technology Officer", "cgaudet(a)rstar.com", "Rock Star",
"403-444-1100", "Canada");
+ addEmployeeToCollection(employeeList, "Kazunori Yamauchi",
"CEO", "ykazunori(a)sony.jp", "Sony",
"410-561-4400", "Tokyo, Japan");
+ addEmployeeToCollection(employeeList, "Willis Aberg", "VP and
CIO", "waberg(a)evjscet.com", "Evj Scet",
"+046-155248000", "Tacoma, WA United States");
+ addEmployeeToCollection(employeeList, "Nick Acree", "Computer
Technician", "nacree(a)grifcity.com", "City Of Griffin",
"781-229-9599", "Houston, TX United States");
+ addEmployeeToCollection(employeeList, "RIchard L. Adams",
"Technology", "rladams(a)penergy.com", "Panhandle Energy",
"713-789-1400", "Valencia, CA United States");
+ addEmployeeToCollection(employeeList, "Vicki Ahlstrom", "Chief
information Officer", "vahlstrom(a)nassjok.com", "AMicrosoft",
"+420-545218196", "Aurskog, Akershus Norway");
+ addEmployeeToCollection(employeeList, "Candace Alexander", "VP
Supply Chain", "acandace(a)ucr.com", "Usgs Central Region",
"248-666-3500", "Holyoke, MA United States");
+ addEmployeeToCollection(employeeList, "Ronnie Allen", "VP Power
Generation Technology", "rallen(a)oilhouse.com", "The Oil House",
"540-672-1144", "Hesperia, CA United States");
+ addEmployeeToCollection(employeeList, "Philip Krell", "MIS
Manager", "pkrell(a)mainpartner.com", "Maintpartner Ab",
"+007-78129533724", "Austin, TX United States");
+ addEmployeeToCollection(employeeList, "Michael Johnston",
"MIS", "mjohnstom(a)scotteq.com", "Scott Equipment Co",
"+031-104600660", "Nashville, TN United States");
+ addEmployeeToCollection(employeeList, "Arne Johansson", "Network
Manager", "ajohansson(a)oneok.com", "Oneok, Inc",
"248-474-2790", "Scottsdale, AZ United States");
+ addEmployeeToCollection(employeeList, "Gary Jenkins", "Senior
Vice-President; Technology", "gjenkins(a)lorien.com", "Lorien",
"608-788-4000", "Yorba Linda, CA United States");
+ addEmployeeToCollection(employeeList, "R.K. Jain", "VP Information
Management", "rjlain(a)broeren.com", "Broeren Oil Inc",
"812-477-1529", "Martinsville, VA United States");
+ addEmployeeToCollection(employeeList, "Kathryn J. Jackson", "MIS
Director", "kjjackson(a)alon.com", "Alon Usa, Lp",
"+046-480450500", "Norco, LA United States");
+ addEmployeeToCollection(employeeList, "Hamid Abbasi", "Programmer
Analyst", "habbasi(a)kwb.com", "K W B Inc",
"+043-318224190", "Spartanburg, SC United States");
+ addEmployeeToCollection(employeeList, "Stephanie Cobb",
"Vice-President; Systems Staff", "scobb(a)amarillcity.com", "City
Of Amarillo", "213-367-4211", "Auburn, IL United States");
+ addEmployeeToCollection(employeeList, "Titus J Colaco", "VP L.T.
and CIO", "tjcolaco(a)gary.com", "Gary Inc",
"337-856-6704", "St. John's, NF Canada");
+ addEmployeeToCollection(employeeList, "Steve Coleman",
"Webmaster", "scoleman(a)ragnsells.com", "Ragn-Sells Ab",
"303-688-5946", "Burke, VA United States");
+ addEmployeeToCollection(employeeList, "Chris K Corcoran", "EVP,
Oxbow Calcining", "ckcorcoran(a)buck.com", "D S Buck Inc",
"+47-23-01-49-70", "Soskut, Hungary");
+ addEmployeeToCollection(employeeList, "Paulo R. Costa", "VP Power
Production", "prcosta(a)sasol.com", "Sasol Limited",
"+46-372789383", "Concord, NH United States");
+ addEmployeeToCollection(employeeList, "Daniel Crespo",
"IT/Internet Support; Analyst", "dcrespo(a)bokken.com", "Bokken
As", "+91-22-6659-7300", "Wien, Austria");
+ addEmployeeToCollection(employeeList, "Petr Cumba",
"IT-chef", "pcumba(a)abarta.com", "ABARTA, Inc.",
"701-277-0403", "Liberal, KS United States");
+ addEmployeeToCollection(employeeList, "James Curley", "Network
Manager", "jcurley(a)triboro.com", "Triboro Gulf",
"+047-52020000", "Nesflaten, Rogaland Norway");
+ addEmployeeToCollection(employeeList, "Lu Dam", "SVP Operations
and Technical", "ludam(a)krepro.com", "Krepro As",
"313-876-0190", "Walters, OK United States");
+ addEmployeeToCollection(employeeList, "Randy Davenport", "Database
Administrator", "rdevenport(a)savatrip.com", "Sav-A-Trip, Inc",
"+032-38807700", "Adelaide, Australia");
+ addEmployeeToCollection(employeeList, "Kevin A. Kohlscheen",
"Computer Specialist", "kakohlscheen(a)eni.com", "Eni S.p.A.",
"+031-455223300", "Andria, Bari Italy");
+ addEmployeeToCollection(employeeList, "M Koetsier",
"Programmer", "mkoetsier(a)pinnergy.com", "Pinnergy Ltd",
"316-838-4663", "Moscow, Russia");
+ addEmployeeToCollection(employeeList, "James Kneale", "General
Manager", "jkneale(a)paleo.com", "Paleo Inc",
"+91-484-272-2061", "Hamburg, Germany");
+ addEmployeeToCollection(employeeList, "Andrew Knaebel", "Technical
Staff", "aknaebel(a)amoco.com", "Hilltop Amoco",
"512-927-3549", "Redhill, Surrey England");
+ addEmployeeToCollection(employeeList, "Andy Kirkham", "VP
Administration", "akirkham(a)pacificorp.com", "Pacificorp",
"561-642-2153", "Ashton, ID United States");
+ addEmployeeToCollection(employeeList, "Derrik Khoo Sin Huat",
"CTO", "aksinhuat(a)aes.com", "The AES Corporation",
"864-233-4064", "Sydney, Australia");
+ addEmployeeToCollection(employeeList, "Rick Kelsven", "Network
Analyst", "rkelsven(a)rudny.com", "Rudny's Inc",
"208-356-4991", "Bangkok, Thailand");
+
+ return employeeList;
+ }
+
+ private static void addEmployeeToCollection(List<Employee> collection, String
employeeName, String employeeTitle,
+ String employeeEmail, String companyName,
String companyPhone,
+ String companyState) {
+ Company company = new Company(companyName);
+ company.setPhone(companyPhone);
+ company.setState(companyState);
+ Employee employee = new Employee(employeeName, employeeTitle);
+ employee.setEMail(employeeEmail);
+ employee.setCompany(company);
+ collection.add(employee);
+ }
+}