import javax.enterprise.event.Observes;
import javax.faces.context.FacesContext;
import javax.inject.Named;
-import org.mxchange.pizzaapplication.beans.BasePizzaController;
import org.mxchange.jusercore.events.login.ObservableUserLoggedInEvent;
import org.mxchange.jusercore.events.logout.ObservableUserLogoutEvent;
+import org.mxchange.pizzaapplication.beans.BasePizzaController;
/**
* A session bean for handling localization/internationalization changes. This
private Locale locale;
@Override
- public void afterUserLogin (@Observes final ObservableUserLoggedInEvent event) {
+ public void afterUserLoginEvent (@Observes final ObservableUserLoggedInEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("LandingLocalizationSessionBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getLoggedInUser(), event.getLoggedInUser().getUserId())); //NOI18N
}
- // Set locale here
- this.setLocale(event.getLoggedInUser().getUserLocale());
+ // Is the locale set?
+ if (event.getLoggedInUser().getUserLocale() instanceof Locale) {
+ // Set locale here
+ this.setLocale(event.getLoggedInUser().getUserLocale());
+ }
// Trace message
//* NOISY-DEBUG: */ System.out.println("LandingLocalizationSessionBean:afterUserLogin - EXIT!"); //NOI18N
}
@Override
- public void afterUserLogout (@Observes final ObservableUserLogoutEvent event) {
+ public void afterUserLogoutEvent (@Observes final ObservableUserLogoutEvent event) {
// Trace message
//* NOISY-DEBUG: */ System.out.println(MessageFormat.format("ReportsLocalizationSessionBean:afterUserLogin: event={0} - CALLED!", event)); //NOI18N
* <p>
* @param event Event instance
*/
- void afterUserLogin (final ObservableUserLoggedInEvent event);
+ void afterUserLoginEvent (final ObservableUserLoggedInEvent event);
/**
* Event observer for logged-out user
* <p>
* @param event Event instance
*/
- void afterUserLogout (final ObservableUserLogoutEvent event);
+ void afterUserLogoutEvent (final ObservableUserLogoutEvent event);
/**
* Getter for locale
String[] requiredFields = {"firstName", "familyName", "city", "street"}; //NOI18N
// Pre-validation (example: not null, not a string, empty string ...)
- super.preValidate(context, component, value, requiredFields, true);
+ super.preValidate(context, component, value, requiredFields, false);
// Trace message
//* NOISY-DEBUG: */ System.out.println("validate: EXIT!"); //NOI18N