[seam-commits] Seam SVN: r7843 - in trunk/examples/ui: view and 1 other directory.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Apr 7 18:14:59 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-04-07 18:14:59 -0400 (Mon, 07 Apr 2008)
New Revision: 7843

Added:
   trunk/examples/ui/src/org/jboss/seam/example/ui/Animal.java
Modified:
   trunk/examples/ui/src/org/jboss/seam/example/ui/AnimalList.java
   trunk/examples/ui/src/org/jboss/seam/example/ui/Person.java
   trunk/examples/ui/view/selectItems.xhtml
Log:
JBSEAM-2856

Added: trunk/examples/ui/src/org/jboss/seam/example/ui/Animal.java
===================================================================
--- trunk/examples/ui/src/org/jboss/seam/example/ui/Animal.java	                        (rev 0)
+++ trunk/examples/ui/src/org/jboss/seam/example/ui/Animal.java	2008-04-07 22:14:59 UTC (rev 7843)
@@ -0,0 +1,32 @@
+package org.jboss.seam.example.ui;
+
+public class Animal
+{
+
+   public static Animal DOG = new Animal("Needs lots of exercise", "Dog");
+   public static Animal CAT = new Animal("Looks after itself", "Cat");
+   public static Animal GOLDFISH = new Animal("Needs a fishtank!", "Goldfish");
+   public static Animal RABBIT = new Animal("Often has floppy ears", "Rabbit");
+   public static Animal SNAKE = new Animal("Better make sure it doesn't bite you", "Snake");
+   public static Animal PARROT = new Animal("Peices of Eight", "Parrot");
+   
+   private String notes;
+   private String name;
+
+   public Animal(String notes, String name)
+   {
+      this.notes = notes;
+      this.name = name;
+   }
+   
+   public String getNotes()
+   {
+      return notes;
+   }
+   
+   public String getName()
+   {
+      return name;
+   }
+   
+}

Modified: trunk/examples/ui/src/org/jboss/seam/example/ui/AnimalList.java
===================================================================
--- trunk/examples/ui/src/org/jboss/seam/example/ui/AnimalList.java	2008-04-07 22:14:40 UTC (rev 7842)
+++ trunk/examples/ui/src/org/jboss/seam/example/ui/AnimalList.java	2008-04-07 22:14:59 UTC (rev 7843)
@@ -10,20 +10,20 @@
 public class AnimalList
 {
 
-   private List<String> animals;
+   private List<Animal> animals;
    
    @Unwrap
-   public List<String> unwrap()
+   public List<Animal> unwrap()
    {
       if (animals == null)
       {
-         animals = new ArrayList<String>();
-         animals.add("Dog");
-         animals.add("Cat");
-         animals.add("Goldfish");
-         animals.add("Rabbit");
-         animals.add("Snake");
-         animals.add("Parrot");
+         animals = new ArrayList<Animal>();
+         animals.add(Animal.CAT);
+         animals.add(Animal.DOG);
+         animals.add(Animal.GOLDFISH);
+         animals.add(Animal.PARROT);
+         animals.add(Animal.RABBIT);
+         animals.add(Animal.SNAKE);
       }
       return animals;
    }

Modified: trunk/examples/ui/src/org/jboss/seam/example/ui/Person.java
===================================================================
--- trunk/examples/ui/src/org/jboss/seam/example/ui/Person.java	2008-04-07 22:14:40 UTC (rev 7842)
+++ trunk/examples/ui/src/org/jboss/seam/example/ui/Person.java	2008-04-07 22:14:59 UTC (rev 7843)
@@ -90,6 +90,8 @@
    
    private String pet;
    
+   
+   
    @ManyToOne
    private Film favouriteFilm;
    

Modified: trunk/examples/ui/view/selectItems.xhtml
===================================================================
--- trunk/examples/ui/view/selectItems.xhtml	2008-04-07 22:14:40 UTC (rev 7842)
+++ trunk/examples/ui/view/selectItems.xhtml	2008-04-07 22:14:59 UTC (rev 7843)
@@ -74,7 +74,7 @@
 			<ui:define name="label">Pet</ui:define>
 			<ui:define name="description">The animal list is a list of Strings</ui:define>
 			<h:selectOneMenu value="#{person.pet}">
-				<s:selectItems value="#{animals}" var="animal" label="#{animal}" noSelectionLabel="Select your pet"/>
+				<s:selectItems value="#{animals}" var="animal" label="#{animal.name} (#{animal.notes})" itemValue="#{animal.name}" noSelectionLabel="Select your pet"/>
 			</h:selectOneMenu>
 		</s:decorate>
 		




More information about the seam-commits mailing list