From: Roland Haeder Date: Fri, 1 Apr 2016 19:04:21 +0000 (+0200) Subject: fixed copyright and added stuff for localization support (unfinished) X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=47c9ae48935d929249029316cf49c4d194b9f9b1;p=addressbook-war.git fixed copyright and added stuff for localization support (unfinished) --- diff --git a/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionBean.java b/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionBean.java index 0ac42117..337199c8 100644 --- a/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionBean.java +++ b/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionBean.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 quix0r + * Copyright (C) 2016 Roland Haeder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionController.java b/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionController.java index 92af0927..a72e8147 100644 --- a/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionController.java +++ b/src/java/org/mxchange/addressbook/beans/email_address/EmailChangeWebSessionController.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 quix0r + * Copyright (C) 2016 Roland Haeder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java new file mode 100644 index 00000000..9bbf244d --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/localization/AddressbookLocalizationSessionBean.java @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.beans.localization; + +import java.util.Locale; +import javax.annotation.PostConstruct; +import javax.faces.bean.SessionScoped; +import javax.faces.context.FacesContext; +import javax.inject.Named; +import org.mxchange.jcoreee.database.BaseDatabaseBean; + +/** + * A session bean for handling localization/internationalization changes. This + * class is based on an example at [1] from mkyong. + *

+ * 1: http://www.mkyong.com/jsf2/jsf-2-internationalization-example/ + *

+ * @author Roland Haeder + */ +@Named ("localization") +@SessionScoped +public class AddressbookLocalizationSessionBean extends BaseDatabaseBean implements LocalizationSessionController { + + /** + * Serial number + */ + private static final long serialVersionUID = 1_867_671_657_629_601_528L; + + /** + * Current Locale + */ + private Locale locale; + + @Override + public Locale getLocale () { + return this.locale; + } + + @Override + public void setLocale (final Locale locale) { + this.locale = locale; + } + + /** + * Initializer for this bean + */ + @PostConstruct + public void init () { + // Create locale instance from context + Locale loc = FacesContext.getCurrentInstance().getExternalContext().getRequestLocale(); + + // Set it here + this.setLocale(loc); + } + +} diff --git a/src/java/org/mxchange/addressbook/beans/localization/LocalizationSessionController.java b/src/java/org/mxchange/addressbook/beans/localization/LocalizationSessionController.java new file mode 100644 index 00000000..f176933b --- /dev/null +++ b/src/java/org/mxchange/addressbook/beans/localization/LocalizationSessionController.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2016 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.addressbook.beans.localization; + +import java.io.Serializable; +import java.util.Locale; + +/** + * An interface for localization change beans + *

+ * @author Roland Haeder + */ +public interface LocalizationSessionController extends Serializable { + + /** + * Getter for locale + *

+ * @return Locale + */ + Locale getLocale (); + + /** + * Setter for locale + *

+ * @param locale Locale + */ + void setLocale (final Locale locale); + +} diff --git a/src/java/org/mxchange/addressbook/validators/password/UserPasswordValidator.java b/src/java/org/mxchange/addressbook/validators/password/UserPasswordValidator.java index cece958d..b4b3848c 100644 --- a/src/java/org/mxchange/addressbook/validators/password/UserPasswordValidator.java +++ b/src/java/org/mxchange/addressbook/validators/password/UserPasswordValidator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2016 quix0r + * Copyright (C) 2016 Roland Haeder * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/web/WEB-INF/templates/base.tpl b/web/WEB-INF/templates/base.tpl index 74115a03..2e862b4c 100644 --- a/web/WEB-INF/templates/base.tpl +++ b/web/WEB-INF/templates/base.tpl @@ -1,5 +1,6 @@ +