001    package users.events;
002    
003    import java.util.EventObject;
004    
005    import users.*;
006    
007    /**
008     * An event indicating changes in a UserManager's list of users.
009     *
010     * @see UserManager
011     * @see User
012     * @see UserDataListener
013     *
014     * @author Steffen Zschaler
015     * @version 2.0 05/05/1999
016     * @since v2.0
017     */
018    public class UserDataEvent extends EventObject {
019    
020        /**
021             * ID for serialization.
022             */
023            private static final long serialVersionUID = 6776462464125736135L;
024            
025            /**
026         * The user affected by the change.
027         *
028         * @serial
029         */
030        private final User m_usrData;
031    
032        /**
033         * Create a new UserDataEvent giving the source and the user that was affected.
034         *
035         * @param source the source of this event, usually a UserManager
036         * @param usrData the user that was affected.
037         */
038        public UserDataEvent(Object source, User usrData) {
039            super(source);
040    
041            m_usrData = usrData;
042        }
043    
044        /**
045         * Get the affected user's name.
046         *
047         * @return the affected user's name.
048         *
049         * @override Never
050         */
051        public String getUserName() {
052            return m_usrData.getName();
053        }
054    
055        /**
056         * Get the affected user.
057         *
058         * @return the affected user.
059         *
060         * @override Never
061         */
062        public User getUser() {
063            return m_usrData;
064        }
065    }