001/*
002 * JGrapes Event Driven Framework
003 * Copyright (C) 2017-2018 Michael N. Lipp
004 * 
005 * This program is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Affero General Public License as published by 
007 * the Free Software Foundation; either version 3 of the License, or 
008 * (at your option) any later version.
009 * 
010 * This program is distributed in the hope that it will be useful, but 
011 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
012 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU Affero General Public License along 
016 * with this program; if not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jgrapes.portal.base.events;
020
021import java.util.Locale;
022
023import org.jgrapes.core.Event;
024import org.jgrapes.portal.base.PortalWeblet;
025
026/**
027 * Signals that the locale for the portal has changed. This  event is
028 * handled by the {@link PortalWeblet} but may, of course, also be
029 * used by other components.
030 * 
031 * ![Event Sequence](SetLocale.svg)
032 * 
033 * @startuml SetLocale.svg
034 * hide footbox
035 * 
036 * Browser -> Portal: "setLocale"
037 * activate Portal
038 * Portal -> PortalWeblet: SetLocale
039 * deactivate Portal
040 * activate PortalWeblet
041 * PortalWeblet -> Browser: "reload"
042 * deactivate PortalWeblet
043 * 
044 * @enduml
045 */
046public class SetLocale extends Event<Void> {
047
048    private final Locale locale;
049
050    /**
051     * Creates a new event.
052     * 
053     * @param locale the locale to set
054     */
055    public SetLocale(Locale locale) {
056        this.locale = locale;
057    }
058
059    /**
060     * Returns the locale to set.
061     * 
062     * @return the locale
063     */
064    public Locale locale() {
065        return locale;
066    }
067}