Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package coreservlets.jsf.ss06;
- import java.util.List;
- import javax.faces.bean.ManagedBean;
- import javax.faces.model.SelectItem;
- @ManagedBean
- public class TrainingForm
- {
- private String emailAddress;
- private String favoriteLanguage = LanguageUtils.findMostPopularLanguage( 0 );
- private String secondFavoriteLanguage = LanguageUtils.findMostPopularLanguage( 1 );
- private boolean isExpert = true;
- private boolean isLiar = false;
- public String getEmailAddress() {
- return emailAddress;
- }
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
- public String getFavoriteLanguage() {
- return favoriteLanguage;
- }
- public void setFavoriteLanguage(String favoriteLanguage) {
- this.favoriteLanguage = favoriteLanguage;
- }
- public String getSecondFavoriteLanguage() {
- return secondFavoriteLanguage;
- }
- public void setSecondFavoriteLanguage(String secondFavoriteLanguage) {
- this.secondFavoriteLanguage = secondFavoriteLanguage;
- }
- public boolean isExpert() {
- return isExpert;
- }
- public void setExpert(boolean isEpxert)
- {
- this.isExpert = isEpxert;
- }
- public boolean isLiar() {
- return isLiar;
- }
- public void setLiar(boolean isLiar) {
- this.isLiar = isLiar;
- }
- public List< SelectItem > getAvailableLanguages()
- {
- return( LanguageUtils.languagesList() );
- }
- public String showTrainingPlan()
- {
- int numLanguagesToStudy;
- if( isExpert )
- {
- numLanguagesToStudy = 4;
- }
- else
- {
- numLanguagesToStudy = 2;
- }
- if( isLiar )
- {
- return( "liar" );
- }
- else
- {
- languagesToStudy = LanguageUtils.randomLanguages( numLanguagesToStudy );
- return( "study-plan");
- }
- }
- private List< String > languagesToStudy;
- public List< String > getLanguagesToStudy()
- {
- return( languagesToStudy );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement