-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a demo to demonstrate the
immediate
flag.
- Loading branch information
1 parent
6193dd5
commit 6766e90
Showing
2 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package net.bootsfaces.demo; | ||
|
||
import javax.faces.bean.ManagedBean; | ||
import javax.faces.bean.ViewScoped; | ||
import javax.faces.event.ActionEvent; | ||
import javax.validation.constraints.Max; | ||
import javax.validation.constraints.Min; | ||
|
||
import net.bootsfaces.utils.FacesMessages; | ||
|
||
@ManagedBean | ||
@ViewScoped | ||
public class NumberGuessBean { | ||
|
||
private int counter = 1; | ||
|
||
private int game = 1; | ||
|
||
private int target=5; | ||
|
||
@Min(1) | ||
@Max(10) | ||
private int guess=42; | ||
|
||
public int getGuess() { | ||
return guess; | ||
} | ||
|
||
public void setGuess(int guess) { | ||
this.guess = guess; | ||
} | ||
|
||
public void submitGuess() { | ||
String msg = "Guess #" + counter++; | ||
if (guess > target) { | ||
msg += " is to high."; | ||
} else if (guess < target) | ||
{ | ||
msg += " is to small."; | ||
} else { | ||
msg += " is correct!"; | ||
} | ||
FacesMessages.info(msg); | ||
} | ||
|
||
public void newGame() { | ||
FacesMessages.info("Start game #" + game++ + "."); | ||
} | ||
|
||
public void clearMessages() { | ||
|
||
} | ||
|
||
public void startNewGame(ActionEvent event) { | ||
FacesMessages.info("Start game by actionListener #" + game++ + "."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters