[richfaces-svn-commits] JBoss Rich Faces SVN: r15797 - in root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo: common and 4 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sun Nov 1 11:34:11 EST 2009


Author: Alex.Kolonitsky
Date: 2009-11-01 11:34:11 -0500 (Sun, 01 Nov 2009)
New Revision: 15797

Modified:
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/CarsBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/InventoryItem.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SelectsBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/UserBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/function/FunctionBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaData.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/outputPanel/OutputPanelBean.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/Choice.java
   root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/ChoicesBean.java
Log:
Code style policy
https://jira.jboss.org/jira/browse/RFPL-195

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/CarsBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/CarsBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/CarsBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -1,9 +1,11 @@
+
 /**
- * 
+ *
  */
 package org.richfaces.demo.carsstore;
 
 import java.math.BigDecimal;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -12,176 +14,175 @@
 import javax.faces.bean.ManagedBean;
 import javax.faces.bean.SessionScoped;
 import javax.faces.model.SelectItem;
- at ManagedBean(name="carsBean")
+
+ at ManagedBean(name = "carsBean")
 @SessionScoped
 public class CarsBean {
+    private static final String[] CHEVROLETES = {"Corvette", "Malibu", "Tahoe"};
+    private static final int DECIMALS = 1;
+    private static final String[] FORDS = {"Taurus", "Explorer"};
+    private static final String[] GMCS = {"Sierra", "Yukon"};
+    private static final String[] INFINITIES = {"G35", "EX35"};
+    private static final String[] NISSANS = {"Maxima", "Frontier"};
+    private static final String[] TOYOTA = {"4-Runner", "Camry", "Avalon"};
+    private static final int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
+    private List<InventoryItem> allCars = null;
+    private List<SelectItem> chevies = new ArrayList<SelectItem>();
+    private List<SelectItem> fords = new ArrayList<SelectItem>();
+    private List<SelectItem> nissans = new ArrayList<SelectItem>();
+    private List<SelectItem> toyotas = new ArrayList<SelectItem>();
+    private List<SelectItem> infinities = new ArrayList<SelectItem>();
+    private List<SelectItem> gmcs = new ArrayList<SelectItem>();
 
-	private static final String [] CHEVROLETES = {"Corvette", "Malibu", "Tahoe"};
-	private static final String [] FORDS = {"Taurus", "Explorer"};
-	private static final String [] NISSANS = {"Maxima", "Frontier"};
-	private static final String [] TOYOTA = {"4-Runner", "Camry", "Avalon"};
-	private static final String [] GMCS = {"Sierra", "Yukon"};
-	private static final String [] INFINITIES = {"G35", "EX35"};
+    public CarsBean() {
+        chevies.add(new SelectItem("Corvette"));
+        chevies.add(new SelectItem("Malibu"));
+        chevies.add(new SelectItem("Tahoe"));
+        fords.add(new SelectItem("Taurus"));
+        fords.add(new SelectItem("Explorer"));
+        nissans.add(new SelectItem("Maxima"));
+        nissans.add(new SelectItem("Frontier"));
+        toyotas.add(new SelectItem("4-Runner"));
+        toyotas.add(new SelectItem("Camry"));
+        toyotas.add(new SelectItem("Avalon"));
+        gmcs.add(new SelectItem("Sierra"));
+        gmcs.add(new SelectItem("Yukon"));
+        infinities.add(new SelectItem("G35"));
+        infinities.add(new SelectItem("EX35"));
+    }
 
-	private static int DECIMALS = 1;
-	private static int ROUNDING_MODE = BigDecimal.ROUND_HALF_UP;
+    public List<InventoryItem> getAllCars() {
+        synchronized (this) {
+            if (allCars == null) {
+                allCars = new ArrayList<InventoryItem>();
 
-	private List<InventoryItem> allCars = null;
+                for (int k = 0; k <= 5; k++) {
+                    try {
+                        switch (k) {
+                            case 0 :
+                                allCars.addAll(createCar("Chevrolet", "Corvette", 5));
+                                allCars.addAll(createCar("Chevrolet", "Malibu", 8));
+                                allCars.addAll(createCar("Chevrolet", "Tahoe", 6));
 
-	private List<SelectItem> chevies = new ArrayList<SelectItem>();
-	private List<SelectItem> fords = new ArrayList<SelectItem>();
-	private List<SelectItem> nissans = new ArrayList<SelectItem>();
-	private List<SelectItem> toyotas = new ArrayList<SelectItem>();
-	private List<SelectItem> gmcs = new ArrayList<SelectItem>();
-	private List<SelectItem> infinities = new ArrayList<SelectItem>();
-	
-	public CarsBean() {
-		chevies.add(new SelectItem("Corvette"));
-		chevies.add(new SelectItem("Malibu"));
-		chevies.add(new SelectItem("Tahoe"));
-		
-		fords.add(new SelectItem("Taurus"));
-		fords.add(new SelectItem("Explorer"));
+                                break;
 
-		nissans.add(new SelectItem("Maxima"));
-		nissans.add(new SelectItem("Frontier"));
-	
-		toyotas.add(new SelectItem("4-Runner"));
-		toyotas.add(new SelectItem("Camry"));
-		toyotas.add(new SelectItem("Avalon"));
+                            case 1 :
+                                allCars.addAll(createCar("Ford", "Taurus", 12));
+                                allCars.addAll(createCar("Ford", "Explorer", 11));
 
-		gmcs.add(new SelectItem("Sierra"));
-		gmcs.add(new SelectItem("Yukon"));
-	
-		infinities.add(new SelectItem("G35"));
-		infinities.add(new SelectItem("EX35"));
-	}
+                                break;
 
-	public List<InventoryItem> getAllCars() {
-		synchronized (this) {
-			if (allCars == null) {
-				allCars = new ArrayList<InventoryItem>();
-				for (int k = 0; k <= 5; k++) {
-					try {
-						switch (k) {
-						case 0:
-							allCars.addAll(createCar("Chevrolet", "Corvette",5));
-							allCars.addAll(createCar("Chevrolet", "Malibu", 8));
-							allCars.addAll(createCar("Chevrolet", "Tahoe", 6));
-							break;
-						case 1:
-							allCars.addAll(createCar("Ford", "Taurus", 12));
-							allCars.addAll(createCar("Ford", "Explorer", 11));
-							break;
-						case 2:
-							allCars.addAll(createCar("Nissan", "Maxima", 9));
-							allCars.addAll(createCar("Nissan", "Frontier", 6));
-							break;
-						case 3:
-							allCars.addAll(createCar("Toyota", "4-Runner", 7));
-							allCars.addAll(createCar("Toyota", "Camry", 15));
-							allCars.addAll(createCar("Toyota", "Avalon", 13));
-							break;
-						case 4:
-							allCars.addAll(createCar("GMC", "Sierra", 8));
-							allCars.addAll(createCar("GMC", "Yukon", 10));
-							break;
-						case 5:
-							allCars.addAll(createCar("Infiniti", "G35", 6));
-							allCars.addAll(createCar("Infiniti", "EX35", 5));
-							break;
-						default:
-							break;
-						}
-					} catch (Exception e) {
-						System.out.println("!!!!!!loadAllCars Error: "
-								+ e.getMessage());
-						e.printStackTrace();
-					}
-				}
-			}
-		}
-		return allCars;
-	}
+                            case 2 :
+                                allCars.addAll(createCar("Nissan", "Maxima", 9));
+                                allCars.addAll(createCar("Nissan", "Frontier", 6));
 
-	public List<InventoryItem> getTenRandomCars() {
-		List<InventoryItem> result = new ArrayList<InventoryItem>();
-		int size = getAllCars().size() - 1;
-		for (int i = 0; i < 10; i++) {
-			result.add(getAllCars().get(rand(1, size)));
-		}
-		return result;
-	}
+                                break;
 
-	public int genRand() {
-		return rand(1, 10000);
-	}
+                            case 3 :
+                                allCars.addAll(createCar("Toyota", "4-Runner", 7));
+                                allCars.addAll(createCar("Toyota", "Camry", 15));
+                                allCars.addAll(createCar("Toyota", "Avalon", 13));
 
-	public List<InventoryItem> createCar(String make, String model,
-			int count) {
+                                break;
 
-		ArrayList<InventoryItem> iiList = null;
+                            case 4 :
+                                allCars.addAll(createCar("GMC", "Sierra", 8));
+                                allCars.addAll(createCar("GMC", "Yukon", 10));
 
-		try {
-			int arrayCount = count;
+                                break;
 
-			InventoryItem[] demoInventoryItemArrays = new InventoryItem[arrayCount];
+                            case 5 :
+                                allCars.addAll(createCar("Infiniti", "G35", 6));
+                                allCars.addAll(createCar("Infiniti", "EX35", 5));
 
-			for (int j = 0; j < demoInventoryItemArrays.length; j++) {
-				InventoryItem ii = new InventoryItem();
+                                break;
 
-				ii.setMake(make);
-				ii.setModel(model);
-				ii.setStock(randomstring(6, 7));
-				ii.setVin(randomstring(14, 15));
-				ii.setMileage(new BigDecimal(rand(5000, 80000)).setScale(
-						DECIMALS, ROUNDING_MODE));
-				ii.setMileageMarket(new BigDecimal(rand(25000, 45000))
-						.setScale(DECIMALS, ROUNDING_MODE));
-				ii.setPrice(new Integer(rand(15000, 55000)));
-				ii.setPriceMarket(new BigDecimal(rand(15000, 55000)).setScale(
-						DECIMALS, ROUNDING_MODE));
-				ii.setDaysLive(rand(1, 90));
-				ii.setChangeSearches(new BigDecimal(rand(0, 5)).setScale(
-						DECIMALS, ROUNDING_MODE));
-				ii.setChangePrice(new BigDecimal(rand(0, 5)).setScale(DECIMALS,
-						ROUNDING_MODE));
-				ii.setExposure(new BigDecimal(rand(0, 5)).setScale(DECIMALS,
-						ROUNDING_MODE));
-				ii.setActivity(new BigDecimal(rand(0, 5)).setScale(DECIMALS,
-						ROUNDING_MODE));
-				ii.setPrinted(new BigDecimal(rand(0, 5)).setScale(DECIMALS,
-						ROUNDING_MODE));
-				ii.setInquiries(new BigDecimal(rand(0, 5)).setScale(DECIMALS,
-						ROUNDING_MODE));
-				demoInventoryItemArrays[j] = ii;
+                            default :
+                                break;
+                        }
+                    } catch (Exception e) {
+                        System.out.println("!!!!!!loadAllCars Error: " + e.getMessage());
+                        e.printStackTrace();
+                    }
+                }
+            }
+        }
 
-			}
+        return allCars;
+    }
 
-			iiList = new ArrayList<InventoryItem>(Arrays
-					.asList(demoInventoryItemArrays));
+    public List<InventoryItem> getTenRandomCars() {
+        List<InventoryItem> result = new ArrayList<InventoryItem>();
+        int size = getAllCars().size() - 1;
 
-		} catch (Exception e) {
-			System.out.println("!!!!!!createCategory Error: " + e.getMessage());
-			e.printStackTrace();
-		}
-		return iiList;
-	}
+        for (int i = 0; i < 10; i++) {
+            result.add(getAllCars().get(rand(1, size)));
+        }
 
-	public static int rand(int lo, int hi) {
-		Random rn2 = new Random();
-		int n = hi - lo + 1;
-		int i = rn2.nextInt() % n;
-		if (i < 0)
-			i = -i;
-		return lo + i;
-	}
+        return result;
+    }
 
-	public static String randomstring(int lo, int hi) {
-		int n = rand(lo, hi);
-		byte b[] = new byte[n];
-		for (int i = 0; i < n; i++)
-			b[i] = (byte) rand('A', 'Z');
-		return new String(b);
-	}
+    public int genRand() {
+        return rand(1, 10000);
+    }
+
+    public List<InventoryItem> createCar(String make, String model, int count) {
+        ArrayList<InventoryItem> iiList = null;
+
+        try {
+            int arrayCount = count;
+            InventoryItem[] demoInventoryItemArrays = new InventoryItem[arrayCount];
+
+            for (int j = 0; j < demoInventoryItemArrays.length; j++) {
+                InventoryItem ii = new InventoryItem();
+
+                ii.setMake(make);
+                ii.setModel(model);
+                ii.setStock(randomstring(6, 7));
+                ii.setVin(randomstring(14, 15));
+                ii.setMileage(new BigDecimal(rand(5000, 80000)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setMileageMarket(new BigDecimal(rand(25000, 45000)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setPrice(new Integer(rand(15000, 55000)));
+                ii.setPriceMarket(new BigDecimal(rand(15000, 55000)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setDaysLive(rand(1, 90));
+                ii.setChangeSearches(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setChangePrice(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setExposure(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setActivity(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setPrinted(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                ii.setInquiries(new BigDecimal(rand(0, 5)).setScale(DECIMALS, ROUNDING_MODE));
+                demoInventoryItemArrays[j] = ii;
+            }
+
+            iiList = new ArrayList<InventoryItem>(Arrays.asList(demoInventoryItemArrays));
+        } catch (Exception e) {
+            System.out.println("!!!!!!createCategory Error: " + e.getMessage());
+            e.printStackTrace();
+        }
+
+        return iiList;
+    }
+
+    public static int rand(int lo, int hi) {
+        Random rn2 = new Random();
+        int n = hi - lo + 1;
+        int i = rn2.nextInt() % n;
+
+        if (i < 0) {
+            i = -i;
+        }
+
+        return lo + i;
+    }
+
+    public static String randomstring(int lo, int hi) {
+        int n = rand(lo, hi);
+        byte[] b = new byte[n];
+
+        for (int i = 0; i < n; i++) {
+            b[i] = (byte) rand('A', 'Z');
+        }
+
+        return new String(b);
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/InventoryItem.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/InventoryItem.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/carsstore/InventoryItem.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -1,30 +1,24 @@
 package org.richfaces.demo.carsstore;
 
 import java.math.BigDecimal;
-import java.io.Serializable;
 
-public class InventoryItem{
-
+public class InventoryItem {
+    BigDecimal activity;
+    BigDecimal changePrice;
+    BigDecimal changeSearches;
+    int daysLive;
+    BigDecimal exposure;
+    BigDecimal inquiries;
     String make;
-    String model;
-    String stock;
-    String vin;
-
     BigDecimal mileage;
     BigDecimal mileageMarket;
+    String model;
     Integer price;
     BigDecimal priceMarket;
-
-    int daysLive;
-    BigDecimal changeSearches;
-    BigDecimal changePrice;
-
-    BigDecimal exposure;
-    BigDecimal activity;
     BigDecimal printed;
-    BigDecimal inquiries;
+    String stock;
+    String vin;
 
-
     public String getMake() {
         return make;
     }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SelectsBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SelectsBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/SelectsBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -12,68 +12,77 @@
  * @author Ilya Shaikovsky
  *
  */
- at ManagedBean(name="selectsBean")
+ at ManagedBean(name = "selectsBean")
 @RequestScoped
 public class SelectsBean {
-		private String currentType="";
-		private String currentItem="";
-		public List<SelectItem> firstList = new ArrayList<SelectItem>(); 
-		public List<SelectItem> secondList = new ArrayList<SelectItem>();
-		private static final String [] FRUITS = {"", "Banana", "Cranberry", "Blueberry", "Orange"};
-		private static final String [] VEGETABLES = {"","Potatoes", "Broccoli", "Garlic", "Carrot"};
-		
-		public SelectsBean() {
-			SelectItem item = new SelectItem("", "");
-			firstList.add(item);
-			item = new SelectItem("fruits", "Fruits");
-			firstList.add(item);
-			item = new SelectItem("vegetables", "Vegetables");
-			firstList.add(item);
-			for (int i = 0; i < FRUITS.length; i++) {
-				item = new SelectItem(FRUITS[i]);
-			}
-		}
-		
-		public List<SelectItem> getFirstList() {
-			return firstList;
-		}
-		public List<SelectItem> getSecondList() {
-			return secondList;
-		}
-		public static String[] getFRUITS() {
-			return FRUITS;
-		}
-		public static String[] getVEGETABLES() {
-			return VEGETABLES;
-		}
-		public void valueChanged(ValueChangeEvent event){
-			secondList.clear();
-			String[] currentItems;
-			if (((String)event.getNewValue()).equals("fruits")) {
-				currentItems = FRUITS;
-			}else{
-				currentItems = VEGETABLES;
-			}
-			for (int i = 0; i < currentItems.length; i++) {
-				SelectItem item = new SelectItem(currentItems[i]);
-				secondList.add(item);
-			} 
-				
-		}
+    private static final String[] FRUITS = {"", "Banana", "Cranberry", "Blueberry", "Orange"};
+    private static final String[] VEGETABLES = {"", "Potatoes", "Broccoli", "Garlic", "Carrot"};
+    private String currentItem = "";
+    private String currentType = "";
+    private List<SelectItem> firstList = new ArrayList<SelectItem>();
+    private List<SelectItem> secondList = new ArrayList<SelectItem>();
 
-		public String getCurrentType() {
-			return currentType;
-		}
+    public SelectsBean() {
+        SelectItem item = new SelectItem("", "");
 
-		public void setCurrentType(String currentType) {
-			this.currentType = currentType;
-		}
+        firstList.add(item);
+        item = new SelectItem("fruits", "Fruits");
+        firstList.add(item);
+        item = new SelectItem("vegetables", "Vegetables");
+        firstList.add(item);
 
-		public String getCurrentItem() {
-			return currentItem;
-		}
+        for (int i = 0; i < FRUITS.length; i++) {
+            item = new SelectItem(FRUITS[i]);
+        }
+    }
 
-		public void setCurrentItem(String currentItem) {
-			this.currentItem = currentItem;
-		}
+    public List<SelectItem> getFirstList() {
+        return firstList;
+    }
+
+    public List<SelectItem> getSecondList() {
+        return secondList;
+    }
+
+    public static String[] getFRUITS() {
+        return FRUITS;
+    }
+
+    public static String[] getVEGETABLES() {
+        return VEGETABLES;
+    }
+
+    public void valueChanged(ValueChangeEvent event) {
+        secondList.clear();
+
+        String[] currentItems;
+
+        if (((String) event.getNewValue()).equals("fruits")) {
+            currentItems = FRUITS;
+        } else {
+            currentItems = VEGETABLES;
+        }
+
+        for (int i = 0; i < currentItems.length; i++) {
+            SelectItem item = new SelectItem(currentItems[i]);
+
+            secondList.add(item);
+        }
+    }
+
+    public String getCurrentType() {
+        return currentType;
+    }
+
+    public void setCurrentType(String currentType) {
+        this.currentType = currentType;
+    }
+
+    public String getCurrentItem() {
+        return currentItem;
+    }
+
+    public void setCurrentItem(String currentItem) {
+        this.currentItem = currentItem;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/UserBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/UserBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/common/UserBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -2,99 +2,100 @@
 
 import javax.faces.bean.ManagedBean;
 import javax.faces.bean.RequestScoped;
-import javax.faces.bean.SessionScoped;
 
 @ManagedBean(name = "userBean")
 @RequestScoped
 public class UserBean {
-	private String name="";
-	private String password="";
-	private String job;
-	private String address;
-	private String city;
-	private String zip;
-	private Integer age; 
+    private String name = "";
+    private String password = "";
+    private String address;
+    private Integer age;
+    private String city;
+    private String job;
+    private String recordStatus;
+    private String zip;
 
-	private String recordStatus;
-	public UserBean() {
-		super();
-	}
-	
-	public void store() {
-		this.recordStatus = "User " + this.name + " stored succesfully";
-	}
-	
-	public String getRecordStatus() {
-		return recordStatus;
-	}
+    public UserBean() {
+        super();
+    }
 
-	public void setRecordStatus(String recordStatus) {
-		this.recordStatus = recordStatus;
-	}
+    public void store() {
+        this.recordStatus = "User " + this.name + " stored succesfully";
+    }
 
-	public String getName() {
-		return this.name;
-	}
-	
-	public void setName(String name) {
-		this.name = name;
-	}
+    public String getRecordStatus() {
+        return recordStatus;
+    }
 
-	public String nameItJohn() {
-		setName("John");
-		return null;
-	}
-	public String nameItMark() {
-		setName("Mark");
-		return null;
-	}
+    public void setRecordStatus(String recordStatus) {
+        this.recordStatus = recordStatus;
+    }
 
-	public String getJob() {
-		return job;
-	}
+    public String getName() {
+        return this.name;
+    }
 
-	public void setJob(String job) {
-		this.job = job;
-	}
+    public void setName(String name) {
+        this.name = name;
+    }
 
-	public String getAddress() {
-		return address;
-	}
+    public String nameItJohn() {
+        setName("John");
 
-	public void setAddress(String address) {
-		this.address = address;
-	}
+        return null;
+    }
 
-	public String getCity() {
-		return city;
-	}
+    public String nameItMark() {
+        setName("Mark");
 
-	public void setCity(String city) {
-		this.city = city;
-	}
+        return null;
+    }
 
-	public String getZip() {
-		return zip;
-	}
+    public String getJob() {
+        return job;
+    }
 
-	public void setZip(String zip) {
-		this.zip = zip;
-	}
+    public void setJob(String job) {
+        this.job = job;
+    }
 
-	public Integer getAge() {
-		return age;
-	}
+    public String getAddress() {
+        return address;
+    }
 
-	public void setAge(Integer age) {
-		this.age = age;
-	}
+    public void setAddress(String address) {
+        this.address = address;
+    }
 
-	public String getPassword() {
-		return password;
-	}
+    public String getCity() {
+        return city;
+    }
 
-	public void setPassword(String password) {
-		this.password = password;
-	}
+    public void setCity(String city) {
+        this.city = city;
+    }
 
+    public String getZip() {
+        return zip;
+    }
+
+    public void setZip(String zip) {
+        this.zip = zip;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/function/FunctionBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/function/FunctionBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/function/FunctionBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -7,19 +7,17 @@
 @ManagedBean(name = "functionBean")
 @RequestScoped
 public class FunctionBean {
-	private String text;
+    private String text;
 
-	public void processHover() {
-		setText(FacesContext.getCurrentInstance().getExternalContext()
-				.getRequestParameterMap().get("name"));
-	}
+    public void processHover() {
+        setText(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("name"));
+    }
 
-	public String getText() {
-		return text;
-	}
+    public String getText() {
+        return text;
+    }
 
-	public void setText(String text) {
-		this.text = text;
-	}
-
+    public void setText(String text) {
+        this.text = text;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -5,72 +5,84 @@
 import java.awt.Graphics2D;
 import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
 import javax.faces.bean.ManagedBean;
 import javax.faces.bean.SessionScoped;
+
 import javax.imageio.ImageIO;
- at ManagedBean(name="mediaBean")
+
+ at ManagedBean(name = "mediaBean")
 @SessionScoped
 public class MediaBean {
+    public void paint(OutputStream out, Object data) throws IOException {
+        if (data instanceof MediaData) {
+            MediaData paintData = (MediaData) data;
+            BufferedImage img = new BufferedImage(paintData.width, paintData.height, BufferedImage.TYPE_INT_RGB);
+            Graphics2D g2d = img.createGraphics();
 
-	public void paint(OutputStream out, Object data) throws IOException{
-		if (data instanceof MediaData) {
-			MediaData paintData = (MediaData) data;
-			BufferedImage img = new BufferedImage(paintData.width, paintData.height, BufferedImage.TYPE_INT_RGB);
-			Graphics2D g2d = img.createGraphics();
-			
-		    g2d.setColor(Color.WHITE);
-		    g2d.fillRect(0, 0, 300, 120);
-		   
-		    int testLenght = paintData.text.length();
-		    int fontSize = testLenght < 8? 40 : 40 - (testLenght - 8);
-		    if (fontSize < 12)fontSize = 12;
-		    Font font = new Font("Serif", Font.HANGING_BASELINE, fontSize);
-		    g2d.setFont(font);
+            g2d.setColor(Color.WHITE);
+            g2d.fillRect(0, 0, 300, 120);
 
-		    int x = 10;
-		    int y = fontSize*5/2;
-		    g2d.translate(x, y);
-		    Color color = new Color(paintData.color);
-		    g2d.setPaint(new Color(color.getRed(),color.getGreen(), color.getBlue(), 30));
-		    AffineTransform origTransform = g2d.getTransform();
-		    g2d.shear(-0.5*paintData.scale, 0);
-		    g2d.scale(1, paintData.scale);
-		    g2d.drawString(paintData.text, 0, 0);
-		    
-		    g2d.setTransform(origTransform);
-		    g2d.setPaint(color);
-		    g2d.drawString(paintData.text, 0, 0);
-			ImageIO.write(img,"jpeg",out);
+            int testLenght = paintData.text.length();
+            int fontSize = testLenght < 8 ? 40 : 40 - (testLenght - 8);
 
-		}
-	}
+            if (fontSize < 12) {
+                fontSize = 12;
+            }
 
-	private void copy(InputStream in, OutputStream out) throws IOException {
-		byte[] buffer = new byte[2048];
-		int read;
-		
-		while ((read = in.read(buffer)) != -1) {
-			out.write(buffer, 0, read);
-		}
-	}
-	
-	public void paintFlash(OutputStream out, Object data) throws IOException {
-		ClassLoader loader = Thread.currentThread().getContextClassLoader();
-		if (loader == null) {
-			loader = getClass().getClassLoader();
-		}
-		
-		InputStream stream = loader.getResourceAsStream("org/richfaces/demo/mediaOutput/text.swf");
-		if (stream != null) {
-			try {
-				copy(stream, out);
-			} finally {
-				stream.close();
-			}
-		}
-	}
-}
\ No newline at end of file
+            Font font = new Font("Serif", Font.HANGING_BASELINE, fontSize);
+
+            g2d.setFont(font);
+
+            int x = 10;
+            int y = fontSize * 5 / 2;
+
+            g2d.translate(x, y);
+
+            Color color = new Color(paintData.color);
+
+            g2d.setPaint(new Color(color.getRed(), color.getGreen(), color.getBlue(), 30));
+
+            AffineTransform origTransform = g2d.getTransform();
+
+            g2d.shear(-0.5 * paintData.scale, 0);
+            g2d.scale(1, paintData.scale);
+            g2d.drawString(paintData.text, 0, 0);
+            g2d.setTransform(origTransform);
+            g2d.setPaint(color);
+            g2d.drawString(paintData.text, 0, 0);
+            ImageIO.write(img, "jpeg", out);
+        }
+    }
+
+    private void copy(InputStream in, OutputStream out) throws IOException {
+        byte[] buffer = new byte[2048];
+        int read;
+
+        while ((read = in.read(buffer)) != -1) {
+            out.write(buffer, 0, read);
+        }
+    }
+
+    public void paintFlash(OutputStream out, Object data) throws IOException {
+        ClassLoader loader = Thread.currentThread().getContextClassLoader();
+
+        if (loader == null) {
+            loader = getClass().getClassLoader();
+        }
+
+        InputStream stream = loader.getResourceAsStream("org/richfaces/demo/mediaOutput/text.swf");
+
+        if (stream != null) {
+            try {
+                copy(stream, out);
+            } finally {
+                stream.close();
+            }
+        }
+    }
+}

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaData.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaData.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/mediaOutput/MediaData.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -1,64 +1,68 @@
 package org.richfaces.demo.mediaOutput;
 
-import java.awt.Color;
-import java.io.Serializable;
-
 import javax.faces.bean.ManagedBean;
 import javax.faces.bean.SessionScoped;
 
- at ManagedBean(name="mediaData")
+import java.io.Serializable;
+
+ at ManagedBean(name = "mediaData")
 @SessionScoped
-public class MediaData implements Serializable{
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
-	int width = 300;
-	int height = 120;
-	String text;
-	Integer color;
-	float scale;
-	
-	public MediaData() {
-		setText("RichFaces 4.0");
-		setColor(1000);
-		setScale(2);
-		System.out.println("MediaData instantiated");
-	}
+public class MediaData implements Serializable {
 
-	public Integer getColor() {
-		return color;
-	}
-	public void setColor(Integer color) {
-		this.color = color;
-	}
-	public float getScale() {
-		return scale;
-	}
-	public void setScale(float scale) {
-		this.scale = scale;
-	}
+    /**
+     *
+     */
+    private static final long serialVersionUID = 1L;
+    int height = 120;
+    int width = 300;
+    Integer color;
+    float scale;
+    String text;
 
-	public String getText() {
-		return text;
-	}
-	public void setText(String text) {
-		this.text = text;
-	}
+    public MediaData() {
+        setText("RichFaces 4.0");
+        setColor(1000);
+        setScale(2);
+        System.out.println("MediaData instantiated");
+    }
 
-	public int getWidth() {
-		return width;
-	}
+    public Integer getColor() {
+        return color;
+    }
 
-	public void setWidth(int width) {
-		this.width = width;
-	}
+    public void setColor(Integer color) {
+        this.color = color;
+    }
 
-	public int getHeight() {
-		return height;
-	}
+    public float getScale() {
+        return scale;
+    }
 
-	public void setHeight(int height) {
-		this.height = height;
-	}
+    public void setScale(float scale) {
+        this.scale = scale;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public void setWidth(int width) {
+        this.width = width;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public void setHeight(int height) {
+        this.height = height;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/outputPanel/OutputPanelBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/outputPanel/OutputPanelBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/outputPanel/OutputPanelBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -1,13 +1,13 @@
 package org.richfaces.demo.outputPanel;
 
 public class OutputPanelBean {
-	private String text;
+    private String text;
 
-	public String getText() {
-		return text;
-	}
+    public String getText() {
+        return text;
+    }
 
-	public void setText(String text) {
-		this.text = text;
-	}
+    public void setText(String text) {
+        this.text = text;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/Choice.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/Choice.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/Choice.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -1,29 +1,31 @@
 package org.richfaces.demo.push;
 
 public class Choice {
-	private String label;
-	private int votesCount;
-	
-	public Choice(String label) {
-		this.label = label;
-		this.votesCount = 0;
-	}
-	
-	public void increment(int i) {
-		this.votesCount+=i;
-	}
-	
-	public String getLabel() {
-		return label;
-	}
-	public void setLabel(String label) {
-		this.label = label;
-	}
-	public int getVotesCount() {
-		return votesCount;
-	}
-	public void setVotesCount(int votesCount) {
-		this.votesCount = votesCount;
-	}
-	
+    private String label;
+    private int votesCount;
+
+    public Choice(String label) {
+        this.label = label;
+        this.votesCount = 0;
+    }
+
+    public void increment(int i) {
+        this.votesCount += i;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public int getVotesCount() {
+        return votesCount;
+    }
+
+    public void setVotesCount(int votesCount) {
+        this.votesCount = votesCount;
+    }
 }

Modified: root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/ChoicesBean.java
===================================================================
--- root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/ChoicesBean.java	2009-11-01 16:33:29 UTC (rev 15796)
+++ root/examples/trunk/richfaces-demo/src/main/java/org/richfaces/demo/push/ChoicesBean.java	2009-11-01 16:34:11 UTC (rev 15797)
@@ -12,140 +12,149 @@
 
 import org.ajax4jsf.event.PushEventListener;
 
- at ManagedBean(name="choicesBean")
+ at ManagedBean(name = "choicesBean")
 @SessionScoped
 public class ChoicesBean implements Runnable {
-	private List<Choice> choices;
-	private List<Choice> lastVotes;
-	private Thread thread;
-	private boolean enabled = false;
-	private Date startDate;
-	private String updateInfo;
-	PushEventListener listener;
+    private boolean enabled = false;
+    private List<Choice> choices;
+    private List<Choice> lastVotes;
+    PushEventListener listener;
+    private Date startDate;
+    private Thread thread;
+    private String updateInfo;
 
-	public ChoicesBean() {
-		choices = new ArrayList<Choice>();
-		lastVotes = new ArrayList<Choice>();
+    public ChoicesBean() {
+        choices = new ArrayList<Choice>();
+        lastVotes = new ArrayList<Choice>();
+        choices.add(new Choice("Orange"));
+        choices.add(new Choice("Pineapple"));
+        choices.add(new Choice("Banana"));
+        choices.add(new Choice("Kiwifruit"));
+        choices.add(new Choice("Apple"));
+        lastVotes.add(new Choice("Orange"));
+        lastVotes.add(new Choice("Pineapple"));
+        lastVotes.add(new Choice("Banana"));
+        lastVotes.add(new Choice("Kiwifruit"));
+        lastVotes.add(new Choice("Apple"));
+    }
 
-		choices.add(new Choice("Orange"));
-		choices.add(new Choice("Pineapple"));
-		choices.add(new Choice("Banana"));
-		choices.add(new Choice("Kiwifruit"));
-		choices.add(new Choice("Apple"));
+    public List<Choice> getChoices() {
+        return choices;
+    }
 
-		lastVotes.add(new Choice("Orange"));
-		lastVotes.add(new Choice("Pineapple"));
-		lastVotes.add(new Choice("Banana"));
-		lastVotes.add(new Choice("Kiwifruit"));
-		lastVotes.add(new Choice("Apple"));
-	}
+    public void setChoices(List<Choice> choices) {
+        this.choices = choices;
+    }
 
-	public List<Choice> getChoices() {
-		return choices;
-	}
+    public void addListener(EventListener listener) {
+        if (this.listener != listener) {
+            this.listener = (PushEventListener) listener;
+        }
+    }
 
-	public void setChoices(List<Choice> choices) {
-		this.choices = choices;
-	}
+    public String getTimeStamp() {
+        return new Date().toGMTString();
+    }
 
-	public void addListener(EventListener listener) {
-		if (this.listener != listener) {
-			this.listener = (PushEventListener) listener;
-		}
-	}
+    public synchronized void start() {
+        if (thread == null) {
+            setStartDate(new Date());
+            setEnabled(true);
+            thread = new Thread(this);
+            thread.setDaemon(true);
+            thread.start();
+        }
+    }
 
-	public String getTimeStamp() {
-		return new Date().toGMTString();
-	}
-	
-	public synchronized void start() {
-		if (thread == null) {
-			setStartDate(new Date());
-			setEnabled(true);
-			thread = new Thread(this);
-			thread.setDaemon(true);
-			thread.start();
-		}
-	}
+    public synchronized void stop() {
+        if (thread != null) {
+            setStartDate(null);
+            setEnabled(false);
+            thread = null;
+        }
+    }
 
-	public synchronized void stop() {
-		if (thread != null) {
-			setStartDate(null);
-			setEnabled(false);
-			thread = null;
-		}
-	}
-	
-	public static int rand(int lo, int hi) {
-		Random rn2 = new Random();
-		int n = hi - lo + 1;
-		int i = rn2.nextInt() % n;
-		if (i < 0)
-			i = -i;
-		return lo + i;
-	}	
-	public void run() {
-		while (thread != null) {
-			try {
-				if (((new Date()).getTime() - startDate.getTime()) >= 60000) {
-					stop();
-				}
-				// changing votes count
-				for (Choice choice : lastVotes) {
-					choice.setVotesCount(rand(0, 3));
-				}
-				//System.out.println("New Event!");
-				listener.onEvent(new EventObject(this));
-				Thread.sleep(5000);
-			} catch (InterruptedException e) {
-				e.printStackTrace();
-			}
-		}
-	}
+    public static int rand(int lo, int hi) {
+        Random rn2 = new Random();
+        int n = hi - lo + 1;
+        int i = rn2.nextInt() % n;
 
-	public void processUpdates() {
-		for (Choice choice : lastVotes) {
-			if (choice.getVotesCount() > 0) {
-				int index = lastVotes.indexOf(choice);
-				choices.get(index).increment(choice.getVotesCount());
-			}
-		}
-		updateInfo="[ ";
-		for (Choice choice : lastVotes) {
-			updateInfo+=choice.getVotesCount()+" ";
-		}
-		updateInfo+="] ";
-		//System.out.println("ChoicesBean.processUpdates()");
-	}
+        if (i < 0) {
+            i = -i;
+        }
 
-	public Thread getThread() {
-		return thread;
-	}
+        return lo + i;
+    }
 
-	public boolean isEnabled() {
-		//System.out.println("ChoicesBean.isEnabled()");
-		//System.out.println(enabled);
-		return enabled;
-	}
+    public void run() {
+        while (thread != null) {
+            try {
+                if (((new Date()).getTime() - startDate.getTime()) >= 60000) {
+                    stop();
+                }
 
-	public void setEnabled(boolean enabled) {
-		this.enabled = enabled;
-	}
+                // changing votes count
+                for (Choice choice : lastVotes) {
+                    choice.setVotesCount(rand(0, 3));
+                }
 
-	public Date getStartDate() {
-		return startDate;
-	}
+                // System.out.println("New Event!");
+                listener.onEvent(new EventObject(this));
+                Thread.sleep(5000);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
 
-	public void setStartDate(Date startDate) {
-		this.startDate = startDate;
-	}
+    public void processUpdates() {
+        for (Choice choice : lastVotes) {
+            if (choice.getVotesCount() > 0) {
+                int index = lastVotes.indexOf(choice);
 
-	public String getUpdateInfo() {
-		return updateInfo;
-	}
+                choices.get(index).increment(choice.getVotesCount());
+            }
+        }
 
-	public List<Choice> getLastVotes() {
-		return lastVotes;
-	}
+        updateInfo = "[ ";
 
+        for (Choice choice : lastVotes) {
+            updateInfo += choice.getVotesCount() + " ";
+        }
+
+        updateInfo += "] ";
+
+        // System.out.println("ChoicesBean.processUpdates()");
+    }
+
+    public Thread getThread() {
+        return thread;
+    }
+
+    public boolean isEnabled() {
+
+        // System.out.println("ChoicesBean.isEnabled()");
+        // System.out.println(enabled);
+        return enabled;
+    }
+
+    public void setEnabled(boolean enabled) {
+        this.enabled = enabled;
+    }
+
+    public Date getStartDate() {
+        return startDate;
+    }
+
+    public void setStartDate(Date startDate) {
+        this.startDate = startDate;
+    }
+
+    public String getUpdateInfo() {
+        return updateInfo;
+    }
+
+    public List<Choice> getLastVotes() {
+        return lastVotes;
+    }
 }



More information about the richfaces-svn-commits mailing list