[webbeans-commits] Webbeans SVN: r2783 - in examples/trunk: numberguess/src/main/java/org/jboss/webbeans/examples/numberguess and 1 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jun 8 09:12:37 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-06-08 09:12:37 -0400 (Mon, 08 Jun 2009)
New Revision: 2783

Modified:
   examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
   examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
   examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
Log:
WBRI-245

Modified: examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:02:42 UTC (rev 2782)
+++ examples/trunk/jsf2/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:12:37 UTC (rev 2783)
@@ -94,6 +94,13 @@
    
    public void validateNumberRange(FacesContext context,  UIComponent toValidate, Object value)
    {
+      if (remainingGuesses <= 0)
+      {
+         FacesMessage message = new FacesMessage("No guesses left!");
+         context.addMessage(toValidate.getClientId(context), message);
+         ((UIInput)toValidate).setValid(false);
+         return;
+      }
       int input = (Integer) value;
 
       if (input < smallest || input > biggest) 

Modified: examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:02:42 UTC (rev 2782)
+++ examples/trunk/numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:12:37 UTC (rev 2783)
@@ -64,7 +64,7 @@
       return remainingGuesses;
    }
    
-   public String check() throws InterruptedException
+   public String check()
    {
       if (guess>number)
       {
@@ -94,6 +94,13 @@
    
    public void validateNumberRange(FacesContext context,  UIComponent toValidate, Object value)
    {
+      if (remainingGuesses <= 0)
+      {
+         FacesMessage message = new FacesMessage("No guesses left!");
+         context.addMessage(toValidate.getClientId(context), message);
+         ((UIInput)toValidate).setValid(false);
+         return;
+      }
       int input = (Integer) value;
 
       if (input < smallest || input > biggest) 

Modified: examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java
===================================================================
--- examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:02:42 UTC (rev 2782)
+++ examples/trunk/servlet-numberguess/src/main/java/org/jboss/webbeans/examples/numberguess/Game.java	2009-06-08 13:12:37 UTC (rev 2783)
@@ -93,6 +93,13 @@
    
    public void validateNumberRange(FacesContext context,  UIComponent toValidate, Object value)
    {
+      if (remainingGuesses <= 0)
+      {
+         FacesMessage message = new FacesMessage("No guesses left!");
+         context.addMessage(toValidate.getClientId(context), message);
+         ((UIInput)toValidate).setValid(false);
+         return;
+      }
       int input = (Integer) value;
 
       if (input < smallest || input > biggest) 




More information about the weld-commits mailing list